From 626cabe8772d16c02584c8b324dd7c45e23002a6 Mon Sep 17 00:00:00 2001
From: zhangxiaoxu123456 <zxx19900626>
Date: 星期四, 14 四月 2022 17:36:12 +0800
Subject: [PATCH] 登录接口

---
 src/pages/login.vue                                                        |   13 +++-
 src/pages/show/otherBusiness/otherBusinessChild/OtherB_PeopleJunShouRu.vue |    3 +
 src/pages/show/renshiRencai/shiyeDanweiRenyuanQingkuang.vue                |   31 ++++++++++
 src/store/modules/user.js                                                  |   51 ++++++----------
 config/index.js                                                            |    9 +-
 src/api/index.js                                                           |    2 
 src/store/index.js                                                         |    2 
 src/libs/axios.js                                                          |   32 ++++++++++
 src/pages/show/jiuyeAndChuangye/jiuyeChildren/zhiyePeixun.vue              |    6 ++
 src/store/getters.js                                                       |    2 
 src/pages/show/laborRelations/LaborRelations.vue                           |    3 +
 11 files changed, 112 insertions(+), 42 deletions(-)

diff --git a/config/index.js b/config/index.js
index 93bd14c..ce7c79a 100644
--- a/config/index.js
+++ b/config/index.js
@@ -3,6 +3,7 @@
 // see http://vuejs-templates.github.io/webpack for documentation.
 
 const path = require("path");
+let url = 'http://192.168.0.133:8081'
 
 module.exports = {
   dev: {
@@ -10,17 +11,17 @@
     assetsSubDirectory: "static", // 缂栬瘧杈撳嚭鐨勪簩绾х洰褰�
     assetsPublicPath: "/", // 缂栬瘧鍙戝竷鐨勬牴鐩綍锛屽彲閰嶇疆涓鸿祫婧愭湇鍔″櫒鍩熷悕鎴� CDN 鍩熷悕
     proxyTable: {
-      "/api": {
-        target: "",
+      "/": {
+        target: url,
         changeOrigin: true,
         pathRewrite: {
-          "^/api": ""
+          "^/": ""
         }
       }
     },
 
     // Various Dev Server settings
-    host: "localhost", // can be overwritten by process.env.HOST
+    host: "0.0.0.0", // can be overwritten by process.env.HOST
     port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
     autoOpenBrowser: false,
     errorOverlay: true,
diff --git a/src/api/index.js b/src/api/index.js
index 6740be1..681c08d 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -2,7 +2,7 @@
 
 // 鍚庡彴鐢ㄦ埛鐩稿叧
 export const login = params => {
-    return postRequest('/login', params);
+    return postRequest('/ybg/webservice/phone/login.do', params);
 }
 export const getAdminIndex = params => {
     return getRequest('/getAdminIndex', params);
diff --git a/src/libs/axios.js b/src/libs/axios.js
index bed6d70..c5747d3 100644
--- a/src/libs/axios.js
+++ b/src/libs/axios.js
@@ -1,9 +1,39 @@
 import axios from 'axios';
+import store from "../store";
 import { getStore, setStore } from './store'
+import routers from '@/router/index'
+import { MessageBox,Message}  from 'element-ui'
 let base = process.env.NODE_ENV == 'development' ? '' : ''; // 鍩虹url
 
-axios.defaults.timeout = 15000;
+axios.defaults.timeout = 30000;
 
+axios.interceptors.request.use(config => {
+  let token = store.getters.token
+  if(token) {
+    config.headers['Authorization'] = token
+  }
+  return config
+},error => {
+  return Promise.reject(error)
+})
+
+axios.interceptors.response.use(config => {
+  const status = Number(config.status)
+  const message = config.data.error
+  if( status !== 200) {
+    Message.error(message)
+    return  Promise.reject(new Error(message))
+  }
+  return config
+},(error) => {
+  console.log(error,'error')
+  const { status, data } = error.response
+  const { error : message } = data
+  if(status === 503) {
+    Message.error(message)
+  }
+  return Promise.reject(error)
+})
 
 export const getRequest = (url, params = {}) => {
     return axios({
diff --git a/src/pages/login.vue b/src/pages/login.vue
index 95512a7..a7d2d1f 100644
--- a/src/pages/login.vue
+++ b/src/pages/login.vue
@@ -47,14 +47,14 @@
   </div>
 </template>
 <script>
-// import {login} from "@/api/index";
+import {login} from "@/api/index";
 
 export default {
   data() {
     return {
       loginForm: {
-        username: "admin",
-        password: "123456"
+        username: "",
+        password: "",
       },
       loginFormRules: {
         // 楠岃瘉鐢ㄦ埛鍚嶆槸鍚﹀悎娉�
@@ -76,7 +76,12 @@
       this.$refs.loginFormRef.validate(async valid => {
         console.log(valid);
         if (!valid) return;
-        this.$router.push("/");
+        this.$store.dispatch('login',this.loginForm).then(res => {
+            this.$router.push('/index')
+        })
+          // login(this.loginForm).then(res => {
+          //   this.$router.push('/index')
+          // })
       });
     }
   }
diff --git a/src/pages/show/jiuyeAndChuangye/jiuyeChildren/zhiyePeixun.vue b/src/pages/show/jiuyeAndChuangye/jiuyeChildren/zhiyePeixun.vue
index 839aaaf..c1f8f28 100644
--- a/src/pages/show/jiuyeAndChuangye/jiuyeChildren/zhiyePeixun.vue
+++ b/src/pages/show/jiuyeAndChuangye/jiuyeChildren/zhiyePeixun.vue
@@ -269,6 +269,12 @@
     width: 100%;
     height: calc(100% - 0.078125rem  /* 20/256 */);
     margin-top: 0.078125rem  /* 20/256 */;
+    .el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell{
+      background: transparent;
+    }
+    .el-table__body tr.hover-row.current-row>td.el-table__cell, .el-table__body tr.hover-row.el-table__row--striped.current-row>td.el-table__cell, .el-table__body tr.hover-row.el-table__row--striped>td.el-table__cell, .el-table__body tr.hover-row>td.el-table__cell{
+      background: transparent;
+    }
     .el-table th.el-table__cell{
       background-color:$color-blue;
       height: 0.3125rem  /* 80/256 */;
diff --git a/src/pages/show/laborRelations/LaborRelations.vue b/src/pages/show/laborRelations/LaborRelations.vue
index 2b575f7..57451a5 100644
--- a/src/pages/show/laborRelations/LaborRelations.vue
+++ b/src/pages/show/laborRelations/LaborRelations.vue
@@ -292,6 +292,9 @@
 <style lang="scss">
 @import "../../../assets/css/base";
 .laborRelations__table {
+  .el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell{
+    background: transparent;
+  }
   .el-table tr {
     background-color: #CEF2FF;
   }
diff --git a/src/pages/show/otherBusiness/otherBusinessChild/OtherB_PeopleJunShouRu.vue b/src/pages/show/otherBusiness/otherBusinessChild/OtherB_PeopleJunShouRu.vue
index 4292095..676fa35 100644
--- a/src/pages/show/otherBusiness/otherBusinessChild/OtherB_PeopleJunShouRu.vue
+++ b/src/pages/show/otherBusiness/otherBusinessChild/OtherB_PeopleJunShouRu.vue
@@ -286,6 +286,9 @@
 @import "../../../../assets/css/base";
 
 .OtherB-PeopleJunShouRu__table {
+  .el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell{
+    background:transparent;
+  }
   width: 100%;
   height: calc(100% - 0.078125rem /* 20/256 */
   );
diff --git a/src/pages/show/renshiRencai/shiyeDanweiRenyuanQingkuang.vue b/src/pages/show/renshiRencai/shiyeDanweiRenyuanQingkuang.vue
new file mode 100644
index 0000000..b36b375
--- /dev/null
+++ b/src/pages/show/renshiRencai/shiyeDanweiRenyuanQingkuang.vue
@@ -0,0 +1,31 @@
+<template>
+    <div class="shiyeDanweiRenyuanQingkuang-wrap">
+      <el-table
+        :data="tableData"
+        style="width: 100%">
+        <el-table-column
+          prop="year"
+          label="骞翠唤">
+        </el-table-column>
+        <el-table-column
+          prop="fanwei"
+          label="鑼冨洿">
+        </el-table-column>
+      </el-table>
+    </div>
+</template>
+
+<script>
+    export default {
+        name: "shiyeDanweiRenyuanQingkuang",
+        data() {
+            return {
+                tableData: []
+            }
+        }
+    }
+</script>
+
+<style scoped>
+
+</style>
diff --git a/src/store/getters.js b/src/store/getters.js
index 49b1a11..0d6496d 100644
--- a/src/store/getters.js
+++ b/src/store/getters.js
@@ -26,7 +26,7 @@
   tagList: state => state.tags.tagList,
   tagCurrent: state => state.tags.tagCurrent,
   tagWel: state => state.tags.tagWel,
-  access_token: state => state.user.access_token,
+  token: state => state.user.token,
   refresh_token: state => state.user.refresh_token,
   roles: state => state.user.roles,
   permissions: state => state.user.permissions,
diff --git a/src/store/index.js b/src/store/index.js
index 6ee8827..e8e14dc 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -19,6 +19,7 @@
 import Vuex from 'vuex'
 import common from './modules/common'
 import user from './modules/user'
+import getters from './getters'
 import vuexI18n from 'vuex-i18n';
 import en from "@/i18n/en-US"
 import zh from "@/i18n/zh-CN"
@@ -30,6 +31,7 @@
         user,
         i18n: vuexI18n.store
     },
+    getters
 })
 
 
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 9ec679d..6d53c1a 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -1,42 +1,31 @@
 /**
  * 鐢ㄦ埛鐧诲綍缁勪欢
  */
-
-
+import {login} from '@/api/index'
+import {getStore,setStore} from "../../libs/store";
 
 const user = {
     state: {
-        menus: [
-            {
-                icon: "sound",
-                index: "/index",
-                title: "瑙嗛绠$悊",
-                subs: [
-                    {
-                        icon: "area-chart",
-                        index: "index",
-                        title: "Dashboard",
-                    },
-                ],
-            },
-            {
-                icon: "setting",
-                index: "/wechat",
-                title: "绯荤粺",
-                subs: [
-                    {
-                        icon: "setting",
-                        index: "admin_user",
-                        title: "甯愬彿绠$悊",
-                    },
-                ],
-            }
-        ]
+      token: getStore('token') || {}
     },
     mutations: {
-        SET_MENUS: (state, action) => {
-            // state.menus = !state.isCollapse
-        },
+      SET_TOKEN: (state, token) => {
+        state.token = token
+      }
+    },
+    actions: {
+      login({commit}, userInfo) {
+         return new Promise((resolve, reject) => {
+           login(userInfo).then(response => {
+             console.log('response----',response)
+             commit('SET_TOKEN',response.obj.token)
+             resolve()
+           }).catch(error => {
+             reject(error)
+           })
+         })
+      }
+
     }
 }
 export default user;

--
Gitblit v1.9.1