import { wxRequestPost, wxRedirectTo } from "@utils/promise-wx-api"; import copyKeyHave from "@npm/dai-mp/tools/copyKeyHave.js"; import commonBehavior from "@mixins/common"; const app = getApp(); Component({ behaviors: [commonBehavior], properties: { issueApplicationId: { type: String, value: "", }, }, data: { iniLoaded: false, info: { issueTitle: "--", gridName: "", issuePublisher: "", issueSuggestion: "", }, topicInfo: { topicId: "", topicContent: "", publishedUser: "", publishedTime: 0, }, topicImgList: [ "/assets/images/login/bg.png", "/assets/images/login/bg.png", ], progressList: [ // { // "historyId": "53380", // "actionType": "7t96LNiM25", // "operateTime": "1605503489178", // "reason": "aAN8yHycK2", // "staffName": "zAvAdt8uPB" // } ], }, methods: { onShow() { this.init(); }, async init() { await app.doAfterLogin(); await this.getApiData(); this.setData({ iniLoaded: true, }); }, async getApiData() { this.getProgressInfo(); await this.getInfo(); }, // 议题详情 async getInfo() { const { 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) { let { info, topicImgList, topicInfo } = this.data; info = copyKeyHave(info, data); // 话题详情相关 topicInfo = copyKeyHave(topicInfo, data.topicInfo); topicImgList = data.topicInfo.topicImgs; console.log("info", info); this.setData({ info, topicInfo, topicImgList, }); } }, // 处理进展 async getProgressInfo() { const { issueApplicationId } = this.data; const { data: { data: { code, data }, }, msg, } = await wxRequestPost( "resi/group/groupissue/applicationhistory", { issueApplicationId, }, { // isMock: true, // isQuiet: true } ); if (msg === "success" && code === 0) { this.setData({ progressList: data.map((item) => { item.actionTypeName = item.actionType == "under_auditing" ? "待审核" : item.actionType == "rejected" ? "已驳回" : item.actionType == "auto_passed" ? "自动通过" : "已通过"; item.actionTimeField = item.actionType == "under_auditing" ? "提交审核时间:" : item.actionType == "rejected" ? "议题驳回时间:" : item.actionType == "auto_passed" ? "自动通过时间:" : "审核通过时间:"; return item; }), }); } }, // 点击查看作品图集 previewImg(e) { const { target: { dataset: { index }, }, } = e; const { topicImgList } = this.data, currentImg = topicImgList[index], imgArr = topicImgList; wx.previewImage({ current: currentImg, urls: imgArr, }); }, // 打电话 callPhone(e) { const { target: { dataset: { phone }, }, } = e; wx.makePhoneCall({ phoneNumber: phone, }); }, reedit() { wxRedirectTo("/subpages/group/pages/topic/topicToDiscussion/index", { topicid: this.data.topicInfo.topicId, from: "audittingDiscussion", }); }, back() { wx.navigateBack(); }, }, });