登录调整

dev_review
yujialong 4 months ago
parent a2b4e242b4
commit b8a41a5e23
  1. 9
      src/components/Header.vue
  2. 2
      src/utils/api.js
  3. 127
      src/views/Login.vue
  4. 149
      src/views/match/add/set.vue
  5. 6
      src/views/match/manage/index.vue
  6. 3
      src/views/theoryExam/index.vue

@ -10,7 +10,7 @@
<span class="user-avator">{{ userName }}</span>
</div>
<el-divider class="ml20" direction="vertical"></el-divider>
<el-button type="text" class="ml20" @click="loginout">退出</el-button>
<el-button type="text" class="ml20" @click="logout">退出</el-button>
</div>
</div>
</div>
@ -34,9 +34,10 @@ export default {
this.$router.push('/person')
}
},
loginout () {
localStorage.removeItem('ms_username');
localStorage.removeItem('token');
async logout () {
await this.$post(this.api.logout)
localStorage.removeItem('ms_username')
localStorage.removeItem('token')
sessionStorage.clear()
location.reload()
},

@ -13,6 +13,8 @@ export default {
refreshPageNotification: `nakadai/message/refreshPageNotification`,
heartbeatDetection: `nakadai/message/heartbeatDetection`,
getCurrentTime: `competition/competition/management/getCurrentTime`,
getToken: `users/users/user/getToken`,
logout: `users/users/user/logout`,
// 阿里云文件/视频管理
getPlayAuth: `${uploadURL}oss/manage/getPlayAuth`, // 获取播放凭证

@ -39,7 +39,7 @@
<el-form v-show="activeIndex === '2'" :model="phoneOrEmail" :rules="phoneOrEmailrules" ref="phoneOrEmail"
label-width="0px" style="margin-top: 20px">
<el-form-item prop="account">
<el-input @blur="phoneBlur" v-model="phoneOrEmail.account" placeholder="请输入电话/邮箱"></el-input>
<el-input @blur="phoneBlur" v-model="phoneOrEmail.workNumber" placeholder="请输入电话/邮箱"></el-input>
</el-form-item>
<el-form-item prop="password">
<el-input type="password" placeholder="请输入密码" v-model="phoneOrEmail.password">
@ -80,6 +80,21 @@
<el-button type="primary" @click="phoneSubmit"> </el-button>
</span>
</el-dialog>
<el-dialog title="请选择您要登录的用户" :visible.sync="userVisible" :close-on-click-modal="false" custom-class="user-dia"
width="500px">
<p class="tips">该手机号已绑定以下用户信息</p>
<ul class="users">
<li :class="{ isEnable: !user.isEnable }" v-for="(user, i) in users" :key="i" @click="chooseUser(user)">
<span>{{ user.schoolName }}{{ user.userName }}{{ user.workNumber }}{{
user.isEnable
? ''
: '(已禁用)' }}</span>
<i class="el-icon-right"></i>
</li>
</ul>
</el-dialog>
<v-footer class="footer" ref="footer"></v-footer>
</div>
</template>
@ -115,7 +130,6 @@ export default {
platform: 3,
random: '',
distinguish: 1,
type: 2
},
rules: {
account: [{ required: true, message: '请输入账号', trigger: 'blur' }],
@ -127,16 +141,15 @@ export default {
showPhoneVerify: true,// -
PhoneVerificationIMG: '',//
phoneOrEmail: {
account: '',
workNumber: '',
password: '',
code: '',
platform: 3,
random: '',
distinguish: 2,
type: 2
distinguish: 1,
},
phoneOrEmailrules: {
account: [{ validator: regPhoneOrEmail, trigger: 'blur' }],
workNumber: [{ validator: regPhoneOrEmail, trigger: 'blur' }],
password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
code: [{ required: true, message: '请输入验证码', trigger: 'blur' }],
},
@ -147,8 +160,11 @@ export default {
phoneDisabled: false,
phoneBtnText: '发送验证码',
phoneTimer: '',
phoneOpener: ''
phoneOpener: '',
userVisible: false,
users: [],
};
},
components: {
@ -182,23 +198,21 @@ export default {
let param = val === 'phone' ? this.phoneOrEmail : this.param
this.$refs[ref].validate(valid => {
if (valid) {
this.$post(this.api.logins, param).then(res => {
const { message } = res
sessionStorage.setItem('token', res.data.token)
this.$get(`${this.api.getUserRolesPermissionMenu}?platformId=${Setting.platformId}`).then(res => {
const list = res.permissionMenu
addRoutes(res.permissionMenu[0].children)
this.$store.commit('setDataPer', res.dataPermissionList)
this.$message.success(message);
this.$router.push({
path: list[0].children[0].path
});
localStorage.setItem('ms_username', this.param.username);
}).catch(err => {
if (err.status === 500) {
sessionStorage.clear()
this.$post(this.api.logins, param).then(({ status, data, message }) => {
if (status == 200) {
const accounts = data.userAccounts
//
if (accounts instanceof Array) {
this.users = accounts
this.userVisible = true
} else {
sessionStorage.setItem('token', data.token)
this.setLogin()
}
})
} else {
param.code = ''
this.$message.error(message)
}
}).catch(err => {
if (err.status === 30001) {
this.phoneVisible = true
@ -212,7 +226,32 @@ export default {
return false;
}
});
},
//
chooseUser (user) {
user.isEnable && this.$post(`${this.api.getToken}?id=${user.id}`).then(({ data }) => {
sessionStorage.setItem('token', data.token)
this.token = data.token
this.setLogin()
}).catch(res => { })
},
//
async setLogin () {
try {
const res = await this.$get(`${this.api.getUserRolesPermissionMenu}?platformId=${Setting.platformId}`)
const list = res.permissionMenu
addRoutes(res.permissionMenu[0].children)
this.$store.commit('setDataPer', res.dataPermissionList)
this.$message.success('登录成功!')
this.$router.push({
path: list[0].children[0].path
});
localStorage.setItem('ms_username', this.param.username);
} catch (e) {
if (e.status === 500) {
sessionStorage.clear()
}
}
},
blur () {
this.param.random = Math.floor(Math.random() * 999999999)
@ -437,6 +476,46 @@ img {
color: #666;
}
/deep/.user-dia {
.tips {
margin-bottom: 20px;
text-align: center;
color: #666;
}
.users {
li {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 15px;
margin-bottom: 10px;
line-height: 40px;
font-size: 14px;
background-color: #ebeef5;
cursor: pointer;
&.isEnable {
color: #c0c4cc;
background-color: #f5f7fa;
cursor: not-allowed;
}
&:last-child {
margin-bottom: 0;
}
&:hover {
background-color: #d3e0ff;
}
i {
font-size: 16px;
}
}
}
}
@media (max-width: 1600px) {
/deep/.ms-login {
width: 1000px;

@ -1,103 +1,69 @@
<template>
<div>
<el-card shadow="hover"
class="m-b-20">
<el-card shadow="hover" class="m-b-20">
<div>
<p class="m-b-20">比赛名称</p>
{{ form.stageName }}
</div>
</el-card>
<el-card shadow="hover"
class="m-b-20">
<el-card shadow="hover" class="m-b-20">
<div>
<p class="m-b-20">比赛时间</p>
<div class="date-inputs">
起止时间
<div style="display: inline-flex;align-items: center;">
<el-date-picker v-model="form.time"
type="datetimerange"
range-separator="~"
start-placeholder="开始日期"
end-placeholder="结束日期"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
@change="timeChange">
<el-date-picker v-model="form.time" type="datetimerange" range-separator="~" start-placeholder="开始日期"
end-placeholder="结束日期" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
@change="timeChange">
</el-date-picker>
<el-alert style="width: auto;padding: 4px 16px;margin-left: 10px;"
:title="'(请设置在 ' + step1.playStartTime + ' ~ ' + step1.playEndTime + '间)'"
type="error"
:closable="false"
effect="dark">
:title="'(请设置在 ' + step1.playStartTime + ' ~ ' + step1.playEndTime + '间)'" type="error" :closable="false"
effect="dark">
</el-alert>
</div>
</div>
</div>
</el-card>
<el-card shadow="hover"
class="mgr20 m-b-20">
<el-card shadow="hover" class="mgr20 m-b-20">
<div>
<p class="m-b-20">课程</p>
<p class="m-b-20">系统</p>
<div class="inline-input">
<el-cascader ref="cur"
v-model="mallIds"
:options="curs"
:props="{ checkStrictly: true, value: 'id' }"
popper-class="course-cas"
@expand-change="curChange"
@change="curChange"></el-cascader>
<el-select v-model="systemId" placeholder="请选择系统" @change="getProject">
<el-option v-for="(item, i) in systems" :key="i" :label="item.systemName" :value="item.systemId">
</el-option>
</el-select>
</div>
</div>
</el-card>
<el-card shadow="hover"
class="m-b-20">
<el-card shadow="hover" class="m-b-20">
<div class="flex-between m-b-20">
<span>实训项目</span>
<div style="display: inline-flex;">
<div>
<el-input placeholder="请输入项目名称"
prefix-icon="el-icon-search"
v-model.trim="keyword"
clearable></el-input>
<el-input placeholder="请输入项目名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input>
</div>
<el-button style="margin-left: 5px"
type="primary"
round
@click="toProject">自定义实验项目</el-button>
<el-button style="margin-left: 5px" type="primary" round @click="toProject">自定义实验项目</el-button>
</div>
</div>
<!-- 实训项目表格 -->
<el-table :data="projects"
class="table"
stripe
header-align="center">
<el-table-column width="60"
label="选择"
align="center">
<el-table :data="projects" class="table" stripe header-align="center">
<el-table-column width="60" label="选择" align="center">
<template slot-scope="scope">
<el-radio v-model="form.projectId"
:label="scope.row.projectId">&nbsp;</el-radio>
<el-radio v-model="form.projectId" :label="scope.row.projectId">&nbsp;</el-radio>
</template>
</el-table-column>
<el-table-column prop="projectName"
label="项目名称"
align="center"></el-table-column>
<el-table-column prop="auth"
label="项目权限"
align="center">
<el-table-column prop="projectName" label="项目名称" align="center"></el-table-column>
<el-table-column prop="auth" label="项目权限" align="center">
<template slot-scope="scope">
{{ permissionsKeys[scope.row.permissions] }}
</template>
</el-table-column>
<el-table-column prop="founder"
label="创建人"
align="center">
<el-table-column prop="founder" label="创建人" align="center">
<template slot-scope="scope">
{{ scope.row.founder ? '老师创建' : '系统内置' }}
</template>
</el-table-column>
<el-table-column prop="createTime"
label="创建时间"
align="center"></el-table-column>
<el-table-column prop="createTime" label="创建时间" align="center"></el-table-column>
<!-- <el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="text" @click="showProject(scope.row)">查看</el-button>
@ -105,18 +71,14 @@
</el-table-column> -->
</el-table>
<div class="pagination">
<el-pagination background
:page-size="pageSize"
@current-change="handleCurrentChange"
layout="total,prev, pager, next"
:total="total"></el-pagination>
<el-pagination background :page-size="pageSize" @current-change="handleCurrentChange"
layout="total,prev, pager, next" :total="total"></el-pagination>
</div>
</el-card>
<div style="text-align: center">
<el-button @click="back">返回</el-button>
<el-button type="primary"
@click="save">保存</el-button>
<el-button type="primary" @click="save">保存</el-button>
</div>
</div>
</template>
@ -129,14 +91,13 @@ export default {
data () {
return {
loadIns: null,
mallIds: [],
curs: [],
systems: [],
keyword: '',
projects: [],
page: 1,
pageSize: 5,
total: 0,
sysId: '',
systemId: '',
permissionsKeys: ['练习', '考核', '竞赛'],
timeInvalid: false
};
@ -163,68 +124,27 @@ export default {
//
async getCourse () {
const sid = this.$store.state.dataPer.find(e => e.permissionName === '服务配置')
const { serviceList } = await this.$post(this.api.queryServiceConfig, {
const res = await this.$post(this.api.queryServiceConfig, {
pageNum: 1,
pageSize: 1000,
supplierId: sid ? sid.supplierId : ''
})
const { page } = await this.$post(this.api.listOfGoods, {
pageNum: 1,
pageSize: 10000,
hotTag: 1,
sort: 0,
isAssociatedProduct: 1,
isShelves: 0,
})
const { records } = page
const { mallId, cid, systemId } = this.form
const { records } = res.serviceList
if (records.length) {
serviceList.records.map(e => {
e.id = +e.systemId
e.label = e.systemName
})
records.map(e => {
e.id = +e.mallId
e.label = e.productName
e.children = serviceList.records.filter(n => e.systemId.split(',').includes(n.systemId)) //
})
this.curs = records
//
const first = records[0]
this.mallIds = [mallId || first.mallId, systemId || first.children[0].id]
this.form.mallId = mallId || first.mallId
this.form.cid = cid || +first.associatedProduct
this.form.systemId = systemId || first.systemId
this.sysId = systemId || first.systemId
this.systems = records
this.systemId = records[0].systemId
this.loadIns = Loading.service()
this.getProject()
}
},
//
curChange (val) {
const id = val[0]
const item = this.curs.find(e => e.id == id)
if (val.length === 1) {
//
this.mallIds = [id, item.children[0].id]
}
this.form.mallId = id
this.form.cid = +item.associatedProduct
this.form.systemId = this.mallIds[1]
this.sysId = this.mallIds[1]
this.loadIns = Loading.service()
this.getProject()
},
//
getProject () {
this.$post(this.api.getProjectAssessmentByCompetition, {
pageNum: this.page,
pageSize: this.pageSize,
cid: this.form.cid,
projectName: this.keyword,
systemId: this.sysId,
systemId: this.systemId,
permissions: 2
}).then(({ data }) => {
this.projects = data.records
@ -302,5 +222,4 @@ export default {
};
</script>
<style scoped lang="scss">
</style>
<style scoped lang="scss"></style>

@ -55,7 +55,11 @@ export default {
AbnormalTeam
},
mounted () {
Setting.dynamicRoute && this.initTabs()
if (Setting.dynamicRoute) {
this.initTabs()
} else {
this.active = 'tab1'
}
},
methods: {
async initTabs () {

@ -6,10 +6,11 @@
<script>
import Util from '@/libs/util'
import Setting from '@/setting'
export default {
data () {
return {
url: `http://121.37.12.51/exam/#/quesBankType?token=${sessionStorage.getItem('token')}`
url: `http://${Setting.isDev ? '192.168.31.125:8098' : '121.37.12.51/examination'}/#/quesBankType?token=${sessionStorage.getItem('token')}`
};
},
mounted () {

Loading…
Cancel
Save