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.
105 lines
2.0 KiB
105 lines
2.0 KiB
import { 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: {
|
|
gridId: "",
|
|
}, // 表决中voting 已转项目turned 已关闭closed
|
|
},
|
|
|
|
listUrl: {
|
|
type: String,
|
|
value: "", // 表决中voting 已转项目turned 已关闭closed
|
|
},
|
|
|
|
status: {
|
|
type: String,
|
|
value: "", // 表决中voting 已转项目turned 已关闭closed
|
|
},
|
|
|
|
listIsMock: {
|
|
type: Boolean,
|
|
value: false,
|
|
},
|
|
},
|
|
|
|
data: {
|
|
iniLoaded: false,
|
|
|
|
refresherIsTriggered: false,
|
|
},
|
|
|
|
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 },
|
|
},
|
|
} = e;
|
|
wxNavigateTo("/pages/discussion/detail/index", {
|
|
issueId: id,
|
|
});
|
|
},
|
|
},
|
|
});
|
|
|