huangbin 4 anni fa
parent
commit
d65521e8d3
4 ha cambiato i file con 52 aggiunte e 56 eliminazioni
  1. 2 1
      public/config/app.config.json
  2. 32 17
      src/App.vue
  3. 17 4
      src/layout/components/header.vue
  4. 1 34
      src/services/bus/index.ts

+ 2 - 1
public/config/app.config.json

@@ -1,3 +1,4 @@
 {
-    "apiUrl": "http://192.168.31.202:8080/cfg?key=test_202"
+    "apiUrl": "http://192.168.31.202:8080/cfg?key=test_202",
+    "icoTitle": "云融"
 }

+ 32 - 17
src/App.vue

@@ -1,30 +1,28 @@
 <template>
-  <div class="app-container dark-theme "
-       @contextmenu.prevent>
-    <!-- 中文配置 -->
-    <a-config-provider :locale="zhCN">
-      <a-spin :tip="tip"
-              :spinning="spinning"
-              size="large">
-        <router-view />
-      </a-spin>
-    </a-config-provider>
-  </div>
+    <div class="app-container dark-theme" @contextmenu.prevent>
+        <!-- 中文配置 -->
+        <a-config-provider :locale="zhCN">
+            <a-spin :tip="tip" :spinning="spinning" size="large">
+                <router-view />
+            </a-spin>
+        </a-config-provider>
+    </div>
 </template>
 
 <script lang="ts">
-import { defineComponent, ref, watchEffect, provide } from 'vue';
+import { initTheme } from '@/common/config/theme';
+import { setLoadComplete } from '@/common/methods';
+import Router from '@/router';
+import APP from '@/services';
 import { globalDataRefresh } from '@/services/bus/index';
+import { isLogin, logout } from '@/services/bus/login';
 import { notice } from '@/services/bus/system';
+import { getAppConfig } from '@/services/go/config';
 import eventBus from '@/utils/eventBus/index';
 import TimerUtils from '@/utils/timer/timerUtil';
-import Router from '@/router';
-import APP from '@/services';
 import { Modal } from 'ant-design-vue';
-import { setLoadComplete } from '@/common/methods';
-import { isLogin, logout } from '@/services/bus/login';
 import zhCN from 'ant-design-vue/es/locale/zh_CN';
-import { initTheme } from '@/common/config/theme';
+import { defineComponent, onMounted, provide, ref, watchEffect } from 'vue';
 let lastTime = new Date().getTime();
 
 function logoutAction() {
@@ -62,6 +60,20 @@ function setOvertime() {
     );
 }
 
+// 设置 ico
+async function setIcon() {
+    const link: any = document.querySelector("link[rel*='icon']") || document.createElement('link');
+    const obj = {
+        type: 'image/x-icon',
+        rel: 'shortcut icon',
+        href: './favicon.ico',
+    }
+    Object.assign(link, obj)
+    const config = await getAppConfig();
+    document.title = config.data.icoTitle
+    document.getElementsByTagName('head')[0].appendChild(link);
+}
+
 export default defineComponent({
     name: 'app',
     components: {},
@@ -82,6 +94,9 @@ export default defineComponent({
                 'logoutTimer'
             );
         });
+        onMounted(() => {
+            setIcon();
+        });
         // 登录成功
         // eventBus.$onOnly('loginSuccess', setOvertime);
         // 监听路由的变化

+ 17 - 4
src/layout/components/header.vue

@@ -1,7 +1,7 @@
 <template>
-  <div>
-    <img src="../../../public/logoHead.png" />
-    <span>{{ getCompanyName() }}</span>
+  <div id="logoHeader">
+    <!-- <img src="./logoHead.png" id="logoHead" /> -->
+    <span id="headName">{{ getCompanyName() }}</span>
   </div>
 
   <div class="m-layout-header-right">
@@ -73,7 +73,7 @@ import Friend from '@/views/setting/friends/index.vue';
 import Setting from '@/views/setting/index.vue';
 import { handleNotice } from '@/views/setting/notice/setup';
 import { SettingFilled, UserOutlined } from '@ant-design/icons-vue';
-import { defineComponent, provide, ref } from 'vue';
+import { defineComponent, onMounted, provide, ref } from 'vue';
 
 // 设置
 const setFn = () => {
@@ -121,6 +121,16 @@ const onSearch = () => {
   function search(value: string) { }
   return { search };
 };
+
+function setLogo() {
+  const img = document.querySelector('#logoHead') || document.createElement('img');
+  const obj = {
+    id: 'logoHeader',
+    src: './logoHead.png',
+  };
+  Object.assign(img, obj);
+  document.querySelector('#logoHeader')?.insertBefore(img, document.querySelector('#headName'));
+}
 export default defineComponent({
   components: {
     UserOutlined,
@@ -137,6 +147,9 @@ export default defineComponent({
   setup() {
     const { openAction: openNotice } = openModal('notice');
     const { getUnReadNoticeLength } = handleNotice();
+    onMounted(() => {
+      setLogo();
+    });
     return {
       openNotice,
       getUserName,

+ 1 - 34
src/services/bus/index.ts

@@ -1,4 +1,3 @@
-import { isOemByEnum, OemType } from '@/common/config/projectName';
 import { TradeMode } from '@/common/constants/enumCommon';
 import APP from '@/services';
 import { isAllEnum } from '@/services/bus/allEnum';
@@ -7,7 +6,7 @@ import { checkTokenAction, handleTokenCheck } from '@/services/bus/token';
 import { getAllEnums, GetPCMenus, getServerTime, queryErrorInfos, QueryTableDefine } from '@/services/go/commonService/index';
 import { getAppConfig, getCommonApiUrl } from '@/services/go/config';
 import { LoginQuery } from '@/services/go/useInfo/index';
-import { serviceURL, setServiceURL } from '@/services/request/serviceURL';
+import { setServiceURL } from '@/services/request/serviceURL';
 import ProtobufCtr from '@/services/socket/protobuf/index';
 import { message } from 'ant-design-vue';
 import { queryMarketRun, QueryMarketsByLoginID } from '../go/commonMarket';
@@ -63,37 +62,6 @@ export async function globalDataRefresh(): Promise<string> {
     }
 }
 
-function getIco(): string {
-    let result = 'favicon'
-    if (isOemByEnum(OemType.manager)) {
-        result = 'favicon'
-    } else if (isOemByEnum(OemType.wrspot)) {
-        result = 'yunrong'
-    } else if (isOemByEnum(OemType.qinghaijin)) {
-        result = 'qianhaijin'
-    } else if (isOemByEnum(OemType.tian_jing_mai_dun)) {
-        result = 'yunrong'
-    }
-
-    return `./${result}.ico`
-}
-
-
-
-function setIcon() {
-    const link: any = document.querySelector("link[rel*='icon']") || document.createElement('link');
-    const obj = {
-        type: 'image/x-icon',
-        rel: 'shortcut icon',
-        href: getIco(),
-    }
-    Object.assign(link, obj)
-    document.title = 'WebPC'
-    if (serviceURL.oem === 'yrdz') {
-        document.title = '云融'
-    }
-    document.getElementsByTagName('head')[0].appendChild(link);
-}
 /**
  * 全局依赖的数据查询,涉及各个方面
  */
@@ -106,7 +74,6 @@ async function queryDependencies(): Promise<number> {
         const apiUrl = await getCommonApiUrl(config.data.apiUrl);
 
         if (apiUrl.data.code === 200) setServiceURL(apiUrl.data.data);
-        setIcon()
         // await APP.connectQuote();
         /** 数据返回 */
         return Promise.resolve(1);