日照项目的居民端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

212 lines
4.6 KiB

import {
wxRequestPost
} from "@utils/promise-wx-api";
import words from "@config/words";
const app = getApp();
Page({
data: {
notSatisify: '../../images/face1.png',
notSatisifySelected: '../../images/face1_light.png',
normalSatisify: '../../images/face2.png',
normalSatisifySelected: '../../images/face2_light.png',
verySatisify: '../../images/face3.png',
verySatisifySelected: '../../images/face3_light.png',
textareaValue: '',
evaluationCallbackVisible: false,
satisifyType: '',
issueId: '', //议题已关闭
projectId: '', //话题转项目
pageInit: '',
voted: false,
evaluateInfo: {},
tit: ''
},
async onLoad(options) {
let issueId = options.issueid,
projectId = options.projectid,
type = options.type,
tit = options.tit
this.setData({
issueId: issueId,
projectId: projectId,
tit: tit
})
console.log('----------------------')
console.log('type',type)
console.log('projectId',projectId)
if (type=='closed') {
this.setData({
pageInit: 'issue'
})
await this.issueInit()
}
if (type=='shift_project') {
this.setData({
pageInit: 'project'
})
await this.projectInit()
}
},
onShow() {
},
// textarea 双向绑定
bindTextareaValue(e) {
this.setData({
textareaValue: e.detail.value
})
},
// 发表评价
async publishEvaluation() {
if (!this.data.satisifyType) {
wx.showToast({
title: '请进行满意度评价',
icon: 'none',
duration: 1000
})
return false
} else if (!this.data.textareaValue) {
wx.showToast({
title: '请填写评价内容',
icon: 'none',
duration: 1000
})
return false
}
if (this.data.pageInit == 'issue') { //议题已关闭
await this.issuePublish()
} else { //项目已结案
await this.projectPublish()
}
},
// 选择 满意度
chooseSatisifyType(e) {
let type = e.currentTarget.dataset.type
this.setData({
satisifyType: type //e.currentTarget.dataset.type
})
},
async issuePublish() {
wx.showLoading({
title: "正在审核中",
mask: true
});
const { issueId } = this.data;
const {
data: {
data: { code, data },
},
msg,
} = await wxRequestPost(
"resi/hall/issue/evaluate",
{
issueId: issueId,
satisfaction: this.data.satisifyType,
comment: this.data.textareaValue
},
{
//isMock: true,
}
);
wx.hideLoading()
if (msg === "success" && code === 0) {
wx.redirectTo({
url: `/pages/discussion/detail/index?issueId=${this.data.issueId}`
})
// wx.navigateBack({
// delta: 1
// })
}
},
async projectPublish() {
wx.showLoading({
title: "正在审核中",
mask: true
});
const { projectId } = this.data;
const {
data: {
data: { code, data },
},
msg,
} = await wxRequestPost(
"resi/hall/issue/projectevaluate",
{
projectId: projectId,
satisfaction: this.data.satisifyType,
comment: this.data.textareaValue
},
{
//isMock: true,
}
);
wx.hideLoading()
if (msg === "success" && code === 0) {
wx.redirectTo({
url: `/pages/discussion/detail/index?issueId=${this.data.issueId}`
})
// wx.navigateBack({
// delta: 1
// })
}
},
async issueInit() {
const { issueId } = this.data;
const {
data: {
data: { code, data },
},
msg,
} = await wxRequestPost(
"resi/hall/issue/initevaluation",
{
issueId
},
{
//isMock: true,
}
);
if (msg === "success" && code === 0) {
this.setData({
voted: data.status,
evaluateInfo: data.evaluateInfo
})
}
},
async projectInit() {
const { projectId } = this.data;
const {
data: {
data: { code, data },
},
msg,
} = await wxRequestPost(
"resi/hall/issue/projectinitevaluation",
{
projectId
},
{
//isMock: true,
}
);
if (msg === "success" && code === 0) {
this.setData({
voted: data.status,
evaluateInfo: data.evaluateInfo
})
console.log('voted',this.data.voted)
}
},
})