接口联调

ui1
yujialong 3 years ago
parent 7f3fc93d8a
commit 0c45e5dd8a
  1. 2
      src/App.vue
  2. 111
      src/api/index.js
  3. BIN
      src/assets/img/code.png
  4. BIN
      src/assets/img/password.png
  5. BIN
      src/assets/img/setting.png
  6. 2
      src/layouts/footer/index.vue
  7. 58
      src/layouts/header/index.vue
  8. 63
      src/layouts/navbar/index.vue
  9. 6
      src/libs/auth/generateBtnPermission.js
  10. 14
      src/libs/route/addRoutes.js
  11. 2
      src/libs/route/generateRoutes.js
  12. 69
      src/pages/account/login/index.vue
  13. 24
      src/pages/data/list/index.vue
  14. 54
      src/pages/index/list/index.vue
  15. 19
      src/pages/role/list/index.vue
  16. 8
      src/pages/setting/person/download.vue
  17. 19
      src/pages/setting/person/index.vue
  18. 504
      src/pages/setting/person/info.vue
  19. 25
      src/pages/stat/list/index.vue
  20. 115
      src/pages/user/list/index.vue
  21. 10
      src/plugins/auth/index.js
  22. 111
      src/plugins/requests/index.js
  23. 16
      src/router/permission.js
  24. 2
      src/setting.js
  25. 8
      src/store/getters.js
  26. 26
      src/store/modules/auth.js
  27. 32
      src/store/modules/data.js
  28. 19
      src/store/modules/role.js
  29. 47
      src/store/modules/stat.js
  30. 86
      src/store/modules/user.js

@ -17,7 +17,7 @@
//vuexlocalStorage //vuexlocalStorage
window.addEventListener("beforeunload",()=>{ window.addEventListener("beforeunload",()=>{
util.local.get(Setting.usernameKey) && util.local.set(Setting.storeKey,this.$store.state) util.local.get(Setting.tokenKey) && util.local.set(Setting.storeKey,this.$store.state)
}) })
} }
} }

@ -1,26 +1,31 @@
import Setting from '@/setting' import Setting from '@/setting'
let uploadURL = Setting.upload.apiURL let uploadURL = Setting.upload.apiURL
let host = 'http://www.liuwanr.cn' let host = 'http://www.liuwanr.cn'
let host1 = 'http://192.168.31.125:9000' let host1 = 'http://192.168.31.125:9000'//林
let host2 = 'http://192.168.31.140:9000'//7
let host3 = 'http://192.168.31.137:9000'//陈
export default { export default {
// 登录注册 // 登录注册
logins: `${host}/liuwanr/userInfo/adminLogins`, logins: `${host3}/users/users/user/login`,
verification:`${host3}/users/users/user/captcha`,
uploadUserAvatars: `liuwanr/userInfo/uploadUserAvatars`, // 公用接口
queryProvince: `liuwanr/province/queryProvince`, queryProvince: `${host3}/nakadai/nakadai/province/queryProvince`,
queryCity: `liuwanr/city/queryCity`, queryCity: `${host3}/nakadai/nakadai/city/queryCity`,
querySchoolData: `liuwanr/customer/querySchool`,
queryAccountIsExist:`liuwanr/userInfo/queryAccountIsExist`,
queryWorkNumberIsExist:`evaluation/tms/userInfo/queryWorkNumberIsExist`, queryWorkNumberIsExist:`evaluation/tms/userInfo/queryWorkNumberIsExist`,
queryStaffWorkNumberIsExist:`evaluation/tms/system/queryStaffWorkNumberIsExist`, queryStaffWorkNumberIsExist:`evaluation/tms/system/queryStaffWorkNumberIsExist`,
querySchool: `liuwanr/customer/querySchool`, querySchool: `${host3}/nakadai/nakadai/school/querySchool`,
queryCourseDiscipline: `${host2}/nakadai/nakadai/discipline/queryDiscipline`,
queryCourseProfessionalClass: `${host2}/nakadai/nakadai/professionalClass/queryProfessionalClass`,
queryCourseProfessional: `${host2}/nakadai/nakadai/professional/queryProfessional`,
// 个人中心 // 个人中心
userInfo:`${host1}/data/userInfo/userInfo`, uploadUserAvatars: `${host1}/users/users/userAccount/updateUserAvatars`,
updateUser:`${host1}/data/userInfo/updateUser`, userInfo:`${host1}/users/users/userInfo/getUserInfo`,
findPasswordByEmail:`/data/userInfo/findPasswordByEmail`, updateUser:`${host1}/users/users/userInfo/updateUser`,
findPasswordByPhone:`/data/userInfo/findPasswordByPhone`, findPasswordByEmail:`/users/users/userAccount/findPasswordByEmail`,
findPasswordByPhone:`/users/users/userAccount/findPasswordByPhone`,
bingEmail:`evaluation/tms/user/bingEmail`, bingEmail:`evaluation/tms/user/bingEmail`,
bindPhone:`evaluation/tms/user/bindPhone`, bindPhone:`evaluation/tms/user/bindPhone`,
@ -31,53 +36,55 @@ export default {
removeMoreVideo: `${uploadURL}/oss/manage/removeMoreVideo`, removeMoreVideo: `${uploadURL}/oss/manage/removeMoreVideo`,
removeVideo: `${uploadURL}/oss/manage/removeVideo`, removeVideo: `${uploadURL}/oss/manage/removeVideo`,
//查询电话是否存在
queryProvince: `cjEnterprise/province/queryProvince`,
queryCity: `cjEnterprise/city/queryCity`,
queryClient: `cjEnterprise/client/list`,
// 用户管理 // 用户管理
saveUser: `/users/data/user/save`, saveUser: `/users/users/data/user/save`,
getUserList: `/users/data/user/getUserList`, getUserList: `/users/users/data/user/getUserList`,
getUserTotalBySchoolId: `${host1}/users/data/user/getUserTotalBySchoolId`, getUserTotalBySchoolId: `${host1}/users/users/data/user/getUserTotalBySchoolId`,
checkAccount:`/users/data/user/checkAccount`, checkAccount:`/users/users/data/user/checkAccount`,
getDetail:`/users/data/user/getDetail`, getDetail:`/users/users/data/user/getDetail`,
modifyUser:`/users/data/user/modify`, modifyUser:`/users/users/data/user/modify`,
export_failure:`${Setting.apiBaseURL}/users/data/user/export_failure`, export_failure:`${Setting.apiBaseURL}/users/users/data/user/export_failure`,
uploadFile:`${Setting.apiBaseURL}/users/data/user/uploadFile`, uploadFile:`${Setting.apiBaseURL}/users/users/data/user/uploadFile`,
deleteUser:`${Setting.apiBaseURL}/users/users/data/user/delete`,
resetPwd: `${host2}/users/users/userAccount/resetPwd`,
sendPhoneOrEmailCode: `${host2}/users/users/userAccount/sendPhoneOrEmailCode`,
bindPhoneOrEmail: `${host2}/users/users/userAccount/bindPhoneOrEmail`,
examinePassword: `${host1}/users/users/userAccount/examinePassword`,
// 角色管理 // 角色管理
batchRemove:`/data/role/batchRemove`, batchRemove:`/data/data/role/batchRemove`,
getRole:`/data/role/get`, getRole:`/data/data/role/get`,
getName:`/data/role/getName`, getName:`/data/data/role/getName`,
listRole:`/data/role/list`, listRole:`/data/data/role/list`,
removeRole:`/data/role/remove`, removeRole:`/data/data/role/remove`,
saveOrUpdate:`/data/role/saveOrUpdate`, saveOrUpdate:`/data/data/role/saveOrUpdate`,
getRoles:`/data/role/getRole`, getRoles:`/data/data/role/getRole`,
getPermissions:`/data/data/permission/getPermissions`,
// 权限菜单管理 // 权限菜单管理
doAssign:`/data/permission/doAssign`, doAssign:`/data/data/permission/doAssign`,
queryPermissionMenu:`/data/permission/queryPermissionMenu`, queryPermissionMenu:`/data/data/permission/queryPermissionMenu`,
savePer:`/data/permission/save`, savePer:`/data/data/permission/save`,
toAssign:`/data/permission/toAssign`, toAssign:`/data/data/permission/toAssign`,
// 表展示 // 表展示
getIdQueryTable:`/data/table/getIdQueryTable`, getIdQueryTable:`/data/data/table/getIdQueryTable`,
getTableByClassification:`/data/table/getTableByClassification`, getTableByClassification:`/data/data/table/getTableByClassification`,
getTableByCondition:`/data/table/getTableByCondition`, getTableByCondition:`/data/data/table/getTableByCondition`,
downloadData:`${host1}/data/download`, downloadData:`${host1}/data/data/download`,
previewData:`${host1}/data/preview`, previewData:`${host1}/data/data/preview`,
downloadRecord:`${host1}/data/myDownload/downloadRecord`, downloadRecord:`${host1}/data/data/myDownload/downloadRecord`,
getDownloadRecord:`data/myDownload/getDownloadRecord`, getDownloadRecord:`/data/data/myDownload/getDownloadRecord`,
downloadAgain:`${host1}/data/downloadAgain`, downloadAgain:`${host1}/data/data/downloadAgain`,
isDownload:`${host1}/data/data/product/isDownload`,
// 数据操作记录 // 数据操作记录
queryAccumulate:`${host1}/data/dataRecord/queryAccumulate`, queryAccumulate:`${host1}/data/data/dataRecord/queryAccumulate`,
queryDatabaseInfo:`${host1}/data/dataRecord/queryDatabaseInfo`, queryDatabaseInfo:`${host1}/data/data/dataRecord/queryDatabaseInfo`,
queryDatabaseInfoByMonth:`${host1}/data/dataRecord/queryDatabaseInfoByMonth`, queryDatabaseInfoByMonth:`${host1}/data/data/dataRecord/queryDatabaseInfoByMonth`,
saveRecord:`${host1}/data/dataRecord/saveRecord`, saveRecord:`${host1}/data/data/dataRecord/saveRecord`,
databaseInfoExport:`${host1}/data/dataRecord/databaseInfoExport`, databaseInfoExport:`${host1}/data/data/dataRecord/data/databaseInfoExport`,
databaseInfoByMonthExport:`${host1}/data/dataRecord/databaseInfoByMonthExport`, databaseInfoByMonthExport:`${host1}/data/data/dataRecord/data/databaseInfoByMonthExport`,
onlineNumber:`${host1}/data/dataRecord/onlineNumber`, onlineNumber:`${host1}/data/data/dataRecord/onlineNumber`,
getProductInfoBySchoolId:`${host1}/data/product/getProductInfoBySchoolId`, getProductInfoBySchoolId:`${host1}/data/data/product/getProductInfoBySchoolId`,
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 771 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 507 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 B

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<div class="copyright">广州超竞教育投资有限公司版权所有</div> <div class="copyright"></div>
</div> </div>
</template> </template>
<script> <script>

@ -6,8 +6,9 @@
</a> </a>
<div style="height: 80px;"></div> <div style="height: 80px;"></div>
<navbar ref="nav"></navbar> <navbar ref="nav"></navbar>
<div class="action"> <div class="action" v-if="token">
<img class="search" src="../../assets/img/search.png" alt=""> <img v-if="isManager || !isUser" class="icon" src="../../assets/img/search.png" alt="" @click="toSearch">
<img v-if="isManager" class="icon" src="../../assets/img/setting.png" alt="" @click="toManager">
<el-dropdown class="user-wrap" @command="userCommand"> <el-dropdown class="user-wrap" @command="userCommand">
<div class="user"> <div class="user">
<el-avatar :size="40" :src="avatar"></el-avatar> <el-avatar :size="40" :src="avatar"></el-avatar>
@ -26,36 +27,69 @@
import navbar from '../navbar' import navbar from '../navbar'
import { mapState,mapActions } from 'vuex' import { mapState,mapActions } from 'vuex'
import Setting from '@/setting' import Setting from '@/setting'
import util from '@/libs/util'
export default { export default {
data() { data() {
return { return {
showBackList: Setting.layout.hideNavList, token: util.local.get(Setting.tokenKey),
isUser: false
}; };
}, },
components: { navbar }, components: { navbar },
computed: { computed: {
...mapState('user', [ ...mapState('user', [
'userId','avatar','userName' 'avatar','userName','isManager','schoolId'
]), ]),
showBack(){ ...mapState('auth', [
let route = this.$route.name 'routes'
if(this.showBackList.includes(route)) return true ])
return false
}
}, },
mounted(){ mounted(){
if(this.token) (this.userName && this.avatar) || this.getUserInfo()
}, },
methods: { methods: {
...mapActions('user', [ ...mapActions('user', [
'logout' 'setInfo','logout','setManager'
]), ]),
getUserInfo(){
this.$get(this.api.userInfo).then(res => {
let userInfo = res.userInfo
let isManager = userInfo.roleId != '0'
this.isUser = isManager
let mg = this.$route.query.mg
if(mg && atob(decodeURI(mg)) === 'true'){
isManager = false
}
this.setInfo({
avatar: userInfo.userAvatars,
userName: userInfo.userName,
schoolId: res.userAccount.schoolId,
})
this.setManager(isManager)
}).catch(err => {})
},
toIndex(){ toIndex(){
this.$refs.nav.jump({ this.$refs.nav.jump({
index: '/index/list', index: '/index/list',
title: '首页' title: '首页'
}) })
}, },
toSearch(){
this.$refs.nav.jump({
index: '/index/list',
title: '首页'
})
},
toManager(){
let route = this.$router.resolve({
path: this.routes[0].name,
query: {
mg: btoa(true),
schoolId: btoa(this.schoolId),
}
})
window.open(route.href)
},
userCommand(command){ userCommand(command){
if(command == 'person'){ if(command == 'person'){
this.$router.push('/setting/person') this.$router.push('/setting/person')
@ -89,7 +123,7 @@ export default {
.action{ .action{
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
.search{ .icon{
margin-right: 30px; margin-right: 30px;
cursor: pointer; cursor: pointer;
} }

@ -7,12 +7,15 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState,mapActions } from 'vuex'
import bus from '@/libs/bus' import addRoutes from '@/libs/route/addRoutes'
import Setting from '@/setting' import Setting from '@/setting'
import util from '@/libs/util'
export default { export default {
data() { data() {
return { return {
managerStr: this.$route.query.mg,
isManager: false,
active: this.$route.path, active: this.$route.path,
defaultMenus: [ defaultMenus: [
{ {
@ -21,7 +24,10 @@ export default {
},{ },{
index: '/data/list', index: '/data/list',
title: '数据' title: '数据'
},{ }
],
managerMenus: [
{
index: '/stat/list', index: '/stat/list',
title: '数据统计' title: '数据统计'
},{ },{
@ -30,17 +36,17 @@ export default {
},{ },{
index: '/role/list', index: '/role/list',
title: '角色权限' title: '角色权限'
}, }
], ],
menus: [], menus: [],
actives: { actives: {}
practice: ['practice-do','practice-randomDo'],
exam: ['exam-do'],
achievement: ['achievement-practice','achievement-assessment'],
wrongBook: ['wrongBook-do'],
}
}; };
}, },
computed: {
...mapState('auth', [
'routes'
])
},
watch: { watch: {
'$route'(to,from) { '$route'(to,from) {
let actives = this.actives let actives = this.actives
@ -50,32 +56,47 @@ export default {
this.active = this.$route.path this.active = this.$route.path
} }
}, },
created() { mounted() {
this.initMenu() if(util.local.get(Setting.tokenKey)){
// Event Bus this.getPer()
bus.$on('collapse', msg => { if(this.managerStr && atob(decodeURI(this.managerStr)) === 'true'){
this.collapse = msg; this.isManager = true
bus.$emit('collapse-content', msg); this.setManager(false)
}); }
}
}, },
methods: { methods: {
...mapActions('user', [
'setManager'
]),
initMenu(){ initMenu(){
if(this.isManager){
this.defaultMenus = this.managerMenus
if(Setting.dynamicRoute){ if(Setting.dynamicRoute){
let routes = this.routes let routes = this.routes
let menus = [] let menus = []
this.defaultMenus.map(e => { this.defaultMenus.map(e => {
routes.find(n => n.path == e.index) && menus.push(e) routes.find(n => n.name == e.index) && menus.push(e)
}) })
this.menus = menus this.menus = menus
this.active = menus[0].index }else{
this.menus = this.defaultMenus
}
}else{ }else{
this.menus = this.defaultMenus this.menus = this.defaultMenus
} }
}, },
jump(item){ jump(item){
this.active = item.index this.active = item.index
this.$router.push(item.index) this.$router.push(item.index).catch(err => {})
} },
getPer(){
this.$post(this.api.getPermissions).then(res => {
let routes = res.permissions[0].children
Setting.dynamicRoute && addRoutes(routes)
this.initMenu()
}).catch(err => {})
},
} }
}; };
</script> </script>

@ -12,14 +12,14 @@ export default function(data){
if(n.children.length){ if(n.children.length){
result.push(`${e.name}:${n.name}`) result.push(`${e.name}:${n.name}`)
n.children.map(j => { n.children.map(j => {
j.select && (e.component ? result.push(`${e.component}:${n.name}:${j.name}`) : result.push(`${n.component}:${j.name}`)) j.select && (e.path ? result.push(`${e.path}:${n.name}:${j.name}`) : result.push(`${n.path}:${j.name}`))
}) })
}else{ }else{
result.push(`${e.component}:${n.name}`) result.push(`${e.path}:${n.name}`)
} }
} }
}) })
} }
}) })
store.commit('addBtnPerData',{btnPermissions: result}) store.dispatch('auth/addBtnAuth',result)
} }

@ -11,12 +11,12 @@ function createMeta(item){
function createRoute(data){ function createRoute(data){
data.map(e => { data.map(e => {
if(e.select && e.component){ if(e.select && e.path){
let meta = createMeta(e) let meta = createMeta(e)
newRoutes.push({ newRoutes.push({
name: e.component, name: e.path,
path: e.component, path: e.path,
component: () => import(`@/pages/${e.component}.vue`), path: () => import(`@/pages/${e.path}.vue`),
meta meta
}) })
} }
@ -27,8 +27,6 @@ function createRoute(data){
export default function(data,path){ export default function(data,path){
generateBtnPermission(data) generateBtnPermission(data)
createRoute(data) createRoute(data)
let routes = router.options.routes store.dispatch('auth/addRoutes',newRoutes)
routes[1].children = [...routes[1].children,...newRoutes] // router.addRoutes(routes)
store.commit("addRoutesData", { routes })
router.addRoutes(routes)
} }

@ -3,7 +3,7 @@ import router from '@/router';
export default function(){ export default function(){
setTimeout(() => { setTimeout(() => {
let routes = store.state.routes let routes = store.state.auth.routes
routes.forEach(e => { routes.forEach(e => {
if(e.path == '/'){ if(e.path == '/'){
e.component = () => import('@/layouts/home/index.vue') e.component = () => import('@/layouts/home/index.vue')

@ -9,17 +9,19 @@
<div class="form"> <div class="form">
<div class="title"><span>登录</span></div> <div class="title"><span>登录</span></div>
<el-form :model="loginForm" :rules="loginRules" ref="login" label-width="0px"> <el-form :model="loginForm" :rules="loginRules" ref="login" label-width="0px">
<el-form-item prop="username"> <el-form-item prop="account">
<label class="account"></label> <label class="account"></label>
<el-input v-model="loginForm.username" placeholder="请输入账号/手机号" @keyup.enter.native="submitForm()"></el-input> <el-input v-model="loginForm.account" placeholder="请输入账号/手机号" @keyup.enter.native="submitForm"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="password"> <el-form-item prop="password">
<label class="password"></label> <label class="password"></label>
<el-input type="password" placeholder="请输入密码" v-model="loginForm.password" @keyup.enter.native="submitForm()"></el-input> <el-input type="password" placeholder="请输入密码" v-model="loginForm.password" @keyup.enter.native="submitForm"></el-input>
</el-form-item>
<el-form-item prop="code">
<label class="code"></label>
<el-input placeholder="请输入验证码" v-model="loginForm.code" @keyup.enter.native="submitForm"></el-input>
<img @click="getVerImg" :src="verificationIMG" class="ver-img" alt="">
</el-form-item> </el-form-item>
<div class="check">
<el-checkbox v-model="remember">15天免费登录</el-checkbox>
</div>
<el-button class="submit" type="primary" @click="submitForm">登录</el-button> <el-button class="submit" type="primary" @click="submitForm">登录</el-button>
</el-form> </el-form>
</div> </div>
@ -34,18 +36,24 @@ import util from '@/libs/util'
export default { export default {
data: function() { data: function() {
return { return {
verificationIMG: '',
loginForm: { loginForm: {
username: 'admin', account: 'admin',
password: 'admin', password: '111aaa',
random: '',
code: ''
}, },
loginRules: { loginRules: {
username: [{ required: true, message: '请输入用户名', trigger: 'blur' }], account: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
password: [{ required: true, message: '请输入密码', trigger: 'blur' }], password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
code: [{ required: true, message: '请输入验证码', trigger: 'blur' }],
}, },
remember: false
}; };
}, },
components: {vHead}, components: {vHead},
mounted(){
this.getVerImg()
},
methods: { methods: {
...mapActions('user', [ ...mapActions('user', [
'login' 'login'
@ -53,18 +61,23 @@ export default {
submitForm() { submitForm() {
this.$refs.login.validate(valid => { this.$refs.login.validate(valid => {
if (valid) { if (valid) {
let data = { this.login(this.loginForm).then(() => {
username: this.loginForm.username,
password: this.loginForm.password,
remember: this.remember
}
this.login(data).then(() => {
let redirect = this.$route.query.redirect ? decodeURIComponent(this.$route.query.redirect) : '/index' let redirect = this.$route.query.redirect ? decodeURIComponent(this.$route.query.redirect) : '/index'
this.$router.replace(redirect) this.$router.replace(redirect)
}).catch(() => {}) }).catch(res => {
this.getVerImg()
this.loginForm.code = ''
})
} }
}) })
}, },
getVerImg(){
if(!this.loginForm.account){
return this.verificationIMG = ''
}
this.loginForm.random = Math.floor(Math.random()*999999999)
this.verificationIMG = this.api.verification+'?random='+`${this.loginForm.random}`
}
}, },
}; };
</script> </script>
@ -129,7 +142,7 @@ export default {
border-bottom: 1px solid #e4e4e4; border-bottom: 1px solid #e4e4e4;
border-radius: 0 !important; border-radius: 0 !important;
} }
.account,.password{ .account,.password,.code{
z-index: 10; z-index: 10;
position: absolute; position: absolute;
top: 11px; top: 11px;
@ -143,8 +156,15 @@ export default {
height: 24px; height: 24px;
background-image: url(../../../assets/img/password.png); background-image: url(../../../assets/img/password.png);
} }
.check{ .code{
text-align: left; width: 22px;
height: 24px;
background-image: url(../../../assets/img/code.png);
}
.ver-img{
position: absolute;
top: -10px;
right: 0;
} }
/deep/.el-form-item__error{ /deep/.el-form-item__error{
top: 105%; top: 105%;
@ -163,15 +183,6 @@ export default {
border-radius: 8px; border-radius: 8px;
border: 0; border: 0;
} }
.links{
margin: 20px 0 20px;
}
.login-tips{
margin-bottom: 20px;
font-size: 16px;
color: #105CB2;
text-align: center;
}
} }
} }
} }

@ -131,13 +131,13 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex'
import axios from 'axios' import axios from 'axios'
import util from '@/libs/util' import util from '@/libs/util'
export default { export default {
data() { data() {
return { return {
typeId: this.$route.query.typeId, typeId: this.$route.query.typeId,
schoolId: 1001,
typeList: [], typeList: [],
defaultType: '', defaultType: '',
defaultOpenType: [], defaultOpenType: [],
@ -179,6 +179,11 @@ export default {
], ],
} }
}, },
computed: {
...mapState('user', [
'schoolId'
]),
},
mounted() { mounted() {
this.getType() this.getType()
if(this.$route.query.download){ if(this.$route.query.download){
@ -241,10 +246,8 @@ export default {
preview(row){ preview(row){
this.$get(`${this.api.previewData}?tableName=${row.name}&tableId=${row.id}`).then(res => { this.$get(`${this.api.previewData}?tableName=${row.name}&tableId=${row.id}`).then(res => {
this.$post(this.api.saveRecord,{ this.$post(this.api.saveRecord,{
platformUserId: 4,
tableId: row.id, tableId: row.id,
type: 2, type: 2,
schoolId: this.schoolId,
}).then(res => {}).catch(res => {}) }).then(res => {}).catch(res => {})
let comment = res.comment let comment = res.comment
let previewHead = [] let previewHead = []
@ -284,7 +287,7 @@ export default {
this.startTime = '' this.startTime = ''
this.endTime = '' this.endTime = ''
this.frequency = '' this.frequency = ''
this.$router.push('/data') this.$router.push('/data').catch(err => {})
}, },
handleOpen(){ handleOpen(){
@ -295,6 +298,8 @@ export default {
confirmDown(){ confirmDown(){
let fields = this.fields let fields = this.fields
if(!fields.length) return util.warningMsg('请选择字段') if(!fields.length) return util.warningMsg('请选择字段')
if(!this.startTime) return util.warningMsg('请选择开始时间')
if(!this.endTime) return util.warningMsg('请选择结束时间')
if(!this.frequency) return util.warningMsg('请选择数据频率') if(!this.frequency) return util.warningMsg('请选择数据频率')
let invalid = false let invalid = false
if(this.startTime && this.endTime){ if(this.startTime && this.endTime){
@ -327,6 +332,12 @@ export default {
if(invalid) return util.warningMsg('请选择完整区间') if(invalid) return util.warningMsg('请选择完整区间')
this.$get(`${this.api.isDownload}`,{
tableId: this.curRow.id,
schoolId: this.schoolId,
}).then(res => {
if(res.status != 200) return util.warningMsg(res.message)
let newFields = [] let newFields = []
let fieldsList = this.fieldsList let fieldsList = this.fieldsList
fields.map(n => { fields.map(n => {
@ -345,17 +356,16 @@ export default {
if(res.data.type != 'multipart/form-data') return util.warningMsg('数据总数为零!') if(res.data.type != 'multipart/form-data') return util.warningMsg('数据总数为零!')
util.downloadFileDirect(`${this.curRow.showName}.xls`,new Blob([res.data])) util.downloadFileDirect(`${this.curRow.showName}.xls`,new Blob([res.data]))
this.$get(`${this.api.downloadRecord}?platformUserId=4&tableId=${this.curRow.id}&fields=${newFields.join()}&startTime=${startTime}&endTime=${endTime}&frequency=${frequency}`).then(res => {}).catch(res => {}) this.$get(`${this.api.downloadRecord}?tableId=${this.curRow.id}&fields=${newFields.join()}` + (startTime ? `&startTime=${startTime}` : '') + (endTime ? `&endTime=${endTime}` : '') + `&frequency=${frequency}`).then(res => {}).catch(res => {})
this.$post(this.api.saveRecord,{ this.$post(this.api.saveRecord,{
platformUserId: 4,
tableId: this.curRow.id, tableId: this.curRow.id,
type: 1, type: 1,
schoolId: this.schoolId,
}).then(res => {}).catch(res => {}) }).then(res => {}).catch(res => {})
}).catch(res => { }).catch(res => {
msgObj.close() msgObj.close()
}) })
}).catch(res => {})
} }
} }
}; };

@ -42,11 +42,11 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex'
export default { export default {
name: 'index', name: 'index',
data() { data() {
return { return {
schoolId: 1001,
keyword: '', keyword: '',
searchTimer: null, searchTimer: null,
listData:[], listData:[],
@ -56,6 +56,11 @@ export default {
hotData: [] hotData: []
} }
}, },
computed: {
...mapState('user', [
'schoolId'
]),
},
watch: { watch: {
keyword: function(val) { keyword: function(val) {
clearTimeout(this.searchTimer) clearTimeout(this.searchTimer)
@ -147,6 +152,27 @@ export default {
cursor: pointer; cursor: pointer;
} }
} }
.hot{
display: flex;
align-items: center;
width: 930px;
margin: 10px auto 0;
.name{
font-size: 14px;
color: #efefef;
}
.list{
flex: 1;
display: inline-flex;
margin-left: 20px;
li{
margin-right: 50px;
color: #568df2;
font-size: 16px;
cursor: pointer;
}
}
}
&.result{ &.result{
padding: 70px 90px 50px; padding: 70px 90px 50px;
background-color: #fff; background-color: #fff;
@ -160,6 +186,11 @@ export default {
&:-moz-placeholder{color: #999} &:-moz-placeholder{color: #999}
} }
} }
.hot{
.name{
color: #333;
}
}
.tips{ .tips{
margin-bottom: 50px; margin-bottom: 50px;
.result{ .result{
@ -173,26 +204,5 @@ export default {
} }
} }
} }
.hot{
display: flex;
align-items: center;
width: 930px;
margin: 10px auto 0;
.name{
font-size: 14px;
color: #efefef;
}
.list{
flex: 1;
display: inline-flex;
margin-left: 20px;
li{
margin-right: 50px;
color: #568df2;
font-size: 16px;
cursor: pointer;
}
}
}
} }
</style> </style>

@ -10,8 +10,8 @@
</li> </li>
</ul> </ul>
<div> <div>
<el-button type="primary" size="small" round @click="addRole" v-auth="'/system/list:角色权限:新增角色'">新增角色</el-button> <el-button type="primary" size="small" round @click="addRole" v-auth>新增角色</el-button>
<el-button type="primary" size="small" round @click="delAllSelection" v-auth="'/system/list:角色权限:批量删除'">批量删除</el-button> <el-button type="primary" size="small" round @click="delAllSelection" v-auth>批量删除</el-button>
</div> </div>
</div> </div>
@ -28,10 +28,10 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" width="180" align="center"> <el-table-column label="操作" width="180" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="showRole(scope.row)" v-auth="'/system/list:角色权限:查看'">查看</el-button> <el-button type="text" @click="showRole(scope.row)" v-auth>查看</el-button>
<template v-if="scope.row.id != 1"> <template v-if="scope.row.id != 1">
<el-button type="text" @click="editRole(scope.row)" v-auth="'/system/list:角色权限:编辑'">编辑</el-button> <el-button type="text" @click="editRole(scope.row)" v-auth>编辑</el-button>
<el-button type="text" @click="handleDelete(scope.row)" v-auth="'/system/list:角色权限:删除'">删除</el-button> <el-button type="text" @click="handleDelete(scope.row)" v-auth>删除</el-button>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
@ -42,7 +42,7 @@
</div> </div>
<el-dialog :title="isDetail ? '查看角色' : (isAdd ? '新增角色' : '编辑角色')" :visible.sync="roleVisible" width="500px" @close="closeRole" class="dialog" :close-on-click-modal="false"> <el-dialog :title="isDetail ? '查看角色' : (isAdd ? '新增角色' : '编辑角色')" :visible.sync="roleVisible" width="500px" @close="closeRole" class="dialog" :close-on-click-modal="false">
<el-form ref="form" :model="form" label-width="100px" label-suffix="" :disabled="isDetail"> <el-form ref="form" :model="form" label-width="85px" label-suffix="" :disabled="isDetail">
<el-form-item label="角色名称"> <el-form-item label="角色名称">
<el-input v-model="form.roleName " ref="account" placeholder="请输入角色名称"></el-input> <el-input v-model="form.roleName " ref="account" placeholder="请输入角色名称"></el-input>
</el-form-item> </el-form-item>
@ -57,7 +57,7 @@
</el-form> </el-form>
<span slot="footer" class="dialog-footer" v-if="!isDetail"> <span slot="footer" class="dialog-footer" v-if="!isDetail">
<el-button size="small" @click="roleVisible = false"> </el-button> <el-button size="small" @click="roleVisible = false"> </el-button>
<el-button size="small" type="primary" @click="saveData"> </el-button> <el-button size="small" type="primary" @click="confirm"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
@ -192,7 +192,7 @@ export default {
this.getDetail(row) this.getDetail(row)
this.roleVisible = true this.roleVisible = true
}, },
async saveData() { confirm() {
if(!this.form.roleName) return util.warningMsg('请填写角色名称') if(!this.form.roleName) return util.warningMsg('请填写角色名称')
if(!this.form.remark) return util.warningMsg('请填写角色描述') if(!this.form.remark) return util.warningMsg('请填写角色描述')
// if(!this.$refs.per.getCheckedKeys().length) return util.warningMsg('') // if(!this.$refs.per.getCheckedKeys().length) return util.warningMsg('')
@ -212,8 +212,7 @@ export default {
isPort: 2 isPort: 2
} }
this.$post(this.api.doAssign,perData).then(res => { this.$post(this.api.doAssign,perData).then(res => {
// console.log(333) util.successMsg(this.form.id ? '修改成功' : '新增成功')
util.successMsg('新增成功')
this.getData() this.getData()
this.roleVisible = false this.roleVisible = false
}).catch(res => {}) }).catch(res => {})

@ -37,6 +37,7 @@ export default {
name: 'role', name: 'role',
data() { data() {
return { return {
schoolId: 1001,
keyword: '', keyword: '',
searchTimer: null, searchTimer: null,
isDetail: false, isDetail: false,
@ -80,6 +81,12 @@ export default {
this.getData() this.getData()
}, },
download(row){ download(row){
this.$get(`${this.api.isDownload}`,{
tableId: row.id,
schoolId: this.schoolId,
}).then(res => {
if(res.status != 200) return util.warningMsg(res.message)
let msgObj = util.successMsg('数据正在生成中,请稍等片刻,生成后会自动下载,您可以先访问其他页面。',5000) let msgObj = util.successMsg('数据正在生成中,请稍等片刻,生成后会自动下载,您可以先访问其他页面。',5000)
axios.get(`${this.api.downloadData}?tableName=${row.tableNme}&table_id=${row.id}&fields=${row.fields}&startTime=${row.startTime ? row.startTime : ''}&endTime=${row.endTime ? row.endTime : ''}&frequency=${row.frequency ? row.frequency : ''}`,{ axios.get(`${this.api.downloadData}?tableName=${row.tableNme}&table_id=${row.id}&fields=${row.fields}&startTime=${row.startTime ? row.startTime : ''}&endTime=${row.endTime ? row.endTime : ''}&frequency=${row.frequency ? row.frequency : ''}`,{
responseType: 'blob' responseType: 'blob'
@ -104,6 +111,7 @@ export default {
}).catch(res => { }).catch(res => {
msgObj.close() msgObj.close()
}) })
}).catch(res => {})
} }
} }
}; };

@ -5,7 +5,7 @@
<div class="inner"> <div class="inner">
<div class="text-center"> <div class="text-center">
<img :src="avatar" class="avatar" /> <img :src="avatar" class="avatar" />
<el-upload :action="this.api.fileupload" :data="{userId: this.userId}" name="file" :limit="1" :on-success="changeAvatar"> <el-upload :headers="{token}" :action="this.api.uploadUserAvatars" name="file" :limit="1" :on-success="changeAvatar">
<el-button type="text" size="small">上传头像</el-button> <el-button type="text" size="small">上传头像</el-button>
</el-upload> </el-upload>
</div> </div>
@ -27,12 +27,15 @@
</template> </template>
<script> <script>
import Setting from '@/setting'
import { mapState,mapActions } from 'vuex' import { mapState,mapActions } from 'vuex'
import info from './info' import info from './info'
import download from './download' import download from './download'
import util from '@/libs/util'
export default { export default {
data() { data() {
return { return {
token: '',
typeList: [ typeList: [
{ {
index: '1', index: '1',
@ -48,22 +51,20 @@ export default {
components: { info,download }, components: { info,download },
computed: { computed: {
...mapState('user', [ ...mapState('user', [
'userId','avatar','userName' 'avatar'
]), ]),
}, },
mounted() { mounted() {
this.token = util.local.get(Setting.tokenKey)
}, },
methods: { methods: {
// ...mapActions('user', [
'setAvatar'
]),
changeAvatar(res) { changeAvatar(res) {
this.setAvatar(res.data.filesResult.fileUrl) this.setAvatar(res.message)
},
uploadHeadImg: function() {
this.$el.querySelector('.hiddenInput').click();
}, },
handleSelect(key, keyPath){ handleSelect(key, keyPath){
console.log(key, keyPath)
this.active = key this.active = key
}, },
} }

@ -6,13 +6,13 @@
<li> <li>
<label>姓名</label> <label>姓名</label>
<div> <div>
<el-input v-model="personalInformation.userName" clearable></el-input> <el-input v-model="form.userName" clearable></el-input>
</div> </div>
</li> </li>
<li> <li>
<label>性别</label> <label>性别</label>
<div> <div>
<el-select v-model="personalInformation.sex"> <el-select v-model="form.sex">
<el-option v-for="item in sexList" :key="item.value" :label="item.name" :value="item.value"></el-option> <el-option v-for="item in sexList" :key="item.value" :label="item.name" :value="item.value"></el-option>
</el-select> </el-select>
</div> </div>
@ -20,12 +20,7 @@
<li> <li>
<label>出生年月日</label> <label>出生年月日</label>
<div> <div>
<el-date-picker <el-date-picker v-model="form.dateBirth" :clearable="false" type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd"></el-date-picker>
v-model="personalInformation.dateBirth"
:clearable="false"
class="block-right"
type="date">
</el-date-picker>
</div> </div>
</li> </li>
<li> <li>
@ -34,15 +29,15 @@
<div class="child"> <div class="child">
<span>国家</span> <span>国家</span>
<div> <div>
<el-select v-model="personalInformation.countries" placeholder> <el-select v-model="form.countries" placeholder>
<el-option v-for="item in countryList" :key="item.value" :label="item.label" :value="item.value"></el-option> <el-option v-for="item in countryList" :key="item.value" :label="item.label" :value="item.label"></el-option>
</el-select> </el-select>
</div> </div>
</div> </div>
<div class="child"> <div class="child">
<span>省份</span> <span>省份</span>
<div> <div>
<el-select v-model="personalInformation.provinceId" placeholder @change="id => getCity(id,1)"> <el-select v-model="form.provinceId" placeholder @change="id => getCity(id,1)">
<el-option v-for="item in provinceList" :key="item.provinceId" :label="item.provinceName" :value="item.provinceId"></el-option> <el-option v-for="item in provinceList" :key="item.provinceId" :label="item.provinceName" :value="item.provinceId"></el-option>
</el-select> </el-select>
</div> </div>
@ -50,7 +45,7 @@
<div class="child"> <div class="child">
<span>城市</span> <span>城市</span>
<div> <div>
<el-select v-model="personalInformation.cityId" placeholder :disabled="personalInformation.provinceId ? false : true"> <el-select v-model="form.cityId" placeholder :disabled="form.provinceId ? false : true">
<el-option v-for="item in cityList" :key="item.cityId" :label="item.cityName" :value="item.cityId"></el-option> <el-option v-for="item in cityList" :key="item.cityId" :label="item.cityName" :value="item.cityId"></el-option>
</el-select> </el-select>
</div> </div>
@ -60,13 +55,13 @@
<li> <li>
<label>证件</label> <label>证件</label>
<div> <div>
<el-input v-model="personalInformation.idnumber" clearable></el-input> <el-input v-model="form.idNumber" clearable></el-input>
</div> </div>
</li> </li>
<li> <li>
<label>教育程度</label> <label>教育程度</label>
<div> <div>
<el-select v-model="personalInformation.educationDegree" placeholder="请选择教育程度"> <el-select v-model="form.educationDegree" placeholder="请选择教育程度">
<el-option v-for="(item,index) in educationDegreeList" :key="index" :label="item.name" :value="item.value"></el-option> <el-option v-for="(item,index) in educationDegreeList" :key="index" :label="item.name" :value="item.value"></el-option>
</el-select> </el-select>
</div> </div>
@ -84,32 +79,36 @@
<div class="archives" v-for="(archive,index) in archivesList" :key="index" v-show="index == 0 || showArch"> <div class="archives" v-for="(archive,index) in archivesList" :key="index" v-show="index == 0 || showArch">
<ul class="list"> <ul class="list">
<li> <li>
<label>职业</label> <!-- <label>专业</label> -->
<div class="mul">
<div class="child">
<span>职业</span>
<div> <div>
<el-select v-model="archive.personalCareerId" placeholder="选择职业"> <el-select v-model="archive.personalCareerId" placeholder="选择职业">
<el-option v-for="item in occupationList" :key="item.value" :label="item.label" :value="item.value"></el-option> <el-option v-for="item in occupationList" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select> </el-select>
</div> </div>
</li> </div>
<li> <div class="child">
<label>国家</label> <span>国家</span>
<div> <div>
<el-select v-model="personalInformation.countries" placeholder> <el-select v-model="form.countries" placeholder>
<el-option v-for="item in countryList" :key="item.value" :label="item.label" :value="item.value" ></el-option> <el-option v-for="item in countryList" :key="item.value" :label="item.label" :value="item.label" ></el-option>
</el-select> </el-select>
</div> </div>
</li> </div>
<li> <div class="child">
<label>学校名称</label> <span>学校名称</span>
<div> <div>
<el-select v-model="archive.schoolId" filterable placeholder="选择学校" @change="id => getSchoolName(id,index)"> <el-select v-model="archive.schoolId" filterable placeholder="选择学校" @change="id => getSchoolName(id,index)">
<el-option v-for="item in schoolList" :key="item.value" :label="item.schoolName" :value="item.schoolId"></el-option> <el-option v-for="item in schoolList" :key="item.value" :label="item.schoolName" :value="item.schoolId"></el-option>
</el-select> </el-select>
</div> </div>
</div>
</div>
</li> </li>
<li> <li>
<label>专业</label>
<div class="mul"> <div class="mul">
<div class="child"> <div class="child">
<span>专业学科</span> <span>专业学科</span>
@ -148,20 +147,20 @@
<li> <li>
<label>用户账号</label> <label>用户账号</label>
<div> <div>
<el-input v-model="personalInformation.account" clearable></el-input> <el-input v-model="form.account" clearable></el-input>
</div> </div>
</li> </li>
<li> <li>
<label>手机号</label> <label>手机号</label>
<div> <div>
<span class="val" v-if="personalInformation.phone">{{personalInformation.phone}}</span> <span class="val" v-if="form.phone">{{form.phone}}</span>
<el-button size="small" @click="bindPhone">更换</el-button> <el-button size="small" @click="bindPhone">更换</el-button>
</div> </div>
</li> </li>
<li> <li>
<label>邮箱</label> <label>邮箱</label>
<div> <div>
<span class="val" v-if="personalInformation.email">{{personalInformation.email}}</span> <span class="val" v-if="form.email">{{form.email}}</span>
<el-button size="small" @click="bindEmail">更换</el-button> <el-button size="small" @click="bindEmail">更换</el-button>
</div> </div>
</li> </li>
@ -177,7 +176,7 @@
</div> </div>
</div> </div>
<el-dialog :title="personalInformation.email ? '更换邮箱' : '绑定邮箱'" :visible.sync="emailVisible" :close-on-click-modal="false" @close="closeEmail" width="30%"> <el-dialog :title="form.email ? '更换邮箱' : '绑定邮箱'" :visible.sync="emailVisible" :close-on-click-modal="false" @close="closeEmail" width="30%">
<el-form ref="form" :model="form" label-width="60px"> <el-form ref="form" :model="form" label-width="60px">
<el-form-item label="邮箱"> <el-form-item label="邮箱">
<el-input placeholder="请输入邮箱" v-model="email"></el-input> <el-input placeholder="请输入邮箱" v-model="email"></el-input>
@ -190,12 +189,12 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="emailVisible = false"> </el-button> <el-button size="small" @click="emailVisible = false"> </el-button>
<el-button type="primary" @click="emailSubmit"> </el-button> <el-button size="small" type="primary" @click="emailSubmit"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog :title="personalInformation.phone ? '更换手机号' : '绑定手机号'" :visible.sync="phoneVisible" :close-on-click-modal="false" @close="closePhone" width="30%"> <el-dialog :title="form.phone ? '更换手机号' : '绑定手机号'" :visible.sync="phoneVisible" :close-on-click-modal="false" @close="closePhone" width="30%">
<el-form ref="form" :model="form" label-width="60px"> <el-form ref="form" :model="form" label-width="60px">
<el-form-item label="手机号"> <el-form-item label="手机号">
<el-input placeholder="请输入手机号" v-model="phone" maxlength="11"></el-input> <el-input placeholder="请输入手机号" v-model="phone" maxlength="11"></el-input>
@ -208,8 +207,8 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="phoneVisible = false"> </el-button> <el-button size="small" @click="phoneVisible = false"> </el-button>
<el-button type="primary" @click="phoneSubmit"> </el-button> <el-button size="small" type="primary" @click="phoneSubmit"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -226,8 +225,8 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="passwordVisible = false"> </el-button> <el-button size="small" @click="passwordVisible = false"> </el-button>
<el-button type="primary" @click="editPassword"> </el-button> <el-button size="small" type="primary" @click="editPassword"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
@ -239,7 +238,7 @@ import util from '@/libs/util'
export default { export default {
data() { data() {
return { return {
personalInformation: { form: {
name:'', name:'',
workNumber:'', workNumber:'',
password:"", password:"",
@ -249,6 +248,10 @@ export default {
cityName:'', cityName:'',
schoolName:'', schoolName:'',
professionalName:'', professionalName:'',
experimentName:'',
sex: 1,
dateBirth: '',
educationDegree: ''
}, },
emailVisible: false, emailVisible: false,
passwordVisible: false, passwordVisible: false,
@ -274,7 +277,13 @@ export default {
label: '中国' label: '中国'
} }
], ],
form: {}, occupationList: [{
value: 1,
label: '学生'
},{
value: 2,
label: '老师'
}],
provinceList:[], provinceList:[],
cityList: [], cityList: [],
educationDegreeList: [ educationDegreeList: [
@ -299,23 +308,24 @@ export default {
value: 5 value: 5
} }
], ],
subjectList: [], //
ProfessionalClassList: [], //
ProfessionalList: [], //
schoolList: [], schoolList: [],
curPassword: '', curPassword: '',
accountRepeat: false, accountRepeat: false,
archivesList: [], archivesList: [],
archivesForm: { archivesForm: {
// personalCareerId: '',
personalCareerId: '', // schoolId: '',
schoolId: '', // schoolName: '',
schoolName: '', // professionalClassId: '',
professionalClassId: '', // professionalClassName: '',
professionalClassName: '', // disciplineId: '',
disciplineId: '', // disciplineName: '',
disciplineName: '', // professionalId: '',
professionalId: '', // professionalName: '',
professionalName: '', //
userId: this.userId
}, },
email: '', email: '',
emailBtnText: '发送验证码', emailBtnText: '发送验证码',
@ -329,15 +339,11 @@ export default {
phoneTimer: null phoneTimer: null
}; };
}, },
computed: {
...mapState('user', [
'userId','avatar','userName'
]),
},
mounted() { mounted() {
this.getdata(); this.getdata();
this.getProvince() this.getProvince()
this.getSchoolData() this.getSchoolData()
this.getSubject()
}, },
methods: { methods: {
...mapActions('user', [ ...mapActions('user', [
@ -348,29 +354,28 @@ export default {
}, },
getProvince(){ getProvince(){
this.$get(this.api.queryProvince).then(res => { this.$get(this.api.queryProvince).then(res => {
this.provinceList = res.data.list this.provinceList = res.list
}).catch(res => {}) }).catch(res => {})
}, },
//
getCity(id,type){ getCity(id,type){
this.personalInformation.cityId = 1 this.form.cityId = 1
this.getCityData() this.getCityData()
}, },
getCityData(index){ getCityData(index){
let provinceId = this.personalInformation.provinceId let provinceId = this.form.provinceId
this.$get(this.api.queryCity,{provinceId}).then(res => { this.$get(this.api.queryCity,{provinceId}).then(res => {
this.cityList = res.data.list this.cityList = res.list
}).catch(res => {}) }).catch(res => {})
}, },
// getCityName(id,index){
this.archivesList[index].cityName = this.archivesList[index].cityList[id-1].cityName
},
getSchoolName(id,index){
this.archivesList[index].schoolName = this.schoolList[id-1].schoolName
},
getSchoolData(){ getSchoolData(){
let data = { this.$get(this.api.querySchool,{schoolName: '',provinceId: this.provinceId,cityId: this.cityId}).then(res => {
searchContent: '', this.schoolList = res.list
provinceId: '',
cityId: ''
}
this.$get(`${this.api.queryClient}/1/1000`,data).then(res => {
this.schoolList = res.data.list
}).catch(res => {}) }).catch(res => {})
}, },
accountChange(){ accountChange(){
@ -384,50 +389,93 @@ export default {
}).catch(res => {}) }).catch(res => {})
}, },
getdata() { getdata() {
this.$get(`${this.api.userInfo}/${this.userId}`) this.$get(this.api.userInfo).then(res => {
.then(res => { let userInfo = res.userInfo
this.personalInformation = res.data.userInfo this.form = Object.assign(userInfo,res.userAccount)
this.personalInformation.countries = '中国' this.originAccount = this.form.account
this.curPassword = this.personalInformation.password this.archivesList = res.personalFiles
this.$nextTick(() => { this.$nextTick(() => {
if(this.personalInformation.provinceId){ if(this.form.provinceId){
this.getCityData(1) this.getCityData(1)
} }
if(this.archivesList.length != 0){
this.archivesList.forEach((e,k) =>{
this.$set(e, 'subjectList', this.subjectList)
this.$set(e, 'disciplineId', e.disciplineId ? e.disciplineId : '')
this.$set(e, 'disciplineName', e.disciplineName ? e.disciplineName : '')
this.$set(e, 'professionalClassId', e.professionalClassId ? e.professionalClassId : '')
this.$set(e, 'professionalClassName', e.professionalClassName ? e.professionalClassName : '')
this.$set(e, 'professionalId', e.professionalId ? e.professionalId : '')
this.$set(e, 'professionalName', e.professionalName ? e.professionalName : '')
this.$set(e, 'schoolId', e.schoolId ? e.schoolId : '')
this.$set(e, 'schoolName', e.schoolName ? e.schoolName : '')
if(e.disciplineId){
this.$post(this.api.queryCourseProfessionalClass,[e.disciplineId]).then(res => {
this.$set(e, 'ProfessionalClassList', res.result)
}).catch(res => {})
}else{
this.$set(e, 'ProfessionalClassList', [])
}
if(e.professionalClassId){
this.$get(this.api.queryCourseProfessional,{ professionalClassId: e.professionalClassId }).then(res => {
this.$set(e, 'ProfessionalList', res.result)
}).catch(res => {})
}else{
this.$set(e, 'ProfessionalList', [])
}
}) })
}else{
this.concatArch()
}
}) })
.catch(err => { }).catch(err => {})
console.log(err)
});
}, },
save() { save() {
if(this.personalInformation.idnumber && !/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)/.test(this.personalInformation.idnumber)) return util.warningMsg('请输入正确的证件号码') if(this.form.idNumber && !/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)/.test(this.form.idNumber)) return util.warningMsg('请输入正确的证件号码')
if(this.accountRepeat) return util.warningMsg('该账号已存在') if(this.accountRepeat) return util.warningMsg('该账号已存在')
if(this.personalInformation.phone && !/^1[3456789]\d{9}$/.test(this.personalInformation.phone)) return util.warningMsg('请输入正确的手机号') let form = this.form
if(this.personalInformation.email && !/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.personalInformation.email)) return util.warningMsg('请输入正确的邮箱') let hrPersonalFileEntities = []
let personalInformation = this.personalInformation let archivesList = this.archivesList
let userInfoEntity = { archivesList.map(n => {
idnumber: personalInformation.idnumber, n.personalCareerId && hrPersonalFileEntities.push({
account: personalInformation.account, disciplineId: n.disciplineId,
cityId: personalInformation.cityId, disciplineName: n.disciplineName,
countries: personalInformation.countries, personalCareerId: n.personalCareerId,
dateBirth: personalInformation.dateBirth, personalFileId: n.personalFileId,
educationDegree: personalInformation.educationDegree, professionalClassId: n.professionalClassId,
email: personalInformation.email, professionalClassName: n.professionalClassName,
phone: personalInformation.phone, professionalId: n.professionalId,
provinceId: personalInformation.provinceId, professionalName: n.professionalName,
clientId: personalInformation.clientId, schoolId: n.schoolId,
clientName: personalInformation.clientName, schoolName: n.schoolName,
sex: personalInformation.sex, userId: form.userId,
userId: personalInformation.userId, })
userName: personalInformation.userName, })
}
let data = { let data = {
userInfoEntity, hrUserAccount: {
personalFileEntities: this.archivesList account: form.account,
userId: form.userId,
workNumber: form.workNumber,
},
hrUserInfo: {
cityId: form.cityId,
countries: form.countries,
dateBirth: form.dateBirth,
educationDegree: form.educationDegree,
idNumber: form.idNumber,
provinceId: form.provinceId,
schoolId: form.schoolId,
sex: form.sex,
userId: form.userId,
userName: form.userName,
},
hrPersonalFileEntities
} }
this.$post(this.api.updateUser,data).then(res => { this.$post(this.api.updateUser,data).then(res => {
if(res.success){ if(res.status == 200){
this.setUserName(personalInformation.userName) this.setUserName(form.userName)
util.successMsg('提交成功') util.successMsg('提交成功')
this.$router.back() this.$router.back()
}else{ }else{
@ -436,70 +484,61 @@ export default {
}).catch(res => {}) }).catch(res => {})
}, },
concatArch(isLoadData) { concatArch() {
this.archivesList = this.archivesList.concat({ this.archivesList = this.archivesList.concat({
isNew: true, countries: '中国',
personalCareerId: '', // personalCareerId: '',
schoolId: '', // schoolId: '',
schoolName: '', // schoolName: '',
subjectList: this.subjectList, // subjectList: this.subjectList,
disciplineId: '', // disciplineId: '',
disciplineName: '', // disciplineName: '',
ProfessionalClassList: [], // ProfessionalClassList: [],
professionalClassId: '', // professionalClassId: '',
professionalClassName: '', // professionalClassName: '',
ProfessionalList: [], // ProfessionalList: [],
professionalId: '', // professionalId: '',
professionalName: '', // professionalName: '',
userId: this.userId,
personalFileId: '' personalFileId: ''
}) })
if(!isLoadData){
this.$nextTick(() => {
document.body.scrollTop = document.querySelector('.content-box').scrollHeight
document.documentElement.scrollTop = document.querySelector('.content-box').scrollHeight
})
}
}, },
addArch() { addArch() {
// let isEmpty = false let isEmpty = false
// this.archivesList.forEach((n,k) => { this.archivesList.forEach((n,k) => {
// if(!n.personalCareerId) isEmpty = true if(!n.personalCareerId) isEmpty = true
// }) })
// if(isEmpty) return this.$message.warning('') if(isEmpty) return util.warningMsg('请选择职业')
this.showArch = true this.showArch = true
this.concatArch() this.concatArch()
}, },
bindEmail() { bindEmail() {
this.email = this.personalInformation.email this.email = this.form.email
this.emailVisible = true this.emailVisible = true
}, },
bindPhone() { bindPhone() {
this.phone = this.personalInformation.phone this.phone = this.form.phone
this.phoneVisible = true this.phoneVisible = true
}, },
bindPassword() { bindPassword() {
this.passwordVisible = true this.passwordVisible = true
}, },
editPassword() { editPassword() {
if(!this.passwordForm.password) return this.$message.warning('请输入原密码') if(!this.passwordForm.password) return util.warningMsg('请输入原密码')
if(!this.passwordForm.newPassword) return this.$message.warning('请输入新密码') if(!this.passwordForm.newPassword) return util.warningMsg('请输入新密码')
if(!this.passwordForm.reNewPassword) return this.$message.warning('请确认新密码') if(!this.passwordForm.reNewPassword) return util.warningMsg('请确认新密码')
if(this.passwordForm.newPassword.length < 6 || this.passwordForm.reNewPassword.length < 6) return this.$message.warning('请输入6位数以上的密码') if(this.passwordForm.newPassword.length < 6 || this.passwordForm.reNewPassword.length < 6) return util.warningMsg('请输入6位数以上的密码')
if(this.passwordForm.newPassword !== this.passwordForm.reNewPassword) return this.$message.warning('输入的新密码不一致,请重新确认') if(this.passwordForm.newPassword !== this.passwordForm.reNewPassword) return util.warningMsg('输入的新密码不一致,请重新确认')
if(this.passwordForm.password === this.passwordForm.newPassword) return this.$message.warning('原密码跟新密码不能一致') if(this.passwordForm.password === this.passwordForm.newPassword) return util.warningMsg('原密码跟新密码不能一致')
let data = this.passwordForm let data = this.passwordForm
data.userid = this.userId data.accountId = this.form.id
this.$post(this.api.examinePassword,data) this.$post(this.api.examinePassword,data)
.then(res => { .then(res => {
if(res.errmessage == 'success'){ if(res.status == 200){
this.$message.success('更换成功') util.successMsg('更换成功')
this.passwordVisible = false this.passwordVisible = false
} }
}).catch(err => { }).catch(err => {})
console.log(err)
})
}, },
closePassword() { closePassword() {
this.passwordForm = { this.passwordForm = {
@ -515,6 +554,136 @@ export default {
document.documentElement.scrollTop = document.querySelector('.content-box').scrollHeight document.documentElement.scrollTop = document.querySelector('.content-box').scrollHeight
}) })
}, },
//
getSubject(){
this.$post(this.api.queryCourseDiscipline).then(res => {
this.subjectList = res.result
}).catch(res => {})
},
//
clearClass(){
this.archivesForm.professionalClassId = '',
this.archivesForm.professionalId = ''
},
//
getProfessionalClass(val){
this.clearClass()
if(val){
let obj = {}
obj = this.subjectList.find((item)=>{
return item.disciplineId === val
});
this.archivesForm.disciplineName = obj.disciplineName
this.getProfessionalClassData(val)
}
},
clearItemClass(index){
this.archivesList[index].professionalClassId = ''
this.archivesList[index].professionalClassName = ''
this.archivesList[index].professionalId = ''
this.archivesList[index].professionalName = ''
// this.archivesList.map(e =>{
// if(e.disciplineId == item){
// e.professionalClassId = '',
// e.professionalClassName = '',
// e.professionalId = '',
// e.professionalName = ''
// }
// })
},
getItemProfessionalClass(item,index){
this.clearItemClass(index)
if(item){
let obj = {}
obj = this.subjectList.find(r =>{
return r.disciplineId === item
});
this.$post(this.api.queryCourseProfessionalClass,[item]).then(res => {
this.archivesList.map(e =>{
if(e.disciplineId == item){
e.ProfessionalClassList = res.result
e.disciplineName = obj.disciplineName
}
})
}).catch(res => {})
}
},
getProfessionalClassData(value){
this.$post(this.api.queryCourseProfessionalClass,[value]).then(res => {
this.ProfessionalClassList = res.result
}).catch(res => {})
},
//
clearProfess(){
this.archivesForm.professionalId = ''
},
//
getProfessional(val){
this.clearProfess()
if(val){
let obj = {}
obj = this.ProfessionalClassList.find((item)=>{
return item.professionalClassId === val
})
this.archivesForm.professionalClassName = obj.professionalClassName
this.getProfessionalData(val)
}
},
clearItemProfess(index){
this.archivesList[index].professionalId = ''
this.archivesList[index].professionalName = ''
// this.archivesList.map(e =>{
// if(e.professionalClassId == item){
// e.professionalId = '',
// e.professionalName = ''
// }
// })
},
getItemProfessional(item,index){
this.clearItemProfess(index)
if(item){
this.$get(this.api.queryCourseProfessional,{ professionalClassId: item }).then(res => {
this.archivesList.map(e =>{
if(e.professionalClassId == item){
let obj = {}
obj = e.ProfessionalClassList.find(r =>{
return r.professionalClassId === item
})
e.ProfessionalList = res.result
e.professionalClassName = obj.professionalClassName
}
})
}).catch(res => {})
}
},
getProfessionalData(value){
this.$get(this.api.queryCourseProfessional,{professionalClassId: value}).then(res => {
this.ProfessionalList = res.result
}).catch(res => {})
},
//
getStuGrade(val){
if(val){
let obj = {}
obj = this.ProfessionalList.find(r =>{
return r.professionalId === val;
})
this.archivesForm.professionalName = obj.professionalName
}
},
getItemStuGrade(item){
if(item){
this.archivesList.map(e =>{
if(e.professionalId == item){
let obj = {}
obj = e.ProfessionalList.find(r =>{
return r.professionalId === item;
})
e.professionalName = obj.professionalName
}
})
}
},
emailCountdown(){ emailCountdown(){
let count = 60 let count = 60
if(!this.emailTimer){ if(!this.emailTimer){
@ -557,32 +726,36 @@ export default {
} }
}, },
sendEmailCode(){ sendEmailCode(){
if(!this.email) return this.$message.warning('请输入邮箱') if(!this.email) return util.warningMsg('请输入邮箱')
if(!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.email)) return this.$message.warning('请输入正确的邮箱') if(!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.email)) return util.warningMsg('请输入正确的邮箱')
let data = { let data = {
userId: this.userId, userId: this.form.userId,
email: this.email, email: this.email,
types: 1 types: 1
} }
this.$post(this.api.findPasswordByEmail,data).then(res => { this.$post(this.api.sendPhoneOrEmailCode,data).then(res => {
if(res.message.opener){
this.emailCountdown() this.emailCountdown()
this.emailOpener = res.data this.emailOpener = res.message.opener
}else{
util.errorMsg(res.message)
}
}).catch(res => {}) }).catch(res => {})
}, },
emailSubmit(){ emailSubmit(){
if(!this.email) return this.$message.warning('请输入邮箱') if(!this.email) return util.warningMsg('请输入邮箱')
if(!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.email)) return this.$message.warning('请输入正确的邮箱') if(!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.email)) return util.warningMsg('请输入正确的邮箱')
if(!this.emailCode) return this.$message.warning('请输入验证码') if(!this.emailCode) return util.warningMsg('请输入验证码')
let data = { let data = {
userId: this.userId, userId: this.form.userId,
email: this.email, email: this.email,
types: 1, types: 1,
code: this.emailCode, code: this.emailCode,
opener: this.emailOpener opener: this.emailOpener
} }
this.$put(this.api.bingEmail,data).then(res => { this.$post(this.api.bindPhoneOrEmail,data).then(res => {
this.$message.success('绑定成功') util.successMsg('绑定成功')
this.personalInformation.email = this.email this.form.email = this.email
this.emailVisible = false this.emailVisible = false
}).catch(res => {}) }).catch(res => {})
}, },
@ -592,32 +765,37 @@ export default {
} }
}, },
sendPhoneCode(){ sendPhoneCode(){
if(!this.phone) return this.$message.warning('请输入手机号') if(!this.phone) return util.warningMsg('请输入手机号')
if(!/^1[3456789]\d{9}$/.test(this.phone)) return this.$message.warning('请输入正确的手机号') if(!/^1[3456789]\d{9}$/.test(this.phone)) return util.warningMsg('请输入正确的手机号')
let data = { let data = {
userId: this.userId, userId: this.form.userId,
phone: this.phone, phone: this.phone,
types: 2 types: 2
} }
this.$post(this.api.sendPhoneCode,data).then(res => { this.$post(this.api.sendPhoneOrEmailCode,data).then(res => {
if(res.message.opener){
this.phoneCountdown() this.phoneCountdown()
this.phoneOpener = res.data this.phoneOpener = res.message.opener
}else{
util.errorMsg(res.message)
}
}).catch(res => {}) }).catch(res => {})
}, },
phoneSubmit(){ phoneSubmit(){
if(!this.phone) return this.$message.warning('请输入手机号') if(!this.phone) return util.warningMsg('请输入手机号')
if(!/^1[3456789]\d{9}$/.test(this.phone)) return this.$message.warning('请输入正确的手机号') if(!/^1[3456789]\d{9}$/.test(this.phone)) return util.warningMsg('请输入正确的手机号')
if(!this.phoneCode) return this.$message.warning('请输入验证码') if(!this.phoneCode) return util.warningMsg('请输入验证码')
let data = { let data = {
userId: this.userId, userId: this.form.userId,
phone: this.phone, phone: this.phone,
types: 2, types: 2,
code: this.phoneCode, code: this.phoneCode,
opener: this.phoneOpener opener: this.phoneOpener
} }
this.$put(this.api.findPasswordByPhone,data).then(res => { this.$post(this.api.bindPhoneOrEmail,data).then(res => {
this.$message.success('绑定成功') util.successMsg('绑定成功')
this.personalInformation.phone = this.phone this.form.phone = this.phone
this.phoneVisible = false this.phoneVisible = false
}).catch(res => {}) }).catch(res => {})
}, },

@ -7,7 +7,7 @@
<div class="date"> <div class="date">
<span class="name">使用期限</span> <span class="name">使用期限</span>
<div class="val"> <div class="val">
{{item.startTime}}<br><br>{{item.endTime}} {{item.endTime}}
</div> </div>
</div> </div>
<p class="surplus" v-if="item.deadline"><span class="name">剩余期限</span><span class="num">{{item.deadline}}</span> </p> <p class="surplus" v-if="item.deadline"><span class="name">剩余期限</span><span class="num">{{item.deadline}}</span> </p>
@ -63,7 +63,7 @@
<h6 class="title">按数据库统计使用概况</h6> <h6 class="title">按数据库统计使用概况</h6>
<div> <div>
<el-button type="primary" size="small" v-auth="'/system/list:员工管理:批量导入'" @click="exportDatabase">导出数据</el-button> <el-button type="primary" size="small" @click="exportDatabase" v-auth="'/stat/list:数据库统计导出'">导出数据</el-button>
</div> </div>
</div> </div>
@ -84,7 +84,7 @@
<div class="flex j-between"> <div class="flex j-between">
<h6 class="title">按月份统计数据库使用概况</h6> <h6 class="title">按月份统计数据库使用概况</h6>
<div> <div>
<el-button type="primary" size="small" v-auth="'/system/list:员工管理:批量导入'" @click="exportDatabaseByMonth">导出数据</el-button> <el-button type="primary" size="small" @click="exportDatabaseByMonth" v-auth="'/stat/list:月份统计导出'">导出数据</el-button>
</div> </div>
</div> </div>
@ -111,12 +111,12 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex'
import axios from 'axios' import axios from 'axios'
import util from '@/libs/util' import util from '@/libs/util'
export default { export default {
data() { data() {
return { return {
schoolId: 1001,
schoolName: '', schoolName: '',
productList: [], productList: [],
userCount: '', userCount: '',
@ -151,6 +151,11 @@ export default {
active: false active: false
} }
}, },
computed: {
...mapState('user', [
'schoolId'
]),
},
watch: { watch: {
keyword: function(val) { keyword: function(val) {
clearTimeout(this.searchTimer) clearTimeout(this.searchTimer)
@ -174,8 +179,8 @@ export default {
}, },
methods: { methods: {
getData(){ getData(){
this.$get(`${this.api.getProductInfoBySchoolId}?schoolId=31`).then(res => { this.$get(`${this.api.getProductInfoBySchoolId}?schoolId=${this.schoolId}`).then(res => {
let list = res.list let list = res.message
list.map(n => { list.map(n => {
n.startTime = util.formatDate('yyyy-MM-dd',new Date(n.startTime)) n.startTime = util.formatDate('yyyy-MM-dd',new Date(n.startTime))
n.endTime = util.formatDate('yyyy-MM-dd',new Date(n.endTime)) n.endTime = util.formatDate('yyyy-MM-dd',new Date(n.endTime))
@ -299,19 +304,21 @@ export default {
.left{ .left{
margin-right: 20px; margin-right: 20px;
.school{ .school{
width: 200px;
margin-bottom: 15px; margin-bottom: 15px;
font-size: 20px; font-size: 20px;
color: #568DF2; color: #568DF2;
text-align: center; text-align: center;
} }
.product{ .product{
width: 200px;
padding: 15px; padding: 15px;
margin-bottom: 15px; margin-bottom: 15px;
background-color: #fff; background-color: #fff;
border-radius: 8px; border-radius: 8px;
.product-name{ .product-name{
margin-bottom: 15px;
font-size: 16px; font-size: 16px;
font-weight: bold;
color: #568DF2; color: #568DF2;
} }
.date{ .date{
@ -319,13 +326,13 @@ export default {
align-items: center; align-items: center;
.val{ .val{
text-align: center; text-align: center;
line-height: 1.8; line-height: 1;
font-size: 15px; font-size: 15px;
color: $main-color; color: $main-color;
} }
} }
.surplus{ .surplus{
margin-top: 15px; margin-top: 10px;
.num{ .num{
font-size: 24px; font-size: 24px;
color: $main-color; color: $main-color;

@ -33,9 +33,9 @@
</li> </li>
</ul> </ul>
<div> <div>
<el-button type="primary" size="small" round @click="addTeacher" v-auth="'/system/list:员工管理:新增员工'">新增员工</el-button> <el-button type="primary" size="small" round @click="addTeacher" v-auth="'/user/list:新增用户'">新增账号</el-button>
<el-button type="primary" size="small" round @click="batchImport" v-auth="'/system/list:员工管理:批量导入'">批量导入</el-button> <el-button type="primary" size="small" round @click="batchImport" v-auth>批量导入</el-button>
<el-button type="primary" size="small" round @click="delAllSelection" v-auth="'/system/list:员工管理:批量删除'">批量删除</el-button> <el-button type="primary" size="small" round @click="delAllSelection" v-auth>批量删除</el-button>
</div> </div>
</div> </div>
@ -48,12 +48,12 @@
<el-table-column prop="workNumber" label="工号/学号" align="center"></el-table-column> <el-table-column prop="workNumber" label="工号/学号" align="center"></el-table-column>
<el-table-column label="权限状态" align="center"> <el-table-column label="权限状态" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.disableAccount ? '禁用' : '启用'}} {{scope.row.isEnable ? '启用' : '禁用'}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="账号角色" align="center"> <el-table-column label="账号角色" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{roleList.find(n => n.id == scope.row.roleId) ? roleList.find(n => n.id == scope.row.roleId).roleName : ''}} {{scope.row.roleId == '0' ? '用户' : (roleList.find(n => n.id == scope.row.roleId) ? roleList.find(n => n.id == scope.row.roleId).roleName : '')}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="loginNumber" label="登录次数" align="center"> <el-table-column prop="loginNumber" label="登录次数" align="center">
@ -64,11 +64,11 @@
<el-table-column prop="lastLoginTime" label="上次登录时间" width="160" align="center"></el-table-column> <el-table-column prop="lastLoginTime" label="上次登录时间" width="160" align="center"></el-table-column>
<el-table-column label="操作" align="center" width="260"> <el-table-column label="操作" align="center" width="260">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="show(scope.row)" v-auth="'/system/list:员工管理:查看'">查看</el-button> <el-button type="text" @click="show(scope.row)" v-auth>查看</el-button>
<el-button type="text" @click="edit(scope.row)" v-auth="'/system/list:员工管理:编辑'">编辑</el-button> <el-button type="text" @click="edit(scope.row)" v-auth>编辑</el-button>
<el-button type="text" @click="resetPassword(scope.row)" v-auth="'/system/list:员工管理:重置密码'">重置密码</el-button> <el-button type="text" @click="resetPassword(scope.row)" v-auth>重置密码</el-button>
<el-button type="text" @click="handleDelete(scope.row)" v-auth="'/system/list:员工管理:删除'">删除</el-button> <el-button type="text" @click="handleDelete(scope.row)" v-auth>删除</el-button>
<el-switch v-model="scope.row.disableAccount" :active-value="0" :inactive-value="1" style="margin: 0 10px 0 5px" :active-text="scope.row.disableAccount ? '关' : '开'" @change="switchOff($event,scope.row,scope.$index)"></el-switch> <el-switch v-model="scope.row.isEnable" :active-value="1" :inactive-value="0" style="margin: 0 10px 0 5px" :active-text="scope.row.isEnable ? '开' : '关'" @change="switchOff($event,scope.row,scope.$index)" v-auth="'/user/list:禁用'"></el-switch>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -76,8 +76,8 @@
<el-pagination background layout="total,prev, pager, next" :current-page="page" @current-change="handleCurrentChange" :total="total"></el-pagination> <el-pagination background layout="total,prev, pager, next" :current-page="page" @current-change="handleCurrentChange" :total="total"></el-pagination>
</div> </div>
<el-dialog :title="isDetail ? '查看员工' : (form.userId ? '编辑员工' : '新增员工')" :visible.sync="userVisible" width="500px" @close="closeUser" class="dialog" :close-on-click-modal="false"> <el-dialog :title="isDetail ? '查看账号' : (form.userId ? '编辑账号' : '新增账号')" :visible.sync="userVisible" width="500px" @close="closeUser" class="dialog" :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="110px" label-suffix="" :disabled="isDetail"> <el-form ref="form" :model="form" :rules="rules" label-width="105px" label-suffix="" :disabled="isDetail">
<el-form-item prop="account" label="账号"> <el-form-item prop="account" label="账号">
<el-input v-model="form.account" ref="account" placeholder="请输入职工账号" @change="accountChange"></el-input> <el-input v-model="form.account" ref="account" placeholder="请输入职工账号" @change="accountChange"></el-input>
</el-form-item> </el-form-item>
@ -85,9 +85,10 @@
<el-input v-model="form.userName" placeholder="请输入员工姓名"></el-input> <el-input v-model="form.userName" placeholder="请输入员工姓名"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="roleId" label="账号角色"> <el-form-item prop="roleId" label="账号角色">
<el-select v-model="form.roleId" placeholder="请选择账号角色"> <el-radio v-model="defaultUser" label="user" disabled>用户</el-radio>
<el-option v-for="(item,index) in roleList" :key="index" :label="item.roleName" :value="item.id"></el-option> <el-radio-group v-model="form.roleId">
</el-select> <el-radio v-for="(item,index) in roleList" :key="index" :label="item.id">{{item.roleName}}</el-radio>
</el-radio-group>
</el-form-item> </el-form-item>
<el-form-item prop="uniqueIdentification" label="唯一标识"> <el-form-item prop="uniqueIdentification" label="唯一标识">
<el-input disabled v-model="form.uniqueIdentification" placeholder="唯一标识"></el-input> <el-input disabled v-model="form.uniqueIdentification" placeholder="唯一标识"></el-input>
@ -111,7 +112,7 @@
<el-dialog title="批量导入" :visible.sync="importVisible" width="400px" @close="closeImport" :close-on-click-modal="false"> <el-dialog title="批量导入" :visible.sync="importVisible" width="400px" @close="closeImport" :close-on-click-modal="false">
<div class="upload-wrap" :class="{lg: uploadFaild}"> <div class="upload-wrap" :class="{lg: uploadFaild}">
<el-button class="download" size="small" @click="downLoad"><img src="../../../assets/img/download.png" alt=""> 模板下载</el-button> <el-button class="download" size="small" @click="downLoad"><img src="../../../assets/img/download.png" alt=""> 模板下载</el-button>
<el-upload ref="import" accept=".xls,.xlsx" :on-remove="handleRemove" :on-error="uploadError" :on-success="uploadSuccess" :before-remove="beforeRemove" :limit="1" :on-exceed="handleExceed" :action="this.api.uploadFile" :file-list="uploadList" :data="{schoolId: this.schoolId}" name="file" :auto-upload="false"> <el-upload ref="import" accept=".xls,.xlsx" :headers="{token}" :on-remove="handleRemove" :on-error="uploadError" :on-success="uploadSuccess" :before-remove="beforeRemove" :limit="1" :on-exceed="handleExceed" :action="this.api.uploadFile" :file-list="uploadList" :data="{schoolId: this.schoolId}" name="file" :auto-upload="false">
<el-button size="small"><img src="../../../assets/img/upload.png" alt=""> 上传文件</el-button> <el-button size="small"><img src="../../../assets/img/upload.png" alt=""> 上传文件</el-button>
</el-upload> </el-upload>
<div class="link" v-if="uploadFaild"> <div class="link" v-if="uploadFaild">
@ -134,7 +135,7 @@ import util from '@/libs/util'
export default { export default {
data() { data() {
return { return {
schoolId: 1001, token: '',
month: '', month: '',
monthList: [ monthList: [
{ {
@ -171,11 +172,13 @@ export default {
isDetail: false, isDetail: false,
userVisible: false, userVisible: false,
roleList: [], roleList: [],
defaultUser: 'user',
form: { form: {
platformId: Setting.platformId, platformId: Setting.platformId,
// type: 1, // // type: 1, // 0-> 1->
account: '', account: '',
userId: '', userId: '',
accountId: '',
userName: '', userName: '',
roleId: '', roleId: '',
phone: '', phone: '',
@ -183,7 +186,8 @@ export default {
workNumber: '', workNumber: '',
email: '', email: '',
schoolId: this.schoolId, schoolId: this.schoolId,
password: '' password: '',
isEnable: 1
}, },
rules: { rules: {
account: [ account: [
@ -197,9 +201,6 @@ export default {
userName: [ userName: [
{ required: true, message: '请输入用户姓名', trigger: 'blur' } { required: true, message: '请输入用户姓名', trigger: 'blur' }
], ],
roleId: [
{ required: true, message: '请选择账号角色', trigger: 'change' }
],
workNumber: [ workNumber: [
{ required: true, message: '请输入工号/学号', trigger: 'blur' }, { required: true, message: '请输入工号/学号', trigger: 'blur' },
{ {
@ -239,11 +240,8 @@ export default {
}, },
computed: { computed: {
...mapState('user', [ ...mapState('user', [
'clientId','clientName' 'schoolId'
]), ]),
...mapState('layout', [
'isIE'
])
}, },
watch: { watch: {
keyword: function(val) { keyword: function(val) {
@ -272,6 +270,7 @@ export default {
} }
}, },
mounted(){ mounted(){
this.token = util.local.get(Setting.tokenKey)
this.form.schoolId = this.schoolId this.form.schoolId = this.schoolId
this.getData() this.getData()
this.getRole() this.getRole()
@ -280,7 +279,7 @@ export default {
getData(){ getData(){
this.$post(this.api.getUserList,{ this.$post(this.api.getUserList,{
createTime: this.startTime, createTime: this.startTime,
disableAccount: this.status, isEnable: this.status,
endTime: this.endTime, endTime: this.endTime,
keyWord: this.keyword, keyWord: this.keyword,
pageNum: this.page, pageNum: this.page,
@ -310,15 +309,14 @@ export default {
type: 'info', type: 'info',
customClass: 'normal' customClass: 'normal'
}).then(() => { }).then(() => {
let data = { this.$get(this.api.resetPwd,{
newPwd: Setting.initialPassword,
userId: row.userId, userId: row.userId,
password: Setting.initialPassword }).then(res => {
} if(res.message == 'success'){
this.$post(this.api.userinfoUpdate,data).then(res => { this.$message.success('重置成功')
if(res.success){
util.successMsg('重置成功')
}else{ }else{
util.errorMsg('重置失败') this.$message.error('重置失败')
} }
}).catch(res => {}) }).catch(res => {})
}).catch(() => {}) }).catch(() => {})
@ -360,14 +358,15 @@ export default {
this.userVisible = true this.userVisible = true
this.isAddteacher = true this.isAddteacher = true
}, },
getDetail(userId){ getDetail(accountId){
this.userVisible = true this.userVisible = true
this.$post(`${this.api.getDetail}?userId=${userId}`).then(res => { this.$post(`${this.api.getDetail}?accountId=${accountId}`).then(res => {
let data = res.data let data = res.data
this.form = { this.form = {
platformId: Setting.platformId, platformId: Setting.platformId,
account: data.account, account: data.account,
userId: data.userId, userId: data.userId,
accountId,
userName: data.userName, userName: data.userName,
roleId: data.roleId, roleId: data.roleId,
phone: data.phone ? data.phone : '', phone: data.phone ? data.phone : '',
@ -375,7 +374,8 @@ export default {
workNumber: data.workNumber, workNumber: data.workNumber,
email: data.email, email: data.email,
schoolId: data.schoolId, schoolId: data.schoolId,
password: '' password: '',
isEnable: data.isEnable
} }
this.originalAccount = data.account this.originalAccount = data.account
this.originalWorkNumber = data.workNumber this.originalWorkNumber = data.workNumber
@ -384,11 +384,11 @@ export default {
edit(row){ edit(row){
this.isDetail = false this.isDetail = false
this.isAddteacher = false this.isAddteacher = false
this.getDetail(row.userId) this.getDetail(row.accountId)
}, },
show(row){ show(row){
this.isDetail = true this.isDetail = true
this.getDetail(row.userId) this.getDetail(row.accountId)
}, },
confirm(){ confirm(){
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
@ -397,6 +397,7 @@ export default {
if(this.workNumberRepeat) return util.warningMsg('该工号已存在') if(this.workNumberRepeat) return util.warningMsg('该工号已存在')
let data = this.form let data = this.form
if(!data.userId) data.uniqueIdentification = new Date().getTime() if(!data.userId) data.uniqueIdentification = new Date().getTime()
if(!data.roleId) data.roleId = '0'
if(this.form.userId){ if(this.form.userId){
this.$post(this.api.modifyUser,data).then(res => { this.$post(this.api.modifyUser,data).then(res => {
this.userVisible = false this.userVisible = false
@ -417,22 +418,27 @@ export default {
this.$confirm('此删除操作不可逆,是否确认删除选中项?', '提示', { this.$confirm('此删除操作不可逆,是否确认删除选中项?', '提示', {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
let data = { this.$post(`${this.api.deleteUser}?accountIds=${row.accountId}`).then(res => {
staffIds: row.staffId
}
this.$del(this.api.deleteStaffs,data).then(res => {
util.successMsg('删除成功') util.successMsg('删除成功')
this.getData() this.getData()
}).catch(res => {}) }).catch(res => {})
}).catch(() => {}) }).catch(() => {})
}, },
switchOff(val,row,index) { switchOff(val,row,index) {
let data = { this.$post(this.api.modifyUser,{
id: row.id, account: row.account,
isDisable: val accountId: row.accountId,
} isEnable: val,
this.$post(this.api.updateClient,data).then((res) => { roleId: row.roleId,
val == 1 ? util.warningMsg('该用户权限已关闭') : util.successMsg('该用户权限已激活') userId: row.userId,
userName: row.userName,
workNumber: row.workNumber,
platformId: Setting.platformId,
password: '',
schoolId: this.schoolId,
phone: ''
}).then((res) => {
val == 1 ? util.successMsg('启用成功') : util.successMsg('禁用成功')
}).catch((res) => {}) }).catch((res) => {})
}, },
handleSelectionChange(val) { handleSelectionChange(val) {
@ -442,15 +448,12 @@ export default {
if(this.multipleSelection.length != ''){ if(this.multipleSelection.length != ''){
let newArr = this.multipleSelection let newArr = this.multipleSelection
let delList = newArr.map(item => { let delList = newArr.map(item => {
return item.userId return `accountIds=${item.accountId}`
}) })
this.$confirm(`此批量删除操作不可逆,是否确认删除${util.ellipsisStr(newArr[0].userName)}${newArr.length}个选中项`, '提示', { this.$confirm(`此批量删除操作不可逆,是否确认删除?`, '提示', {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
let data = { this.$post(`${this.api.deleteUser}?${delList.join('&')}`).then(res => {
staffIds: delList.join(',')
}
this.$del(this.api.deleteStaffs,data).then(res => {
this.$refs.table.clearSelection() this.$refs.table.clearSelection()
util.successMsg('删除成功') util.successMsg('删除成功')
this.getData() this.getData()
@ -474,6 +477,7 @@ export default {
location.href = this.api.downloadStaffTemp location.href = this.api.downloadStaffTemp
}, },
showFaild(){ showFaild(){
this.importVisible = false
location.href = `${this.api.export_failure}?token=${this.token}` location.href = `${this.api.export_failure}?token=${this.token}`
}, },
handleExceed(files, fileList) { handleExceed(files, fileList) {
@ -485,6 +489,7 @@ export default {
this.uploadFaild = false this.uploadFaild = false
if(res.status == 200){ if(res.status == 200){
if(res.data.token){ if(res.data.token){
util.errorMsg('导入失败,请下载失败模板查看原因')
this.token = res.data.token this.token = res.data.token
this.uploadFaild = true this.uploadFaild = true
}else{ }else{

@ -3,7 +3,7 @@
* 当传入的权限当前用户没有时会移除该组件 * 当传入的权限当前用户没有时会移除该组件
* 用例<Tag v-auth>text</Tag> <Tag v-auth="'user:'">text</Tag> * 用例<Tag v-auth>text</Tag> <Tag v-auth="'user:'">text</Tag>
* */ * */
import store from '@/store'; import store from '@/store'
export default { export default {
inserted (el, binding, vnode) { inserted (el, binding, vnode) {
@ -11,14 +11,14 @@ export default {
if(binding.value){ if(binding.value){
btnText = binding.value btnText = binding.value
}else{ }else{
btnText = `${vnode.context.$route.name}:${el.innerText}` btnText = `${vnode.context.$route.path}:${el.innerText}`
} }
const btnPermissions = store.state.btnPermissions; const btnPermissions = store.state.auth.btns
if (btnText && btnPermissions && btnPermissions.length) { if (btnText && btnPermissions && btnPermissions.length) {
const isPermission = btnPermissions.includes(btnText); const isPermission = btnPermissions.includes(btnText)
if (!isPermission) { if (!isPermission) {
el.parentNode && el.parentNode.removeChild(el); el.parentNode && el.parentNode.removeChild(el)
} }
} }
} }

@ -2,72 +2,78 @@ import axios from 'axios'
import util from '@/libs/util' import util from '@/libs/util'
import router from '@/router/index' import router from '@/router/index'
import Setting from '@/setting' import Setting from '@/setting'
import store from '@/store'
const service = axios.create({ const service = axios.create({
baseURL: Setting.apiBaseURL, baseURL: Setting.apiBaseURL,
timeout: 10000000 timeout: 10000000
}) })
// post请求头 // post请求头
service.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8' service.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8'
// 请求拦截器 // 请求拦截器
// service.interceptors.request.use(config => { service.interceptors.request.use(config => {
// if (sessionStorage.getItem('token')) { let token = util.local.get(Setting.tokenKey)
// // 存在将token写入 request header if(token) config.headers.token = token
// config.headers.Authorization = `${sessionStorage.getItem('token')}`; let storeSchoolId = store.state.user.schoolId
// } let routeSchoolId = router.app._route.query.schoolId
// return config; if(routeSchoolId) routeSchoolId = atob(decodeURI(routeSchoolId))
// }, err => { config.headers.schoolId = storeSchoolId ? storeSchoolId : routeSchoolId
// util.errorMsg({ return config
// message: '退出登陆', },err => {
// onClose: function () { util.errorMsg({
// router.push({name: 'login'}); message: '退出登陆',
// } onClose: function () {
// }) router.push({name: '/login'})
// return Promise.reject(err); }
// }) })
return Promise.reject(err)
})
// 响应拦截器 // 响应拦截器
service.interceptors.response.use( service.interceptors.response.use(
response => { response => {
const res = response.data const res = response.data
// if (res.status == 200) { if(res.status == 200) {
return Promise.resolve(res).catch(e => {})
}else if(!res.status){
return Promise.resolve(res).catch(e => {}) return Promise.resolve(res).catch(e => {})
// } else { }else {
// switch (res.code) { util.errorMsg(res.message)
// case 201: return Promise.reject(res)
// util.errorMsg(res.message ? res.message : '数据请求异常') }
// break;
// default:
// Promise.reject(res).catch(e => {})
// }
// return Promise.reject(res).catch(e => {})
// }
}, },
// 服务器状态码不是200的情况 // 服务器状态码不是200的情况
error => { error => {
if (error.res.status) { if (error.response.status) {
switch (error.res.status) { switch (error.response.status) {
// 401: 未登录 // 401: 未登录
// 未登录则跳转登录页面,并携带当前页面的路径 // 未登录则跳转登录页面,并携带当前页面的路径
// 在登录成功后返回当前页面,这一步需要在登录页操作。 // 在登录成功后返回当前页面,这一步需要在登录页操作。
case 500: case 401:
util.local.remove(Setting.storeKey)
util.local.remove(Setting.tokenKey)
util.errorMsg('登录过期,请重新登录')
setTimeout(() => {
router.replace({ router.replace({
path: '/login', path: '/login',
// query: { redirect: router.currentRoute.fullPath } query: {
}); redirect: router.currentRoute.fullPath
break; }
})
}, 1000)
break
case 500:
util.errorMsg('网络错误')
break
// 403 token过期 // 403 token过期
// 登录过期对用户进行提示 // 登录过期对用户进行提示
// 清除本地token和清空vuex中token对象 // 清除本地token和清空vuex中token对象
// 跳转登录页面 // 跳转登录页面
case 403: case 403:
// Toast({ util.local.remove(Setting.storeKey)
// message: '登录过期,请重新登录', util.local.remove(Setting.tokenKey)
// duration: 1000, util.errorMsg('登录过期,请重新登录')
// forbidClick: true
// });
// 清除token // 清除token
// store.commit('loginSuccess', null); // store.commit('loginSuccess', null);
// 跳转登录页面,并将要浏览的页面fullPath传过去,登录成功后跳转需要访问的页面 // 跳转登录页面,并将要浏览的页面fullPath传过去,登录成功后跳转需要访问的页面
@ -77,20 +83,19 @@ service.interceptors.response.use(
query: { query: {
redirect: router.currentRoute.fullPath redirect: router.currentRoute.fullPath
} }
}); })
}, 1000) }, 1000)
break; break
// 404请求不存在 // 404请求不存在
case 404: case 404:
router.replace({ util.errorMsg('网络请求不存在!')
path: '/404', break
})
break;
// 其他错误,直接抛出错误提示 // 其他错误,直接抛出错误提示
default: default:
util.errorMsg(error.response.data.message)
Promise.reject(res) Promise.reject(res)
} }
return Promise.reject(error.res) return Promise.reject(error.response)
} }
} }
); );
@ -98,11 +103,7 @@ service.interceptors.response.use(
function get(url, params){ function get(url, params){
return new Promise((resolve, reject) =>{ return new Promise((resolve, reject) =>{
service.get(url, {params: params}).then(res => { service.get(url, {params: params}).then(res => {
if(res){
resolve(res) resolve(res)
}else{
reject(res)
}
}).catch(err => { }).catch(err => {
reject(err) reject(err)
}) })
@ -112,11 +113,7 @@ function get(url, params){
function post(url, params){ function post(url, params){
return new Promise((resolve, reject) =>{ return new Promise((resolve, reject) =>{
service.post(url,params).then(res => { service.post(url,params).then(res => {
// if(res){
resolve(res) resolve(res)
// }else{
// reject()
// }
}).catch(err => { }).catch(err => {
reject(err.data) reject(err.data)
}) })
@ -128,11 +125,7 @@ function del(url, params){
service.delete(url, { service.delete(url, {
params params
}).then(res => { }).then(res => {
if(res){
resolve(res) resolve(res)
}else{
reject()
}
}).catch(err => { }).catch(err => {
reject(err.data) reject(err.data)
}) })
@ -144,11 +137,7 @@ function put(url, params){
service.put(url, { service.put(url, {
params params
}).then(res => { }).then(res => {
if(res){
resolve(res) resolve(res)
}else{
reject()
}
}).catch(err => { }).catch(err => {
reject(err.data) reject(err.data)
}) })

@ -3,13 +3,25 @@ import Setting from '@/setting'
import util from '@/libs/util' import util from '@/libs/util'
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
document.title = Setting.titleSuffix; document.title = Setting.titleSuffix
const role = util.local.get(Setting.usernameKey); const role = util.local.get(Setting.tokenKey)
if (!role && to.path !== '/login') { if (!role && to.path !== '/login') {
next('/login') next('/login')
} else if(role && to.path == '/login') { } else if(role && to.path == '/login') {
next('/index') next('/index')
} else { } else {
let mg = from.query.mg
if(mg){
if(!to.query.mg){
next({
path: to.path,
query: {mg}
})
}else{
next() next()
} }
}else{
next()
}
}
}); });

@ -64,7 +64,7 @@ const Setting = {
// 相同路由,不同参数间进行切换,是否强力更新 // 相同路由,不同参数间进行切换,是否强力更新
sameRouteForceUpdate: false, sameRouteForceUpdate: false,
// 是否使用动态路由 // 是否使用动态路由
dynamicRoute: false, dynamicRoute: true,
// 文件上传 // 文件上传
upload: { upload: {
apiURL: 'http://8.134.8.197:8001', apiURL: 'http://8.134.8.197:8001',

@ -1,10 +1,4 @@
const getters = { const getters = {
userId: state => state.user.info.userId,
roleId: state => state.user.info.roleId,
userName: state => state.user.info.userName,
account: state => state.user.info.account,
phone: state => state.user.info.phone,
clientId: state => state.user.info.clientId,
clientName: state => state.user.info.clientName,
} }
export default getters export default getters

@ -0,0 +1,26 @@
/**
* 权限管理
* */
export default {
namespaced: true,
state: {
btns: [],
routes: []
},
mutations: {
SET_BTN_AUTH: (state, btns) => {
state.btns = btns
},
SET_ROUTE: (state, routes) => {
state.routes = routes
},
},
actions: {
addBtnAuth({ state,commit },btns) {
commit('SET_BTN_AUTH',btns)
},
addRoutes({ state,commit },routes) {
commit('SET_ROUTE',routes)
}
}
}

@ -1,32 +0,0 @@
/**
* 成绩管理
* */
export default {
namespaced: true,
state: {
id: '',
assessmentId: '',
assessmentName: '',
classId: '',
score: 0,
timeSpent: 0
},
getters: {
},
mutations: {
SET_INFO: (state, info) => {
state.id = info.id
state.assessmentId = info.assessmentId
state.assessmentName = info.assessmentName
state.classId = info.classId
state.score = info.score
state.timeSpent = info.timeSpent
},
},
actions: {
setInfo({ commit },info) {
commit('SET_INFO',info)
},
}
}

@ -1,19 +0,0 @@
/**
* 客户管理
* */
export default {
namespaced: true,
state: {
provinceList: []
},
mutations: {
SET_PROVINCE: (state, provinceList) => {
state.provinceList = provinceList
},
},
actions: {
setProvince({ commit, state, dispatch },provinceList) {
commit('SET_PROVINCE',provinceList)
},
}
}

@ -1,47 +0,0 @@
/**
* 试卷管理
* */
export default {
namespaced: true,
state: {
degreeList: [
{
id: 0,
label: '简单'
},{
id: 1,
label: '一般'
},{
id: 2,
label: '较难'
},{
id: 3,
label: '很难'
},
],
practiseId: '',
paperId: '',
practiseName: '',
isContinue: '',
identification: '',
},
getters: {
getDegreeName: state => id => {
return id != null ? state.degreeList.find(n => n.id == id).label : ''
}
},
mutations: {
SET_INFO: (state, info) => {
state.practiseId = info.practiseId
state.paperId = info.paperId
state.practiseName = info.practiseName
state.isContinue = info.isContinue
state.identification = info.identification
},
},
actions: {
setInfo({ commit },info) {
commit('SET_INFO',info)
},
}
}

@ -1,4 +1,4 @@
import addRoutes from '@/libs/route/addRoutes'
import Setting from '@/setting' import Setting from '@/setting'
import util from '@/libs/util' import util from '@/libs/util'
import { Message } from 'element-ui' import { Message } from 'element-ui'
@ -12,79 +12,47 @@ export default {
namespaced: true, namespaced: true,
state: { state: {
avatar: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png', avatar: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
token: '',
userId: '',
roleId: '',
userName: '', userName: '',
account: '', schoolId: '',
phone: '', isManager: false
clientId: '',
clientName: '',
}, },
mutations: { mutations: {
SET_INFO: (state, info) => { SET_INFO: (state, info) => {
info.avatar && (state.avatar = info.avatar) if(info.avatar) state.avatar = info.avatar
state.userId = info.userId state.schoolId = info.schoolId
state.roleId = info.roleId
state.userName = info.userName state.userName = info.userName
state.account = info.account
state.phone = info.phone
state.clientId = info.clientId
state.clientName = info.clientName
},
SET_TOKEN: (state, token) => {
state.token = token
}, },
SET_AVATAR: (state, avatar) => { SET_AVATAR: (state, avatar) => {
state.avatar = avatar state.avatar = avatar
}, },
SET_USERNAME: (state, userName) => { SET_MANAGER: (state, isManager) => {
state.userName = userName state.isManager = isManager
},
SET_ROLEID: (state, roleId) => {
state.roleId = roleId
}, },
SET_CLIENTID: (state, clientId) => {
state.clientId = clientId
},
SET_CLIENTNAME: (state, clientName) => {
state.clientName = clientName
}
}, },
actions: { actions: {
login({ state,commit }, userInfo) { login({ state,commit }, userInfo) {
// util.local.set('data-token','testfffff',1296000000) const { account, password, code, random } = userInfo
const { username, password } = userInfo
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
get(api.logins,{ account: username.trim(), password: password, source: 0 }).then(res => { post(api.logins,{
console.log(333,res) account,
if(res.status == 200){ password,
let user = res.message.retvalue code,
console.log(user) platform: Setting.platformId,
// if(user.roleId == 1){ random,
let routes = res.message.listValue }).then(res => {
commit('SET_INFO',{ setTimeout(() => {
avatar: user.userAvatars, post(api.saveRecord,{
userId: user.userId, type: 3,
roleId: user.roleId, }).then(res => {}).catch(res => {})
userName: user.userName, },3000)
account: user.account,
phone: user.phone,
clientId: user.clientId,
clientName: user.clientName,
})
if(userInfo.remember) util.local.set(Setting.tokenKey,user.token,1296000000)
Setting.dynamicRoute && addRoutes(routes) if(res.status == 200){
util.local.set(Setting.usernameKey, user.userName) util.local.set(Setting.tokenKey,res.data.token,1296000000)
util.successMsg('登录成功') util.successMsg('登录成功')
resolve() resolve()
// }else{
// util.errorMsg('该用户没有权限')
// }
}else{ }else{
util.errorMsg(res.message) util.errorMsg(res.message)
reject(res)
} }
}).catch(error => { }).catch(error => {
reject(error) reject(error)
@ -93,7 +61,6 @@ export default {
}, },
logout({ commit, state, dispatch }) { logout({ commit, state, dispatch }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
util.local.remove(Setting.usernameKey)
util.local.remove(Setting.storeKey) util.local.remove(Setting.storeKey)
util.local.remove(Setting.tokenKey) util.local.remove(Setting.tokenKey)
location.reload() location.reload()
@ -108,8 +75,11 @@ export default {
} }
post(api.userinfoUpdate,data).then(res => {}).catch(res => {}) post(api.userinfoUpdate,data).then(res => {}).catch(res => {})
}, },
setUserName({ state,commit },userName) { setInfo({ state,commit },info) {
commit('SET_USERNAME',userName) commit('SET_INFO',info)
},
setManager({ state,commit },isManager) {
commit('SET_MANAGER',isManager)
}, },
} }
} }
Loading…
Cancel
Save