diff --git a/src/api/index.js b/src/api/index.js
index ad5a019..70ff281 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -7,23 +7,23 @@ let host3 = 'http://192.168.31.137:9000'//陈
export default {
// 登录注册
- logins: `${host3}/users/users/user/login`,
- verification:`${host3}/users/users/user/captcha`,
+ logins: `/users/users/user/login`,
+ verification:`${Setting.apiBaseURL}/users/users/user/captcha`,
// 公用接口
- queryProvince: `${host3}/nakadai/nakadai/province/queryProvince`,
- queryCity: `${host3}/nakadai/nakadai/city/queryCity`,
+ queryProvince: `/nakadai/nakadai/province/queryProvince`,
+ queryCity: `/nakadai/nakadai/city/queryCity`,
queryWorkNumberIsExist:`evaluation/tms/userInfo/queryWorkNumberIsExist`,
queryStaffWorkNumberIsExist:`evaluation/tms/system/queryStaffWorkNumberIsExist`,
- querySchool: `${host3}/nakadai/nakadai/school/querySchool`,
- queryCourseDiscipline: `${host2}/nakadai/nakadai/discipline/queryDiscipline`,
- queryCourseProfessionalClass: `${host2}/nakadai/nakadai/professionalClass/queryProfessionalClass`,
- queryCourseProfessional: `${host2}/nakadai/nakadai/professional/queryProfessional`,
+ querySchool: `/nakadai/nakadai/school/querySchool`,
+ queryCourseDiscipline: `/nakadai/nakadai/discipline/queryDiscipline`,
+ queryCourseProfessionalClass: `/nakadai/nakadai/professionalClass/queryProfessionalClass`,
+ queryCourseProfessional: `/nakadai/nakadai/professional/queryProfessional`,
// 个人中心
- uploadUserAvatars: `${host1}/users/users/userAccount/updateUserAvatars`,
- userInfo:`${host1}/users/users/userInfo/getUserInfo`,
- updateUser:`${host1}/users/users/userInfo/updateUser`,
+ uploadUserAvatars: `/users/users/userAccount/updateUserAvatars`,
+ userInfo:`/users/users/userInfo/getUserInfo`,
+ updateUser:`/users/users/userInfo/updateUser`,
findPasswordByEmail:`/users/users/userAccount/findPasswordByEmail`,
findPasswordByPhone:`/users/users/userAccount/findPasswordByPhone`,
bingEmail:`evaluation/tms/user/bingEmail`,
@@ -39,17 +39,18 @@ export default {
// 用户管理
saveUser: `/users/users/data/user/save`,
getUserList: `/users/users/data/user/getUserList`,
- getUserTotalBySchoolId: `${host1}/users/users/data/user/getUserTotalBySchoolId`,
+ getUserTotalBySchoolId: `/users/users/data/user/getUserTotalBySchoolId`,
checkAccount:`/users/users/data/user/checkAccount`,
getDetail:`/users/users/data/user/getDetail`,
modifyUser:`/users/users/data/user/modify`,
export_failure:`${Setting.apiBaseURL}/users/users/data/user/export_failure`,
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`,
+ deleteUser:`/users/users/data/user/delete`,
+ resetPwd: `/users/users/userAccount/resetPwd`,
+ sendPhoneOrEmailCode: `/users/users/userAccount/sendPhoneOrEmailCode`,
+ bindPhoneOrEmail: `/users/users/userAccount/bindPhoneOrEmail`,
+ examinePassword: `/users/users/userAccount/examinePassword`,
+ userTemplate: `http://39.108.250.202/template/%E6%95%B0%E6%8D%AE%E5%B9%B3%E5%8F%B0%E7%94%A8%E6%88%B7%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx`,
// 角色管理
batchRemove:`/data/data/role/batchRemove`,
@@ -71,20 +72,20 @@ export default {
getIdQueryTable:`/data/data/table/getIdQueryTable`,
getTableByClassification:`/data/data/table/getTableByClassification`,
getTableByCondition:`/data/data/table/getTableByCondition`,
- downloadData:`${host1}/data/data/download`,
- previewData:`${host1}/data/data/preview`,
- downloadRecord:`${host1}/data/data/myDownload/downloadRecord`,
+ downloadData:`${Setting.apiBaseURL}/data/data/download`,
+ previewData:`/data/data/preview`,
+ downloadRecord:`/data/data/myDownload/downloadRecord`,
getDownloadRecord:`/data/data/myDownload/getDownloadRecord`,
- downloadAgain:`${host1}/data/data/downloadAgain`,
- isDownload:`${host1}/data/data/product/isDownload`,
+ downloadAgain:`/data/data/downloadAgain`,
+ isDownload:`/data/data/product/isDownload`,
// 数据操作记录
- queryAccumulate:`${host1}/data/data/dataRecord/queryAccumulate`,
- queryDatabaseInfo:`${host1}/data/data/dataRecord/queryDatabaseInfo`,
- queryDatabaseInfoByMonth:`${host1}/data/data/dataRecord/queryDatabaseInfoByMonth`,
- saveRecord:`${host1}/data/data/dataRecord/saveRecord`,
- databaseInfoExport:`${host1}/data/data/dataRecord/databaseInfoExport`,
- databaseInfoByMonthExport:`${host1}/data/data/dataRecord/databaseInfoByMonthExport`,
- onlineNumber:`${host1}/data/data/dataRecord/onlineNumber`,
- getProductInfoBySchoolId:`${host1}/data/data/product/getProductInfoBySchoolId`,
+ queryAccumulate:`/data/data/dataRecord/queryAccumulate`,
+ queryDatabaseInfo:`/data/data/dataRecord/queryDatabaseInfo`,
+ queryDatabaseInfoByMonth:`/data/data/dataRecord/queryDatabaseInfoByMonth`,
+ saveRecord:`/data/data/dataRecord/saveRecord`,
+ databaseInfoExport:`/data/data/dataRecord/databaseInfoExport`,
+ databaseInfoByMonthExport:`/data/data/dataRecord/databaseInfoByMonthExport`,
+ onlineNumber:`/data/data/dataRecord/onlineNumber`,
+ getProductInfoBySchoolId:`/data/data/product/getProductInfoBySchoolId`,
}
\ No newline at end of file
diff --git a/src/layouts/header/index.vue b/src/layouts/header/index.vue
index e1d88f0..33a6497 100644
--- a/src/layouts/header/index.vue
+++ b/src/layouts/header/index.vue
@@ -7,14 +7,14 @@
-
+
-
+
{{userName}}
- 个人资料
+ 个人资料
退出登录
@@ -49,7 +49,7 @@ export default {
components: { navbar },
computed: {
...mapState('user', [
- 'avatar','isManager','schoolId'
+ 'avatar','isManager','schoolId','isCustomer'
]),
...mapState('auth', [
'routes'
@@ -64,17 +64,19 @@ export default {
]),
getUserInfo(){
this.$get(this.api.userInfo).then(res => {
- let userInfo = res.userInfo
- let isManager = userInfo.roleId != '0'
+ let userInfo = res.userInfo ? res.userInfo : {}
+ let userAccount = res.userAccount
+ let isManager = userAccount.roleId != '0'
this.isUser = isManager
let mg = this.$route.query.mg
if(mg && atob(decodeURI(mg)) === 'true'){
this.showSetting = false
}
- this.userName = userInfo.userName
+ this.userName = userAccount.account
+
this.setInfo({
avatar: userInfo.userAvatars,
- schoolId: res.userAccount.schoolId,
+ schoolId: userAccount.schoolId,
})
this.setManager(isManager)
}).catch(err => {})
@@ -148,6 +150,9 @@ export default {
.action{
display: inline-flex;
align-items: center;
+ .icon{
+ cursor: pointer;
+ }
.user-wrap {
display: inline-flex;
align-items: center;
diff --git a/src/pages/account/login/index.vue b/src/pages/account/login/index.vue
index 0b2aa13..dd988a2 100644
--- a/src/pages/account/login/index.vue
+++ b/src/pages/account/login/index.vue
@@ -4,28 +4,48 @@
-
或然数据网
+
或然数据平台
+
+
+
+
+
+
+
+
+
+ {{phoneBtnText}}
+
+
+
+
+
@@ -33,21 +53,38 @@
import { mapActions } from 'vuex'
import vHead from '@/layouts/header'
import util from '@/libs/util'
+import Setting from '@/setting'
export default {
data: function() {
return {
+ tabList: [
+ {
+ id: '1',
+ label: '账号登录'
+ },{
+ id: '2',
+ label: '手机号/邮箱登录'
+ }
+ ],
verificationIMG: '',
- loginForm: {
+ form: {
+ distinguish: '1',
account: 'admin',
password: '111aaa',
random: '',
code: ''
},
- loginRules: {
- account: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
+ rules: {
+ account: [{ required: true, message: '请输入账号', trigger: 'blur' }],
password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
code: [{ required: true, message: '请输入验证码', trigger: 'blur' }],
},
+ phoneVisible: false,
+ phone: '',
+ phoneCode: '',
+ phoneDisabled: false,
+ phoneTimer: null,
+ phoneBtnText: '发送验证码'
};
},
components: {vHead},
@@ -56,28 +93,105 @@ export default {
},
methods: {
...mapActions('user', [
- 'login'
+ 'login','setToken'
]),
+ typeClick(item){
+ this.form.account = ''
+ this.form.distinguish = item.id
+ this.$refs.login.clearValidate()
+ this.rules.account[0].message = item.id == 1 ? '请输入账号' : '请输入手机号/邮箱'
+ },
submitForm() {
this.$refs.login.validate(valid => {
if (valid) {
- this.login(this.loginForm).then(() => {
+ this.login(this.form).then(() => {
let redirect = this.$route.query.redirect ? decodeURIComponent(this.$route.query.redirect) : '/index'
this.$router.replace(redirect)
}).catch(res => {
+ if(res && res.status == 30001){
+ this.phoneVisible = true
+ }
this.getVerImg()
- this.loginForm.code = ''
+ this.form.code = ''
})
}
})
},
getVerImg(){
- if(!this.loginForm.account){
+ if(!this.form.account){
return this.verificationIMG = ''
}
- this.loginForm.random = Math.floor(Math.random()*999999999)
- this.verificationIMG = this.api.verification+'?random='+`${this.loginForm.random}`
- }
+ this.form.random = Math.floor(Math.random()*999999999)
+ this.verificationIMG = this.api.verification+'?random='+`${this.form.random}`
+ },
+ phoneCountdown(){
+ let count = 60
+ if(!this.phoneTimer){
+ this.phoneDisabled = true
+ this.phoneTimer = setInterval(() => {
+ console.log('倒计时中')
+ if(count > 0){
+ count--
+ this.phoneBtnText = `${count}秒后重试`
+ }else{
+ this.phoneDisabled = false
+ clearInterval(this.phoneTimer)
+ this.phoneTimer = null
+ this.phoneBtnText = `发送验证码`
+ }
+ },1000)
+ }
+ },
+ closePhone(){
+ if(!this.emailDisabled){
+ this.emailCode = ''
+ }
+ },
+ sendPhoneCode(){
+ if(!this.phone) return util.warningMsg('请输入手机号')
+ if(!/^1[3456789]\d{9}$/.test(this.phone)) return util.warningMsg('请输入正确的手机号')
+ let data = {
+ phone: this.phone,
+ types: 2
+ }
+ this.$post(this.api.sendPhoneOrEmailCode,data).then(res => {
+ if(res.message.opener){
+ this.phoneCountdown()
+ this.phoneOpener = res.message.opener
+ }else{
+ util.errorMsg(res.message)
+ }
+
+ }).catch(res => {})
+ },
+ phoneSubmit(){
+ if(!this.phone) return util.warningMsg('请输入手机号')
+ if(!/^1[3456789]\d{9}$/.test(this.phone)) return util.warningMsg('请输入正确的手机号')
+ if(!this.phoneCode) return util.warningMsg('请输入验证码')
+ let data = {
+ phone: this.phone,
+ types: 2,
+ code: this.phoneCode,
+ opener: this.phoneOpener,
+ platform: Setting.platformId,
+ account: this.form.account
+ }
+ this.$post(this.api.bindPhoneOrEmail,data).then(res => {
+ util.successMsg('绑定成功')
+ this.form.phone = this.phone
+ this.phoneVisible = false
+
+ this.setToken(res.token)
+ util.local.set(Setting.tokenKey,res.token,43200000)
+ util.successMsg('登录成功')
+ setTimeout(() => {
+ this.$post(this.api.saveRecord,{
+ type: 3,
+ }).then(res => {}).catch(res => {})
+ },3000)
+ this.$router.push('/index/list')
+ }).catch(res => {})
+ },
},
};
@@ -106,24 +220,21 @@ export default {
margin-top: 30px;
border-radius: 10px;
background-color: #fff;
- .title{
- position: relative;
+ .tab{
+ display: flex;
+ justify-content: center;
+ align-items: center;
margin-bottom: 30px;
- text-align: center;
- span{
- display: inline-block;
+ border-bottom: 2px solid #e0e0e0;
+ li{
padding: 9px 20px;
+ margin-bottom: -1px;
color: #555;
- border-bottom: 2px solid $main-color;
- }
- &:after{
- content: '';
- position: absolute;
- left: 0;
- bottom: -1px;
- width: 100%;
- height: 1px;
- background-color: #e0e0e0;
+ cursor: pointer;
+ border-bottom: 2px solid transparent;
+ &.active{
+ border-bottom-color: $main-color;
+ }
}
}
.el-form{
diff --git a/src/pages/index/list/index.vue b/src/pages/index/list/index.vue
index 0831466..dc7ab13 100644
--- a/src/pages/index/list/index.vue
+++ b/src/pages/index/list/index.vue
@@ -1,6 +1,6 @@
-
欢迎来到
或然数据网
+
欢迎来到
或然数据平台
diff --git a/src/pages/setting/person/download.vue b/src/pages/setting/person/download.vue
index 788c582..27538a5 100644
--- a/src/pages/setting/person/download.vue
+++ b/src/pages/setting/person/download.vue
@@ -93,20 +93,8 @@ export default {
}).then(res => {
msgObj.close()
if(res.data.type != 'multipart/form-data') return util.warningMsg('数据总数为零!')
- const blob = new Blob([res.data])
- const fileName = `${row.databaseName}.xls`
- if ('download' in document.createElement('a')) { // 非IE下载
- const elink = document.createElement('a')
- elink.download = fileName
- elink.style.display = 'none'
- elink.href = URL.createObjectURL(blob)
- document.body.appendChild(elink)
- elink.click()
- URL.revokeObjectURL(elink.href) // 释放URL 对象
- document.body.removeChild(elink)
- } else { // IE10+下载
- navigator.msSaveBlob(blob, fileName)
- }
+ util.downloadFileDirect(`${row.databaseName}.xls`,new Blob([res.data]))
+
this.$post(`${this.api.saveRecord}?platformUserId=4&tableId=${row.id}&type=1&schoolId=1`).then(res => {}).catch(res => {})
}).catch(res => {
msgObj.close()
diff --git a/src/pages/user/list/index.vue b/src/pages/user/list/index.vue
index a6f6eb0..6817618 100644
--- a/src/pages/user/list/index.vue
+++ b/src/pages/user/list/index.vue
@@ -133,10 +133,11 @@
import Setting from '@/setting'
import { mapState } from 'vuex'
import util from '@/libs/util'
+import axios from 'axios'
export default {
data() {
return {
- token: '',
+ token: util.local.get(Setting.tokenKey),
month: '',
monthList: [
{
@@ -163,10 +164,10 @@ export default {
id: '',
label: '不限'
},{
- id: 0,
+ id: 1,
label: '启用'
},{
- id: 1,
+ id: 0,
label: '禁用'
}
],
@@ -271,7 +272,6 @@ export default {
}
},
mounted(){
- this.token = util.local.get(Setting.tokenKey)
this.form.schoolId = this.schoolId
this.getData()
this.getRole()
@@ -397,6 +397,7 @@ export default {
if(this.accountRepeat) return util.warningMsg('该账号已存在')
if(this.workNumberRepeat) return util.warningMsg('该工号已存在')
let data = this.form
+ data.schoolId = data.schoolId ? data.schoolId : this.schoolId
if(!data.userId) data.uniqueIdentification = new Date().getTime()
if(!data.roleId) data.roleId = '0'
if(this.form.userId){
@@ -440,7 +441,9 @@ export default {
phone: ''
}).then((res) => {
val == 1 ? util.successMsg('启用成功') : util.successMsg('禁用成功')
- }).catch((res) => {})
+ }).catch((res) => {
+ row.isEnable = val == 1 ? 0 : 1
+ })
},
handleSelectionChange(val) {
this.multipleSelection = val
@@ -475,11 +478,18 @@ export default {
this.getData()
},
downLoad(){
- location.href = this.api.downloadStaffTemp
+ location.href = this.api.userTemplate
},
showFaild(){
this.importVisible = false
- location.href = `${this.api.export_failure}?token=${this.importToken}`
+ axios.get(`${this.api.export_failure}?token=${this.importToken}`,{
+ headers: {
+ token: this.token
+ },
+ responseType: 'blob'
+ }).then((res) => {
+ util.downloadFileDirect(`导入失败原因.xlsx`,new Blob([res.data]))
+ }).catch(res => {})
},
handleExceed(files, fileList) {
util.warningMsg(
diff --git a/src/plugins/requests/index.js b/src/plugins/requests/index.js
index 85d5bed..4be4800 100644
--- a/src/plugins/requests/index.js
+++ b/src/plugins/requests/index.js
@@ -36,6 +36,8 @@ service.interceptors.response.use(
const res = response.data
if(res.status == 200) {
return Promise.resolve(res).catch(e => {})
+ }else if(res.status == 30001) {
+ return Promise.resolve(res).catch(e => {})
}else if(!res.status){
return Promise.resolve(res).catch(e => {})
}else {
diff --git a/src/router/permission.js b/src/router/permission.js
index 9d4393e..9ff736d 100644
--- a/src/router/permission.js
+++ b/src/router/permission.js
@@ -8,7 +8,7 @@ router.beforeEach((to, from, next) => {
document.title = Setting.titleSuffix
const role = util.local.get(Setting.tokenKey)
if (!role && to.path !== '/login' && to.path !== '/index/list') {
- next('/login')
+ next('/index/list')
} else if(role && to.path == '/login') {
next('/index')
} else {
diff --git a/src/router/routes.js b/src/router/routes.js
index f8bfc0c..7a80835 100644
--- a/src/router/routes.js
+++ b/src/router/routes.js
@@ -10,7 +10,7 @@ import BasicLayout from '@/layouts/home'
const frameIn = [
{
path: '/',
- redirect: '/login',
+ redirect: '/index/list',
},
{
path: '/',
diff --git a/src/setting.js b/src/setting.js
index 11ff9e5..fb5a5de 100644
--- a/src/setting.js
+++ b/src/setting.js
@@ -15,8 +15,8 @@ const Setting = {
// 页面切换时,是否显示模拟的进度条
showProgressBar: true,
// 接口请求地址
- // apiBaseURL: env === 'development' ? 'http://192.168.31.125:8888' : 'http://39.108.250.202:8000',
- apiBaseURL: env === 'development' ? 'http://192.168.31.216:9000' : 'http://www.liuwanr.cn',
+ // apiBaseURL: env === 'development' ? 'http://192.168.31.216:9000' : 'http://39.108.250.202:9000',
+ apiBaseURL: env === 'development' ? 'http://192.168.31.216:9000' : 'http://39.108.250.202:9000',
// 接口请求返回错误时,弹窗的持续时间,单位:秒
modalDuration: 3,
// 接口请求返回错误时,弹窗的类型,可选值为 Message 或 Notice
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 91f8cb3..e86ecd8 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -12,7 +12,8 @@ export default {
state: {
avatar: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
schoolId: '',
- isManager: false
+ isManager: false,
+ isCustomer: false
},
mutations: {
SET_INFO: (state, info) => {
@@ -25,10 +26,13 @@ export default {
SET_MANAGER: (state, isManager) => {
state.isManager = isManager
},
+ SET_CUSTOMER: (state, isCustomer) => {
+ state.isCustomer = isCustomer
+ },
},
actions: {
login({ state,commit }, userInfo) {
- const { account, password, code, random } = userInfo
+ const { account, password, code, random, distinguish } = userInfo
return new Promise((resolve, reject) => {
post(api.logins,{
account,
@@ -36,16 +40,17 @@ export default {
code,
platform: Setting.platformId,
random,
+ distinguish
}).then(res => {
- setTimeout(() => {
- post(api.saveRecord,{
- type: 3,
- }).then(res => {}).catch(res => {})
- },3000)
-
if(res.status == 200){
- util.local.set(Setting.tokenKey,res.data.token,1296000000)
+ commit('SET_CUSTOMER',res.data.customer)
+ util.local.set(Setting.tokenKey,res.data.token,43200000)
util.successMsg('登录成功')
+ setTimeout(() => {
+ post(api.saveRecord,{
+ type: 3,
+ }).then(res => {}).catch(res => {})
+ },3000)
resolve()
}else{
util.errorMsg(res.message)
@@ -73,5 +78,8 @@ export default {
setManager({ state,commit },isManager) {
commit('SET_MANAGER',isManager)
},
+ setToken({ state,commit },token) {
+ commit('SET_CUSTOMER',token)
+ },
}
}
\ No newline at end of file