From 20533e659b5fbd45fd3983697dd28ff712c52055 Mon Sep 17 00:00:00 2001 From: xuesinan <1404152492@qq.com> Date: Fri, 29 Oct 2021 14:59:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 30 +++++--- src/config/api.js | 2 +- src/router/index.js | 2 +- src/store/modules/home/state.js | 1 - src/views/Apply/apply.vue | 110 +++++++++++++++------------- src/views/Checked/Checked.vue | 2 +- src/views/Checking/Checking.vue | 2 +- src/views/Pay/Pay.vue | 2 +- src/views/PeopleList/PeopleList.vue | 2 +- 9 files changed, 87 insertions(+), 66 deletions(-) diff --git a/src/App.vue b/src/App.vue index e691ea2..210dbce 100644 --- a/src/App.vue +++ b/src/App.vue @@ -17,22 +17,32 @@ export default { }, async created() { - const userId = this.$route.query.uid; - const roleId = this.$route.query.rid; - const params = new URLSearchParams(); - params.append('userId', userId); - // const params = { userId }; + var query = window.location.search.substring(1); + var vars = query.split('&'); + + let userId = ''; + let roleId = ''; + let projectId = ''; + + vars.forEach((item, index) => { + let items = item.split('='); + if (items[0] == 'uid') { + userId = items[1]; + } else if (items[0] == 'pid') { + projectId = items[1]; + } else if (items[0] == 'rid') { + roleId = items[1]; + } + }); + const params = { userId: userId }; await this.getUserId(params); await this.setRoleId(roleId); - await this.getAllMembers({ projectId: this.$route.query.pid }); - this.setProjectId(this.$route.query.pid); - this.setUserId(this.$route.query.uid); + this.setProjectId(projectId); }, methods: { - ...mapMutations('home', ['setProjectId', 'setMembers', 'setRoleId', 'setUserId']), + ...mapMutations('home', ['setProjectId', 'setMembers', 'setRoleId']), ...mapActions('user', ['getUserId']), - ...mapActions('home', ['getAllMembers']), }, }; diff --git a/src/config/api.js b/src/config/api.js index 1b49140..0519e74 100644 --- a/src/config/api.js +++ b/src/config/api.js @@ -26,5 +26,5 @@ export const auditList = params => axios.post(`${defaultwbs}/teacher/getComplete // 审核结业申请 export const auditApply = params => axios.post(`${defaultwbs}/teacher/auditComplete`, params); -发证; +// 发证 export const certificate = params => axios.post(`${defaultwbs}/player/certificate`, params); diff --git a/src/router/index.js b/src/router/index.js index ee65004..0a977f8 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,4 +1,4 @@ -import Home from 'views/FirstPage/FirstPage.vue'; +import Home from 'views/Apply/apply.vue'; import Vue from 'vue'; import VueRouter from 'vue-router'; diff --git a/src/store/modules/home/state.js b/src/store/modules/home/state.js index 55d58e4..85a3d5d 100644 --- a/src/store/modules/home/state.js +++ b/src/store/modules/home/state.js @@ -7,7 +7,6 @@ */ const state = { projectId: '', - userId: '', clockInfos: [], // 考勤信息 members: [], // 所有成员 startTime: null, diff --git a/src/views/Apply/apply.vue b/src/views/Apply/apply.vue index 4c884a0..9972fd6 100644 --- a/src/views/Apply/apply.vue +++ b/src/views/Apply/apply.vue @@ -5,28 +5,33 @@
姓名*
- +
身份证号*
- +
年龄
- +
性别
- + + + + +
身份*
-
- 请选择当前等级 + +
+ {{ positionName }}
@@ -37,12 +42,12 @@
地址
- +
电话*
- +
@@ -51,7 +56,8 @@
培训目标*
-
+ +
{{ targetName }}
@@ -64,7 +70,7 @@
-
培训目标/当前身份
+
{{ title }}
{{ item.name }} @@ -94,8 +100,6 @@ import { mapState, mapMutations } from 'vuex'; import { getUserInfo, submitSignUp, getPositionList } from '@/config/api'; -const plainOptions = ['男', '女']; - export default { data() { return { @@ -103,17 +107,20 @@ export default { name: '', // 姓名 idCard: '', // 身份证 age: '', // 年龄 - gender: 0, // 性别 + gender: -1, // 性别 + genderName: '', // 性别 positionId: 0, // 身份 + positionName: '请选择当前身份', // 身份 address: '', // 地址 phone: '', // 手机 targetId: 0, // 目标 targetName: '请选择培训目标', // 目标名称 - plainOptions, // 单选选项 - value: '女', // 单选默认选中 targetList: [], showMenu: false, - isApply: 0, // 是否已经报完名 + isApply: 1, // 是否已经报完名 + title: '', + playerId: '', + currType: 1, }; }, @@ -123,33 +130,24 @@ export default { this.timer = setInterval(async () => { if (this.projectId) { clearInterval(this.timer); - await this.setParams(); + await this.getUserInfo(); await this.getTargetList(); - - // 自动移动到目标位置 - // document.querySelector('#scrollTo').scrollIntoView({ - // behavior: 'smooth', // 平滑过渡 - // block: 'start', // 上边框与视窗顶部平齐。默认值 - // }); } }, 300); }, methods: { - // ...mapMutations('home', ['setStartTime', 'setEndTime', 'setMemberIdList']), - onChange(e) { - console.log('radio1 checked', e.target.value); - this.gender = e.target.value == '男' ? 1 : 0; - }, - - async setParams() { - const { projectId, startTime, endTime, memberIdList, roleId } = this; - const params = { param: { projectId, memberIdList, startTime, endTime, roleId } }; - await this.getUserInfo(); + this.gender = e.target.value; }, - async openMenu() { + async openMenu(type) { + this.currType = type; + if (type === 1) { + this.title = '当前身份'; + } else { + this.title = '培训目标'; + } await this.getTargetList(); this.showMenu = true; }, @@ -163,8 +161,13 @@ export default { */ selectTarget(item) { this.cancel(); - this.targetId = item.id; - this.targetName = item.name; + if (this.currType == 1) { + this.positionId = item.id; + this.positionName = item.name; + } else if (this.currType == 2) { + this.targetId = item.id; + this.targetName = item.name; + } }, /** @@ -211,7 +214,7 @@ export default { return false; } - if (!this.targetId === 0) { + if (this.targetId === 0) { this.$message.info('请选择培训目标'); return false; } @@ -223,7 +226,7 @@ export default { idCard: this.idCard, age: this.age, gender: this.gender, - position: this.positionId, + positionId: this.positionId, address: this.address, phone: this.phone, targetId: this.targetId, @@ -233,7 +236,7 @@ export default { const res = await submitSignUp(params); const { code, msg, data } = res.data; if (code === 200) { - console.log(data); + window.history.back(); } else { this.$message.error(msg || '获取失败'); throw msg; @@ -251,16 +254,21 @@ export default { const params = { param: { projectId: this.projectId } }; const res = await getUserInfo(params); const { code, msg, data } = res.data; - if (code === 200 && data) { - this.isApply = 1; - this.name = data.name; - this.idCard = data.idCard; - this.age = data.age; - this.gender = data.gender; - this.position = data.position; - this.address = data.address; - this.phone = data.phone; - this.targetId = data.targetId; + if (code === 200) { + if (data) { + this.isApply = 1; + this.name = data.name; + this.idCard = data.idCard; + this.age = data.age; + this.genderName = data.gender == 1 ? '男' : '女'; + this.gender = data.gender; + this.positionName = data.position; + this.address = data.address; + this.phone = data.phone; + this.targetName = data.target; + } else { + this.isApply = 0; + } } else { this.$message.error(msg || '获取失败'); throw msg; @@ -300,6 +308,10 @@ export default { width: calc(100% - 80px); } + input:disabled { + background-color: transparent; + } + div.flex { width: calc(100% - 80px); } diff --git a/src/views/Checked/Checked.vue b/src/views/Checked/Checked.vue index 78710db..2d1b399 100644 --- a/src/views/Checked/Checked.vue +++ b/src/views/Checked/Checked.vue @@ -48,7 +48,7 @@ export default { }; }, - computed: mapState('home', ['projectId', 'userId', 'roleId']), + computed: mapState('home', ['projectId', 'roleId']), mounted() { this.timer = setInterval(async () => { diff --git a/src/views/Checking/Checking.vue b/src/views/Checking/Checking.vue index 3269cc1..9db4737 100644 --- a/src/views/Checking/Checking.vue +++ b/src/views/Checking/Checking.vue @@ -60,7 +60,7 @@ export default { }; }, - computed: mapState('home', ['projectId', 'userId', 'roleId']), + computed: mapState('home', ['projectId', 'roleId']), mounted() { this.timer = setInterval(async () => { diff --git a/src/views/Pay/Pay.vue b/src/views/Pay/Pay.vue index 0eebfe1..ee75ab0 100644 --- a/src/views/Pay/Pay.vue +++ b/src/views/Pay/Pay.vue @@ -80,7 +80,7 @@ export default { }, computed: { - ...mapState('home', ['projectId', 'userId', 'roleId']), + ...mapState('home', ['projectId', 'roleId']), headers() { const token = sessionStorage.getItem('anyringToken'); return { Authorization: `Bearer ${token}` }; diff --git a/src/views/PeopleList/PeopleList.vue b/src/views/PeopleList/PeopleList.vue index 449b24d..e09672d 100644 --- a/src/views/PeopleList/PeopleList.vue +++ b/src/views/PeopleList/PeopleList.vue @@ -53,7 +53,7 @@ export default { }; }, - computed: mapState('home', ['projectId', 'roleId', 'userId']), + computed: mapState('home', ['projectId', 'roleId']), mounted() { this.timer = setInterval(async () => {