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.
103 lines
2.2 KiB
103 lines
2.2 KiB
import {
|
|
nextTick,
|
|
doAfterLogin,
|
|
getComponent
|
|
} from "../../../../utils/tools";
|
|
import {
|
|
wxRequestGet,
|
|
wxRedirectTo,
|
|
} from "../../../../utils/promise-wx-api";
|
|
import words from "../../../../config/words";
|
|
|
|
const app = getApp();
|
|
let $loading;
|
|
let $modal;
|
|
|
|
Page({
|
|
data: {
|
|
words,
|
|
|
|
customerId: "",
|
|
gridId: "",
|
|
gridName: "",
|
|
gridInfo: {}
|
|
|
|
},
|
|
|
|
// 初始化组件实例赋值
|
|
iniComponentVar() {
|
|
$loading = getComponent("#loading");
|
|
$modal = getComponent("#modal");
|
|
},
|
|
|
|
async onLoad(options) {
|
|
this.iniComponentVar();
|
|
$loading.show();
|
|
|
|
await doAfterLogin();
|
|
await this.getGridName(options.gridId)
|
|
|
|
this.handleRouter(options)
|
|
$loading.hide();
|
|
},
|
|
|
|
async onShow() {
|
|
|
|
},
|
|
handleRouter(options) {
|
|
console.log('skip-options', options)
|
|
const { customerId, gridId } = app.globalData;
|
|
if (!options.gridId) {
|
|
wxRedirectTo('/subpages/mine/pages/message/index/index')
|
|
return
|
|
}
|
|
|
|
if (options.gridId !== gridId) {
|
|
wx.showModal({
|
|
title: '提示',
|
|
content: '该消息发送到{' + `${this.data.gridInfo.gridName}` + '},是否切换网格查看消息详情',
|
|
confirmText: '切换网格',
|
|
success: async res => {
|
|
if (res.confirm) await app.switchGrid(options.customerId, options.gridId)
|
|
wxRedirectTo('/subpages/mine/pages/message/index/index')
|
|
},
|
|
fail: err => {
|
|
console.log('err', err)
|
|
wx.showToast(err)
|
|
// wxRedirectTo('/subpages/mine/pages/message/index/index')
|
|
}
|
|
})
|
|
} else wxRedirectTo('/subpages/mine/pages/message/index/index')
|
|
|
|
},
|
|
async getGridName(id: String) {
|
|
const {
|
|
data: {
|
|
data: { code, data }
|
|
},
|
|
msg
|
|
} = await wxRequestGet(
|
|
"gov/org/customergrid/" + id,
|
|
{},
|
|
{
|
|
// isMock: true,
|
|
isQuiet: true
|
|
}
|
|
);
|
|
|
|
if (msg === "success" && code === 0) {
|
|
console.log('dataaaaa', data)
|
|
if (data !== null) {
|
|
this.setData({
|
|
gridInfo: {...data}
|
|
})
|
|
}
|
|
|
|
}
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|