This commit is contained in:
Paidax
2025-08-13 16:00:10 +08:00
parent cc8216eff7
commit 8fcfafbd5a
64 changed files with 3309 additions and 327 deletions
+5 -5
View File
@@ -7,11 +7,11 @@ layout("/mobile/platform.html"){
}
.swiper {
height: 200px;
height: 180px;
}
.swiper img {
height: 200px;
height: 180px;
}
.module {
@@ -172,7 +172,7 @@ layout("/mobile/platform.html"){
<div id="app">
<!--首页-->
<div style="margin-bottom: 60px" v-if="active === 0">
<div style="margin-bottom: 60px;max-height: calc(100vh - 60px);overflow-y: auto" v-if="active === 0">
<!--轮播图-->
<van-swipe :autoplay="3000" class="swiper">
<van-swipe-item :key="index" v-for="(image, index) in images">
@@ -724,8 +724,8 @@ layout("/mobile/platform.html"){
const active = sessionStorage.getItem("zhgh-mobile-home-active")
this.active = active ? parseInt(active) : 0
// this.clickIndex = 2
// this.clickMenu = this.moduleMenus.find(o => o.moduleName === '日常办公')
this.clickIndex = 2
this.clickMenu = this.moduleMenus.find(o => o.moduleName === '职工权益')
}
})
@@ -216,7 +216,7 @@ layout("/mobile/platform.html"){
</div>
<div style="text-indent: 2.1rem">
<span :style="'color:' + (formData.isVoluntary ? '#1989fa' : '#F56C6C') ">
我将严格遵守工会章程 ,认真执行工会决议,积极参与工会活动,主动融入“杭医健康幸福家”建设,为营造温暖、和谐、奋进的校园氛围贡献力量,以实际行动助力学校各项事业发展。
我将严格遵守工会章程,认真执行工会决议,积极参与工会活动,主动融入“杭医健康幸福家”建设,为营造温暖、和谐、奋进的校园氛围贡献力量,以实际行动助力学校各项事业发展。
</span>
</div>
</van-checkbox>
@@ -125,7 +125,6 @@
async flushCache() {
const day = moment().format('YYYY-MM-DD')
if (window.localStorage.getItem('flushCache') !== day) {
debugger
const { code, msg } = await $.post('/platform/home/clearCache')
if (code === 0) {
location.reload()
@@ -352,7 +352,7 @@ layout("/mobile/platform.html"){
<span>联系方式:</span>{{o.baseContactNumber}}
</div>
<div class="mobile">
<span>已报人数</span>{{o.signUpUserNum}}
<span>出行时间</span>{{o.specificTime}}
</div>
</div>
</div>
@@ -0,0 +1,424 @@
<!--#
layout("/mobile/platform.html"){
#-->
<style>
.container {
background: #ffffff;
padding: 0;
}
.container .title {
text-align: center;
padding: 20px;
background: #ffffff;
margin: 0 0 10px 0;
}
.container .card {
padding: 10px;
background: #ffffff;
}
.description, .last-content {
background: rgb(255, 255, 255);
padding: 5px 20px;
margin: -15px 0 10px 0;
line-height: 1.5rem;
font-size: 16px;
}
.subject {
background: #fff;
padding: 15px;
margin-bottom: 15px;
/*border-top: 2px solid rgba(24, 103, 176, 0.6);*/
border-bottom: 2px solid rgba(24, 103, 176, 0.6);
/*box-shadow: 0 2px 4px rgba(24, 103, 176, 0.6);*/
position: relative;
}
.first-box {
border-top: 2px solid rgba(24, 103, 176, 0.6);
}
.subject p {
font-size: 16px;
margin: 20px 0 10px 0;
font-weight: bold;
}
.subject .tag {
position: absolute;
top: 0;
}
.button-control {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 20px;
display: flex;
column-gap: 20px;
background: #fff;
}
.van-checkbox__icon--checked .van-icon {
color: #fff !important;
background-color: var(--color-primary) !important;
border-color: var(--color-primary) !important;
}
.van-checkbox__icon--disabled .van-icon {
background-color: #fff;
}
.ui-input-box {
border: 1px solid #e3e3e3;
margin: 5px 0;
background-color: #fff;
padding: 0;
width: 100%;
display: flex;
}
.ui-input-box input {
background-color: #fff;
border: none !important;
padding: 10px;
font-size: 14px;
line-height: 18px;
display: inline-block;
margin: 0;
-webkit-appearance: none;
resize: none;
width: 100%;
}
.desc-content{
width: 100%;
max-width: 100%;
}
.desc-content *{
max-width: 100%!important;
}
</style>
<div id="app" v-cloak>
<van-nav-bar title="满意度调查" left-arrow @click-left="doBack" placeholder fixed></van-nav-bar>
<div class="container" :style="{'padding-bottom': answerRecord.isFinish ? 0 : '84px'}">
<h2 class="title">{{ activity.title }}</h2>
<div class="description" v-if="activity.description">
<div v-html="activity.description"></div>
</div>
<div v-if="!isFinished">
<div v-for="(subject, index) in subjects" :key="index" class="subject" :class="{ 'first-box': index === 0 }">
<p>{{index+1}}、{{ subject.title }}</p>
<div class="tag">
<van-tag v-if="subject.type === 'checkbox'" type="primary" size="large">多选</van-tag>
<van-tag v-if="subject.type === 'radio'" type="primary" size="large">单选</van-tag>
<van-tag v-if="subject.type === 'text'" type="primary" size="large">填空</van-tag>
<van-tag v-if="subject.score" type="primary" size="large">{{subject.score}}分</van-tag>
</div>
<!--单选、多选-->
<van-checkbox-group
v-model="subject.userSelectOptionIds"
:ref="'subject'+subject.id"
:max="subject.maxMulti ? subject.maxMulti : 0"
v-if="['radio','checkbox'].includes(subject.type)"
>
<van-cell-group>
<div v-for="(option,index) in subject.options">
<van-cell :title="option.text" :key="option.id" clickable @click="cellToggle(subject,option.id)">
<template #icon>
<van-checkbox :name="option.id" :ref="'option'+option.id"
:disabled="answerRecord.isFinish"
style="margin-right: 10px"></van-checkbox>
</template>
<img
slot="right-icon"
v-if="option.imgUrl"
:src="option.imgUrl"
alt=""
style="width: 40px; height: 40px"
@click.stop="previewOptionImg(option.imgUrl)"
/>
<div slot="extra">
<div v-if="option.description" style="color: #0a84ff" @click.stop="openDesc(option)">
查看详情
</div>
</div>
</van-cell>
<div v-if="option.isOpenContent==true && selectOptionIds.includes(option.id)">
<van-field v-model="option.content" :label="option.contentPrefix"
:placeholder="'请填写' + (option.contentPrefix ? option.contentPrefix : '')"
:disabled="answerRecord.isFinish"></van-field>
</div>
</div>
</van-cell-group>
</van-checkbox-group>
<!--填空题-->
<div class="ui-input-box" v-if="subject.type==='text'">
<input type="text" v-model="subject.userFillContent" :readonly="answerRecord.isFinish" />
</div>
</div>
<div class="last-content" style="margin-top: 0px" v-if="activity.lastContent">
<div v-html="activity.lastContent"></div>
</div>
<div class="button-control" v-if="!answerRecord.isFinish">
<van-button type="primary" style="background-color: #0a84ff;border: 1px solid #0a84ff"
@click="onSubmit" block :disabled="isEnd">{{isEnd ? '已结束' : '提交'}}</van-button>
</div>
</div>
</div>
<van-action-sheet v-model="descShow" title="详情">
<div class="desc-content" v-html="optionDesc" @click="descClick">
</div>
</van-action-sheet>
</div>
<script>
const vue = new Vue({
el: "#app",
data() {
return {
pjaxType: '',
list: [],
id: null,
subjects: [],
activity: {},
remainingTime: 0,
isFinished: false,
answerRecord: {},
answerRecordId: null,
descShow:false,
optionDesc:null,
selectOptionIds: [],
}
},
computed: {
isEnd() {
if (this.activity) {
return this.$moment().unix() > this.$moment(this.activity.endTime).unix()
}
return true
}
},
methods: {
//获取活动、题目
listSubjects() {
$.post("/platform/h5/welfare/evaluate/subjects", { activityId: this.id }).then((res) => {
if (res.code === 0) {
this.activity = res.data.activity
this.subjects = res.data.subjects
this.answerRecordId = res.data.answerRecordId
this.getAnswerRecord()
} else {
vant.Dialog.alert({
title: '温馨提示',
message: res.msg,
}).then(() => {
pjaxReplace("/mobile/index")
})
}
})
},
//获取回答记录
getAnswerRecord() {
$.post("/platform/h5/welfare/evaluate/answerRecord", { answerRecordId: this.answerRecordId }).then((res) => {
if (res.code === 0) {
this.answerRecord = res.data
if (this.answerRecord.isFinish) {
vant.Dialog.alert({
title: '温馨提示',
message: '您已完成该调查,感谢您的参与!',
}).then(() => {
// on close
});
// this.$toast.success("您已完成该调查")
}
this.initAnswer()
}
})
},
//答案回显
initAnswer() {
this.subjects.forEach((subject, subjectIndex) => {
const answer = this.answerRecord.extJson[subject.id]
if (["radio", "checkbox"].includes(subject.type)) {
this.$refs["subject" + subject.id][0].toggleAll(false)
answer?.optionIds.forEach((optionId) => {
this.$nextTick(() => {
this.$refs["option" + optionId][0].toggle()
})
})
if (answer.optionContents && answer.optionContents.length > 0) {
answer.optionContents.forEach((data) => {
if (data.content) {
this.selectOptionIds.push(data.optionId)
const option = subject.options.find(option => option.id === data.optionId)
option.content = data.content
}
})
}
} else if (subject.type === "text") {
subject.userFillContent = answer?.text
}
})
},
//选项点击
cellToggle(subject, optionId) {
if (this.answerRecord.isFinish) {
return
}
if (subject.type === "radio") {
this.$refs["subject" + subject.id][0].toggleAll(false)
const option = subject.options.find(option => option.id === optionId)
this.selectOptionIds = this.selectOptionIds.filter(item => item !== optionId)
if (option.isOpenContent == true) {
this.selectOptionIds.push(optionId)
}
}
this.$refs["option" + optionId][0].toggle()
},
//预览图片
previewOptionImg(img) {
vant.ImagePreview([img])
},
//查看详情
openDesc(option){
this.descShow = true
this.optionDesc = option.description
},
//详情点击
descClick(event){
//如果点击的是图片
if(event.target.tagName === 'IMG'){
vant.ImagePreview([event.target.src])
}
},
//手动提交
onSubmit() {
if (this.isEnd) {
this.$toast("调查已结束")
return
}
//提示那些题没有作答
for (let i = 0; i < this.subjects.length; i++) {
const subject = this.subjects[i]
if (["radio", "checkbox"].includes(subject.type)) {
if (!subject.userSelectOptionIds || subject.userSelectOptionIds.length === 0) {
this.$toast.fail("第" + (i + 1) + "题未做答")
return
}
} else if ("text" === subject.type) {
if (!subject.userFillContent) {
this.$toast.fail("第" + (i + 1) + "题未作答")
return
}
}
}
// 提示确定提交吗
vant.Dialog.confirm({
title: '温馨提示',
message: '提交后不可修改哦,确定要提交吗?',
}).then(() => {
this.autoSubmit()
}).catch(() => {
// on cancel
});
},
//自动提交
autoSubmit(loading = null) {
$.post("/platform/h5/welfare/evaluate/submitAnswer", {
answer: JSON.stringify({
activityId: this.id,
answerRecordId: this.answerRecordId,
subjects: this.subjects.map((subject) => {
const isChoiceType = ["checkbox", "radio"].includes(subject.type);
const userSelectOptions = isChoiceType ? subject.userSelectOptionIds.map((optionId) => {
const option = subject.options.find((option) => option.id === optionId);
return option ? {
optionId: option.id,
content: option.content
} : '';
}) : [];
const userFillContent = subject.type === "text" ? subject.userFillContent : null;
return {
id: subject.id,
userSelectOptionIds: isChoiceType ? subject.userSelectOptionIds : [],
userSelectOptionContent: userSelectOptions,
userFillContent
};
})
})
})
.then((res) => {
if (res.code === 0) {
this.$toast.success(res.msg)
this.getAnswerRecord()
}
if (loading) {
loading.clear()
}
})
},
doBack() {
if (this.pjaxType === "welfare") {
pjaxReplace('/mobile/welfare/mine/myWelfare')
} else {
pjaxReplace('/mobile/index')
}
}
},
created() {
const id = GetQueryString("id")
this.pjaxType = GetQueryString("type")
if (id) {
this.id = id
this.listSubjects()
}
}
})
</script>
<!--#
}
#-->
@@ -110,7 +110,7 @@ layout("/mobile/platform.html"){
</div>
</div>
<div slot="footer" style="margin-top: 10px;">
<van-button @click="openEvaluate(item)" plain round size="small">评价商品
<van-button v-if="item.evaId" @click="openEvaluate(item)" plain round size="small">评价商品
</van-button>
<van-button @click="openExpress(item)" plain round size="small"
v-if="item.provideMode==3">
@@ -424,17 +424,18 @@ layout("/mobile/platform.html"){
//打开评价
async openEvaluate(item) {
if (item.isChoose !== 1) {
this.$modal.msg("选择后才能评价")
return
}
const resp = await this.getUserSelection(item.projectId)
this.selectedOptions = resp.data
if (this.selectedOptions && this.selectedOptions.length > 0) {
await this.finOneWelfareEvaluate(item.id, this.selectedOptions[0].selectOptionId)
}
this.evaluatePopup = true
pjaxReplace('/platform/h5/welfare/evaluate?id=' + item.evaId + '&type=welfare')
// if (item.isChoose !== 1) {
// this.$modal.msg("选择后才能评价")
// return
// }
//
// const resp = await this.getUserSelection(item.projectId)
// this.selectedOptions = resp.data
// if (this.selectedOptions && this.selectedOptions.length > 0) {
// await this.finOneWelfareEvaluate(item.id, this.selectedOptions[0].selectOptionId)
// }
// this.evaluatePopup = true
},
async finOneWelfareEvaluate(projectId, optionId) {
const {