移动端返回
This commit is contained in:
@@ -54,7 +54,7 @@ layout("/mobile/platform.html"){
|
||||
}
|
||||
|
||||
.middle-subject-topic {
|
||||
background-color: #FFFFFF;
|
||||
background-color: #ffffff;
|
||||
margin-bottom: 1rem;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
@@ -94,11 +94,10 @@ layout("/mobile/platform.html"){
|
||||
line-height: 40px;
|
||||
outline: none;
|
||||
padding: 0 15px;
|
||||
transition: border-color .2s cubic-bezier(.645, .045, .355, 1);
|
||||
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
.middle-subject-topic-submit .u-btn {
|
||||
width: 60%;
|
||||
}
|
||||
@@ -109,7 +108,7 @@ layout("/mobile/platform.html"){
|
||||
right: 0;
|
||||
height: 40px;
|
||||
z-index: 999;
|
||||
background-color: #FFF;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 20px rgb(230, 230, 230);
|
||||
border-radius: 20px 0 0 20px;
|
||||
}
|
||||
@@ -119,7 +118,7 @@ layout("/mobile/platform.html"){
|
||||
width: 40px;
|
||||
box-shadow: 0 0 10px #1678ff;
|
||||
border-radius: 20px 0 0 20px;
|
||||
background-color: #FFF;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
@@ -133,7 +132,7 @@ layout("/mobile/platform.html"){
|
||||
align-items: center;
|
||||
box-shadow: 0 0 10px #1678ff;
|
||||
border-radius: 20px 0 0 20px;
|
||||
background-color: #FFF;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.middle-subject-info-footer {
|
||||
@@ -142,7 +141,7 @@ layout("/mobile/platform.html"){
|
||||
left: 0;
|
||||
right: 0;
|
||||
max-height: 64px;
|
||||
background-color: #FFF;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 20px rgb(230, 230, 230);
|
||||
z-index: 999;
|
||||
padding: 10px 20px;
|
||||
@@ -170,8 +169,7 @@ layout("/mobile/platform.html"){
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<div class="middle-subject">
|
||||
<van-nav-bar title="在线调查" left-arrow
|
||||
@click-left="history.back()"></van-nav-bar>
|
||||
<van-nav-bar title="在线调查" left-arrow @click-left="pjaxReplace('/mobile/index')"></van-nav-bar>
|
||||
|
||||
<div class="middle-subject-info">
|
||||
<div class="middle-subject-info-scroll">
|
||||
@@ -192,17 +190,18 @@ layout("/mobile/platform.html"){
|
||||
<span>多选</span>
|
||||
</div>
|
||||
<div style="margin-bottom: 10px">
|
||||
<span v-if="issue.iisbd" style="color: red;">*</span>
|
||||
<span v-if="issue.iisbd" style="color: red">*</span>
|
||||
<span class="middle-subject-topic-title">
|
||||
{{ issueIndex + 1 }}.
|
||||
{{ removeHTMLTag(issue.iname) }}
|
||||
<span v-if="issue.iminselect">(最少选择:{{issue.iminselect}})</span>
|
||||
<span v-if="issue.imaxselect">(最多选择:{{issue.imaxselect}})</span>
|
||||
<div v-if="issue.its" class="middle-subject-topic-desc"
|
||||
v-html="issue.its"
|
||||
style="margin-left: 17px;font-size: 12px;font-weight: 500;">
|
||||
</div>
|
||||
</span>
|
||||
{{ issueIndex + 1 }}. {{ removeHTMLTag(issue.iname) }}
|
||||
<span v-if="issue.iminselect">(最少选择:{{issue.iminselect}})</span>
|
||||
<span v-if="issue.imaxselect">(最多选择:{{issue.imaxselect}})</span>
|
||||
<div
|
||||
v-if="issue.its"
|
||||
class="middle-subject-topic-desc"
|
||||
v-html="issue.its"
|
||||
style="margin-left: 17px; font-size: 12px; font-weight: 500"
|
||||
></div>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- 选择题 -->
|
||||
@@ -210,28 +209,25 @@ layout("/mobile/platform.html"){
|
||||
<!-- 单选题 -->
|
||||
<van-radio-group v-if="issue.iisdx" v-model="issue.rwid" :disabled="replyFinish">
|
||||
<div v-for="(wor,worIndex) in issue.wors" :key="wor.wid">
|
||||
<van-radio :ref="wor.wid" :name="wor.wid">
|
||||
{{ letterList[worIndex] }}. {{ wor.wtxt }}
|
||||
</van-radio>
|
||||
<van-radio :ref="wor.wid" :name="wor.wid">{{ letterList[worIndex] }}. {{ wor.wtxt }}</van-radio>
|
||||
<div class="middle-subject-topic-desc">
|
||||
<van-row gutter="16">
|
||||
<van-col span="8" v-if="wor.wimg">
|
||||
<image style="height: 80px;width: 80px" :src="wor.wimg"
|
||||
mode="aspectFit">
|
||||
</image>
|
||||
</van-col>
|
||||
<van-col span="16" v-if="wor.wsm">
|
||||
{{ wor.wsm }}
|
||||
<image style="height: 80px; width: 80px" :src="wor.wimg" mode="aspectFit"></image>
|
||||
</van-col>
|
||||
<van-col span="16" v-if="wor.wsm">{{ wor.wsm }}</van-col>
|
||||
</van-row>
|
||||
</div>
|
||||
</div>
|
||||
</van-radio-group>
|
||||
|
||||
<!-- 多选题 -->
|
||||
<van-checkbox-group v-else-if="!issue.iisdx" v-model="issue.rwid"
|
||||
:disabled="replyFinish"
|
||||
:max="issue.imaxselect ? issue.imaxselect:0">
|
||||
<van-checkbox-group
|
||||
v-else-if="!issue.iisdx"
|
||||
v-model="issue.rwid"
|
||||
:disabled="replyFinish"
|
||||
:max="issue.imaxselect ? issue.imaxselect:0"
|
||||
>
|
||||
<div v-for="(wor,worIndex) in issue.wors" :key="worIndex">
|
||||
<van-checkbox :ref="wor.wid" :name="wor.wid" shape="square">
|
||||
{{ letterList[worIndex] }}. {{ wor.wtxt }}
|
||||
@@ -239,13 +235,9 @@ layout("/mobile/platform.html"){
|
||||
<div class="middle-subject-topic-desc">
|
||||
<van-row gutter="16">
|
||||
<van-col span="8" v-if="wor.wimg">
|
||||
<image style="height: 80px;width: 80px" :src="wor.wimg"
|
||||
mode="aspectFit">
|
||||
</image>
|
||||
</van-col>
|
||||
<van-col span="16" v-if="wor.wsm">
|
||||
{{ wor.wsm }}
|
||||
<image style="height: 80px; width: 80px" :src="wor.wimg" mode="aspectFit"></image>
|
||||
</van-col>
|
||||
<van-col span="16" v-if="wor.wsm">{{ wor.wsm }}</van-col>
|
||||
</van-row>
|
||||
</div>
|
||||
</div>
|
||||
@@ -254,11 +246,17 @@ layout("/mobile/platform.html"){
|
||||
|
||||
<!-- 填空题 -->
|
||||
<template v-if="issue.itx===2">
|
||||
<van-field v-model="issue.rval" type="text" border
|
||||
class="itx_field"
|
||||
cursor-spacing="100"
|
||||
:show-confirmbar="false"
|
||||
:disabled="replyFinish" :auto-height="true" maxlength="2000"/>
|
||||
<van-field
|
||||
v-model="issue.rval"
|
||||
type="text"
|
||||
border
|
||||
class="itx_field"
|
||||
cursor-spacing="100"
|
||||
:show-confirmbar="false"
|
||||
:disabled="replyFinish"
|
||||
:auto-height="true"
|
||||
maxlength="2000"
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
@@ -267,13 +265,8 @@ layout("/mobile/platform.html"){
|
||||
|
||||
<div class="middle-subject-info-footer">
|
||||
<div class="middle-subject-info-footer-save">
|
||||
<van-button size="medium" type="primary" @click="saveAnswer"
|
||||
:disabled="replyFinish">保存
|
||||
</van-button>
|
||||
<van-button size="medium" type="info" :disabled="replyFinish"
|
||||
@click="submitAnswer">
|
||||
提交
|
||||
</van-button>
|
||||
<van-button size="medium" type="primary" @click="saveAnswer" :disabled="replyFinish">保存</van-button>
|
||||
<van-button size="medium" type="info" :disabled="replyFinish" @click="submitAnswer">提交</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -282,7 +275,7 @@ layout("/mobile/platform.html"){
|
||||
|
||||
<script>
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
el: "#app",
|
||||
mixins: [mobileMixins],
|
||||
data() {
|
||||
return {
|
||||
@@ -295,87 +288,85 @@ layout("/mobile/platform.html"){
|
||||
computed: {
|
||||
letterList() {
|
||||
const alphabet = Array.from(new Array(26), (ele, index) => {
|
||||
return String.fromCharCode(65 + index);
|
||||
return String.fromCharCode(65 + index)
|
||||
})
|
||||
return alphabet
|
||||
},
|
||||
replyFinish() {
|
||||
return this.replyInfo.some(v => !v.save)
|
||||
return this.replyInfo.some((v) => !v.save)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getQuestionData() {
|
||||
const resp = await $.get('/mobile/question/h5/questionInfo/' + this.id)
|
||||
const resp = await $.get("/mobile/question/h5/questionInfo/" + this.id)
|
||||
this.questionData = resp.data
|
||||
this.issueList = this.questionData && this.questionData.issues
|
||||
},
|
||||
saveAnswer() {
|
||||
const formData = this.formatFormData()
|
||||
formData.forEach(v => v.save = true)
|
||||
this.$modal.loading('保存中')
|
||||
$.post('/mobile/question/h5/saveAnswer', {repliesArray: JSON.stringify(formData)}).then(res => {
|
||||
formData.forEach((v) => (v.save = true))
|
||||
this.$modal.loading("保存中")
|
||||
$.post("/mobile/question/h5/saveAnswer", { repliesArray: JSON.stringify(formData) }).then((res) => {
|
||||
this.$modal.closeLoading()
|
||||
if (res.code === 0) {
|
||||
this.$modal.msg('保存成功')
|
||||
this.$modal.msg("保存成功")
|
||||
this.getReply()
|
||||
} else {
|
||||
this.$modal.msg('保存失败')
|
||||
this.$modal.msg("保存失败")
|
||||
}
|
||||
})
|
||||
},
|
||||
submitAnswer() {
|
||||
const v1 = this.issueList.some(v => v.itx === 1 && v.iisbd && v.rwid == null)
|
||||
const v1 = this.issueList.some((v) => v.itx === 1 && v.iisbd && v.rwid == null)
|
||||
if (v1) {
|
||||
this.$modal.msg('请选择后再提交')
|
||||
this.$modal.msg("请选择后再提交")
|
||||
return
|
||||
}
|
||||
const v2 = this.issueList.some(v => v.itx === 2 && v.iisbd && (v.rval == null || v.rval === ''))
|
||||
const v2 = this.issueList.some((v) => v.itx === 2 && v.iisbd && (v.rval == null || v.rval === ""))
|
||||
if (v2) {
|
||||
this.$modal.msg('请填写后再提交')
|
||||
this.$modal.msg("请填写后再提交")
|
||||
return
|
||||
}
|
||||
|
||||
const formData = this.formatFormData()
|
||||
formData.forEach(v => v.save = false)
|
||||
this.$modal.confirm('您确定要提交吗?提交后不能修改!').then(() => {
|
||||
this.$modal.loading('提交中')
|
||||
$.post('/mobile/question/h5/saveAnswer', {repliesArray: JSON.stringify(formData)}).then(res => {
|
||||
formData.forEach((v) => (v.save = false))
|
||||
this.$modal.confirm("您确定要提交吗?提交后不能修改!").then(() => {
|
||||
this.$modal.loading("提交中")
|
||||
$.post("/mobile/question/h5/saveAnswer", { repliesArray: JSON.stringify(formData) }).then((res) => {
|
||||
this.$modal.closeLoading()
|
||||
if (res.code === 0) {
|
||||
this.$modal.msg('提交成功')
|
||||
this.$modal.msg("提交成功")
|
||||
this.getReply()
|
||||
} else {
|
||||
this.$modal.msg('提交失败')
|
||||
this.$modal.msg("提交失败")
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
validAnswer() {
|
||||
|
||||
},
|
||||
validAnswer() {},
|
||||
|
||||
//格式化提交数据
|
||||
formatFormData() {
|
||||
const formData = []
|
||||
this.issueList.forEach(v => {
|
||||
this.issueList.forEach((v) => {
|
||||
if (v.itx === 1 && v.iisdx) {
|
||||
//单选
|
||||
if (v.rwid) {
|
||||
formData.push({
|
||||
"rwid": v.rwid,
|
||||
"qid": this.questionData.qid,
|
||||
"issueId": v.iid
|
||||
rwid: v.rwid,
|
||||
qid: this.questionData.qid,
|
||||
issueId: v.iid
|
||||
})
|
||||
}
|
||||
} else if (v.itx === 1 && !v.iisdx) {
|
||||
//多选
|
||||
if (v.rwid) {
|
||||
v.rwid.forEach(r => {
|
||||
v.rwid.forEach((r) => {
|
||||
formData.push({
|
||||
"rwid": r,
|
||||
"qid": this.questionData.qid,
|
||||
"issueId": v.iid
|
||||
rwid: r,
|
||||
qid: this.questionData.qid,
|
||||
issueId: v.iid
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -383,10 +374,10 @@ layout("/mobile/platform.html"){
|
||||
if (v.rval) {
|
||||
debugger
|
||||
formData.push({
|
||||
"rwid": v.wors[0].wid,
|
||||
"rval": v.rval,
|
||||
"qid": this.questionData.qid,
|
||||
"issueId": v.iid
|
||||
rwid: v.wors[0].wid,
|
||||
rval: v.rval,
|
||||
qid: this.questionData.qid,
|
||||
issueId: v.iid
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -395,21 +386,21 @@ layout("/mobile/platform.html"){
|
||||
},
|
||||
//获取回答信息并赋值
|
||||
async getReply() {
|
||||
const resp = await $.get('/mobile/question/h5/answerInfo/' + this.id)
|
||||
const resp = await $.get("/mobile/question/h5/answerInfo/" + this.id)
|
||||
this.replyInfo = resp.data
|
||||
this.issueList.forEach((issue, issueIndex) => {
|
||||
if (issue.itx === 1 && issue.iisdx) {
|
||||
//单选
|
||||
const rw = this.replyInfo.find(answer => answer.issueId === issue.iid)
|
||||
this.$set(this.issueList[issueIndex], 'rwid', rw ? rw.rwid : null)
|
||||
const rw = this.replyInfo.find((answer) => answer.issueId === issue.iid)
|
||||
this.$set(this.issueList[issueIndex], "rwid", rw ? rw.rwid : null)
|
||||
} else if (issue.itx === 1 && !issue.iisdx) {
|
||||
//多选
|
||||
const rws = this.replyInfo.filter(answer => answer.issueId === issue.iid).map(v => v.rwid)
|
||||
this.$set(this.issueList[issueIndex], 'rwid', rws ? rws : [])
|
||||
const rws = this.replyInfo.filter((answer) => answer.issueId === issue.iid).map((v) => v.rwid)
|
||||
this.$set(this.issueList[issueIndex], "rwid", rws ? rws : [])
|
||||
} else if (issue.itx === 2) {
|
||||
//填空题
|
||||
const rw = this.replyInfo.find(answer => answer.issueId === issue.iid)
|
||||
this.$set(this.issueList[issueIndex], 'rval', rw ? rw.rval : null)
|
||||
const rw = this.replyInfo.find((answer) => answer.issueId === issue.iid)
|
||||
this.$set(this.issueList[issueIndex], "rval", rw ? rw.rval : null)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -418,7 +409,7 @@ layout("/mobile/platform.html"){
|
||||
this.id = GetQueryString("id")
|
||||
await this.getQuestionData()
|
||||
await this.getReply()
|
||||
},
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user