Commit bd3a2a11 authored by neogcg's avatar neogcg

Merge branch 'dev' into dev_gcg

parents e4c36db6 6621c7eb
<template>
<div class="pagination-wraper">
<el-pagination
layout="total, sizes, prev, pager, next, jumper"
prev-text="上一页"
next-text="下一页"
......
......@@ -14,25 +14,10 @@ import router from './router'
import '@/icons' // icon
import '@/permission' // permission control
import performLoader from '@/utils/global_main_loader.js'
/**
* If you don't want to use mock-server
* you want to use MockJs for mock api
* you can execute: mockXHR()
*
* Currently MockJs will be used in the production environment,
* please remove it before going online ! ! !
*/
if (process.env.NODE_ENV === 'production') {
const { mockXHR } = require('../mock')
mockXHR()
}
// set ElementUI lang to EN
Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui,按如下方式声明
// Vue.use(ElementUI)
performLoader(Vue) // 所有的第三方插件性质的东西都放到这里面了
Vue.config.productionTip = false
new Vue({
......
......@@ -55,7 +55,7 @@ const actions = {
const { name, avatar } = data
commit('SET_NAME', name)
// commit('SET_NAME', name)
commit('SET_AVATAR', avatar)
resolve(data)
}).catch(error => {
......
import Pagination from '@/components/Pagination/index.vue'
// import VueSocketIO from 'vue-socket.io'
export default function performLoader(Vue) {
// self component
function plugins(Vue) {
Vue.component('Pagination', Pagination)
}
Vue.use(plugins)
}
......@@ -34,7 +34,8 @@ service.interceptors.request.use(
config => {
// do something before request is sent
startLoading(config.el)
// config.data = json.dumps(config.data)
config.headers.get['Content-Type'] = 'application/json'
if (store.getters.token) {
config.headers['Authorization'] = getToken()
} else {
......@@ -60,11 +61,11 @@ service.interceptors.response.use(
let code = resFinal.errorCode || resFinal.code
let message = resFinal.message || resFinal.errorMsg || resFinal.error || '接口错误'
if(code) {
if (code == 40101) {
if (code == 501) {
location.href = location.href.replace(/#.+/, '') + '#/login'
return
}
if (code == '401') {
if (code == '501') {
!config.silence && !errorShowing && Message.error(message)
errorShowing = true
setTimeout(() => { errorShowing = false }, 3000)
......
......@@ -142,7 +142,7 @@ export default {
username,
password
} = this.loginForm
let { token } = await login({
let { userName, token } = await login({
userName: username,
password: password,
}, {
......@@ -150,33 +150,17 @@ export default {
})
if (!token) return
this.$store.commit("user/SET_TOKEN", token)
this.$store.commit("user/SET_NAME", userName)
setToken(token)
// this.$store.commit("user/SET_NAVIGATION_SHOW", false)
this.$router.push({ path: "/" })
setTimeout(() => {
location.reload()
}, 10)
// setTimeout(() => {
// location.reload()
// }, 10)
},
handleLogin() {
this.$refs.loginForm.validate((valid) => {
if (valid) {
this.toLogin()
// this.loading = true;
// this.$store
// .dispatch("user/login", this.loginForm)
// .then(() => {
// if (this.loginForm.password == "123456") {
// this.$router.push({ path: this.redirect || "/" });
// this.loading = false;
// } else {
// alert("密码错误");
// this.loading = false;
// return false;
// }
// })
// .catch(() => {
// this.loading = false;
// });
} else {
console.log("error submit!!");
return false;
......
......@@ -35,7 +35,7 @@ export default {
}
return {
form: {
name: 'admin',
name: this.$store.getters.name,
oldPass: '',
newPass: '',
confirmPwd: ''
......@@ -45,7 +45,6 @@ export default {
oldPass: { required: true, message: '请输入原密码', trigger: 'blur' },
newPass: { required: true, message: '请输入新密码', trigger: 'blur' },
confirmPwd: [{ required: true, validator: validatePass2, trigger: 'blur' }]
}
}
},
......
import request from '@/utils/request'
const path = {
list: 'user/selectUserPage',
create: 'user/saveUser',
updatePwd: 'user/updatePwd',
updateInfo: 'user/updateUserBaseInfo',
}
export function list() {
return request.post(path.list, ...arguments)
}
export function create() {
return request.post(path.create, ...arguments)
}
export function updatePwd() {
return request.post(path.updatePwd, ...arguments)
}
export function updateInfo() {
return request.post(path.updateInfo, ...arguments)
}
<template>
<div class="leakage-cable">
<div class="leakage-top">
<div class="leakage-cable">
<div class="leakage-top">
<div style="color: #666666"></div>
<div class="operate-btn">
<el-button type="primary" >添加新用户</el-button>
<el-button type="primary">添加新用户</el-button>
</div>
</div>
<el-table
v-loading="loading"
:data="tableData2"
:data="tableData"
class="statistics-table"
style="width: 100%"
:row-class-name="tableRowClassName"
:header-cell-style="{background:'#eaf1fe',color:'#000', fontWeight: 700, height: '50px'}"
:header-cell-style="{
background: '#eaf1fe',
color: '#000',
fontWeight: 700,
height: '50px',
}"
>
<el-table-column type="index" label="用户编号" align="center" width="100" />
<el-table-column prop="name" label="用户名" align="center" />
<el-table-column
type="index"
label="用户编号"
align="center"
width="100"
/>
<el-table-column prop="userName" label="用户名" align="center" />
<el-table-column prop="realName" label="真实姓名" align="center" />
<el-table-column prop="dept" label="用户部门" align="center" />
<el-table-column prop="deptId" label="用户部门" align="center" />
<el-table-column prop="phone" label="电话号码" align="center" />
<el-table-column prop="email" label="邮箱" align="center" />
<el-table-column label="操作" align="center">
<template>
<el-button type="text">修改密码</el-button>
<el-button type="text">修改基本信息</el-button>
<template slot-scope="scope">
<el-button type="text" @click="toEditPwd(scope.row)">修改密码</el-button>
<el-button type="text" @click="toEditInfo(scope.row)">修改基本信息</el-button>
</template>
</el-table-column>
</el-table>
<pagination
:limit="searchForm.pageSize"
:page="searchForm.pageNum"
<Pagination
:limit="params.pageSize"
:page="params.pageNum"
:total="total"
class="pagination"
@pagination="handlePageChange"
......@@ -40,56 +48,15 @@
</template>
<script>
import Pagination from '@/components/Pagination'
import { list, create, updatePwd, updateInfo } from './api'
export default {
components: {
Pagination
},
data() {
return {
searchForm: {
params: {
pageNum: 1,
pageSize: 10
},
tableData2:[],
tableData: [
{
name: 'admin',
realName: '张三',
dept: 'NetWork',
phone: '13912451245',
email: '123456@163.com'
},
{
name: 'admin',
realName: '张三',
dept: 'NetWork',
phone: '13912451245',
email: '123456@163.com'
},
{
name: 'admin',
realName: '张三',
dept: 'NetWork',
phone: '13912451245',
email: '123456@163.com'
},
{
name: 'admin',
realName: '张三',
dept: 'NetWork',
phone: '13912451245',
email: '123456@163.com'
},
{
name: 'admin',
realName: '张三',
dept: 'NetWork',
phone: '13912451245',
email: '123456@163.com'
}
],
tableData: [],
total: 5,
loading: false
}
......@@ -99,16 +66,20 @@ export default {
return rowIndex % 2 === 0 ? '' : 'single-row'
},
handlePageChange(pageData) {
this.searchForm.pageSize = pageData.size
this.searchForm.pageNum = pageData.page
this.getTableData()
this.params.pageSize = pageData.size
this.params.pageNum = pageData.page
this.getTableData()
},
getTableData() {
this.tableData2 = this.tableData.slice(( this.searchForm.pageNum - 1) * this.searchForm.pageSize,
this.searchForm.pageNum * this.searchForm.pageSize
);
this.total = this.tableData.length
getTableData() {
let params = {
current: this.params.pageNum,
size: this.params.pageSize
}
list(params).then(res => {
let list = res.records || []
this.tableData = list
this.total = res.total
})
},
},
mounted() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment