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.
247 lines
5.2 KiB
247 lines
5.2 KiB
import request from "@config/rerquest";
|
|
import { wxRequestPost } from "@utils/promise-wx-api";
|
|
import { nextTick } from "@utils/tools";
|
|
|
|
const app = getApp();
|
|
|
|
Page({
|
|
data: {
|
|
iniLoaded: false,
|
|
|
|
isBlocked: false,
|
|
|
|
topicId: "",
|
|
topicDetail: {},
|
|
subject: {
|
|
topicId: "",
|
|
issueTitle: "",
|
|
suggest: "",
|
|
},
|
|
from: "",
|
|
|
|
checkHistoryList: [],
|
|
rejectReason: "",
|
|
voiceList: [], // 音频列表
|
|
},
|
|
|
|
async onLoad(options) {
|
|
await app.doAfterLogin();
|
|
|
|
this.setData({
|
|
topicId: options.topicid,
|
|
from: options.from,
|
|
});
|
|
|
|
await this.initSubject();
|
|
await this.getAttechment();
|
|
|
|
this.setData({ iniLoaded: true });
|
|
},
|
|
|
|
bindInput(e) {
|
|
this.setData({
|
|
"subject.issueTitle": e.detail.value,
|
|
});
|
|
app.globalData.tempData.subjectTitle = e.detail.value;
|
|
console.log(app.globalData.tempData.subjectTitle);
|
|
},
|
|
bindTextAreaBlur: function (e) {
|
|
this.setData({
|
|
"subject.suggest": e.detail.value,
|
|
});
|
|
app.globalData.tempData.subjectSuggest = e.detail.value;
|
|
console.log(app.globalData.tempData.subjectSuggest);
|
|
},
|
|
|
|
async initSubject() {
|
|
const {
|
|
data: {
|
|
data: { code, data },
|
|
},
|
|
msg,
|
|
} = await wxRequestPost(
|
|
"resi/group/topic/initturnissue",
|
|
{
|
|
topicId: this.data.topicId,
|
|
},
|
|
{
|
|
// isMock: true
|
|
}
|
|
);
|
|
|
|
if (msg === "success" && code === 0) {
|
|
this.setData({
|
|
topicDetail: data,
|
|
});
|
|
if (data.applyStatus == "rejected") {
|
|
await this.getCheckHistory();
|
|
await this.getIssueInfo();
|
|
}
|
|
} else if (code === 9006) {
|
|
this.setData({
|
|
isBlocked: true,
|
|
});
|
|
}
|
|
},
|
|
|
|
// 获取话题附件
|
|
async getAttechment() {
|
|
const { topicId } = this.data;
|
|
|
|
const {
|
|
data: {
|
|
data: { code, data },
|
|
},
|
|
msg,
|
|
} = await wxRequestPost(
|
|
"resi/group/topic/topicattachmentlist",
|
|
{
|
|
topicId,
|
|
},
|
|
{
|
|
// isMock: true
|
|
}
|
|
);
|
|
console.log("ddddata", data);
|
|
if (msg === "success" && code === 0) {
|
|
this.setData({
|
|
voiceList: data.voiceList,
|
|
});
|
|
}
|
|
},
|
|
|
|
// 议题详情
|
|
async getIssueInfo() {
|
|
const {
|
|
topicDetail: { issueApplicationId },
|
|
} = this.data;
|
|
|
|
const {
|
|
data: {
|
|
data: { code, data },
|
|
},
|
|
msg,
|
|
} = await wxRequestPost(
|
|
"resi/group/groupissue/applicationdetail",
|
|
{
|
|
issueApplicationId,
|
|
},
|
|
{
|
|
// isMock: true,
|
|
// isQuiet: true
|
|
}
|
|
);
|
|
if (msg === "success" && code === 0) {
|
|
this.setData({
|
|
"subject.issueTitle": data.issueTitle,
|
|
"subject.suggest": data.issueSuggestion,
|
|
});
|
|
}
|
|
},
|
|
|
|
async getCheckHistory() {
|
|
const {
|
|
topicDetail: { issueApplicationId },
|
|
} = this.data;
|
|
|
|
if (!issueApplicationId) return;
|
|
|
|
const {
|
|
data: {
|
|
data: { code, data },
|
|
},
|
|
msg,
|
|
} = await wxRequestPost(
|
|
"resi/group/groupissue/applicationhistory",
|
|
{
|
|
issueApplicationId,
|
|
},
|
|
{
|
|
// isMock: true
|
|
}
|
|
);
|
|
|
|
if (msg === "success" && code === 0) {
|
|
this.setData({
|
|
checkHistoryList: data,
|
|
rejectReason: data[0].reason,
|
|
});
|
|
}
|
|
},
|
|
|
|
preview() {
|
|
let topicid = this.data.topicId;
|
|
wx.navigateTo({
|
|
url: `../subjectPreview/index?topicid=${topicid}`,
|
|
});
|
|
},
|
|
|
|
async turnSubject() {
|
|
const {
|
|
topicId,
|
|
topicDetail: { issueApplicationId },
|
|
subject,
|
|
} = this.data;
|
|
|
|
if (subject.issueTitle == "") {
|
|
wx.showToast({
|
|
title: "请输入标题",
|
|
icon: "none",
|
|
duration: 3000,
|
|
});
|
|
return false;
|
|
}
|
|
if (subject.suggest == "") {
|
|
wx.showToast({
|
|
title: "请输入处理意见",
|
|
icon: "none",
|
|
duration: 3000,
|
|
});
|
|
return false;
|
|
}
|
|
|
|
const url = issueApplicationId
|
|
? "resi/group/topic/editissueapplication"
|
|
: "resi/group/topic/turnintoissuev2";
|
|
let params = {
|
|
topicId,
|
|
issueTitle: subject.issueTitle,
|
|
suggestion: subject.suggest,
|
|
issueApplicationId,
|
|
};
|
|
|
|
wx.showLoading({
|
|
title: "正在审核中",
|
|
mask: true,
|
|
});
|
|
|
|
const {
|
|
data: {
|
|
data: { code, data },
|
|
},
|
|
msg,
|
|
} = await wxRequestPost(url, params, {
|
|
// isMock: true
|
|
});
|
|
wx.hideLoading();
|
|
|
|
if (msg === "success" && code === 0) {
|
|
if (data.issueApplicationId || data.auditSwitch == "open") {
|
|
return this.setData({
|
|
"topicDetail.applyStatus": "under_auditing",
|
|
"topicDetail.issueApplicationId": data.issueApplicationId,
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: "转议题成功",
|
|
icon: "none",
|
|
duration:2000,
|
|
});
|
|
await nextTick(1500)
|
|
wx.redirectTo({
|
|
url: `/pages/discussion/detail/index?issueId=${data.issueId}`,
|
|
});
|
|
}
|
|
}
|
|
},
|
|
});
|
|
|