blade 6 سال پیش
والد
کامیت
ef24a3b67f
4فایلهای تغییر یافته به همراه37 افزوده شده و 1 حذف شده
  1. 3 1
      service/src/api/ports.js
  2. 25 0
      service/src/assets/common.js
  3. 3 0
      service/src/main.js
  4. 6 0
      service/src/pages/login.vue

+ 3 - 1
service/src/api/ports.js

@@ -11,6 +11,7 @@ export default {
 
     
   },
+
   // 历史会话
   SessionHistory:{
     historyList:'/service/history/historyList',//历史会话列表
@@ -55,6 +56,7 @@ export default {
   overview:{
     allConversation:"/service/history/allConversation",
     chatByTime:'/service/history/chatByTime',
-  }
+  },
+  checkValidCodeEnabledUrl:"/index/index/getConfigs"
 
 }

+ 25 - 0
service/src/assets/common.js

@@ -0,0 +1,25 @@
+import md5 from 'js-md5';
+import http from '../api/http';
+import ports from '../api/ports.js';
+export default{
+    //检测验证码是否开启
+    checkValidCodeEnabled(){
+        let params={
+            headers: {
+                apiToken:this.getApiToken('index','index','getConfigs')
+            }
+        };
+        this.checkEnabled=false;
+        http.get(ports.checkValidCodeEnabledUrl,params).then(res => {
+            // console.log(res);
+            if (res.data.code == 1) {
+                //私有库
+                this.checkEnabled = res.data.data.checkcodeflag; // res.data.data.sysWords
+            }
+        });
+        return this.checkEnabled;
+    },
+    getApiToken(m,c,act){
+       return md5(act+'customer-service'+c+m);
+    }
+}

+ 3 - 0
service/src/main.js

@@ -13,6 +13,7 @@ import axios from 'axios'; //引入axios
 import ports from './api/ports.js'; //api接口文档
 import publicMethods from '../static/publicMethods.js';
 import md5 from 'js-md5';
+import comm from './assets/common.js';
 Vue.use(ElementUI);
 
 Vue.config.productionTip = false;
@@ -20,10 +21,12 @@ Vue.config.productionTip = false;
 Vue.prototype.$frce = frce.frce;
 // 注册加密文档
 Vue.prototype.$md5 = md5;
+
 // 公共方法
 Vue.prototype.$ports = ports;
 Vue.prototype.$http = http;
 Vue.prototype.$public = publicMethods;
+Vue.prototype.$comm=comm;
 /* eslint-disable no-new */
 new Vue({
   el: '#app',

+ 6 - 0
service/src/pages/login.vue

@@ -162,6 +162,7 @@
 			// 判断验证码参数
 			let SystemId = this.$public.getQueryString("id");
 			let System = this.$public.getQueryString("code");
+			
 			if( !SystemId && !System ){
 				this.showSecurityCode = true;
 			}else {
@@ -171,6 +172,11 @@
 				localStorage.clear();
 				sessionStorage.clear();
 			}
+			this.checkEnabled=this.$comm.checkValidCodeEnabled();
+			if(this.checkEnabled==0){
+				this.showSecurityCode = false;
+			
+			}
 
 			this.$http.get(this.$ports.TIME).then(res => {
 				if (res.data.code == 1) {