Browse Source

修改登录,增加系统设置功能(sunzehao提交)

wangb 3 months ago
parent
commit
49daaaad2c
4 changed files with 24 additions and 8 deletions
  1. 4 3
      .env.development
  2. 1 0
      src/api/gengra.js
  3. 3 3
      src/components/commonHeaders.vue
  4. 16 2
      src/views/login/index.vue

+ 4 - 3
.env.development

@@ -11,15 +11,16 @@ VUE_APP_TITLE = '页面标题'
 # 马力军
 # VUE_APP_LOGIN_URL = 'http://192.168.2.45:48080'
 # 王波
-VUE_APP_LOGIN_URL = 'http://172.16.12.101:48080'
+# VUE_APP_LOGIN_URL = 'http://172.16.12.101:48080'
+VUE_APP_LOGIN_URL = 'http://172.16.12.102:8190'
 
 # 发电能力分析
 # VUE_APP_GENERAT_URL = 'http://192.168.0.102:9002'
 # 马力军
 # VUE_APP_GENERAT_URL = 'http://192.168.2.45:9002'
 # 王波
-# VUE_APP_GENERAT_URL = 'http://172.16.12.101:9002'
-VUE_APP_GENERAT_URL = 'http://127.0.0.1:9002'
+VUE_APP_GENERAT_URL = 'http://172.16.12.101:9002'
+# VUE_APP_GENERAT_URL = 'http://127.0.0.1:9002'
 
 # 智能报表
 # VUE_APP_REPORT_URL = 'http://192.168.0.102:9001'

+ 1 - 0
src/api/gengra.js

@@ -5,6 +5,7 @@ export function apiProjectLogin(params) {
     return httpRequest({
         baseURL: process.env.VUE_APP_LOGIN_URL,
         url: 'admin-api/system/auth/login',
+        url: 'login',
         data: params,
         method: "post"
     })

+ 3 - 3
src/components/commonHeaders.vue

@@ -44,7 +44,7 @@
                   <img :src="header_wendang" class="Settingitem downItem" />
                 </a>
               </el-tooltip>
-              <el-tooltip class="box-item" effect="light" content="系统设置">
+              <el-tooltip class="box-item" effect="light" content="系统设置" v-if="userName === 'administrators'">
                   <img :src="header_shezhi" class="Settingitem" @click="openSystemSet">
               </el-tooltip>
               <el-tooltip class="box-item" effect="light" content="退出">
@@ -137,7 +137,7 @@ export default {
     this.$emit("swichFn", this.switchTheme);
     this.getThemeClass(this.switchTheme);
     let userMes = JSON.parse(window.sessionStorage.getItem("userMessage"));
-    that.userName = userMes ? userMes.role : "administrator";
+    that.userName = userMes ? userMes.role : "administrators";
     if (this.$route.query.markKey) {
       that.userName = that.$route.query.userid;
     }
@@ -176,7 +176,7 @@ export default {
     },
     openSystemSet() {
       // let url = 'http://127.0.0.1:8009/login'
-      let url = "http://172.16.12.101:8082/login"
+      let url = "http://172.16.12.101:7095/"
       window.open(url,"target")
     },
     showHeader(route) {

+ 16 - 2
src/views/login/index.vue

@@ -106,6 +106,8 @@
                 // administrator qweABC123
                 inputUser: 'admin',
                 inputMima: 'admin123',
+                // inputUser: 'testdb',
+                // inputMima: '123456',
                 inputYanzhengma: '',
                 codeUrl: '',
                 ememberMe: true,
@@ -237,8 +239,20 @@
                     password: pass
                 }
                 apiProjectLogin(params).then(datas => {
-                    if (datas && datas.code === 0) {
-                        setToken(datas.data.accessToken)
+                    if (datas && datas.code === 200) {
+                        // setToken(datas.data.accessToken)
+                        setToken(datas.token)
+                        let userObj = {
+                            role: '',
+                            userId: datas.userId
+                        }
+                        if (datas.userId === 1) {
+                            userObj.role = 'administrators'
+                            window.sessionStorage.setItem('userMessage', JSON.stringify(userObj))
+                        } else {
+                            userObj.role = 'ordinaryUser'
+                            window.sessionStorage.setItem('userMessage', JSON.stringify(userObj))
+                        }
                         that.$router.push({
                             path: "/home"
                             // path: "/generatingCap/dataFilter/prepare"