trainSignUp.vue
2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<template>
<view class="pd20">
<uni-steps :options="steps" active-icon="checkmarkempty" :active="active" />
</view>
<view class="hasfixedbottom">
<view class="wpage">
<step1 v-show="active==0" @prev="prev" @next="next" :activity="activity" />
<step2 v-show="active==1" @prev="prev" @next="next" :personal="personal" />
<step3 v-show="active==2" @prev="prev" @next="next" :activity="activity" :trainId="trainId"
:active="active" />
<step4 v-show="active==3" @prev="prev" @publish="publish" :personal="personal" :activity="activity"
:exam-list="examList" :train-list="trainList" :trainId="trainId" :active="active"/>
</view>
</view>
</template>
<script setup>
import {
onLoad
} from '@dcloudio/uni-app'
import {
ref,
reactive,
toRefs
} from 'vue'
import * as train from '@/training/train.js'
import step1 from '@/training/components/step1'
import step2 from '@/training/components/step2'
import step3 from '@/training/components/step3'
import step4 from '@/training/components/step4'
const active = ref(0)
const steps = ref([{
title: '报名须知'
}, {
title: '个人信息完善'
}, {
title: '培训信息完善'
}, {
title: '培训考试选择'
}])
const data = reactive({
activity: {},
examList: [],
trainList: [],
personal: {},
trainId: ''
})
const {
activity,
examList,
trainList,
personal,
trainId
} = toRefs(data)
onLoad(options => {
active.value = options.step || 0
trainId.value = options.id
train.getTrainDetail(trainId.value).then((res) => {
activity.value = res.data.activity
examList.value = res.data.examVoList
trainList.value = res.data.subjectTrainList
if (activity.value.signNoticeAttachment) {
activity.value.signNoticeAttachment = JSON.parse(activity.value.signNoticeAttachment)[0]
}
})
train.getPersonalInfo().then((res) => {
personal.value = res.data || {}
})
})
function next() {
active.value++
}
function prev() {
active.value--
}
function publish() {
uni.redirectTo({
url: `/training/trainList`
});
}
</script>
<style scoped lang="scss">
.pd20 {
padding: 30rpx 0 0;
}
.wpage {
background-color: #fff;
width: 700rpx;
margin: 30rpx auto;
border-radius: 5rpx;
padding: 30rpx;
box-sizing: border-box;
}
</style>