zhangxiaoxu123456
2022-04-14 626cabe8772d16c02584c8b324dd7c45e23002a6
登录接口
10个文件已修改
1个文件已添加
152 ■■■■ 已修改文件
config/index.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/index.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/libs/axios.js 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/login.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/show/jiuyeAndChuangye/jiuyeChildren/zhiyePeixun.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/show/laborRelations/LaborRelations.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/show/otherBusiness/otherBusinessChild/OtherB_PeopleJunShouRu.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/show/renshiRencai/shiyeDanweiRenyuanQingkuang.vue 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/getters.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/index.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/user.js 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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,
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);
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({
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')
          // })
      });
    }
  }
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 */;
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;
  }
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 */
  );
src/pages/show/renshiRencai/shiyeDanweiRenyuanQingkuang.vue
New file
@@ -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>
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,
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
})
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;