c0aee960 by 华明祺

培训报名规则修改

1 parent 4b268e3f
1 <template> 1 <template>
2 <view> 2 <view>
3 <!-- 培训信息完善 --> 3 <!-- 培训信息完善 -->
4 <view class="title-left-border">培训信息</view> 4 <view class="title-left-border">培训信息</view>
5 <uni-forms ref="baseForm" :modelValue="form" label-width="120"> 5 <uni-forms ref="baseForm" :modelValue="form" label-width="120">
6 <uni-forms-item label="所在单位名称" required name="unitName"> 6 <uni-forms-item label="所在单位名称" required name="unitName">
7 <uni-easyinput v-model="form.unitName" placeholder="请输入所在单位名称" /> 7 <uni-easyinput v-model="form.unitName" placeholder="请输入所在单位名称" />
8 </uni-forms-item> 8 </uni-forms-item>
9 <uni-forms-item label="现任职务" required name="unitRole"> 9 <uni-forms-item label="现任职务" required name="unitRole">
10 <uni-easyinput v-model="form.unitRole" placeholder="请输入现任职务" /> 10 <uni-easyinput v-model="form.unitRole" placeholder="请输入现任职务" />
11 </uni-forms-item> 11 </uni-forms-item>
12 <view v-if="activity.invoiceFlag=='1'"> 12 <view v-if="activity.invoiceFlag=='1'">
13 <uni-forms-item label="是否需要发票" required name="invoiceFlag"> 13 <uni-forms-item label="是否需要发票" required name="invoiceFlag">
14 <uni-data-checkbox v-model="form.invoiceFlag" :localdata="invoiceFlag" /> 14 <uni-data-checkbox v-model="form.invoiceFlag" :localdata="invoiceFlag" />
15 </uni-forms-item> 15 </uni-forms-item>
16 <uni-forms-item label="发票形式" v-if="form.invoiceFlag=='1'" required name="invoiceType"> 16 <uni-forms-item label="发票形式" v-if="form.invoiceFlag=='1'" required name="invoiceType">
17 <uni-data-checkbox v-model="form.invoiceType" :localdata="invoiceType" /> 17 <uni-data-checkbox v-model="form.invoiceType" :localdata="invoiceType" />
18 </uni-forms-item> 18 </uni-forms-item>
19 <uni-forms-item label="开票信息" v-if="form.invoiceFlag=='1'" required name="invoiceInfo"> 19 <uni-forms-item label="开票信息" v-if="form.invoiceFlag=='1'" required name="invoiceInfo">
20 <uni-easyinput v-model="form.invoiceInfo" placeholder="请输入开票信息" /> 20 <uni-easyinput v-model="form.invoiceInfo" placeholder="请输入开票信息" />
21 </uni-forms-item> 21 </uni-forms-item>
22 </view> 22 </view>
23 <uni-forms-item :label="c.name" v-for="c in customInfo" :key="c.id"> 23 <uni-forms-item :label="c.name" v-for="c in customInfo" :key="c.id">
24 <uni-easyinput v-if="c.type=='1'" v-model="form.customInfoObj[c.id]" placeholder="请输入" /> 24 <uni-easyinput v-if="c.type=='1'" v-model="form.customInfoObj[c.id]" placeholder="请输入" />
25 <view> 25 <view>
26 26
27 <uni-file-picker v-if="c.type == '2'" limit="1" file-mediatype="all" file-extname="doc,docx,pdf,txt" 27 <uni-file-picker v-if="c.type == '2'" limit="1" file-mediatype="all" file-extname="doc,docx,pdf,txt"
28 v-model="c.value" @select="selectFile" 28 v-model="c.value" @select="selectFile"
29 @delete="delSupplementFile(c,$event)" /> 29 @delete="delSupplementFile(c,$event)" />
30 <text v-if="c.type == '2'" style="font-size: 24rpx;color: #999;">仅支持上传doc,docx,pdf,txt</text> 30 <text v-if="c.type == '2'" style="font-size: 24rpx;color: #999;">仅支持上传doc,docx,pdf,txt</text>
31 31
32 <uni-file-picker v-if="c.type == '3'" v-model="upSupplement3Value" return-type="object" limit="1" 32 <uni-file-picker v-if="c.type == '3'" v-model="upSupplement3Value" return-type="object" limit="1"
33 @select="upSupplement3" @delete="delSupplementImg(c,$event)" /> 33 @select="upSupplement3" @delete="delSupplementImg(c,$event)" />
34 </view> 34 </view>
35 <uni-data-select v-model="c.value" v-if="c.type == '4'" :localdata="c.option"></uni-data-select> 35 <uni-data-select v-model="c.value" v-if="c.type == '4'" :localdata="c.option"></uni-data-select>
36 36
37 </uni-forms-item> 37 </uni-forms-item>
38 38
39 39
40 40
41 </uni-forms> 41 </uni-forms>
42 </view> 42 </view>
43 43
44 <view class="fixedBottom"> 44 <view class="fixedBottom">
45 <button class="btn btn-red-kx" @click="prev">上一步</button> 45 <button class="btn btn-red-kx" @click="prev">上一步</button>
46 <button class="btn btn-red" @click="next">下一步</button> 46 <button class="btn btn-red" @click="next">下一步</button>
47 </view> 47 </view>
48 </template> 48 </template>
49 49
50 <script setup> 50 <script setup>
51 import { 51 import {
52 onLoad 52 onLoad
53 } from '@dcloudio/uni-app' 53 } from '@dcloudio/uni-app'
54 import { 54 import {
55 ref, 55 ref,
56 reactive, 56 reactive,
57 toRefs, 57 toRefs,
58 computed, 58 computed,
59 watch 59 watch
60 } from 'vue' 60 } from 'vue'
61 import _ from 'lodash' 61 import _ from 'lodash'
62 import * as train from '@/training/train.js' 62 import * as train from '@/training/train.js'
63 63
64 const emit = defineEmits(['prev', 'next']) 64 const emit = defineEmits(['prev', 'next'])
65 const props = defineProps({ 65 const props = defineProps({
66 activity: { 66 activity: {
67 type: Object, 67 type: Object,
68 default: () => {} 68 default: () => {}
69 }, 69 },
70 trainId: { 70 trainId: {
71 type: String, 71 type: String,
72 default: () => {} 72 default: () => {}
73 }, 73 },
74 active: { 74 active: {
75 type: Number, 75 type: Number,
76 default: () => {} 76 default: 0
77 } 77 }
78 78
79 }) 79 })
80 80
81 const customInfo = computed(() => { 81 const customInfo = computed(() => {
82 if (props.activity.customInfo) { 82 if (props.activity.customInfo) {
83 return JSON.parse(props.activity.customInfo).info 83 return JSON.parse(props.activity.customInfo).info
84 } else { 84 } else {
85 return [] 85 return []
86 } 86 }
87 }) 87 })
88 88
89 const data = reactive({ 89 const data = reactive({
90 form: { 90 form: {
91 invoiceFlag: '1', 91 invoiceFlag: '1',
92 customInfoObj: {} 92 customInfoObj: {}
93 }, 93 },
94 invoiceFlag: [{ 94 invoiceFlag: [{
95 value: '0', 95 value: '0',
96 text: '否' 96 text: '否'
97 }, { 97 }, {
98 value: '1', 98 value: '1',
99 text: '是' 99 text: '是'
100 }], 100 }],
101 invoiceType: [{ 101 invoiceType: [{
102 value: 0, 102 value: 0,
103 text: '电子票' 103 text: '电子票'
104 }, { 104 }, {
105 value: 1, 105 value: 1,
106 text: '纸质专票' 106 text: '纸质专票'
107 }, { 107 }, {
108 value: 2, 108 value: 2,
109 text: '纸质普票' 109 text: '纸质普票'
110 }] 110 }]
111 }) 111 })
112 const { 112 const {
113 form, 113 form,
114 invoiceType, 114 invoiceType,
115 invoiceFlag 115 invoiceFlag
116 } = toRefs(data) 116 } = toRefs(data)
117 117
118 watch(() => props.activity.invoiceFlag, (val) => { 118 watch(() => props.activity.invoiceFlag, (val) => {
119 if (val == '1') { 119 if (val == '1') {
120 if (!form.value.invoiceType) { 120 if (!form.value.invoiceType) {
121 form.value.invoiceType = _.orderBy(props.activity.invoiceType.split(','))[0] 121 form.value.invoiceType = _.orderBy(props.activity.invoiceType.split(','))[0]
122 } 122 }
123 } 123 }
124 }, { 124 }, {
125 immediate: true 125 immediate: true
126 }) 126 })
127 watch(() => props.active, (val) => { 127 watch(() => props.active, (val) => {
128 if (val == 2) { 128 if (val == 2) {
129 uni.showLoading({ 129 uni.showLoading({
130 title:'加载中' 130 title:'加载中'
131 }) 131 })
132 train.getTrainPersonalInfo(props.trainId).then(res => { 132 train.getTrainPersonalInfo(props.trainId).then(res => {
133 133 form.value = res.data || {}
134 form.value = res.data || {} 134 if (res.data?.customInfo) {
135 if (res.data?.customInfo) { 135 form.value.customInfoObj = JSON.parse(res.data.customInfo)
136 form.value.customInfoObj = JSON.parse(res.data.customInfo) 136 } else {
137 } else { 137 form.value.customInfoObj = {}
138 form.value.customInfoObj = {} 138 }
139 } 139 uni.hideLoading()
140 uni.hideLoading() 140 })
141 141 }
142 }) 142 })
143 } 143
144 }) 144 function prev() {
145 145 emit('prev')
146 function prev() { 146 }
147 emit('prev') 147
148 } 148 function next() {
149 149 // 判断必填
150 function next() { 150 if(!form.value.unitName){
151 // 判断必填 151 uni.showToast({
152 if(!form.value.unitName){ 152 title: '请填写所在单位',
153 uni.showToast({ 153 icon: 'none'
154 title: '请填写所在单位', 154 })
155 icon: 'none' 155 return
156 }) 156 }
157 return 157 if(!form.value.unitRole){
158 } 158 uni.showToast({
159 if(!form.value.unitRole){ 159 title: '请填写职务信息',
160 uni.showToast({ 160 icon: 'none'
161 title: '请填写职务信息', 161 })
162 icon: 'none' 162 return
163 }) 163 }
164 return 164 form.value.activityId = props.trainId
165 } 165 form.value.customInfo = JSON.stringify(form.value.customInfoObj)
166 form.value.activityId = props.trainId 166 train.savePersonalInfo(form.value).then(() => {
167 form.value.customInfo = JSON.stringify(form.value.customInfoObj) 167 uni.showToast({
168 train.savePersonalInfo(form.value).then(() => { 168 title: '保存成功',
169 uni.showToast({ 169 icon: 'none'
170 title: '保存成功', 170 }).finally(res=>{
171 icon: 'none' 171 emit('next')
172 }).finally(res=>{ 172 })
173 emit('next') 173 })
174 }) 174 }
175 })
176 }
177 </script> 175 </script>
178 176
179 <style scoped lang="scss"> 177 <style scoped lang="scss">
......
...@@ -2,20 +2,20 @@ import request from '@/common/request.js' ...@@ -2,20 +2,20 @@ import request from '@/common/request.js'
2 import config from '@/config.js' 2 import config from '@/config.js'
3 // 获取培训列表 3 // 获取培训列表
4 export function getTrainList(params) { 4 export function getTrainList(params) {
5 return request({ 5 return request({
6 url: `${config.trainUrl_api}/webPc/getTrains`, 6 url: `${config.trainUrl_api}/webPc/getTrains`,
7 method: 'get', 7 method: 'get',
8 params: params 8 params: params
9 }) 9 })
10 } 10 }
11 11
12 // 查看培训项目 12 // 查看培训项目
13 export function getTrainDetail(id) { 13 export function getTrainDetail(id) {
14 return request({ 14 return request({
15 url: `${config.trainUrl_api}/webPc/getTrainDetails`, 15 url: `${config.trainUrl_api}/webPc/getTrainDetails`,
16 method: 'get', 16 method: 'get',
17 params: {id} 17 params: { id }
18 }) 18 })
19 } 19 }
20 export function getPersonalInfo() { 20 export function getPersonalInfo() {
21 return request({ 21 return request({
...@@ -89,4 +89,13 @@ export function commitSign(data) { ...@@ -89,4 +89,13 @@ export function commitSign(data) {
89 method: 'put', 89 method: 'put',
90 params: data 90 params: data
91 }) 91 })
92 }
...\ No newline at end of file ...\ No newline at end of file
92 }
93
94
95 export function getAllRules(id) {
96 return request({
97 url: `${config.trainUrl_api}/train/activity/getAllRules`,
98 method: 'get',
99 params: { id }
100 })
101 }
......
1 <template> 1 <template>
2 <view class="pd20"> 2 <view class="pd20">
3 <uni-steps :options="steps" active-icon="checkmarkempty" :active="active" /> 3 <uni-steps :options="steps" active-icon="checkmarkempty" :active="active" />
4 </view> 4 </view>
5 <view class="hasfixedbottom"> 5 <view class="hasfixedbottom">
6 <view class="wpage"> 6 <view class="wpage">
7 <step1 v-show="active==0" @prev="prev" @next="next" :activity="activity" /> 7 <step1 v-show="active==0" @prev="prev" @next="next" :activity="activity" />
8 <step2 v-show="active==1" @prev="prev" @next="next" :personal="personal" /> 8 <step2 v-show="active==1" @prev="prev" @next="next" :personal="personal" />
9 <step3 v-show="active==2" @prev="prev" @next="next" :activity="activity" :trainId="trainId" 9 <step3 v-show="active==2" @prev="prev" @next="next" :activity="activity" :trainId="trainId"
10 :active="active" /> 10 :active="active" />
11 <step4 v-show="active==3" @prev="prev" @publish="publish" :personal="personal" :activity="activity" 11 <step4 v-show="active==3" @prev="prev" @publish="publish" :personal="personal" :activity="activity"
12 :exam-list="examList" :train-list="trainList" :trainId="trainId"/> 12 :exam-list="examList" :train-list="trainList" :trainId="trainId" :active="active"/>
13 </view> 13 </view>
14 </view> 14 </view>
15 15
16 </template> 16 </template>
17 17
18 <script setup> 18 <script setup>
19 import { 19 import {
20 onLoad 20 onLoad
21 } from '@dcloudio/uni-app' 21 } from '@dcloudio/uni-app'
22 import { 22 import {
23 ref, 23 ref,
24 reactive, 24 reactive,
25 toRefs 25 toRefs
26 } from 'vue' 26 } from 'vue'
27 import * as train from '@/training/train.js' 27 import * as train from '@/training/train.js'
28 import step1 from '@/training/components/step1' 28 import step1 from '@/training/components/step1'
29 import step2 from '@/training/components/step2' 29 import step2 from '@/training/components/step2'
30 import step3 from '@/training/components/step3' 30 import step3 from '@/training/components/step3'
31 import step4 from '@/training/components/step4' 31 import step4 from '@/training/components/step4'
32 const active = ref(0) 32 const active = ref(0)
33 33
34 const steps = ref([{ 34 const steps = ref([{
35 title: '报名须知' 35 title: '报名须知'
36 }, { 36 }, {
37 title: '个人信息完善' 37 title: '个人信息完善'
38 }, { 38 }, {
39 title: '培训信息完善' 39 title: '培训信息完善'
40 }, { 40 }, {
41 title: '培训考试选择' 41 title: '培训考试选择'
42 }]) 42 }])
43 43
44 const data = reactive({ 44 const data = reactive({
45 activity: {}, 45 activity: {},
46 examList: [], 46 examList: [],
47 trainList: [], 47 trainList: [],
48 personal: {}, 48 personal: {},
49 trainId: '' 49 trainId: ''
50 }) 50 })
51 const { 51 const {
52 activity, 52 activity,
53 examList, 53 examList,
54 trainList, 54 trainList,
55 personal, 55 personal,
56 trainId 56 trainId
57 } = toRefs(data) 57 } = toRefs(data)
58 onLoad(options => { 58 onLoad(options => {
59 active.value = options.step || 0 59 active.value = options.step || 0
60 trainId.value = options.id 60 trainId.value = options.id
61 train.getTrainDetail(trainId.value).then((res) => { 61 train.getTrainDetail(trainId.value).then((res) => {
62 activity.value = res.data.activity 62 activity.value = res.data.activity
63 examList.value = res.data.examVoList 63 examList.value = res.data.examVoList
64 trainList.value = res.data.subjectTrainList 64 trainList.value = res.data.subjectTrainList
65 65
66 if (activity.value.signNoticeAttachment) { 66 if (activity.value.signNoticeAttachment) {
67 activity.value.signNoticeAttachment = JSON.parse(activity.value.signNoticeAttachment)[0] 67 activity.value.signNoticeAttachment = JSON.parse(activity.value.signNoticeAttachment)[0]
68 } 68 }
69 }) 69 })
70 70
71 train.getPersonalInfo().then((res) => { 71 train.getPersonalInfo().then((res) => {
72 personal.value = res.data || {} 72 personal.value = res.data || {}
73 }) 73 })
74 }) 74 })
75 75
76 function next() { 76 function next() {
77 active.value++ 77 active.value++
78 } 78 }
79 79
80 function prev() { 80 function prev() {
81 active.value-- 81 active.value--
82 } 82 }
83 83
84 function publish() { 84 function publish() {
85 uni.redirectTo({ 85 uni.redirectTo({
86 url: `/training/trainList` 86 url: `/training/trainList`
87 }); 87 });
88 } 88 }
89 </script> 89 </script>
90 90
91 <style scoped lang="scss"> 91 <style scoped lang="scss">
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!