Browse Source

报名

master
xuesinan 4 years ago
parent
commit
20533e659b
  1. 30
      src/App.vue
  2. 2
      src/config/api.js
  3. 2
      src/router/index.js
  4. 1
      src/store/modules/home/state.js
  5. 110
      src/views/Apply/apply.vue
  6. 2
      src/views/Checked/Checked.vue
  7. 2
      src/views/Checking/Checking.vue
  8. 2
      src/views/Pay/Pay.vue
  9. 2
      src/views/PeopleList/PeopleList.vue

30
src/App.vue

@ -17,22 +17,32 @@ export default {
}, },
async created() { async created() {
const userId = this.$route.query.uid; var query = window.location.search.substring(1);
const roleId = this.$route.query.rid; var vars = query.split('&');
const params = new URLSearchParams();
params.append('userId', userId); let userId = '';
// const params = { 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.getUserId(params);
await this.setRoleId(roleId); await this.setRoleId(roleId);
await this.getAllMembers({ projectId: this.$route.query.pid }); this.setProjectId(projectId);
this.setProjectId(this.$route.query.pid);
this.setUserId(this.$route.query.uid);
}, },
methods: { methods: {
...mapMutations('home', ['setProjectId', 'setMembers', 'setRoleId', 'setUserId']), ...mapMutations('home', ['setProjectId', 'setMembers', 'setRoleId']),
...mapActions('user', ['getUserId']), ...mapActions('user', ['getUserId']),
...mapActions('home', ['getAllMembers']),
}, },
}; };
</script> </script>

2
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 auditApply = params => axios.post(`${defaultwbs}/teacher/auditComplete`, params);
发证; // 发证
export const certificate = params => axios.post(`${defaultwbs}/player/certificate`, params); export const certificate = params => axios.post(`${defaultwbs}/player/certificate`, params);

2
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 Vue from 'vue';
import VueRouter from 'vue-router'; import VueRouter from 'vue-router';

1
src/store/modules/home/state.js

@ -7,7 +7,6 @@
*/ */
const state = { const state = {
projectId: '', projectId: '',
userId: '',
clockInfos: [], // 考勤信息 clockInfos: [], // 考勤信息
members: [], // 所有成员 members: [], // 所有成员
startTime: null, startTime: null,

110
src/views/Apply/apply.vue

@ -5,28 +5,33 @@
<div class="container px-6 bg-white"> <div class="container px-6 bg-white">
<div class="item-box flex justify-between items-center border-b"> <div class="item-box flex justify-between items-center border-b">
<div class="item-title text-gray-400">姓名<span class="text-red-500 ml-1 align-middle">*</span></div> <div class="item-title text-gray-400">姓名<span class="text-red-500 ml-1 align-middle">*</span></div>
<input class="text-right outline-none" v-model="name" type="text" placeholder="请输入您的姓名" /> <input class="text-right outline-none" :disabled="isApply" v-model="name" type="text" placeholder="请输入您的姓名" />
</div> </div>
<div class="item-box flex justify-between items-center border-b"> <div class="item-box flex justify-between items-center border-b">
<div class="item-title text-gray-400">身份证号<span class="text-red-500 ml-1 align-middle">*</span></div> <div class="item-title text-gray-400">身份证号<span class="text-red-500 ml-1 align-middle">*</span></div>
<input class="text-right outline-none" v-model="idCard" type="text" placeholder="请输入您的身份证号" /> <input class="text-right outline-none" :disabled="isApply" v-model="idCard" type="text" placeholder="请输入您的身份证号" />
</div> </div>
<div class="item-box flex justify-between items-center border-b"> <div class="item-box flex justify-between items-center border-b">
<div class="item-title text-gray-400">年龄</div> <div class="item-title text-gray-400">年龄</div>
<input class="text-right outline-none" v-model="age" type="number" placeholder="请输入您的年龄" /> <input class="text-right outline-none" :disabled="isApply" v-model="age" type="number" placeholder="请输入您的年龄" />
</div> </div>
<div class="item-box flex justify-between items-center border-b"> <div class="item-box flex justify-between items-center border-b">
<div class="item-title text-gray-400">性别</div> <div class="item-title text-gray-400">性别</div>
<a-radio-group :options="plainOptions" :default-value="value" @change="onChange" /> <input v-if="isApply" class="text-right outline-none" disabled v-model="genderName" />
<a-radio-group v-else v-model="gender" @change="onChange">
<a-radio :value="1"> </a-radio>
<a-radio :value="0"> </a-radio>
</a-radio-group>
</div> </div>
<div class="item-box flex justify-between items-center border-b"> <div class="item-box flex justify-between items-center border-b">
<div class="item-title text-gray-400">身份<span class="text-red-500 ml-1 align-middle">*</span></div> <div class="item-title text-gray-400">身份<span class="text-red-500 ml-1 align-middle">*</span></div>
<div class="flex justify-end items-center"> <input v-if="isApply" class="text-right outline-none" disabled v-model="positionName" />
<span class="mr-1 truncate">请选择当前等级</span> <div v-else class="flex justify-end items-center" @click="openMenu(1)">
<span class="mr-1 truncate">{{ positionName }}</span>
<a-icon type="right" /> <a-icon type="right" />
</div> </div>
</div> </div>
@ -37,12 +42,12 @@
<div class="container px-6 bg-white"> <div class="container px-6 bg-white">
<div class="item-box flex justify-between items-center border-b"> <div class="item-box flex justify-between items-center border-b">
<div class="item-title text-gray-400">地址</div> <div class="item-title text-gray-400">地址</div>
<input class="text-right outline-none" v-model="name" type="text" placeholder="请输入您的详细地址" /> <input class="text-right outline-none" :disabled="isApply" v-model="address" type="text" placeholder="请输入您的详细地址" />
</div> </div>
<div class="item-box flex justify-between items-center border-b"> <div class="item-box flex justify-between items-center border-b">
<div class="item-title text-gray-400">电话<span class="text-red-500 ml-1 align-middle">*</span></div> <div class="item-title text-gray-400">电话<span class="text-red-500 ml-1 align-middle">*</span></div>
<input class="text-right outline-none" v-model="idCard" type="text" placeholder="请输入您的电话" /> <input class="text-right outline-none" :disabled="isApply" v-model="phone" type="text" placeholder="请输入您的电话" />
</div> </div>
</div> </div>
@ -51,7 +56,8 @@
<div class="container px-6 bg-white"> <div class="container px-6 bg-white">
<div class="item-box flex justify-between items-center border-b"> <div class="item-box flex justify-between items-center border-b">
<div class="item-title text-gray-400">培训目标<span class="text-red-500 ml-1 align-middle">*</span></div> <div class="item-title text-gray-400">培训目标<span class="text-red-500 ml-1 align-middle">*</span></div>
<div class="flex justify-end items-center" @click="openMenu"> <input v-if="isApply" class="text-right outline-none" disabled v-model="targetName" />
<div v-else class="flex justify-end items-center" @click="openMenu(2)">
<span class="mr-1 truncate">{{ targetName }}</span> <span class="mr-1 truncate">{{ targetName }}</span>
<a-icon type="right" /> <a-icon type="right" />
</div> </div>
@ -64,7 +70,7 @@
<div class="fixed top-0 bottom-0 left-0 right-0 bg-black bg-opacity-60" v-if="showMenu"> <div class="fixed top-0 bottom-0 left-0 right-0 bg-black bg-opacity-60" v-if="showMenu">
<div class="target-list absolute bottom-0 w-full bg-white"> <div class="target-list absolute bottom-0 w-full bg-white">
<div class="item-box text-center font-semibold border-b">培训目标/当前身份</div> <div class="item-box text-center font-semibold border-b">{{ title }}</div>
<div class="list"> <div class="list">
<div class="item-box text-center" v-for="(item, index) in targetList" :key="index" :id="item.id" @click="selectTarget(item)"> <div class="item-box text-center" v-for="(item, index) in targetList" :key="index" :id="item.id" @click="selectTarget(item)">
{{ item.name }} {{ item.name }}
@ -94,8 +100,6 @@
import { mapState, mapMutations } from 'vuex'; import { mapState, mapMutations } from 'vuex';
import { getUserInfo, submitSignUp, getPositionList } from '@/config/api'; import { getUserInfo, submitSignUp, getPositionList } from '@/config/api';
const plainOptions = ['男', '女'];
export default { export default {
data() { data() {
return { return {
@ -103,17 +107,20 @@ export default {
name: '', // name: '', //
idCard: '', // idCard: '', //
age: '', // age: '', //
gender: 0, // gender: -1, //
genderName: '', //
positionId: 0, // positionId: 0, //
positionName: '请选择当前身份', //
address: '', // address: '', //
phone: '', // phone: '', //
targetId: 0, // targetId: 0, //
targetName: '请选择培训目标', // targetName: '请选择培训目标', //
plainOptions, //
value: '女', //
targetList: [], targetList: [],
showMenu: false, showMenu: false,
isApply: 0, // isApply: 1, //
title: '',
playerId: '',
currType: 1,
}; };
}, },
@ -123,33 +130,24 @@ export default {
this.timer = setInterval(async () => { this.timer = setInterval(async () => {
if (this.projectId) { if (this.projectId) {
clearInterval(this.timer); clearInterval(this.timer);
await this.setParams(); await this.getUserInfo();
await this.getTargetList(); await this.getTargetList();
//
// document.querySelector('#scrollTo').scrollIntoView({
// behavior: 'smooth', //
// block: 'start', //
// });
} }
}, 300); }, 300);
}, },
methods: { methods: {
// ...mapMutations('home', ['setStartTime', 'setEndTime', 'setMemberIdList']),
onChange(e) { onChange(e) {
console.log('radio1 checked', e.target.value); this.gender = 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();
}, },
async openMenu() { async openMenu(type) {
this.currType = type;
if (type === 1) {
this.title = '当前身份';
} else {
this.title = '培训目标';
}
await this.getTargetList(); await this.getTargetList();
this.showMenu = true; this.showMenu = true;
}, },
@ -163,8 +161,13 @@ export default {
*/ */
selectTarget(item) { selectTarget(item) {
this.cancel(); this.cancel();
this.targetId = item.id; if (this.currType == 1) {
this.targetName = item.name; 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; return false;
} }
if (!this.targetId === 0) { if (this.targetId === 0) {
this.$message.info('请选择培训目标'); this.$message.info('请选择培训目标');
return false; return false;
} }
@ -223,7 +226,7 @@ export default {
idCard: this.idCard, idCard: this.idCard,
age: this.age, age: this.age,
gender: this.gender, gender: this.gender,
position: this.positionId, positionId: this.positionId,
address: this.address, address: this.address,
phone: this.phone, phone: this.phone,
targetId: this.targetId, targetId: this.targetId,
@ -233,7 +236,7 @@ export default {
const res = await submitSignUp(params); const res = await submitSignUp(params);
const { code, msg, data } = res.data; const { code, msg, data } = res.data;
if (code === 200) { if (code === 200) {
console.log(data); window.history.back();
} else { } else {
this.$message.error(msg || '获取失败'); this.$message.error(msg || '获取失败');
throw msg; throw msg;
@ -251,16 +254,21 @@ export default {
const params = { param: { projectId: this.projectId } }; const params = { param: { projectId: this.projectId } };
const res = await getUserInfo(params); const res = await getUserInfo(params);
const { code, msg, data } = res.data; const { code, msg, data } = res.data;
if (code === 200 && data) { if (code === 200) {
this.isApply = 1; if (data) {
this.name = data.name; this.isApply = 1;
this.idCard = data.idCard; this.name = data.name;
this.age = data.age; this.idCard = data.idCard;
this.gender = data.gender; this.age = data.age;
this.position = data.position; this.genderName = data.gender == 1 ? '男' : '女';
this.address = data.address; this.gender = data.gender;
this.phone = data.phone; this.positionName = data.position;
this.targetId = data.targetId; this.address = data.address;
this.phone = data.phone;
this.targetName = data.target;
} else {
this.isApply = 0;
}
} else { } else {
this.$message.error(msg || '获取失败'); this.$message.error(msg || '获取失败');
throw msg; throw msg;
@ -300,6 +308,10 @@ export default {
width: calc(100% - 80px); width: calc(100% - 80px);
} }
input:disabled {
background-color: transparent;
}
div.flex { div.flex {
width: calc(100% - 80px); width: calc(100% - 80px);
} }

2
src/views/Checked/Checked.vue

@ -48,7 +48,7 @@ export default {
}; };
}, },
computed: mapState('home', ['projectId', 'userId', 'roleId']), computed: mapState('home', ['projectId', 'roleId']),
mounted() { mounted() {
this.timer = setInterval(async () => { this.timer = setInterval(async () => {

2
src/views/Checking/Checking.vue

@ -60,7 +60,7 @@ export default {
}; };
}, },
computed: mapState('home', ['projectId', 'userId', 'roleId']), computed: mapState('home', ['projectId', 'roleId']),
mounted() { mounted() {
this.timer = setInterval(async () => { this.timer = setInterval(async () => {

2
src/views/Pay/Pay.vue

@ -80,7 +80,7 @@ export default {
}, },
computed: { computed: {
...mapState('home', ['projectId', 'userId', 'roleId']), ...mapState('home', ['projectId', 'roleId']),
headers() { headers() {
const token = sessionStorage.getItem('anyringToken'); const token = sessionStorage.getItem('anyringToken');
return { Authorization: `Bearer ${token}` }; return { Authorization: `Bearer ${token}` };

2
src/views/PeopleList/PeopleList.vue

@ -53,7 +53,7 @@ export default {
}; };
}, },
computed: mapState('home', ['projectId', 'roleId', 'userId']), computed: mapState('home', ['projectId', 'roleId']),
mounted() { mounted() {
this.timer = setInterval(async () => { this.timer = setInterval(async () => {

Loading…
Cancel
Save