Browse Source

常见问题根据配置来

seimin 2 years ago
parent
commit
119bb9672a
2 changed files with 56 additions and 54 deletions
  1. 50 53
      src/views/Login.vue
  2. 6 1
      src/views/indes.vue

+ 50 - 53
src/views/Login.vue

@@ -36,30 +36,27 @@ export default {
36
       zhanghao: "",
36
       zhanghao: "",
37
       mima: "",
37
       mima: "",
38
       requesterLgoinType: "",
38
       requesterLgoinType: "",
39
-      isSSo: true, // 是否单点登录
39
+      isSSo: true // 是否单点登录
40
     };
40
     };
41
   },
41
   },
42
   components: {
42
   components: {
43
-    LoadIng,
43
+    LoadIng
44
   },
44
   },
45
   methods: {
45
   methods: {
46
     // 登陆
46
     // 登陆
47
     login() {
47
     login() {
48
       var that = this;
48
       var that = this;
49
-      that.$http.post("service/auth/wechatAuth", {}).then((res) => {
49
+      that.$http.post("service/auth/wechatAuth", {}).then(res => {
50
         if (res.data.url) {
50
         if (res.data.url) {
51
           window.location.href = res.data.url;
51
           window.location.href = res.data.url;
52
         } else {
52
         } else {
53
-          console.log(res.data)
53
+          console.log(res.data);
54
           if (res.data.user) {
54
           if (res.data.user) {
55
             localStorage.setItem(
55
             localStorage.setItem(
56
               "loginUser",
56
               "loginUser",
57
               JSON.stringify(res.data.user.user)
57
               JSON.stringify(res.data.user.user)
58
             );
58
             );
59
-            localStorage.setItem(
60
-              "menu",
61
-              JSON.stringify(res.data.user.menu)
62
-            );
59
+            localStorage.setItem("menu", JSON.stringify(res.data.user.menu));
63
             localStorage.setItem(
60
             localStorage.setItem(
64
               "login_requester",
61
               "login_requester",
65
               JSON.stringify(res.data.user.requester)
62
               JSON.stringify(res.data.user.requester)
@@ -77,12 +74,12 @@ export default {
77
         that.login();
74
         that.login();
78
       } else {
75
       } else {
79
         var code = {
76
         var code = {
80
-          code: url[1],
77
+          code: url[1]
81
           // name: "微信处理人"
78
           // name: "微信处理人"
82
         };
79
         };
83
         // alert("2--传code参数:");
80
         // alert("2--传code参数:");
84
         // alert(JSON.stringify(code));
81
         // alert(JSON.stringify(code));
85
-        that.$http.post("service/auth/wechatLoginEncrypt", code).then((res) => {
82
+        that.$http.post("service/auth/wechatLoginEncrypt", code).then(res => {
86
           if (res.data.state == 200) {
83
           if (res.data.state == 200) {
87
             console.log(res.data);
84
             console.log(res.data);
88
             // alert(3);
85
             // alert(3);
@@ -92,10 +89,7 @@ export default {
92
                 "loginUser",
89
                 "loginUser",
93
                 JSON.stringify(res.data.user.user)
90
                 JSON.stringify(res.data.user.user)
94
               );
91
               );
95
-              localStorage.setItem(
96
-                "menu",
97
-                JSON.stringify(res.data.user.menu)
98
-              );
92
+              localStorage.setItem("menu", JSON.stringify(res.data.user.menu));
99
               localStorage.setItem(
93
               localStorage.setItem(
100
                 "login_requester",
94
                 "login_requester",
101
                 JSON.stringify(res.data.user.requester)
95
                 JSON.stringify(res.data.user.requester)
@@ -107,7 +101,7 @@ export default {
107
               .$createDialog({
101
               .$createDialog({
108
                 type: "alert",
102
                 type: "alert",
109
                 title: "您的账号被删除,请联系管理员",
103
                 title: "您的账号被删除,请联系管理员",
110
-                icon: "cubeic-alert",
104
+                icon: "cubeic-alert"
111
               })
105
               })
112
               .show();
106
               .show();
113
           } else {
107
           } else {
@@ -115,7 +109,7 @@ export default {
115
               .$createDialog({
109
               .$createDialog({
116
                 type: "alert",
110
                 type: "alert",
117
                 title: res.data.remarks,
111
                 title: res.data.remarks,
118
-                icon: "cubeic-alert",
112
+                icon: "cubeic-alert"
119
               })
113
               })
120
               .show();
114
               .show();
121
           }
115
           }
@@ -129,19 +123,16 @@ export default {
129
         .post("service/auth/loginEncrypt", {
123
         .post("service/auth/loginEncrypt", {
130
           // username: "DingDanDan",
124
           // username: "DingDanDan",
131
           username: "admin",
125
           username: "admin",
132
-          password: "20200326",
126
+          password: "20200326"
133
         })
127
         })
134
-        .then(function (res) {
128
+        .then(function(res) {
135
           that.loading = false;
129
           that.loading = false;
136
           if (res.data && res.data.state == 200) {
130
           if (res.data && res.data.state == 200) {
137
             localStorage.setItem(
131
             localStorage.setItem(
138
               "loginUser",
132
               "loginUser",
139
               JSON.stringify(res.data.data.user)
133
               JSON.stringify(res.data.data.user)
140
             );
134
             );
141
-            localStorage.setItem(
142
-              "menu",
143
-              JSON.stringify(res.data.data.menu)
144
-            );
135
+            localStorage.setItem("menu", JSON.stringify(res.data.data.menu));
145
             localStorage.setItem(
136
             localStorage.setItem(
146
               "login_requester",
137
               "login_requester",
147
               JSON.stringify(res.data.data.requester)
138
               JSON.stringify(res.data.data.requester)
@@ -156,35 +147,41 @@ export default {
156
       this.$http
147
       this.$http
157
         .post("service/sysinfo/data/fetchDataList/systemConfiguration", {
148
         .post("service/sysinfo/data/fetchDataList/systemConfiguration", {
158
           idx: 0,
149
           idx: 0,
159
-          sum: 1000,
150
+          sum: 1000
160
         })
151
         })
161
-        .then((res) => {
152
+        .then(res => {
162
           let list = res.data.list;
153
           let list = res.data.list;
163
-          let repairMain = list.find((v) => v.keyconfig == "repairMain"); //报修主体
164
-          let incidentWithConsumable = list.find(
165
-            (v) => v.keyconfig == "incidentWithConsumable"
166
-          ); //是否绑定耗材
167
-          let wxIncidentWithCmdb = list.find(
168
-            (v) => v.keyconfig == "wxIncidentWithCmdb"
169
-          ); //是否绑定资产
170
-          localStorage.setItem(
171
-            "valConfig",
172
-            JSON.stringify(repairMain.valueconfig)
173
-          );
174
-          localStorage.setItem(
175
-            "incidentWithConsumable",
176
-            incidentWithConsumable.valueconfig
177
-          );
178
-          localStorage.setItem(
179
-            "wxIncidentWithCmdb",
180
-            wxIncidentWithCmdb.valueconfig
181
-          );
154
+          list.forEach(v => {
155
+            switch (v.keyconfig) {
156
+              case "repairMain": //报修主体
157
+                localStorage.setItem(
158
+                  "valConfig",
159
+                  JSON.stringify(v.valueconfig)
160
+                );
161
+                break;
162
+              case "incidentWithConsumable": //是否绑定耗材
163
+                localStorage.setItem("incidentWithConsumable", v.valueconfig);
164
+                break;
165
+              case "wxIncidentWithCmdb": //是否绑定资产
166
+                localStorage.setItem("wxIncidentWithCmdb", v.valueconfig);
167
+                break;
168
+              // case "wxBxQuestions": //微信报修常见问题链接
169
+              //   localStorage.setItem("wxBxQuestions", v.valueconfig);
170
+              //   break;
171
+              // case "wxGuide": //微信报修服务指南链接
172
+              //   localStorage.setItem("wxGuide", v.valueconfig);
173
+              //   break;
174
+              case "wxClQuestions": //微信处理常见问题链接
175
+                localStorage.setItem("wxClQuestions", v.valueconfig);
176
+                break;
177
+            }
178
+          });
182
           this.$router.push({ path: "/main" });
179
           this.$router.push({ path: "/main" });
183
         });
180
         });
184
     },
181
     },
185
     // 获取报修人登录方式
182
     // 获取报修人登录方式
186
     getLoginType() {
183
     getLoginType() {
187
-      this.$http.post("service/wechat/getLoginType", {}).then((result) => {
184
+      this.$http.post("service/wechat/getLoginType", {}).then(result => {
188
         if (result.data.status == 200) {
185
         if (result.data.status == 200) {
189
           this.requesterLgoinType = result.data.data;
186
           this.requesterLgoinType = result.data.data;
190
           window.localStorage.setItem(
187
           window.localStorage.setItem(
@@ -206,21 +203,21 @@ export default {
206
       var ssoStr = "";
203
       var ssoStr = "";
207
       var ssoJson;
204
       var ssoJson;
208
       if (this.isSSo) {
205
       if (this.isSSo) {
209
-        ssoStr = location.search.replace("?", "").split("&")[0].split("=")[1];
206
+        ssoStr = location.search
207
+          .replace("?", "")
208
+          .split("&")[0]
209
+          .split("=")[1];
210
         ssoStr = decode(decodeURIComponent(ssoStr));
210
         ssoStr = decode(decodeURIComponent(ssoStr));
211
         ssoJson = JSON.parse(ssoStr);
211
         ssoJson = JSON.parse(ssoStr);
212
       }
212
       }
213
       var postData = this.isSSo
213
       var postData = this.isSSo
214
         ? { username: ssoJson.a, password: ssoJson.u, t: false }
214
         ? { username: ssoJson.a, password: ssoJson.u, t: false }
215
         : { username: this.zhanghao, password: this.mima };
215
         : { username: this.zhanghao, password: this.mima };
216
-      this.$http.post("service/auth/loginEncrypt", postData).then((res) => {
216
+      this.$http.post("service/auth/loginEncrypt", postData).then(res => {
217
         that.loading = false;
217
         that.loading = false;
218
         if (res.data && res.data.state == 200) {
218
         if (res.data && res.data.state == 200) {
219
           localStorage.setItem("loginUser", JSON.stringify(res.data.data.user));
219
           localStorage.setItem("loginUser", JSON.stringify(res.data.data.user));
220
-          localStorage.setItem(
221
-            "menu",
222
-            JSON.stringify(res.data.data.menu)
223
-          );
220
+          localStorage.setItem("menu", JSON.stringify(res.data.data.menu));
224
           localStorage.setItem(
221
           localStorage.setItem(
225
             "login_requester",
222
             "login_requester",
226
             JSON.stringify(res.data.data.requester)
223
             JSON.stringify(res.data.data.requester)
@@ -233,7 +230,7 @@ export default {
233
               title: "系统错误",
230
               title: "系统错误",
234
               content: "请稍后再试",
231
               content: "请稍后再试",
235
               icon: "cubeic-wrong",
232
               icon: "cubeic-wrong",
236
-              color: "red",
233
+              color: "red"
237
             })
234
             })
238
             .show();
235
             .show();
239
         }
236
         }
@@ -247,7 +244,7 @@ export default {
247
         return unescape(r[2]);
244
         return unescape(r[2]);
248
       }
245
       }
249
       return null;
246
       return null;
250
-    },
247
+    }
251
   },
248
   },
252
   created() {
249
   created() {
253
     if (location.search.length > 0) {
250
     if (location.search.length > 0) {
@@ -259,7 +256,7 @@ export default {
259
       this.zlogin();
256
       this.zlogin();
260
     }
257
     }
261
     this.getLoginType();
258
     this.getLoginType();
262
-  },
259
+  }
263
 };
260
 };
264
 </script>
261
 </script>
265
 
262
 

+ 6 - 1
src/views/indes.vue

@@ -10,10 +10,14 @@
10
         <i class="iconfont icon-xinjian"></i>
10
         <i class="iconfont icon-xinjian"></i>
11
         <span>新建事件</span>
11
         <span>新建事件</span>
12
       </div>-->
12
       </div>-->
13
-      <router-link to="/knowList">
13
+      <router-link to="/knowList" v-if="wxClQuestions == 0">
14
         <i class="iconfont icon-message"></i>
14
         <i class="iconfont icon-message"></i>
15
         <span>常见问题</span>
15
         <span>常见问题</span>
16
       </router-link>
16
       </router-link>
17
+      <a :href="wxClQuestions" v-if="wxClQuestions != 0 && wxClQuestions != -1">
18
+        <i class="iconfont icon-xinjian"></i>
19
+        <span>常见问题</span>
20
+      </a>
17
       <router-link to="/guide">
21
       <router-link to="/guide">
18
         <i class="iconfont icon-fuwuzhinan"></i>
22
         <i class="iconfont icon-fuwuzhinan"></i>
19
         <span>公告公示</span>
23
         <span>公告公示</span>
@@ -221,6 +225,7 @@ import { SM } from "./../http/http";
221
 export default {
225
 export default {
222
   data() {
226
   data() {
223
     return {
227
     return {
228
+      wxClQuestions:localStorage.getItem("wxClQuestions"),
224
       loginUser: JSON.parse(localStorage.getItem("loginUser")),
229
       loginUser: JSON.parse(localStorage.getItem("loginUser")),
225
       incidentWithConsumable: localStorage.getItem("incidentWithConsumable"),//是否绑定耗材
230
       incidentWithConsumable: localStorage.getItem("incidentWithConsumable"),//是否绑定耗材
226
       wxIncidentWithCmdb: localStorage.getItem("wxIncidentWithCmdb"),//是否绑定资产
231
       wxIncidentWithCmdb: localStorage.getItem("wxIncidentWithCmdb"),//是否绑定资产