yufan 1 year ago
parent
commit
aa86446fb3
6 changed files with 124 additions and 67 deletions
  1. 3 1
      .env.development
  2. 3 1
      .env.production
  3. 14 0
      .env.shanxi
  4. 1 0
      package.json
  5. 29 0
      src/api/publicApi.ts
  6. 74 65
      src/layout/Header.vue

+ 3 - 1
.env.development

@@ -6,4 +6,6 @@ VITE_APP_AES_KEY_BOOK_STORE = 'book_aes_store__'
 # 图书馆项目地址
 VITE_APP_BOOK_STORE_URL = 'http://test.psslbd.cn/dashboard'
 # VITE_APP_BOOK_STORE_URL = 'http://www.areader.org.cn/'
-VITE_APP_PATH = 'development'
+VITE_APP_PATH = 'development'
+VITE_LOGO=''
+VITE_MH_ADDRESS='https://test.sqjyy.cn'

+ 3 - 1
.env.production

@@ -7,4 +7,6 @@ VITE_APP_AES_KEY_BOOK_STORE = 'book_aes_store__'
 # 图书馆项目地址
 VITE_APP_BOOK_STORE_URL = 'http://www.areader.org.cn/'
 
-VITE_APP_PATH = 'production'
+VITE_APP_PATH = 'production'
+VITE_LOGO=''
+VITE_MH_ADDRESS='https://sqjyy.cn'

+ 14 - 0
.env.shanxi

@@ -0,0 +1,14 @@
+VITE_APP_BASE_URL = 'http://113.137.40.180:8181/gateway'
+VITE_APP_FDFS_WEB_SERVER_URL = 'https://zjzl-test.oss-cn-hangzhou.aliyuncs.com'
+
+VITE_CAS_SERVER_ADDRESS = 'http://113.137.40.180:8181/cas/'
+ 
+VITE_APP_PATH = 'production'
+VITE_APP_ISSHANXI = 'true'
+VITE_CAS_SERVER_ADDRESS = 'http://113.137.40.180:8181/cas/'
+VITE_FRONT_DEPLOYMENT_ADDRESS_NO_SYFFIX = 'http://113.137.40.180:8181'
+VITE_APP_IMG = 'http://113.137.40.180:8181/fastdfs'
+#版本控制
+VITE_APP_VERSION = '0.0.1'
+VITE_LOGO='https://test.vod.sqjyy.cn/sxjyj.png'
+VITE_MH_ADDRESS='http://113.137.40.180:8181'

+ 1 - 0
package.json

@@ -6,6 +6,7 @@
     "build:dev": "vue-tsc --noEmit && vite build --mode development",
     "build:test": "vue-tsc --noEmit && vite build --mode preview",
     "build:prod": "vue-tsc --noEmit && vite build --mode production",
+    "build:shanxi": "vite build --mode shanxi",
     "serve": "vite preview"
   },
   "dependencies": {

+ 29 - 0
src/api/publicApi.ts

@@ -0,0 +1,29 @@
+/*
+ * @Author: yufan 56580223@qq.com
+ * @Date: 2022-12-17 17:13:57
+ * @LastEditors: yufan 56580223@qq.com
+ * @LastEditTime: 2022-12-17 17:14:19
+ * @FilePath: /bookPc/src/api/publicApi.ts
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ */
+import { HttpResponse } from '@/@type';
+import Axios from './axios';
+
+const api = {
+  getTenant: '/fighter-tenant-manage/tenant', //租户信息
+};
+
+interface listByCataCode {
+  cataCode: string;
+}
+
+class publicFn {
+  static async getTenant(params): Promise<HttpResponse> {
+    return Axios(api.getTenant + '/' + params, {
+      method: 'get',
+      // responseType: 'json',
+    });
+  }
+}
+
+export default publicFn;

+ 74 - 65
src/layout/Header.vue

@@ -7,7 +7,7 @@
 -->
 <template>
   <div class="header">
-    <div class="title"><img :src="getPng()?logo:logo_public" alt="" /></div>
+    <div class="title"> <img :src="login" @click="goMH" /></div>
     <!-- <div class="userinfo">
       <a-avatar style="background-color: #87d068" size="small">
         <template #icon>
@@ -20,75 +20,84 @@
 </template>
 
 <script setup lang="ts">
-import { UserOutlined } from '@ant-design/icons-vue';
-import { SessionStorageService, LocalStorageService } from '@/utils/storage';
-import { ref, onMounted, computed, watch } from 'vue';
-import { useRouter } from 'vue-router';
-import { removeToken } from '@/utils/cookie';
-import logo from '@/assets/tital.png'
-import logo_public from '@/assets/logo_public.png'
-import store from '@/store';
-const colorList = '#f56a00';
-let avatarValue = '超级';
-console.log('mounted');
+  import { UserOutlined } from '@ant-design/icons-vue';
+  import { SessionStorageService, LocalStorageService } from '@/utils/storage';
+  import { ref, onMounted, computed, watch } from 'vue';
+  import { useRouter } from 'vue-router';
+  import { removeToken } from '@/utils/cookie';
+  import logo from '@/assets/tital.png';
+  import logo_public from '@/assets/logo_public.png';
+  import publicFn from '@/api/publicApi';
+  import store from '@/store';
+  const colorList = '#f56a00';
+  let avatarValue = '超级';
+  console.log('mounted');
+  const userinfo = ref(LocalStorageService.get('userInfo'));
+  const router = useRouter();
+  const login = import.meta.env.VITE_LOGO ? import.meta.env.VITE_LOGO : logo;
+  const isLog = import.meta.env.VITE_APP_PATH;
+  const logPng = ref();
 
-const router = useRouter();
-
-const isLog = import.meta.env.VITE_APP_PATH
-const getPng = () => {
-        console.log(1)
-    if(isLog == 'production'||isLog =='development'){
-        return true
-    }else{
-        console.log(2)
-       return false 
+  const getLogin = () => {
+    if (!userinfo.value) return;
+    publicFn.getTenant(store.getters.userInfo?.tenantId).then((res) => {
+      const { code, data } = res.data;
+      if (code == 200) {
+        console.log(res.data);
+        if (data.logo.split(',')[0]) {
+          logPng.value = import.meta.env.VITE_APP_IMG + data.logo.split(',')[0];
+        } else {
+          logPng.value = '';
+        }
+      }
+    });
+  };
+  // getLogin();
+  const quit = () => {
+    removeToken();
+    LocalStorageService.clearAll();
+    store.dispatch('user/LogOut');
+    window.location.href = 'http://www.sqjyy.cn/cas/logout?service=http://www.sqjyy.cn';
+    // window.location.href = import.meta.env.VITE_APP_BOOK_STORE_URL as string;
+    // router.push('/entry/login');
+  };
+  const goMH = () => {
+    console.log(import.meta.env.VITE_MH_ADDRESS);
+    window.open(import.meta.env.VITE_MH_ADDRESS as string | undefined);
+  };
+  watch(
+    () => store.state.user.userInfo,
+    (val, old) => {
+      userinfo.value = val;
     }
-}
-
-const quit = () => {
-  removeToken();
-  LocalStorageService.clearAll();
-  store.dispatch('user/LogOut');
-  window.location.href = 'http://www.sqjyy.cn/cas/logout?service=http://www.sqjyy.cn';
-  // window.location.href = import.meta.env.VITE_APP_BOOK_STORE_URL as string;
-  // router.push('/entry/login');
-};
-
-const userinfo = ref(LocalStorageService.get('userInfo'));
-
-watch(
-  () => store.state.user.userInfo,
-  (val, old) => {
-    userinfo.value = val;
-  }
-);
+  );
 </script>
 
 <style lang="less" scoped>
-.header {
-  height: 6.4rem;
-  line-height: 6.4rem;
-  background: #ffffff;
-  z-index: 100;
-  box-shadow: 0px 12px 20px 0px rgba(97, 131, 155, 0.06);
-  color: #000;
-  display: flex;
-  justify-content: space-between;
-  padding: 0 4rem;
-  position: fixed;
-  width: 100%;
-  .title {
-    font-size: 2rem;
-    font-weight: bold;
-    img {
-      width: 285px;
-      height: 28px;
+  .header {
+    height: 6.4rem;
+    line-height: 6.4rem;
+    background: #ffffff;
+    z-index: 100;
+    box-shadow: 0px 12px 20px 0px rgba(97, 131, 155, 0.06);
+    color: #000;
+    display: flex;
+    justify-content: space-between;
+    padding: 0 4rem;
+    position: fixed;
+    width: 100%;
+    .title {
+      font-size: 2rem;
+      font-weight: bold;
+      img {
+        width: 285px;
+        height: 28px;
+      }
+    }
+    .quit {
+      color: @link-color;
+      margin-left: 5px;
+      cursor: pointer;
     }
   }
-  .quit {
-    color: @link-color;
-    margin-left: 5px;
-    cursor: pointer;
-  }
-}
 </style>