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.
766 lines
35 KiB
766 lines
35 KiB
"use strict";
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
function step(op) {
|
|
if (f) throw new TypeError("Generator is already executing.");
|
|
while (_) try {
|
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
switch (op[0]) {
|
|
case 0: case 1: t = op; break;
|
|
case 4: _.label++; return { value: op[1], done: false };
|
|
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
default:
|
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
if (t[2]) _.ops.pop();
|
|
_.trys.pop(); continue;
|
|
}
|
|
op = body.call(thisArg, _);
|
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
}
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
var promise_wx_api_1 = require("../../../utils/promise-wx-api");
|
|
var index_js_1 = require("../../../utils/validate/index.js");
|
|
var words_1 = require("../../../config/words");
|
|
var copyKeyHave_js_1 = require("../../../miniprogram_npm/dai-mp/tools/copyKeyHave.js");
|
|
var dateFormat_js_1 = require("../../../miniprogram_npm/dai-mp/tools/dateFormat.js");
|
|
var index_js_2 = require("../../../miniprogram_npm/dai-mp/mixins/computed-component/index.js");
|
|
var common_1 = require("../../../mixins/common");
|
|
var list_1 = require("../../../mixins/list");
|
|
var app = getApp();
|
|
var testPic = "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3015922630,3907554494&fm=26&gp=0.jpg";
|
|
Component({
|
|
behaviors: [common_1.default, index_js_2.default, list_1.default],
|
|
properties: {
|
|
issueId: {
|
|
type: String,
|
|
value: "",
|
|
},
|
|
shareLinkId: {
|
|
type: String,
|
|
value: "",
|
|
},
|
|
},
|
|
data: {
|
|
iniLoaded: false,
|
|
refreshFlag: false,
|
|
haveRegistered: false,
|
|
myShareLinkId: "",
|
|
awaitAudit: false,
|
|
inAnyGroup: true,
|
|
inGroup: true,
|
|
voted: false,
|
|
voterst: "",
|
|
votedNum: {},
|
|
info: {
|
|
issueTitle: "--",
|
|
issuePublisherMobile: "",
|
|
sourceType: "",
|
|
sourceId: "",
|
|
issueStatus: "",
|
|
issueSuggestion: "",
|
|
belongsGridName: "",
|
|
issueInitiator: "",
|
|
joinVote: false,
|
|
projectStatus: false,
|
|
projectId: "",
|
|
issueIdea: "",
|
|
publishIdeaFlag: false,
|
|
},
|
|
topicInfo: {
|
|
topicId: "",
|
|
groupName: "",
|
|
topicContent: "",
|
|
publishedUser: "",
|
|
publishedTime: 0,
|
|
topicPublisherMobile: "",
|
|
},
|
|
eventInfo: {},
|
|
topicContentFolded: true,
|
|
topicImgList: [],
|
|
voteInfo: {
|
|
shouldVoteCount: 0,
|
|
realityVoteCount: 0,
|
|
supportAmount: 0,
|
|
oppositionAmount: 0,
|
|
},
|
|
chartData: [],
|
|
voiceList: [],
|
|
progressList: [],
|
|
showedCloseFm: false,
|
|
fmData: {
|
|
resolveType: "resloved",
|
|
closeReason: "",
|
|
},
|
|
resolveTypeList: [
|
|
{
|
|
name: "已解决",
|
|
value: "resloved",
|
|
},
|
|
{
|
|
name: "无需解决",
|
|
value: "unresloved",
|
|
},
|
|
],
|
|
listUrl: "resi/hall/issue/projectevaluationlist",
|
|
listIsMock: false,
|
|
listParams: {},
|
|
classTag: {
|
|
class: "",
|
|
tag: "",
|
|
},
|
|
},
|
|
computed: {
|
|
errBeforeSubmit: function (data) {
|
|
var fmData = data.fmData, vlt = index_js_1.default(fmData, {
|
|
closeReason: [
|
|
{
|
|
rule: "required",
|
|
message: "请先输入【处理答复】",
|
|
},
|
|
],
|
|
});
|
|
if (!vlt.valid) {
|
|
return vlt.error;
|
|
}
|
|
else {
|
|
return "";
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
onLoad: function () {
|
|
this.init();
|
|
},
|
|
onShow: function () {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
return __generator(this, function (_a) {
|
|
switch (_a.label) {
|
|
case 0:
|
|
if (!this.data.refreshFlag) return [3, 2];
|
|
return [4, app.enterGridData()];
|
|
case 1:
|
|
_a.sent();
|
|
this.syncRoleInfo();
|
|
this.getInfo();
|
|
_a.label = 2;
|
|
case 2: return [2];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
toTagPage: function () {
|
|
promise_wx_api_1.wxNavigateTo("tag/index", { issueId: this.data.issueId });
|
|
},
|
|
onShareAppMessage: function () {
|
|
var _a = this.data, topicImgList = _a.topicImgList, myShareLinkId = _a.myShareLinkId;
|
|
var _b = app.globalData.userInfo, userStreetName = _b.userStreetName, nickname = _b.nickname;
|
|
var name = userStreetName || nickname;
|
|
return {
|
|
title: name + "\u5206\u4EAB\u7ED9\u60A8\u4E00\u6761\u8BAE\u9898\uFF0C\u8BF7\u67E5\u770B",
|
|
path: this.route + "?shareLinkId=" + myShareLinkId,
|
|
imageUrl: topicImgList.length > 0 ? topicImgList[0] : "",
|
|
success: function (shareTickets) {
|
|
log("转发成功", shareTickets);
|
|
},
|
|
};
|
|
},
|
|
shiftFoldTopicContent: function () {
|
|
this.setData({
|
|
topicContentFolded: !this.data.topicContentFolded,
|
|
});
|
|
},
|
|
init: function () {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var shareLinkId;
|
|
return __generator(this, function (_a) {
|
|
switch (_a.label) {
|
|
case 0:
|
|
shareLinkId = this.data.shareLinkId;
|
|
if (!shareLinkId) return [3, 4];
|
|
return [4, app.loginGetToken()];
|
|
case 1:
|
|
_a.sent();
|
|
return [4, this.getShareInfo()];
|
|
case 2:
|
|
_a.sent();
|
|
return [4, app.enterGridData()];
|
|
case 3:
|
|
_a.sent();
|
|
return [3, 6];
|
|
case 4: return [4, app.doAfterLogin()];
|
|
case 5:
|
|
_a.sent();
|
|
_a.label = 6;
|
|
case 6:
|
|
this.syncRoleInfo();
|
|
return [4, this.voteNum()];
|
|
case 7:
|
|
_a.sent();
|
|
return [4, this.getApiData()];
|
|
case 8:
|
|
_a.sent();
|
|
this.getMyShareLinkId();
|
|
if (!shareLinkId) return [3, 10];
|
|
return [4, this.getGroupRelation()];
|
|
case 9:
|
|
_a.sent();
|
|
_a.label = 10;
|
|
case 10:
|
|
this.setData({
|
|
iniLoaded: true,
|
|
refreshFlag: true,
|
|
});
|
|
return [2];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
syncRoleInfo: function () {
|
|
var haveRegistered = app.globalData.userRoleList.indexOf("registered_resi") !== -1;
|
|
this.setData({
|
|
haveRegistered: haveRegistered,
|
|
});
|
|
if (haveRegistered) {
|
|
this.selectComponent("#modalReg").hide();
|
|
}
|
|
},
|
|
getShareInfo: function () {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var shareLinkId, _a, _b, code, data, msg;
|
|
return __generator(this, function (_c) {
|
|
switch (_c.label) {
|
|
case 0:
|
|
shareLinkId = this.data.shareLinkId;
|
|
return [4, promise_wx_api_1.wxRequestPost("gov/issue/issuesharelink/visit", {
|
|
shareLinkId: shareLinkId,
|
|
}, {})];
|
|
case 1:
|
|
_a = _c.sent(), _b = _a.data.data, code = _b.code, data = _b.data, msg = _a.msg;
|
|
if (msg === "success" && code === 0) {
|
|
this.setData({
|
|
issueId: data.issueId,
|
|
});
|
|
app.globalData.gridId = data.gridId;
|
|
app.globalData.customerId = data.customerId;
|
|
}
|
|
return [2];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
getGroupRelation: function () {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var shareLinkId, _a, _b, code, data, msg;
|
|
return __generator(this, function (_c) {
|
|
switch (_c.label) {
|
|
case 0:
|
|
shareLinkId = this.data.shareLinkId;
|
|
return [4, promise_wx_api_1.wxRequestPost("resi/group/topicsharelink/getstatus", {
|
|
id: shareLinkId,
|
|
type: "issue",
|
|
}, {})];
|
|
case 1:
|
|
_a = _c.sent(), _b = _a.data.data, code = _b.code, data = _b.data, msg = _a.msg;
|
|
if (msg === "success" && code === 0) {
|
|
this.setData({
|
|
inGroup: data.inGroup,
|
|
inAnyGroup: data.inAnyGroup,
|
|
awaitAudit: data.awaitAudit,
|
|
});
|
|
}
|
|
return [2];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
getApiData: function () {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
return __generator(this, function (_a) {
|
|
switch (_a.label) {
|
|
case 0:
|
|
this.getChartInfo();
|
|
return [4, this.getInfo()];
|
|
case 1:
|
|
_a.sent();
|
|
this.getClassTagInfo();
|
|
return [4, this.getAttechment()];
|
|
case 2:
|
|
_a.sent();
|
|
return [2];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
share: function () {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
return __generator(this, function (_a) {
|
|
switch (_a.label) {
|
|
case 0: return [4, this.beforeAct()];
|
|
case 1: return [2, _a.sent()];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
beforeAct: function () {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var _a, inAnyGroup, awaitAudit, haveRegistered, $modal, confirm;
|
|
return __generator(this, function (_b) {
|
|
switch (_b.label) {
|
|
case 0:
|
|
_a = this.data, inAnyGroup = _a.inAnyGroup, awaitAudit = _a.awaitAudit, haveRegistered = _a.haveRegistered;
|
|
if (!awaitAudit) return [3, 1];
|
|
wx.showToast({
|
|
title: "已提交入组申请,请等待组长确认",
|
|
icon: "none",
|
|
duration: 2000,
|
|
});
|
|
return [2, false];
|
|
case 1:
|
|
if (!!inAnyGroup) return [3, 8];
|
|
$modal = this.selectComponent("#modal");
|
|
return [4, $modal.show({
|
|
title: "加入小组",
|
|
content: "您还不是该小组成员,请确认加入小组",
|
|
})];
|
|
case 2:
|
|
confirm = _b.sent();
|
|
$modal.hide();
|
|
if (!confirm) return [3, 6];
|
|
if (!!haveRegistered) return [3, 4];
|
|
return [4, this.selectComponent("#modalReg").show()];
|
|
case 3:
|
|
_b.sent();
|
|
if (this.data.haveRegistered) {
|
|
return [2, this.joinGroup()];
|
|
}
|
|
return [3, 5];
|
|
case 4: return [2, this.joinGroup()];
|
|
case 5: return [3, 7];
|
|
case 6: return [2, false];
|
|
case 7: return [3, 9];
|
|
case 8: return [2, true];
|
|
case 9: return [2];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
joinGroup: function () {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var shareLinkId, _a, _b, code, data, msg, status;
|
|
return __generator(this, function (_c) {
|
|
switch (_c.label) {
|
|
case 0:
|
|
shareLinkId = this.data.shareLinkId;
|
|
return [4, promise_wx_api_1.wxRequestPost("resi/group/member/applyenterbylink", {
|
|
shareLinkId: shareLinkId,
|
|
shareLinkType: "issue",
|
|
}, {})];
|
|
case 1:
|
|
_a = _c.sent(), _b = _a.data.data, code = _b.code, data = _b.data, msg = _a.msg;
|
|
if (msg === "success" && code === 0) {
|
|
status = data.status;
|
|
if (status == "entered") {
|
|
wx.showToast({
|
|
title: "入组成功",
|
|
icon: "success",
|
|
duration: 1500,
|
|
});
|
|
this.setData({
|
|
inAnyGroup: true,
|
|
inGroup: true,
|
|
});
|
|
return [2, true];
|
|
}
|
|
else if (status == "auditing") {
|
|
wx.showToast({
|
|
title: "已提交入组申请,请等待组长确认",
|
|
icon: "none",
|
|
duration: 1500,
|
|
});
|
|
this.setData({
|
|
awaitAudit: true,
|
|
});
|
|
}
|
|
}
|
|
return [2, false];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
getMyShareLinkId: function () {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var issueId, _a, _b, code, data, msg;
|
|
return __generator(this, function (_c) {
|
|
switch (_c.label) {
|
|
case 0:
|
|
issueId = this.data.issueId;
|
|
return [4, promise_wx_api_1.wxRequestPost("gov/issue/issuesharelink/createurl", {
|
|
issueId: issueId,
|
|
customerId: app.globalData.customerId,
|
|
}, {
|
|
isQuiet: true,
|
|
})];
|
|
case 1:
|
|
_a = _c.sent(), _b = _a.data.data, code = _b.code, data = _b.data, msg = _a.msg;
|
|
if (msg === "success" && code === 0) {
|
|
this.setData({ myShareLinkId: data.shareLinkId });
|
|
}
|
|
return [2];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
getInfo: function () {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var issueId, _a, _b, code, data, msg, _c, info, topicImgList, topicInfo;
|
|
var _d, _e;
|
|
return __generator(this, function (_f) {
|
|
switch (_f.label) {
|
|
case 0:
|
|
issueId = this.data.issueId;
|
|
return [4, promise_wx_api_1.wxRequestPost("resi/hall/issue/detail", {
|
|
issueId: issueId,
|
|
}, {})];
|
|
case 1:
|
|
_a = _f.sent(), _b = _a.data.data, code = _b.code, data = _b.data, msg = _a.msg;
|
|
if (msg === "success" && code === 0) {
|
|
_c = this.data, info = _c.info, topicImgList = _c.topicImgList, topicInfo = _c.topicInfo;
|
|
info = copyKeyHave_js_1.default(info, data);
|
|
topicInfo = copyKeyHave_js_1.default(topicInfo, data.topicInfo);
|
|
topicImgList = Array.isArray(data.topicInfo.topicImgs)
|
|
? data.topicInfo.topicImgs
|
|
: [];
|
|
console.log("info", info);
|
|
if (info.issueStatus == "closed" ||
|
|
info.issueStatus == "shift_project") {
|
|
this.getProgressInfo();
|
|
}
|
|
if (info.issueStatus == "closed") {
|
|
this.setData((_d = {
|
|
listUrl: "resi/hall/issue/evaluationlist"
|
|
},
|
|
_d["listParams.issueId"] = this.data.issueId,
|
|
_d));
|
|
console.log("给老子出来", this.data.listParams);
|
|
this.resetList();
|
|
this.getList();
|
|
}
|
|
if (info.issueStatus == "shift_project") {
|
|
this.setData((_e = {
|
|
listUrl: "resi/hall/issue/projectevaluationlist"
|
|
},
|
|
_e["listParams.projectId"] = info.projectId,
|
|
_e));
|
|
console.log("给老子出来", this.data.listParams);
|
|
this.resetList();
|
|
this.getList();
|
|
}
|
|
this.setData({
|
|
info: info,
|
|
topicInfo: topicInfo,
|
|
topicImgList: topicImgList,
|
|
});
|
|
if (info.sourceType == "ic_event") {
|
|
this.getEventInfo();
|
|
}
|
|
}
|
|
return [2];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
getEventInfo: function () {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var info, _a, _b, code, data, msg;
|
|
return __generator(this, function (_c) {
|
|
switch (_c.label) {
|
|
case 0:
|
|
info = this.data.info;
|
|
return [4, promise_wx_api_1.wxRequestPost("gov/project/icEvent/detail", {
|
|
icEventId: info.sourceId,
|
|
}, {})];
|
|
case 1:
|
|
_a = _c.sent(), _b = _a.data.data, code = _b.code, data = _b.data, msg = _a.msg;
|
|
console.log('ddddata', data);
|
|
if (msg === "success" && code === 0) {
|
|
this.setData({
|
|
eventInfo: data
|
|
});
|
|
}
|
|
return [2];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
getAttechment: function () {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var topicId, _a, _b, code, data, msg;
|
|
return __generator(this, function (_c) {
|
|
switch (_c.label) {
|
|
case 0:
|
|
topicId = this.data.topicInfo.topicId;
|
|
return [4, promise_wx_api_1.wxRequestPost("resi/group/topic/topicattachmentlist", {
|
|
topicId: topicId,
|
|
}, {})];
|
|
case 1:
|
|
_a = _c.sent(), _b = _a.data.data, code = _b.code, data = _b.data, msg = _a.msg;
|
|
console.log("ddddata", data);
|
|
if (msg === "success" && code === 0) {
|
|
this.setData({
|
|
voiceList: data.voiceList,
|
|
});
|
|
}
|
|
return [2];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
getClassTagInfo: function () {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var issueId, _a, _b, code, data, msg, categoryList, tagList, classTag;
|
|
return __generator(this, function (_c) {
|
|
switch (_c.label) {
|
|
case 0:
|
|
issueId = this.data.issueId;
|
|
return [4, promise_wx_api_1.wxRequestPost("gov/issue/issuecategory/categorytaglist", {
|
|
issueId: issueId,
|
|
}, {})];
|
|
case 1:
|
|
_a = _c.sent(), _b = _a.data.data, code = _b.code, data = _b.data, msg = _a.msg;
|
|
if (msg === "success" && code === 0) {
|
|
if (Object.keys(data).length > 0) {
|
|
categoryList = data.categoryList, tagList = data.tagList;
|
|
categoryList = categoryList.map(function (item) { return item.name; }).join("\n");
|
|
tagList = tagList.map(function (item) { return item.name; }).join(" ");
|
|
classTag = { class: categoryList, tag: tagList };
|
|
this.setData({
|
|
classTag: classTag,
|
|
});
|
|
}
|
|
}
|
|
return [2];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
getChartInfo: function () {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var issueId, _a, _b, code, data, msg, _c, voteInfo, chartData_1;
|
|
return __generator(this, function (_d) {
|
|
switch (_d.label) {
|
|
case 0:
|
|
issueId = this.data.issueId;
|
|
return [4, promise_wx_api_1.wxRequestPost("resi/hall/issue/votingtrend", {
|
|
issueId: issueId,
|
|
}, {})];
|
|
case 1:
|
|
_a = _d.sent(), _b = _a.data.data, code = _b.code, data = _b.data, msg = _a.msg;
|
|
if (msg === "success" && code === 0) {
|
|
_c = this.data, voteInfo = _c.voteInfo, chartData_1 = _c.chartData;
|
|
voteInfo = copyKeyHave_js_1.default(voteInfo, data);
|
|
chartData_1 = [];
|
|
data.polyLine.forEach(function (item) {
|
|
var date = dateFormat_js_1.default(new Date(item.voteDate * 1000), "yyyy-MM-dd");
|
|
console.log("date:" + date);
|
|
chartData_1.push({
|
|
date: date,
|
|
value: item.supportIncrement,
|
|
type: "支持",
|
|
}, {
|
|
date: date,
|
|
value: item.oppositionIncrement,
|
|
type: "反对",
|
|
});
|
|
});
|
|
console.log("chartData", chartData_1);
|
|
this.setData({
|
|
voteInfo: voteInfo,
|
|
chartData: chartData_1,
|
|
});
|
|
}
|
|
return [2];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
getProgressInfo: function () {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var issueId, _a, _b, code, data, msg;
|
|
return __generator(this, function (_c) {
|
|
switch (_c.label) {
|
|
case 0:
|
|
issueId = this.data.issueId;
|
|
return [4, promise_wx_api_1.wxRequestPost("resi/hall/issue/processlist", {
|
|
issueId: issueId,
|
|
}, {})];
|
|
case 1:
|
|
_a = _c.sent(), _b = _a.data.data, code = _b.code, data = _b.data, msg = _a.msg;
|
|
if (msg === "success" && code === 0) {
|
|
this.setData({
|
|
progressList: data,
|
|
});
|
|
}
|
|
return [2];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
previewImg: function (e) {
|
|
var index = e.target.dataset.index;
|
|
var topicImgList = this.data.topicImgList, currentImg = topicImgList[index], imgArr = topicImgList;
|
|
wx.previewImage({
|
|
current: currentImg,
|
|
urls: imgArr,
|
|
});
|
|
},
|
|
callPhone: function (e) {
|
|
var phone = e.target.dataset.phone;
|
|
wx.makePhoneCall({
|
|
phoneNumber: phone,
|
|
});
|
|
},
|
|
voteNum: function () {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var issueId, _a, _b, code, data, msg;
|
|
return __generator(this, function (_c) {
|
|
switch (_c.label) {
|
|
case 0:
|
|
issueId = this.data.issueId;
|
|
return [4, promise_wx_api_1.wxRequestPost("resi/hall/issue/vote", {
|
|
issueId: issueId,
|
|
}, {})];
|
|
case 1:
|
|
_a = _c.sent(), _b = _a.data.data, code = _b.code, data = _b.data, msg = _a.msg;
|
|
if (msg === "success" && code === 0) {
|
|
this.setData({
|
|
votedNum: data,
|
|
});
|
|
if (data.voteFlag) {
|
|
this.setData({
|
|
voted: true,
|
|
voterst: data.voteType,
|
|
});
|
|
}
|
|
}
|
|
return [2];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
rate: function (e) {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var issueid, projectid, type, tit;
|
|
return __generator(this, function (_a) {
|
|
console.log(e.currentTarget.dataset.tit);
|
|
issueid = e.currentTarget.dataset.issueid, projectid = e.currentTarget.dataset.projectid, type = e.currentTarget.dataset.type, tit = e.currentTarget.dataset.tit;
|
|
wx.navigateTo({
|
|
url: "/subpages/discussion/pages/rate/index?type=" + type + "&issueid=" + issueid + "&projectid=" + projectid + "&tit=" + tit,
|
|
});
|
|
return [2];
|
|
});
|
|
});
|
|
},
|
|
support: function () {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var issueId, _a, _b, code, data, msg;
|
|
return __generator(this, function (_c) {
|
|
switch (_c.label) {
|
|
case 0: return [4, this.beforeAct()];
|
|
case 1:
|
|
if (!(_c.sent()))
|
|
return [2];
|
|
if (!this.data.votedNum.voteAuthorization) {
|
|
wx.showToast({
|
|
title: words_1.default.topic.vote,
|
|
icon: "none",
|
|
duration: 3000,
|
|
});
|
|
return [2, false];
|
|
}
|
|
issueId = this.data.issueId;
|
|
wx.showLoading({
|
|
title: words_1.default.common.submitting,
|
|
mask: true,
|
|
});
|
|
return [4, promise_wx_api_1.wxRequestPost("resi/hall/issue/support", {
|
|
issueId: issueId,
|
|
}, {})];
|
|
case 2:
|
|
_a = _c.sent(), _b = _a.data.data, code = _b.code, data = _b.data, msg = _a.msg;
|
|
wx.hideLoading();
|
|
if (!(msg === "success" && code === 0)) return [3, 4];
|
|
return [4, this.voteNum()];
|
|
case 3:
|
|
_c.sent();
|
|
this.setData({
|
|
voted: true,
|
|
voterst: "support",
|
|
});
|
|
_c.label = 4;
|
|
case 4: return [2];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
oppose: function () {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var issueId, _a, _b, code, data, msg;
|
|
return __generator(this, function (_c) {
|
|
switch (_c.label) {
|
|
case 0: return [4, this.beforeAct()];
|
|
case 1:
|
|
if (!(_c.sent()))
|
|
return [2];
|
|
if (!this.data.votedNum.voteAuthorization) {
|
|
wx.showToast({
|
|
title: words_1.default.topic.vote,
|
|
icon: "none",
|
|
duration: 3000,
|
|
});
|
|
return [2, false];
|
|
}
|
|
issueId = this.data.issueId;
|
|
wx.showLoading({
|
|
title: words_1.default.common.submitting,
|
|
mask: true,
|
|
});
|
|
return [4, promise_wx_api_1.wxRequestPost("resi/hall/issue/oppose", {
|
|
issueId: issueId,
|
|
}, {})];
|
|
case 2:
|
|
_a = _c.sent(), _b = _a.data.data, code = _b.code, data = _b.data, msg = _a.msg;
|
|
wx.hideLoading();
|
|
if (!(msg === "success" && code === 0)) return [3, 4];
|
|
return [4, this.voteNum()];
|
|
case 3:
|
|
_c.sent();
|
|
this.setData({
|
|
voted: true,
|
|
voterst: "opposition",
|
|
});
|
|
_c.label = 4;
|
|
case 4: return [2];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
});
|
|
|