Browse Source

修改需求

master
岳鹏龙 8 months ago
parent
commit
e217f9bc4d
  1. 11
      src/api/index.ts
  2. 39
      src/pages/index/active/activeDetail.vue
  3. 13
      src/pages/index/index.vue
  4. 74
      src/pages/index/subform.vue
  5. 10
      src/pages/index/ztdetail.vue

11
src/api/index.ts

@ -75,7 +75,7 @@ export function ai(data: any) {
}) })
} }
//填写表单 //专题填写表单
export function specialSign(data: any) { export function specialSign(data: any) {
return request.http({ return request.http({
url: '/api/huiqitong/special/sign', url: '/api/huiqitong/special/sign',
@ -83,3 +83,12 @@ export function specialSign(data: any) {
data data
}) })
} }
//活动填写表单
export function activitySign(data: any) {
return request.http({
url: '/api/huiqitong/activity/sign',
method: 'POST',
data
})
}

39
src/pages/index/active/activeDetail.vue

@ -1,6 +1,6 @@
<template> <template>
<image style="width: 100%; height: 352rpx" :src="baseurl + detaildata.index_pic" mode=""></image> <image style="width: 100%; height: 352rpx" :src="baseurl + detaildata.index_pic" mode=""></image>
<view class="container"> <view class="container" :style="{height: detaildata.form?'calc(100vh - 552rpx)': 'calc(100vh - 352rpx)'}">
<text class="headtxt">{{ detaildata.title }}</text> <text class="headtxt">{{ detaildata.title }}</text>
<text class="address">活动地点{{ detaildata.address }}</text> <text class="address">活动地点{{ detaildata.address }}</text>
<view class="adressnum"> <view class="adressnum">
@ -19,6 +19,11 @@
<u-parse :content="detaildata.content"></u-parse> <u-parse :content="detaildata.content"></u-parse>
<text class="certetime">{{ detaildata.create_time }}</text> <text class="certetime">{{ detaildata.create_time }}</text>
</view> </view>
<view class="baombut" v-if="detaildata.form">
<view class="buttt" @click="gotij(detaildata.id, detaildata.form)">
立即报名
</view>
</view>
</template> </template>
<script setup> <script setup>
@ -29,6 +34,12 @@ import { activityInfo } from '@/api/index'
const baseurl = ref(import.meta.env.VITE_APP_BASE_URL + '/') const baseurl = ref(import.meta.env.VITE_APP_BASE_URL + '/')
const detaildata = ref({}) const detaildata = ref({})
const gotij = (id,item) => {
uni.navigateTo({
url: '/pages/index/subform?form='+JSON.stringify(item)+ '&id='+id +'&type='+'hd'
})
}
onLoad(async (param) => { onLoad(async (param) => {
await activityInfo(param.id).then((res) => { await activityInfo(param.id).then((res) => {
if (res.code === 1) { if (res.code === 1) {
@ -41,7 +52,7 @@ onLoad(async (param) => {
<style scoped lang="scss"> <style scoped lang="scss">
.container { .container {
background-color: #ffffff; background-color: #ffffff;
height: calc(100vh - 352rpx); height: calc(100vh - 552rpx);
width: 100%; width: 100%;
padding: 40rpx 40rpx 0 40rpx; padding: 40rpx 40rpx 0 40rpx;
box-sizing: border-box; box-sizing: border-box;
@ -149,4 +160,28 @@ onLoad(async (param) => {
color: #a1a1a1; color: #a1a1a1;
} }
} }
.baombut {
width: 100%;
padding: 36rpx 0;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(0, 0, 0, 0.3);
background: #FFFFFF;
position: fixed;
bottom: 0;
.buttt {
width: 574rpx;
height: 96rpx;
border-radius: 248rpx;
background: linear-gradient(90deg, #007FFF 0%, #99CCFF 100%);
font-family: Source Han Sans;
font-size: 36rpx;
color: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
}
}
</style> </style>

13
src/pages/index/index.vue

@ -165,9 +165,16 @@ const change = (val) => {
current.value = val.current current.value = val.current
} }
const swiperClick = (item) => { const swiperClick = (item) => {
uni.navigateTo({ if(list5.value[item].to_type === 1) {
url: '/pages/index/ztdetail?id=' + list5.value[item].id + '&type=' + 'index' uni.navigateTo({
}) url: '/pages/index/ztdetail?id=' + list5.value[item].id + '&type=' + 'index'
})
} else {
uni.navigateTo({
url: list5.value[item].to_page_path
})
}
} }
const hdList = ref([ const hdList = ref([

74
src/pages/index/subform.vue

@ -6,12 +6,14 @@
<u-input v-model="item.answer" v-if="item.type === 'input'" /> <u-input v-model="item.answer" v-if="item.type === 'input'" />
<u-textarea v-model="item.answer" v-if="item.type === 'textarea'" placeholder="请输入内容" <u-textarea v-model="item.answer" v-if="item.type === 'textarea'" placeholder="请输入内容"
autoHeight></u-textarea> autoHeight></u-textarea>
<u-radio-group v-model="item.answer" v-if="item.type === 'radio'" placement="column" <u-input v-model="item.answer" @focus="showpicker = true" v-if="item.type === 'radio'" />
<u-picker v-if="item.type === 'radio'" :show="showpicker" v-model="item.answer" :columns="[arrtoarr(item.choose)]" @cancel="showpicker = false" @confirm="showpicker = false"></u-picker>
<!-- <u-radio-group v-model="item.answer" v-if="item.type === 'radio'" placement="column"
@change="groupChange"> @change="groupChange">
<u-radio :customStyle="{marginBottom: '16rpx'}" v-for="(item, index) in item.choose" :key="index" <u-radio :customStyle="{marginBottom: '16rpx'}" v-for="(item, index) in item.choose" :key="index"
:label="item.name" :name="item.name"> :label="item.name" :name="item.name">
</u-radio> </u-radio>
</u-radio-group> </u-radio-group> -->
<u-checkbox-group v-model="item.answer" v-if="item.type === 'checkbox'" placement="column" <u-checkbox-group v-model="item.answer" v-if="item.type === 'checkbox'" placement="column"
> >
<u-checkbox :customStyle="{marginBottom: '16rpx'}" v-for="(item, index) in item.choose" :key="index" <u-checkbox :customStyle="{marginBottom: '16rpx'}" v-for="(item, index) in item.choose" :key="index"
@ -36,18 +38,22 @@
ref ref
} from 'vue' } from 'vue'
import { import {
specialSign specialSign,
activitySign
} from '@/api/index' } from '@/api/index'
const titleData = ref({}) const titleData = ref({})
const ztid = ref('') const ztid = ref('')
const showpicker = ref(false)
const type = ref('')
function processCheckboxAnswers(arr) { function processCheckboxAnswers(arr) {
return arr.map(item => { return arr.map(item => {
// //
const result = { id: item.id }; const result = { id: item.id };
// answer // answer
if (item.type === 'checkbox' && typeof item.answer === 'object') { if (item.type === 'checkbox' && typeof item.answer === 'object') {
// //
@ -56,12 +62,21 @@
.join(','); .join(',');
} else { } else {
// checkboxanswer // checkboxanswer
result.answer = item.answer; if(item.type === 'radio') {
result.answer = item.answer[0]
} else {
result.answer = item.answer;
}
} }
return result; return result;
}); });
} }
const arrtoarr = (arr) => {
let newar = arr.map(item => item.name)
return newar
}
// //
function submit() { function submit() {
@ -82,25 +97,44 @@
form_id: titleData.value.form_id, form_id: titleData.value.form_id,
answer: processCheckboxAnswers(titleData.value.question) answer: processCheckboxAnswers(titleData.value.question)
} }
specialSign(param).then((res)=> { if(type.value === 'zt') {
if(res.code === 1) { specialSign(param).then((res)=> {
uni.showToast({ if(res.code === 1) {
title: '提交成功!', uni.showToast({
duration: 2000 title: '提交成功!',
}) duration: 2000
setTimeout(()=> { })
uni.navigateBack() setTimeout(()=> {
},2000) uni.navigateBack()
} else { },2000)
uni.showToast({ } else {
title: res.msg, uni.showToast({
}) title: res.msg,
} })
}) }
})
} else {
activitySign(param).then((res)=> {
if(res.code === 1) {
uni.showToast({
title: '提交成功!',
duration: 2000
})
setTimeout(()=> {
uni.navigateBack()
},2000)
} else {
uni.showToast({
title: res.msg,
})
}
})
}
} }
} }
onLoad(async (param) => { onLoad(async (param) => {
type.value = param.type
ztid.value = param.id ztid.value = param.id
titleData.value = JSON.parse(param.form) titleData.value = JSON.parse(param.form)
}) })

10
src/pages/index/ztdetail.vue

@ -1,7 +1,7 @@
<template> <template>
<u-navbar :title="titleData.special_id_name ? '“' + titleData.special_id_name + '”' + '专题' : ''" placeholder="true" <u-navbar :title="titleData.special_id_name ? '“' + titleData.special_id_name + '”' + '专题' : ''" placeholder="true"
bg-color="#F1F3F9" :auto-back="true"></u-navbar> bg-color="#F1F3F9" :auto-back="true"></u-navbar>
<view class="container"> <view class="container" :style="{height: titleData.form?'calc(100vh - 350rpx)': 'calc(100vh - 150rpx)'}">
<view class="titlepart"> <view class="titlepart">
<image style="width: 8rpx; height: 1em" src="@/static/img/Fill1.png" mode=""></image> <image style="width: 8rpx; height: 1em" src="@/static/img/Fill1.png" mode=""></image>
<image style="width: 8rpx; height: 1em; margin-left: 6rpx" src="@/static/img/Fill2.png" mode=""></image> <image style="width: 8rpx; height: 1em; margin-left: 6rpx" src="@/static/img/Fill2.png" mode=""></image>
@ -31,10 +31,10 @@
} from '@/api/index' } from '@/api/index'
const titleData = ref([]) const titleData = ref([])
const gotij = (id,item) => { const gotij = (id, item) => {
uni.navigateTo({ uni.navigateTo({
url: '/pages/index/subform?form='+JSON.stringify(item)+ '&id='+id url: '/pages/index/subform?form=' + JSON.stringify(item) + '&id=' + id + '&type=' + 'zt'
}) })
} }
@ -63,7 +63,7 @@
width: 100%; width: 100%;
padding: 48rpx; padding: 48rpx;
box-sizing: border-box; box-sizing: border-box;
overflow-y: auto; overflow-y: auto;
.titlepart { .titlepart {
display: flex; display: flex;

Loading…
Cancel
Save