Просмотр исходного кода

添加客户服务系统跳转入口

hxl13994548489 1 год назад
Родитель
Сommit
fb165e489a
3 измененных файлов с 69 добавлено и 10 удалено
  1. 8 0
      src/http/moudules/menu.js
  2. 21 10
      src/views/Login.vue
  3. 40 0
      src/views/NavBar/NavBar.vue

+ 8 - 0
src/http/moudules/menu.js

@@ -150,4 +150,12 @@ export const newfindMenuTree = () => {
         url: '/menu/v1/findMenuTree',
         method: 'get'
     })
+}
+
+export const getKhgxConfig = (data) => {
+    return axios({
+        url: '/sysUserLinkSys/authorizeKhgxByUserId?userId=' + data.userId,
+        method: 'get',
+
+    })
 }

+ 21 - 10
src/views/Login.vue

@@ -198,7 +198,6 @@ export default {
       sysId: null,
       systemType: "1", //系统类型
       addressInfo: {}, //当前登录信息
-      locationIp:'',//当前ip
     };
   },
   created() {
@@ -304,7 +303,22 @@ export default {
                   window.location.href =
                     process.env.CONSOLE_BASE_URL + "/#/index?token=" + token;
                   // alert(res.data);
-                } else {
+                }else if (this.sysId === 3) {
+                  Cookies.set("user", this.loginForm.account);
+                  let userId = this.loginForm.account;
+                  let  data ={
+                    userId: userId,
+                    token: res.data
+                  }
+                  let jsonStr = JSON.stringify(data);
+                  let token = CryptoJS.AES.encrypt(
+                    jsonStr,
+                    "token"
+                  ).toString();
+                  window.location.href =process.env.CONSOLE_KHGX_URL + "?token=" + token;
+    
+                } 
+                else {
                   this.getUser();
                   Cookies.set("token", res.data); // 放置token到Cookie
                   // this.submitLocation();
@@ -312,8 +326,7 @@ export default {
                   setTimeout(() => {
                     let userId = sessionStorage.getItem("user");
                     let data = {
-                      // ...this.addressInfo,
-                      ip:this.locationIp,
+                      ...this.addressInfo,
                       userId,
                       systemType: this.systemType,
                     };
@@ -343,8 +356,7 @@ export default {
     submitLocation() {
       let location = {
         systemType: this.systemType,
-        // ...this.addressInfo,
-        ip:this.locationIp,
+        ...this.addressInfo,
       };
       this.$api.login.uploadLocationInfo(location).then((res) => {
         if (res.code !== 200) {
@@ -492,10 +504,9 @@ export default {
     this.refreshCaptcha();
     /**获取当前登录的ip地址 */
     getUserIP((ip) => {
-      this.locationIp=ip
-      // getAddressLocation(ip, (info) => {
-        // this.addressInfo = ip;
-      // });
+      getAddressLocation(ip, (info) => {
+        this.addressInfo = info;
+      });
     });
   },
   computed: {

+ 40 - 0
src/views/NavBar/NavBar.vue

@@ -37,6 +37,15 @@
               <span>晋掌柜控制台</span>
             </div>
           </el-dropdown-item>
+          <el-dropdown-item v-if="showKhgxConfig">
+            <div class="flex" @click="toKhgxConfig">
+              <img
+                src="@/assets/image/title.png"
+                style="width: 30px; height: 30px; margin-right: 5px"
+              />
+              <span>客户服务平台</span>
+            </div>
+          </el-dropdown-item>
         </el-dropdown-menu>
       </el-dropdown>
     </div>
@@ -109,11 +118,13 @@ export default {
           ? this.$route.meta.index
           : this.leftTree[0].id,
       showConfig: false,
+      showKhgxConfig: false,
     };
   },
   created() {
     this.handleRoute(this.$route);
     this.getConfig();
+    this.getKhgxConfig();
   },
   methods: {
     toConfig() {
@@ -127,6 +138,35 @@ export default {
       window.location.href =
         process.env.CONSOLE_BASE_URL + "/#/index?token=" + token;
     },
+    toKhgxConfig() {
+      let userId = JSON.parse(localStorage.getItem("user_data")).id;
+          let  data ={
+            userId: userId,
+            token: Cookies.get("token")
+          }
+          let jsonStr = JSON.stringify(data);
+          let token = CryptoJS.AES.encrypt(
+            jsonStr,
+            "token"
+          ).toString();
+          window.location.href =process.env.CONSOLE_KHGX_URL + "?token=" + token;
+    },
+                    
+    showKhgxConfig() {
+      // console.log();
+      let userId = JSON.parse(localStorage.getItem("user_data")).id;
+      // console.log(userId);
+      this.$api.menu
+        .getKhgxConfig({
+          userId: userId,
+        })
+        .then((res) => {
+          // console.log(res);
+          if (res.code === 200) {
+            this.showKhgxConfig = res.data;
+          }
+        });
+    },
     getConfig() {
       // console.log();
       let userId = JSON.parse(localStorage.getItem("user_data")).id;