mirror of
https://gitee.com/java110/WechatOwnerService.git
synced 2026-06-11 06:07:24 +08:00
加入投票功能
This commit is contained in:
parent
12a11c7ea2
commit
75362a6342
@ -61,4 +61,31 @@ export function queryQuestionAnswerTitle(_data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add by wuxw
|
||||||
|
* @param {Object} _data 保存 用户地址
|
||||||
|
*/
|
||||||
|
export function saveUserQuestionAnswerValue(_data){
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let moreRooms = [];
|
||||||
|
request({
|
||||||
|
url: url.saveUserQuestionAnswerValue,
|
||||||
|
method: "POST",
|
||||||
|
data: _data, //动态数据
|
||||||
|
success: function(res) {
|
||||||
|
let _data = res.data;
|
||||||
|
if (_data.code == 0) {
|
||||||
|
resolve(_data);
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
reject(_data.msg);
|
||||||
|
},
|
||||||
|
fail: function(e) {
|
||||||
|
reject(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -116,6 +116,7 @@ export default {
|
|||||||
queryContract:baseUrl + "app/contract/queryContract",
|
queryContract:baseUrl + "app/contract/queryContract",
|
||||||
queryQuestionAnswer:baseUrl + "app/questionAnswer/queryQuestionAnswer",
|
queryQuestionAnswer:baseUrl + "app/questionAnswer/queryQuestionAnswer",
|
||||||
queryQuestionAnswerTitle:baseUrl + "app/questionAnswer/queryQuestionAnswerTitle",
|
queryQuestionAnswerTitle:baseUrl + "app/questionAnswer/queryQuestionAnswerTitle",
|
||||||
|
saveUserQuestionAnswerValue:baseUrl + "app/userQuestionAnswer/saveUserQuestionAnswerValue",
|
||||||
|
|
||||||
NEED_NOT_LOGIN_PAGE: [
|
NEED_NOT_LOGIN_PAGE: [
|
||||||
'/pages/login/login',
|
'/pages/login/login',
|
||||||
|
|||||||
@ -12,6 +12,7 @@
|
|||||||
<text class="margin-right-xs">结束时间:</text> {{question.endTime}}</view>
|
<text class="margin-right-xs">结束时间:</text> {{question.endTime}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="action" v-if="question.state == '0'">已结束</view>
|
<view class="action" v-if="question.state == '0'">已结束</view>
|
||||||
|
<view class="action" v-else-if="question.state == '2'">已投票</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="cu-list menu" v-if="questions.length === 0">
|
<view class="cu-list menu" v-if="questions.length === 0">
|
||||||
@ -41,13 +42,15 @@
|
|||||||
communityId: "",
|
communityId: "",
|
||||||
questions: [],
|
questions: [],
|
||||||
currPageIndex: 0,
|
currPageIndex: 0,
|
||||||
pageSize: 10
|
pageSize: 10,
|
||||||
|
userId:''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad: function(options) {
|
onLoad: function(options) {
|
||||||
let that = this;
|
let that = this;
|
||||||
context.onLoad(options);
|
context.onLoad(options);
|
||||||
that.communityId = context.getUserInfo().communityId;
|
that.communityId = context.getUserInfo().communityId;
|
||||||
|
that.userId = context.getUserInfo().userId;
|
||||||
|
|
||||||
queryQuestionAnswer({
|
queryQuestionAnswer({
|
||||||
page:1,
|
page:1,
|
||||||
@ -62,7 +65,10 @@
|
|||||||
if(_endTime.getTime() > new Date().getTime()){
|
if(_endTime.getTime() > new Date().getTime()){
|
||||||
item.state = '1';
|
item.state = '1';
|
||||||
}else{
|
}else{
|
||||||
item.state = '0'
|
item.state = '0';
|
||||||
|
}
|
||||||
|
if(item.userId == that.userId){
|
||||||
|
item.state = '2';
|
||||||
}
|
}
|
||||||
item.startTime = item.startTime.replace(/:\d{1,2}$/, ' ');
|
item.startTime = item.startTime.replace(/:\d{1,2}$/, ' ');
|
||||||
item.endTime = item.endTime.replace(/:\d{1,2}$/, ' ');
|
item.endTime = item.endTime.replace(/:\d{1,2}$/, ' ');
|
||||||
@ -82,6 +88,13 @@
|
|||||||
})
|
})
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
if(_question.state == '2'){
|
||||||
|
uni.showToast({
|
||||||
|
icon:'none',
|
||||||
|
title:'此投票问卷已投票'
|
||||||
|
})
|
||||||
|
return ;
|
||||||
|
}
|
||||||
let that = this;
|
let that = this;
|
||||||
this.vc.navigateTo({
|
this.vc.navigateTo({
|
||||||
url: "/pages/questionAnswerDetail/questionAnswerDetail?qaId=" + _question.qaId+"&objType="+_question.objType
|
url: "/pages/questionAnswerDetail/questionAnswerDetail?qaId=" + _question.qaId+"&objType="+_question.objType
|
||||||
|
|||||||
@ -36,7 +36,7 @@
|
|||||||
const factory = context.factory;
|
const factory = context.factory;
|
||||||
|
|
||||||
import {
|
import {
|
||||||
queryQuestionAnswerTitle
|
queryQuestionAnswerTitle,saveUserQuestionAnswerValue
|
||||||
} from '../../api/question/questionApi.js'
|
} from '../../api/question/questionApi.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -108,22 +108,53 @@
|
|||||||
submitQuestionAnswer: function(e) {
|
submitQuestionAnswer: function(e) {
|
||||||
|
|
||||||
console.log(this.titles);
|
console.log(this.titles);
|
||||||
|
|
||||||
|
let _questionAnswerTitles = [];
|
||||||
|
let _titles = this.titles;
|
||||||
|
let _valueId = '';
|
||||||
|
_titles.forEach(item => {
|
||||||
|
|
||||||
|
if (item.titleType == '2002') {
|
||||||
|
item.radio.forEach(_radio=>{
|
||||||
|
_questionAnswerTitles.push({
|
||||||
|
valueContent:_radio.valueId,
|
||||||
|
titleId:item.titleId,
|
||||||
|
titleType:item.titleType
|
||||||
|
})
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
_valueId = item.radio;
|
||||||
|
_questionAnswerTitles.push({
|
||||||
|
valueContent:_valueId,
|
||||||
|
titleId:item.titleId,
|
||||||
|
titleType:item.titleType
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
let obj = {
|
let obj = {
|
||||||
"repairName": this.bindRepairName,
|
"qaId": this.qaId,
|
||||||
"repairType": this.repairType,
|
"objType": this.objType,
|
||||||
"appointmentTime": this.bindDate + " " + this.bindTime + ":00",
|
"objId": context.getUserInfo().communityId,
|
||||||
"tel": this.bindTel,
|
"answerType": '1002',
|
||||||
"roomId": this.roomId,
|
questionAnswerTitles:_questionAnswerTitles
|
||||||
"photos": [],
|
|
||||||
"context": this.context,
|
|
||||||
"userId": this.userId,
|
|
||||||
"userName": this.userName,
|
|
||||||
"communityId": this.communityId,
|
|
||||||
"bindDate": this.bindDate,
|
|
||||||
"bindTime": this.bindTime,
|
|
||||||
"repairObjType": this.repairObjType,
|
|
||||||
"repairChannel": 'Z'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
saveUserQuestionAnswerValue(obj)
|
||||||
|
.then(_data=>{
|
||||||
|
uni.showToast({
|
||||||
|
icon:'none',
|
||||||
|
title:'投票成功'
|
||||||
|
});
|
||||||
|
uni.navigateBack({
|
||||||
|
delta:1
|
||||||
|
})
|
||||||
|
},err=>{
|
||||||
|
uni.showToast({
|
||||||
|
icon:'none',
|
||||||
|
title:err
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user