yjwang hace 8 horas
padre
commit
03b4363af9
Se han modificado 7 ficheros con 53 adiciones y 5 borrados
  1. 10 1
      src/App.vue
  2. 2 1
      src/api/login.js
  3. BIN
      src/assets/logo/hk.png
  4. 2 1
      src/layout/components/Sidebar/Logo.vue
  5. 2 1
      src/main.js
  6. 35 0
      src/utils/brand.js
  7. 2 1
      src/views/login.vue

+ 10 - 1
src/App.vue

@@ -5,7 +5,16 @@
 </template>
 
 <script>
+import { getBrandTitle } from '@/utils/brand'
 export default  {
-  name:  'App'
+  name:  'App',
+    metaInfo() {
+        return {
+            title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
+            titleTemplate: title => {
+                return title ? `${title} - ${getBrandTitle()}` : getBrandTitle()
+            }
+        }
+    }
 }
 </script>

+ 2 - 1
src/api/login.js

@@ -6,7 +6,8 @@ export function login(username, password, code, uuid) {
     username,
     password,
     code,
-    uuid
+    uuid,
+    domain: window.location.hostname
   }
   return request({
     url: '/login',

BIN
src/assets/logo/hk.png


+ 2 - 1
src/layout/components/Sidebar/Logo.vue

@@ -14,6 +14,7 @@
 </template>
 
 <script>
+import { getBrandTitle } from '@/utils/brand'
 
 export default {
   name: 'SidebarLogo',
@@ -25,7 +26,7 @@ export default {
   },
   data() {
     return {
-      title: process.env.VUE_APP_TITLE
+      title: getBrandTitle()
     }
   }
 }

+ 2 - 1
src/main.js

@@ -38,7 +38,8 @@ import { VueJsonp } from 'vue-jsonp'
 Vue.use(VueJsonp)
 
 // 全局配置
-Vue.prototype.logImg = require(process.env.VUE_APP_LOG_URL)
+import { getBrandLogo } from '@/utils/brand'
+Vue.prototype.logImg = getBrandLogo()
 Vue.prototype.cloneObject = cloneObject
 Vue.prototype.getDicts = getDicts
 Vue.prototype.getConfigKey = getConfigKey

+ 35 - 0
src/utils/brand.js

@@ -0,0 +1,35 @@
+/**
+ * 品牌信息工具(销售端)
+ * 根据访问域名区分展示不同的系统名称与 Logo:
+ *  - company.bjyjbao.com:使用各环境变量(.env)中的原有配置(打包配置)
+ *  - 其它所有域名(含 localhost):统一展示"惠康SCRM销售端"品牌
+ */
+
+// 指定使用原有环境变量配置的域名
+const COMPANY_HOST = 'company.bjyjbao.com'
+
+// 惠康销售端品牌文案(登录页标题与左上角名称一致)
+const HUIKANG_TITLE = '惠康SCRM销售端'
+
+/**
+ * 是否为 company.bjyjbao.com 域名
+ */
+export function isCompanyHost() {
+  return typeof window !== 'undefined' && window.location.hostname === COMPANY_HOST
+}
+
+/**
+ * 登录页大标题 / 左上角导航栏名称
+ */
+export function getBrandTitle() {
+  return isCompanyHost() ? process.env.VUE_APP_TITLE : HUIKANG_TITLE
+}
+
+/**
+ * Logo 图片(左上角、右上角统一使用)
+ */
+export function getBrandLogo() {
+  return isCompanyHost()
+    ? require(process.env.VUE_APP_LOG_URL)
+    : require('@/assets/logo/hk.png')
+}

+ 2 - 1
src/views/login.vue

@@ -79,13 +79,14 @@ import { getCodeImg } from "@/api/login";
 import Cookies from "js-cookie";
 import { encrypt, decrypt } from '@/utils/jsencrypt'
 import { getFirstLogin } from "@/api/login";
+import { getBrandTitle } from '@/utils/brand'
 
 export default {
   name: "Login",
   data() {
     return {
       codeUrl: "",
-      vueAppTitle: process.env.VUE_APP_TITLE,
+      vueAppTitle: getBrandTitle(),
       companyName: process.env.VUE_APP_COMPANY_NAME,
       icpRecord: process.env.VUE_APP_ICP_RECORD,
       icpUrl: process.env.VUE_APP_ICP_URL,