Sfoglia il codice sorgente

修改 动态配置图表

huangbin 4 anni fa
parent
commit
77143f5a84
5 ha cambiato i file con 141 aggiunte e 174 eliminazioni
  1. 2 1
      public/config/app.config.json
  2. 0 0
      public/logoHead.png
  3. 32 17
      src/App.vue
  4. 106 122
      src/layout/components/header.vue
  5. 1 34
      src/services/bus/index.ts

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

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

+ 0 - 0
public/qhjLogo.png → public/logoHead.png


+ 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);
         // 监听路由的变化

+ 106 - 122
src/layout/components/header.vue

@@ -1,34 +1,10 @@
 <template>
-
-  <!-- 风险管理 -->
-  <div v-if="isOemByEnum(OemType.manager)">
-    <img src="../../assets/images/logoHeader.png" />
-    <span>{{getCompanyName()}}</span>
-  </div>
-
-  <!-- 云融 -->
-  <div v-else-if="isOemByEnum(OemType.wrspot)">
-    <img src="../../assets/images/headLogo.jpg" />
-    <span>云融</span>
-  </div>
-  <!-- 天津麦顿 -->
-  <div v-else-if="isOemByEnum(OemType.tian_jing_mai_dun)">
-    <img src="../../assets/images/tian_jing_mai_dun.png" />
-    <span>天津麦顿</span>
-  </div>
-
-  <!-- 千海金 -->
-  <div v-else-if="isOemByEnum(OemType.qinghaijin)">
-    <img src="../../assets/images/qianhaijin_logo.jpg" />
-    <span>{{getCompanyName()}}</span>
-  </div>
-
-  <div v-else>
-    <img src="../../assets/images/logoHeader.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">
-    <div @click="openDrawer">
+    <div>
       <span>{{ getUserName() }},您好!</span>
     </div>
     <div class="relative">
@@ -37,49 +13,44 @@
                           placeholder="请输入代码/名称"
                           @pressEnter="search">
                           readonly
-            </a-input-search>-->
+      </a-input-search>-->
       <!-- <a-icon type="search" /> -->
     </div>
     <div v-if="isOemByEnum(OemType.wrspot) || isOemByEnum(OemType.tian_jing_mai_dun)">
-      <a-popover trigger="click"
-                 placement="bottom"
-                 overlayClassName="friendPopover">
+      <a-popover trigger="click" placement="bottom" overlayClassName="friendPopover">
         <template #content>
           <Friend />
         </template>
         <span class="friendIcon">
-          <svg class="icon svg-icon"
-               aria-hidden="true">
+          <svg class="icon svg-icon" aria-hidden="true">
             <use xlink:href="#icon-pengyou1" />
           </svg>
         </span>
       </a-popover>
     </div>
     <div class="news-container">
-      <a-badge @click="openNotice"
-               :dot="getUnReadNoticeLength() > 0">
-        <svg class="icon svg-icon"
-             aria-hidden="true">
+      <a-badge @click="openNotice" :dot="getUnReadNoticeLength() > 0">
+        <svg class="icon svg-icon" aria-hidden="true">
           <use xlink:href="#icon-xiaoxi" />
         </svg>
       </a-badge>
     </div>
     <div>
-      <a-popover v-model:visible="visible"
-                 trigger="click"
-                 placement="bottomRight">
+      <a-popover v-model:visible="visible" trigger="click" placement="bottomRight">
         <template #content>
-          <div v-for="item in setMenu"
-               class="popItem"
-               @click="chooseSetMenu(item.path)"
-               :key="item.path">{{ item.name }}</div>
+          <div
+            v-for="item in setMenu"
+            class="popItem"
+            @click="chooseSetMenu(item.path)"
+            :key="item.path"
+          >{{ item.name }}</div>
         </template>
         <a-avatar :size="24">
           <template #icon>
             <SettingFilled />
             <!-- <svg class="icon svg-icon" aria-hidden="true">
                             <use xlink:href="#icon-yonghu1" />
-                        </svg>-->
+            </svg>-->
           </template>
         </a-avatar>
       </a-popover>
@@ -89,101 +60,114 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, ref, provide } from 'vue';
-import { openModal } from '@/common/setup/modal/index';
-import { UserOutlined, SettingFilled } from '@ant-design/icons-vue';
-import Setting from '@/views/setting/index.vue';
-import { getUserName, getCompanyName } from '@/services/bus/user';
-import { logout } from '@/services/bus/login';
-import APP from '@/services';
-import Router from '@/router';
-import { handleNotice } from '@/views/setting/notice/setup';
 import { isOemByEnum, OemType } from '@/common/config/projectName';
 import { changeTheme, ThemeEnum } from '@/common/config/theme';
 import { initData } from '@/common/methods';
+import { openModal } from '@/common/setup/modal/index';
+import Router from '@/router';
+import APP from '@/services';
+import { logout } from '@/services/bus/login';
+import { getCompanyName, getUserName } from '@/services/bus/user';
 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, onMounted, provide, ref } from 'vue';
 
 // 设置
 const setFn = () => {
-    const visible = ref<boolean>(false);
-    const chooseSetupItem = ref<string>('');
-    provide('ControlModal', chooseSetupItem);
-    const setMenu = ref([{ name: '退出', path: 'logout' }]);
-    // const setMenu = [
-    //     // { name: '修改密码', path: 'password' },
-    //     // { name: '收货地址', path: 'addresss' },
-    //     // // {name: '发票', path: 'setup-password'},
-    //     // { name: '手机号码绑定/解绑', path: 'phone' },
-    //     // { name: '关于我们', path: 'aboutUs' },
-    //     { name: '白主题', path: ThemeEnum.light },
-    //     { name: '黑主题', path: ThemeEnum.dark },
-    //     { name: '退出', path: 'logout' },
-    // ];
-    initData(() => {
-        if (isOemByEnum(OemType.wrspot) || isOemByEnum(OemType.tian_jing_mai_dun)) {
-            const theme = [
-                { name: '白主题', path: ThemeEnum.light },
-                { name: '黑主题', path: ThemeEnum.dark },
-            ];
-            setMenu.value = [...theme, ...setMenu.value];
-        }
-    });
-    const { openAction } = openModal('logout');
-    function chooseSetMenu(path: string) {
-        if (path === 'logout') {
-            logout();
-            APP.closeServer();
-            Router.replace('/login');
-        } else {
-            changeTheme(path as ThemeEnum);
-            // openAction();
-        }
-        visible.value = false;
+  const visible = ref<boolean>(false);
+  const chooseSetupItem = ref<string>('');
+  provide('ControlModal', chooseSetupItem);
+  const setMenu = ref([{ name: '退出', path: 'logout' }]);
+  // const setMenu = [
+  //     // { name: '修改密码', path: 'password' },
+  //     // { name: '收货地址', path: 'addresss' },
+  //     // // {name: '发票', path: 'setup-password'},
+  //     // { name: '手机号码绑定/解绑', path: 'phone' },
+  //     // { name: '关于我们', path: 'aboutUs' },
+  //     { name: '白主题', path: ThemeEnum.light },
+  //     { name: '黑主题', path: ThemeEnum.dark },
+  //     { name: '退出', path: 'logout' },
+  // ];
+  initData(() => {
+    if (isOemByEnum(OemType.wrspot) || isOemByEnum(OemType.tian_jing_mai_dun)) {
+      const theme = [
+        { name: '白主题', path: ThemeEnum.light },
+        { name: '黑主题', path: ThemeEnum.dark },
+      ];
+      setMenu.value = [...theme, ...setMenu.value];
     }
+  });
+  const { openAction } = openModal('logout');
+  function chooseSetMenu(path: string) {
+    if (path === 'logout') {
+      logout();
+      APP.closeServer();
+      Router.replace('/login');
+    } else {
+      changeTheme(path as ThemeEnum);
+      // openAction();
+    }
+    visible.value = false;
+  }
 
-    return { visible, setMenu, chooseSetMenu };
+  return { visible, setMenu, chooseSetMenu };
 };
 
 // 搜索
 const onSearch = () => {
-    function search(value: string) {}
-    return { search };
+  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,
-        Setting,
-        Friend,
-        SettingFilled,
-    },
-    props: {
-        collapsed: {
-            default: true,
-            type: Boolean,
-        },
-    },
-    setup() {
-        const { openAction: openNotice } = openModal('notice');
-        const { getUnReadNoticeLength } = handleNotice();
-        return {
-            openNotice,
-            getUserName,
-            getUnReadNoticeLength,
-            ...setFn(),
-            ...onSearch(),
-            isOemByEnum,
-            OemType,
-            getCompanyName,
-        };
+  components: {
+    UserOutlined,
+    Setting,
+    Friend,
+    SettingFilled,
+  },
+  props: {
+    collapsed: {
+      default: true,
+      type: Boolean,
     },
+  },
+  setup() {
+    const { openAction: openNotice } = openModal('notice');
+    const { getUnReadNoticeLength } = handleNotice();
+    onMounted(() => {
+      setLogo();
+    });
+    return {
+      openNotice,
+      getUserName,
+      getUnReadNoticeLength,
+      ...setFn(),
+      ...onSearch(),
+      isOemByEnum,
+      OemType,
+      getCompanyName,
+    };
+  },
 });
 </script>
 <style lang="less">
 .friendIcon {
-    .icon {
-        font-size: 20px;
-        line-height: 32px;
-        margin: 6px 5px;
-    }
+  .icon {
+    font-size: 20px;
+    line-height: 32px;
+    margin: 6px 5px;
+  }
 }
 </style>

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