271 lines
6.6 KiB
Vue
271 lines
6.6 KiB
Vue
<template>
|
||
<view class="hzIndex">
|
||
<hzHeader title="问卷详情"></hzHeader>
|
||
<view class="hzContent" style="padding-top: 200upx;">
|
||
|
||
<view class="details">
|
||
<view class="detail_msg">
|
||
<view class="info-item" style="width: 100%;text-align: center;font-weight: bold;">
|
||
<text class="infoSpan">{{item.TITLE}}</text>
|
||
</view>
|
||
<view class="info-item">
|
||
<text class="infoSpan">{{item.DESCRIBE}}</text>
|
||
</view>
|
||
|
||
<view class="form-box-ud" style="border-radius: 10upx;margin-top: 20upx;">
|
||
<view class="form-item" v-for="(obj,index) in questionList" v-bind:key="index">
|
||
<view class="label">
|
||
<text style="color: red;">*</text>{{obj.NUMBER}}. {{obj.TOPIC}}
|
||
<text class="ques-type" v-if="obj.TOPIC_TYPE =='1'">{{questionType[0]}}</text>
|
||
<text class="ques-type" v-if="obj.TOPIC_TYPE =='0'">{{questionType[1]}}</text>
|
||
</view>
|
||
<view class="ipt-box" v-if="obj.TOPIC_TYPE =='1'">
|
||
<radio-group @change="changeRadioGroup($event,obj)" >
|
||
<label class="uni-list-cell uni-list-cell-pd radio-group" v-for="(item, index) in choosenType" :key="item.id" >
|
||
<view>
|
||
<radio color="#4db4ea" :value="item.id" :checked="obj.OPTION==item.id" :disabled="type=='2'||(state=='0'||state=='1')"/>
|
||
</view>
|
||
<view>{{item.name}}</view>
|
||
</label>
|
||
</radio-group>
|
||
</view>
|
||
<view class="ipt-box" v-if="obj.TOPIC_TYPE =='0'">
|
||
<view style="width: 100%;border: 1px solid #E5E5E5;margin-top:50upx;padding: 20upx;min-height: 200upx;color: #666;border-radius: 10upx;">
|
||
<textarea v-model="obj.OPTION" :disabled="type=='2'||(state=='0'||state=='1')" placeholder="请输入" maxlength="120"/>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
</view>
|
||
|
||
</view>
|
||
</view>
|
||
|
||
<view class="occupied" style="margin-top: 100upx;"></view>
|
||
<view class="footer-btn" v-if="state=='2' && type=='1'">
|
||
<view class="btn" style="background: #00C277;color: #f2f2f2;" @click="submit()">提交</view>
|
||
</view>
|
||
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import {
|
||
getQuestionnaireById,updateQuestionnaire
|
||
} from '@/common/api.js';
|
||
import {
|
||
callbackRequest,
|
||
getStorage,
|
||
alertTip,
|
||
formatDate,
|
||
sureAlterTip,
|
||
vbPicture,
|
||
formatImgUrl
|
||
} from '@/common/util.js';
|
||
export default {
|
||
data() {
|
||
return {
|
||
|
||
choosenType: [{ id: '1', name: '非常满意' }, { id: '2', name: '满意' }, { id: '3', name: '一般' }, { id: '4', name: '不满意' }],
|
||
vbPicture:vbPicture,
|
||
formatImgUrl:formatImgUrl,
|
||
userInfo:getStorage('userInfo'),
|
||
userId:getStorage('userInfo').userId,
|
||
formatDate:formatDate,
|
||
item: {},
|
||
questionType:['单选题','简答题'],
|
||
questionList:[],
|
||
id:0,
|
||
state:'',
|
||
type:'',
|
||
feedback:'',
|
||
submitFlag:true,
|
||
}
|
||
},
|
||
onLoad(option) {
|
||
this.state = option.state||'0';
|
||
this.id = option.id|| 0;
|
||
this.type = option.type|| '1';
|
||
console.log(this.type,'type:1未参加,2已参加')
|
||
console.log(this.state,'state:0未开始,1已结束,2进行中')
|
||
this.getQuestion();
|
||
},
|
||
methods: {
|
||
getQuestion(){
|
||
let params = {
|
||
method: getQuestionnaireById,
|
||
data: {
|
||
userId:this.userId,
|
||
id:this.id
|
||
}
|
||
};
|
||
callbackRequest(params).then(res => {
|
||
res = res.data;
|
||
console.log(res)
|
||
if (res.returnCode == 1) {
|
||
this.item = res.returnData.list[0];
|
||
this.questionList = res.returnData.listTopIc;
|
||
} else {
|
||
alertTip(res.returnMsg);
|
||
}
|
||
});
|
||
},
|
||
changeRadioGroup(e,obj){
|
||
console.log(e.detail.value)
|
||
console.log(Number(obj.NUMBER)-1)
|
||
let index = Number(obj.NUMBER)-1;
|
||
this.questionList[index].OPTION = e.detail.value;
|
||
// this.formData[radioData] = e.detail.value;
|
||
// console.log(this.formData);
|
||
// console.log(data);
|
||
},
|
||
submit(state){
|
||
if(!this.submitFlag){
|
||
return false;
|
||
}
|
||
this.questionList.forEach(item=>{
|
||
if(item.OPTION=='' || !item.OPTION){
|
||
alertTip('问卷未填写完整');
|
||
return false;
|
||
}
|
||
})
|
||
this.submitFlag = false;
|
||
let params = {
|
||
"method": updateQuestionnaire,
|
||
"data":{
|
||
id: this.id,
|
||
userId:getStorage('userInfo').id,
|
||
userName:getStorage('userInfo').userName,
|
||
topIc:this.questionList.map(item=>{
|
||
return {id:item.ID,option:item.OPTION}
|
||
})
|
||
}
|
||
};
|
||
callbackRequest(params).then(res => {
|
||
res = res.data;
|
||
if (res.returnCode == 1) {
|
||
alertTip(res.returnMsg);
|
||
this.getQuestion();
|
||
uni.redirectTo({
|
||
url: '/pages/questionnaire/questionnaire'
|
||
});
|
||
this.submitFlag = true;
|
||
} else {
|
||
alertTip(res.returnMsg);
|
||
this.submitFlag = true;
|
||
}
|
||
})
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
@import '@/static/css/common.scss';
|
||
|
||
.details{
|
||
// height: 550upx;
|
||
background: white;
|
||
margin: 20upx;
|
||
border-radius: 15upx;
|
||
padding-bottom:15rpx;
|
||
position: relative;
|
||
font-size: 26upx;
|
||
.detail_msg {
|
||
margin-left: 20upx;
|
||
border-radius: 10upx;
|
||
.info-item{
|
||
border-bottom:1px solid #f8f8f8;
|
||
padding:20upx 10upx;
|
||
line-height: 50upx;
|
||
.label{
|
||
float: left;
|
||
width: 180upx;
|
||
font-size: 28upx;
|
||
color: #333;
|
||
font-weight: bold;
|
||
line-height: 50upx;
|
||
}
|
||
}
|
||
.status {
|
||
.infoSpan{
|
||
color: #00c277;
|
||
}
|
||
.infoSpan2{
|
||
color: red;
|
||
}
|
||
}
|
||
.img-box {
|
||
// background: #fff;
|
||
image{
|
||
width: 200upx;
|
||
height: 200upx;
|
||
margin:20upx 20upx 0 0;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
.form-box-ud {
|
||
background: #fff;
|
||
.form-item {
|
||
overflow: hidden;
|
||
// border-bottom: 1px solid #eee;
|
||
padding: 30upx 20upx 10upx 20upx;
|
||
.label {
|
||
margin-top: 20upx;
|
||
width: 100%;
|
||
font-size: 28upx;
|
||
color: #333;
|
||
font-weight: bold;
|
||
line-height: 50upx;
|
||
word-break: break-all;
|
||
.ques-type{
|
||
float: right;
|
||
margin-right: 20upx;
|
||
}
|
||
}
|
||
.ipt-box {
|
||
margin-left: 20upx;
|
||
margin-top: 20upx;
|
||
input {
|
||
width: 100%;
|
||
height: 70upx;
|
||
line-height: 70upx;
|
||
font-size: 28upx;
|
||
color: #666;
|
||
border: 1px solid #e5e5e5;
|
||
padding-left: 20upx;
|
||
border-radius: 10upx;
|
||
// padding: 40upx 20upx;
|
||
}
|
||
.radio-group{
|
||
font-size: 26upx;
|
||
display: flex;
|
||
justify-content: flex-start;
|
||
align-items: center;
|
||
margin-right: 40upx;
|
||
min-width: 140upx;
|
||
margin-bottom: 20upx;
|
||
}
|
||
}
|
||
.select {
|
||
.arrow {
|
||
float: right;
|
||
width: 16upx;
|
||
height: 29upx;
|
||
margin-top: 10upx;
|
||
}
|
||
.picker {
|
||
height: 50upx;
|
||
line-height: 50upx;
|
||
font-size: 26upx;
|
||
color: #666;
|
||
margin-left: 10upx;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
</style>
|