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.
146 lines
3.3 KiB
146 lines
3.3 KiB
2 years ago
|
import { wxRequestPost, wxNavigateTo } from "@utils/promise-wx-api";
|
||
|
//import nextTick from "@npm/dai-mp/tools/nextTick.js";
|
||
|
import commonBehavior from "@mixins/common";
|
||
|
import listBehavior from "@mixins/list";
|
||
|
|
||
|
const app = getApp();
|
||
|
|
||
|
Component({
|
||
|
behaviors: [commonBehavior, listBehavior],
|
||
|
properties: {
|
||
|
listParams: {
|
||
|
type: Object,
|
||
|
value: {
|
||
|
status: "",
|
||
|
}, // 未处理un_read 处理中 processing 已办结 closed_case
|
||
|
//// 未读:un_read;已读:read;
|
||
|
},
|
||
|
|
||
|
listUrl: {
|
||
|
type: String,
|
||
|
value: "",
|
||
|
},
|
||
|
|
||
|
listIsMock: {
|
||
|
type: Boolean,
|
||
|
value: false,
|
||
|
},
|
||
|
|
||
|
|
||
|
|
||
|
},
|
||
|
|
||
|
data: {
|
||
|
iniLoaded: false,
|
||
|
refresherIsTriggered: false,
|
||
|
demoList:[
|
||
|
{
|
||
|
resiEventId:"11",
|
||
|
eventContent:"我的报事我的报事我的报事我的报事我的报事我的报事我的报事我的报事我的报事我的报事",
|
||
|
imgList:[],
|
||
|
redDot:true,//true展示;false不展示
|
||
|
status:"closed_case",//处理中:processing;已办结:closed_case
|
||
|
shiftProjectShow:"",
|
||
|
shiftProject:false,//true:已转项目;false:未立项
|
||
|
showTime:"2012-09-30 10:10:10",//列表显示时间用此列:yyyy-MM-dd HH:mm:ss;处理中:上报事件时间,处理中:最新一次处理事件;已办结:办结时间
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
|
||
|
lifetimes: {
|
||
|
ready() {
|
||
|
this.init();
|
||
|
},
|
||
|
},
|
||
|
|
||
|
pageLifetimes: {
|
||
|
async show() {
|
||
|
await this.refreshData()
|
||
|
},
|
||
|
},
|
||
|
|
||
|
methods: {
|
||
|
async init() {
|
||
|
const { iniLoaded } = this.data;
|
||
|
const $loading = this.selectComponent("#loading");
|
||
|
|
||
|
if (!iniLoaded) {
|
||
|
$loading.show();
|
||
|
}
|
||
|
|
||
|
await this.getApiData();
|
||
|
|
||
|
this.setData({
|
||
|
iniLoaded: true,
|
||
|
});
|
||
|
|
||
|
$loading.hide();
|
||
|
},
|
||
|
|
||
|
// 刷新
|
||
|
async refreshData() {
|
||
|
if (this.data.iniLoaded) {
|
||
|
// 如果第一页,静默刷新
|
||
|
const { list } = this.data;
|
||
|
if (list.page == 2) {
|
||
|
list.page = 1;
|
||
|
list.isNone = false;
|
||
|
this.setData({ list });
|
||
|
await this.getApiData();
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
|
||
|
// 加载更多
|
||
|
getMore() {
|
||
|
this.getApiData();
|
||
|
},
|
||
|
|
||
|
async getApiData() {
|
||
|
await this.getList();
|
||
|
},
|
||
|
|
||
|
// 查看详情
|
||
|
handleTapItem(e) {
|
||
|
const {
|
||
|
currentTarget: {
|
||
|
dataset: { id ,status},
|
||
|
},
|
||
|
} = e;
|
||
|
this.data.list.data.forEach(item => {
|
||
|
if (item.icEventId == id) {
|
||
|
wx.setStorageSync('myEvent', item)
|
||
|
if (item.redDot) {
|
||
|
this.removeRedDot()
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
wxNavigateTo("/subpages/mine/pages/myReportEvent/detail/index", {
|
||
|
eventId: id,
|
||
|
status,
|
||
|
});
|
||
|
},
|
||
|
// 点击详情时,去除红点
|
||
|
async removeRedDot() {
|
||
|
const { icEventId } = wx.getStorageSync('myEvent')
|
||
|
const {
|
||
|
data: {
|
||
|
data: { code, data },
|
||
|
},
|
||
|
msg,
|
||
|
} = await wxRequestPost(
|
||
|
"gov/project/icEvent/remove-red",
|
||
|
{
|
||
|
icEventId: icEventId
|
||
|
},
|
||
|
{
|
||
|
//isMock: true,
|
||
|
}
|
||
|
);
|
||
|
if (msg === "success" && code === 0) {
|
||
|
|
||
|
}
|
||
|
},
|
||
|
},
|
||
|
});
|