c0aee960 by 华明祺

培训报名规则修改

1 parent 4b268e3f
<template>
<view>
<!-- 培训信息完善 -->
<view class="title-left-border">培训信息</view>
<uni-forms ref="baseForm" :modelValue="form" label-width="120">
<uni-forms-item label="所在单位名称" required name="unitName">
<uni-easyinput v-model="form.unitName" placeholder="请输入所在单位名称" />
</uni-forms-item>
<uni-forms-item label="现任职务" required name="unitRole">
<uni-easyinput v-model="form.unitRole" placeholder="请输入现任职务" />
</uni-forms-item>
<view v-if="activity.invoiceFlag=='1'">
<uni-forms-item label="是否需要发票" required name="invoiceFlag">
<uni-data-checkbox v-model="form.invoiceFlag" :localdata="invoiceFlag" />
</uni-forms-item>
<uni-forms-item label="发票形式" v-if="form.invoiceFlag=='1'" required name="invoiceType">
<uni-data-checkbox v-model="form.invoiceType" :localdata="invoiceType" />
</uni-forms-item>
<uni-forms-item label="开票信息" v-if="form.invoiceFlag=='1'" required name="invoiceInfo">
<uni-easyinput v-model="form.invoiceInfo" placeholder="请输入开票信息" />
</uni-forms-item>
</view>
<uni-forms-item :label="c.name" v-for="c in customInfo" :key="c.id">
<uni-easyinput v-if="c.type=='1'" v-model="form.customInfoObj[c.id]" placeholder="请输入" />
<view>
<uni-file-picker v-if="c.type == '2'" limit="1" file-mediatype="all" file-extname="doc,docx,pdf,txt"
v-model="c.value" @select="selectFile"
@delete="delSupplementFile(c,$event)" />
<text v-if="c.type == '2'" style="font-size: 24rpx;color: #999;">仅支持上传doc,docx,pdf,txt</text>
<uni-file-picker v-if="c.type == '3'" v-model="upSupplement3Value" return-type="object" limit="1"
@select="upSupplement3" @delete="delSupplementImg(c,$event)" />
</view>
<uni-data-select v-model="c.value" v-if="c.type == '4'" :localdata="c.option"></uni-data-select>
</uni-forms-item>
</uni-forms>
</view>
<view class="fixedBottom">
<button class="btn btn-red-kx" @click="prev">上一步</button>
<button class="btn btn-red" @click="next">下一步</button>
</view>
<view>
<!-- 培训信息完善 -->
<view class="title-left-border">培训信息</view>
<uni-forms ref="baseForm" :modelValue="form" label-width="120">
<uni-forms-item label="所在单位名称" required name="unitName">
<uni-easyinput v-model="form.unitName" placeholder="请输入所在单位名称" />
</uni-forms-item>
<uni-forms-item label="现任职务" required name="unitRole">
<uni-easyinput v-model="form.unitRole" placeholder="请输入现任职务" />
</uni-forms-item>
<view v-if="activity.invoiceFlag=='1'">
<uni-forms-item label="是否需要发票" required name="invoiceFlag">
<uni-data-checkbox v-model="form.invoiceFlag" :localdata="invoiceFlag" />
</uni-forms-item>
<uni-forms-item label="发票形式" v-if="form.invoiceFlag=='1'" required name="invoiceType">
<uni-data-checkbox v-model="form.invoiceType" :localdata="invoiceType" />
</uni-forms-item>
<uni-forms-item label="开票信息" v-if="form.invoiceFlag=='1'" required name="invoiceInfo">
<uni-easyinput v-model="form.invoiceInfo" placeholder="请输入开票信息" />
</uni-forms-item>
</view>
<uni-forms-item :label="c.name" v-for="c in customInfo" :key="c.id">
<uni-easyinput v-if="c.type=='1'" v-model="form.customInfoObj[c.id]" placeholder="请输入" />
<view>
<uni-file-picker v-if="c.type == '2'" limit="1" file-mediatype="all" file-extname="doc,docx,pdf,txt"
v-model="c.value" @select="selectFile"
@delete="delSupplementFile(c,$event)" />
<text v-if="c.type == '2'" style="font-size: 24rpx;color: #999;">仅支持上传doc,docx,pdf,txt</text>
<uni-file-picker v-if="c.type == '3'" v-model="upSupplement3Value" return-type="object" limit="1"
@select="upSupplement3" @delete="delSupplementImg(c,$event)" />
</view>
<uni-data-select v-model="c.value" v-if="c.type == '4'" :localdata="c.option"></uni-data-select>
</uni-forms-item>
</uni-forms>
</view>
<view class="fixedBottom">
<button class="btn btn-red-kx" @click="prev">上一步</button>
<button class="btn btn-red" @click="next">下一步</button>
</view>
</template>
<script setup>
import {
onLoad
} from '@dcloudio/uni-app'
import {
ref,
reactive,
toRefs,
computed,
watch
} from 'vue'
import _ from 'lodash'
import * as train from '@/training/train.js'
const emit = defineEmits(['prev', 'next'])
const props = defineProps({
activity: {
type: Object,
default: () => {}
},
trainId: {
type: String,
default: () => {}
},
active: {
type: Number,
default: () => {}
}
})
const customInfo = computed(() => {
if (props.activity.customInfo) {
return JSON.parse(props.activity.customInfo).info
} else {
return []
}
})
const data = reactive({
form: {
invoiceFlag: '1',
customInfoObj: {}
},
invoiceFlag: [{
value: '0',
text: '否'
}, {
value: '1',
text: '是'
}],
invoiceType: [{
value: 0,
text: '电子票'
}, {
value: 1,
text: '纸质专票'
}, {
value: 2,
text: '纸质普票'
}]
})
const {
form,
invoiceType,
invoiceFlag
} = toRefs(data)
watch(() => props.activity.invoiceFlag, (val) => {
if (val == '1') {
if (!form.value.invoiceType) {
form.value.invoiceType = _.orderBy(props.activity.invoiceType.split(','))[0]
}
}
}, {
immediate: true
})
watch(() => props.active, (val) => {
if (val == 2) {
uni.showLoading({
title:'加载中'
})
train.getTrainPersonalInfo(props.trainId).then(res => {
form.value = res.data || {}
if (res.data?.customInfo) {
form.value.customInfoObj = JSON.parse(res.data.customInfo)
} else {
form.value.customInfoObj = {}
}
uni.hideLoading()
})
}
})
function prev() {
emit('prev')
}
function next() {
// 判断必填
if(!form.value.unitName){
uni.showToast({
title: '请填写所在单位',
icon: 'none'
})
return
}
if(!form.value.unitRole){
uni.showToast({
title: '请填写职务信息',
icon: 'none'
})
return
}
form.value.activityId = props.trainId
form.value.customInfo = JSON.stringify(form.value.customInfoObj)
train.savePersonalInfo(form.value).then(() => {
uni.showToast({
title: '保存成功',
icon: 'none'
}).finally(res=>{
emit('next')
})
})
}
import {
onLoad
} from '@dcloudio/uni-app'
import {
ref,
reactive,
toRefs,
computed,
watch
} from 'vue'
import _ from 'lodash'
import * as train from '@/training/train.js'
const emit = defineEmits(['prev', 'next'])
const props = defineProps({
activity: {
type: Object,
default: () => {}
},
trainId: {
type: String,
default: () => {}
},
active: {
type: Number,
default: 0
}
})
const customInfo = computed(() => {
if (props.activity.customInfo) {
return JSON.parse(props.activity.customInfo).info
} else {
return []
}
})
const data = reactive({
form: {
invoiceFlag: '1',
customInfoObj: {}
},
invoiceFlag: [{
value: '0',
text: '否'
}, {
value: '1',
text: '是'
}],
invoiceType: [{
value: 0,
text: '电子票'
}, {
value: 1,
text: '纸质专票'
}, {
value: 2,
text: '纸质普票'
}]
})
const {
form,
invoiceType,
invoiceFlag
} = toRefs(data)
watch(() => props.activity.invoiceFlag, (val) => {
if (val == '1') {
if (!form.value.invoiceType) {
form.value.invoiceType = _.orderBy(props.activity.invoiceType.split(','))[0]
}
}
}, {
immediate: true
})
watch(() => props.active, (val) => {
if (val == 2) {
uni.showLoading({
title:'加载中'
})
train.getTrainPersonalInfo(props.trainId).then(res => {
form.value = res.data || {}
if (res.data?.customInfo) {
form.value.customInfoObj = JSON.parse(res.data.customInfo)
} else {
form.value.customInfoObj = {}
}
uni.hideLoading()
})
}
})
function prev() {
emit('prev')
}
function next() {
// 判断必填
if(!form.value.unitName){
uni.showToast({
title: '请填写所在单位',
icon: 'none'
})
return
}
if(!form.value.unitRole){
uni.showToast({
title: '请填写职务信息',
icon: 'none'
})
return
}
form.value.activityId = props.trainId
form.value.customInfo = JSON.stringify(form.value.customInfoObj)
train.savePersonalInfo(form.value).then(() => {
uni.showToast({
title: '保存成功',
icon: 'none'
}).finally(res=>{
emit('next')
})
})
}
</script>
<style scoped lang="scss">
......
......@@ -2,20 +2,20 @@ import request from '@/common/request.js'
import config from '@/config.js'
// 获取培训列表
export function getTrainList(params) {
return request({
url: `${config.trainUrl_api}/webPc/getTrains`,
method: 'get',
params: params
})
return request({
url: `${config.trainUrl_api}/webPc/getTrains`,
method: 'get',
params: params
})
}
// 查看培训项目
export function getTrainDetail(id) {
return request({
url: `${config.trainUrl_api}/webPc/getTrainDetails`,
method: 'get',
params: {id}
})
return request({
url: `${config.trainUrl_api}/webPc/getTrainDetails`,
method: 'get',
params: { id }
})
}
export function getPersonalInfo() {
return request({
......@@ -89,4 +89,13 @@ export function commitSign(data) {
method: 'put',
params: data
})
}
\ No newline at end of file
}
export function getAllRules(id) {
return request({
url: `${config.trainUrl_api}/train/activity/getAllRules`,
method: 'get',
params: { id }
})
}
......
<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"/>
</view>
</view>
<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)
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 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
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]
}
})
if (activity.value.signNoticeAttachment) {
activity.value.signNoticeAttachment = JSON.parse(activity.value.signNoticeAttachment)[0]
}
})
train.getPersonalInfo().then((res) => {
personal.value = res.data || {}
})
})
train.getPersonalInfo().then((res) => {
personal.value = res.data || {}
})
})
function next() {
active.value++
}
function next() {
active.value++
}
function prev() {
active.value--
}
function prev() {
active.value--
}
function publish() {
uni.redirectTo({
url: `/training/trainList`
});
}
function publish() {
uni.redirectTo({
url: `/training/trainList`
});
}
</script>
<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!