yufan 1 year ago
parent
commit
f64212e182
5 changed files with 67 additions and 7 deletions
  1. 4 1
      .env.development
  2. 4 1
      .env.production
  3. 4 1
      .env.shanxi
  4. 29 0
      src/api/publicApi.ts
  5. 26 4
      src/layout/Header.vue

+ 4 - 1
.env.development

@@ -14,6 +14,9 @@ VITE_APP_BOOK_STORE_URL = 'http://www.test.sqjyy.cn/bookManage/#/bookManage'
 VITE_APP_NATIONAL_INTERNET_SECURITY_MANAGE_SERVICE_URL = 'http://www.beian.gov.cn/portal/recordQuery?token=3bba8661-6f23-4c04-9d65-e7fba769b65e'
 
 VITE_APP_PATH = 'development'
+VITE_APP_IMG = 'https://test.sqjyy.cn/fastdfs'
 VITE_APP_ISSHANXI = 'false'
 #版本控制
-VITE_APP_VERSION = '0.0.1'
+VITE_APP_VERSION = '0.0.1'
+VITE_LOGO=''
+VITE_MH_ADDRESS='https://test.sqjyy.cn/'

+ 4 - 1
.env.production

@@ -12,4 +12,7 @@ VITE_APP_ISSHANXI = 'false'
 VITE_CAS_SERVER_ADDRESS = 'https://sqjyy.cn/cas/'
 VITE_FRONT_DEPLOYMENT_ADDRESS_NO_SYFFIX = 'https://sqjyy.cn'
 #版本控制
-VITE_APP_VERSION = '0.0.1'
+VITE_APP_VERSION = '0.0.1'
+VITE_APP_IMG = 'https://sqjyy.cn/fastdfs'
+VITE_LOGO=''
+VITE_MH_ADDRESS='https://sqjyy.cn/'

+ 4 - 1
.env.shanxi

@@ -10,5 +10,8 @@ VITE_APP_BOOK_STORE_URL = 'http://www.test.sqjyy.cn/bookManage/#/bookManage'
 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_APP_VERSION = '0.0.1'
+VITE_LOGO='https://test.vod.sqjyy.cn/sxjyj.png'
+VITE_MH_ADDRESS='http://113.137.40.180:8181'

+ 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;

+ 26 - 4
src/layout/Header.vue

@@ -2,7 +2,7 @@
   <div class="main">
     <div class="user-info">
       <div class="logo">
-        <img :src="getPng() ? userImg : logo_public" class="imgicon" />
+        <img :src="logPng ? logPng : login" @click="goMH" />
         <!-- {{
           userinfo?.userinfo?.orgList[0]?.name ? userinfo.userinfo.orgList[0].name : '宿迁市教育局'
         }} -->
@@ -63,11 +63,11 @@
   import orderImg from '@/assets/images/order.svg';
   import { removeToken } from '@/utils/cookie';
   import { useStore } from 'vuex';
-
+  import publicFn from '@/api/publicApi';
   const store = useStore();
   const router = useRouter();
   console.log('mounted');
-
+  const userinfo = ref(store.getters.userInfo.subject);
   const isLog = import.meta.env.VITE_APP_PATH;
   const getPng = () => {
     console.log(1);
@@ -78,7 +78,25 @@
       return false;
     }
   };
+  const login = import.meta.env.VITE_LOGO ? import.meta.env.VITE_LOGO : userImg;
+  const logPng = ref();
 
+  const getLogin = () => {
+    console.log(userinfo.value, 'infoDatainfoDatainfoData');
+    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();
   // function goToPage(path) {
   //   router.replace({
   //     path: path,
@@ -96,11 +114,15 @@
     //store.dispatch('user/LogOut');
     //window.location.href = import.meta.env.VITE_APP_BOOK_STORE_URL as string;
   };
+  const goMH = () => {
+    console.log(import.meta.env.VITE_MH_ADDRESS);
+    window.open(import.meta.env.VITE_MH_ADDRESS as string | undefined);
+  };
   const toAccount = () => {
     window.location.href = import.meta.env.VITE_APP_BOOK_STORE_URL as string;
   };
   console.log(store.getters.userInfo, 'store.state.user.userInfo');
-  const userinfo = ref(store.getters.userInfo.subject);
+ 
   console.log(userinfo.value, '+++++', store.state.user.userInfo);
 
   watch(