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() {
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']),
},
};
</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 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 VueRouter from 'vue-router';

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

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

110
src/views/Apply/apply.vue

@ -5,28 +5,33 @@
<div class="container px-6 bg-white">
<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>
<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 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>
<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 class="item-box flex justify-between items-center border-b">
<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 class="item-box flex justify-between items-center border-b">
<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 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="flex justify-end items-center">
<span class="mr-1 truncate">请选择当前等级</span>
<input v-if="isApply" class="text-right outline-none" disabled v-model="positionName" />
<div v-else class="flex justify-end items-center" @click="openMenu(1)">
<span class="mr-1 truncate">{{ positionName }}</span>
<a-icon type="right" />
</div>
</div>
@ -37,12 +42,12 @@
<div class="container px-6 bg-white">
<div class="item-box flex justify-between items-center border-b">
<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 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>
<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>
@ -51,7 +56,8 @@
<div class="container px-6 bg-white">
<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="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>
<a-icon type="right" />
</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="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="item-box text-center" v-for="(item, index) in targetList" :key="index" :id="item.id" @click="selectTarget(item)">
{{ 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);
}

2
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 () => {

2
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 () => {

2
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}` };

2
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 () => {

Loading…
Cancel
Save