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.
459 lines
8.9 KiB
459 lines
8.9 KiB
// subpages/mine/pages/task/task.js
|
|
import {
|
|
wxRequestPost,
|
|
wxNavigateTo,
|
|
wxGetUserProfile,
|
|
} from "@utils/promise-wx-api";
|
|
import { nextTick } from "@utils/tools";
|
|
import { inputSync } from "@utils/tools";
|
|
|
|
const app = getApp();
|
|
|
|
Page({
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
iniLoaded: false,
|
|
info: {},
|
|
partyInfo: {},
|
|
taskList: [],
|
|
|
|
refresh: true,
|
|
noMore: false, //没有更多了
|
|
pageNo: 1,
|
|
pageSize: 20,
|
|
noticeList:[],
|
|
|
|
searchTopic:'',
|
|
userHeadPhoto: app.globalData.userInfo.userHeadPhoto,
|
|
scrollInto: 'index0',
|
|
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: async function (options) {
|
|
|
|
await this.getInfo();
|
|
await this.getPartyInfo();
|
|
await this.bindFilterNew();
|
|
this.setData({
|
|
iniLoaded: true,
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: async function () {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: async function () {
|
|
// await this.bindFilterNew();
|
|
// this.setData({
|
|
// iniLoaded: true,
|
|
// });
|
|
},
|
|
handleBindinput(e){
|
|
let {searchTopic} = this.data
|
|
searchTopic=e.detail.value
|
|
this.setData({
|
|
searchTopic,
|
|
});
|
|
},
|
|
|
|
pageScrollToBottom() {
|
|
wx.pageScrollTo({
|
|
selector: "#item_bottom",
|
|
});
|
|
},
|
|
|
|
async handleReadAll(){
|
|
wx.showToast({
|
|
title: '已置为已读',
|
|
icon: "none",
|
|
duration: 1000,
|
|
});
|
|
const params = {};
|
|
|
|
const url = "message/icMessage/read";
|
|
const {
|
|
data: {
|
|
data: { code, data },
|
|
},
|
|
msg,
|
|
} = await wxRequestPost(url, params, {
|
|
//isMock: true,
|
|
// isQuiet: true
|
|
});
|
|
|
|
if (msg === "success" && code === 0) {
|
|
this.bindFilterNew()
|
|
}
|
|
},
|
|
|
|
async sendNotice(e){
|
|
const {searchTopic} = this.data
|
|
|
|
console.log(searchTopic)
|
|
|
|
let {noticeList} = this.data;
|
|
|
|
let oneSearch={
|
|
showType:'searchName',
|
|
searchTopic:searchTopic
|
|
}
|
|
noticeList.push(oneSearch)
|
|
|
|
this.setData({
|
|
noticeList,
|
|
searchTopic:'',
|
|
});
|
|
|
|
const params = {
|
|
topic:searchTopic,
|
|
pageSize: 5,
|
|
pageNo: 1,
|
|
};
|
|
|
|
// const url = "http://yapi.elinkservice.cn/mock/102/resi/partymember/icPartyAct/list";
|
|
const url = "resi/partymember/icPartyAct/list";
|
|
const {
|
|
data: {
|
|
data: { code, data },
|
|
},
|
|
msg,
|
|
} = await wxRequestPost(url, params, {
|
|
//isMock: true,
|
|
// isQuiet: true
|
|
});
|
|
|
|
if (msg === "success" && code === 0) {
|
|
let oneObj={
|
|
showType:'search',
|
|
list:data.list
|
|
}
|
|
|
|
noticeList.push(oneObj)
|
|
|
|
this.setData({
|
|
noticeList,
|
|
});
|
|
console.log(this.data.noticeList)
|
|
this.pageScrollToBottom()
|
|
}
|
|
|
|
let index = noticeList.length-1
|
|
this.setData({
|
|
scrollInto: 'index' + index
|
|
})
|
|
|
|
|
|
},
|
|
|
|
async selectProject(e) {
|
|
|
|
const {
|
|
currentTarget: {
|
|
dataset: { index,id,type },
|
|
},
|
|
} = e;
|
|
|
|
|
|
let {noticeList} = this.data
|
|
|
|
await this.readNotice(index)
|
|
|
|
|
|
if(type==='party_schedule'){
|
|
return false
|
|
}
|
|
|
|
const url= `resi/partymember/icPartyAct/act-detail/${id}`;
|
|
const {
|
|
data: {
|
|
data: { code, data },
|
|
},
|
|
msg,
|
|
} = await wxRequestPost(
|
|
url,
|
|
{},
|
|
{
|
|
// isMock: true,
|
|
isQuiet: false,
|
|
}
|
|
);
|
|
|
|
if (msg === "success" && code === 0) {
|
|
wxNavigateTo("/subpages/partyHelper/pages/partyAct/detail", {
|
|
icPartyActId: id,
|
|
});
|
|
|
|
}else if (code === 9999) {
|
|
wx.showToast({
|
|
title: msg,
|
|
icon: "none",
|
|
duration: 2000,
|
|
});
|
|
}
|
|
|
|
},
|
|
async selectSearchProject(e) {
|
|
|
|
const {
|
|
currentTarget: {
|
|
dataset: { index,id },
|
|
},
|
|
} = e;
|
|
|
|
const url= `resi/partymember/icPartyAct/act-detail/${id}`;
|
|
const {
|
|
data: {
|
|
data: { code, data },
|
|
},
|
|
msg,
|
|
} = await wxRequestPost(
|
|
url,
|
|
{},
|
|
{
|
|
// isMock: true,
|
|
isQuiet: false,
|
|
}
|
|
);
|
|
|
|
if (msg === "success" && code === 0) {
|
|
wxNavigateTo("/subpages/partyHelper/pages/partyAct/detail", {
|
|
icPartyActId: id,
|
|
});
|
|
|
|
}else if (code === 9999) {
|
|
wx.showToast({
|
|
title: msg,
|
|
icon: "none",
|
|
duration: 2000,
|
|
});
|
|
}
|
|
|
|
},
|
|
|
|
async readNotice(index){
|
|
let {noticeList} = this.data
|
|
const url= 'message/icMessage/read'
|
|
let params={
|
|
id: noticeList[index].id
|
|
}
|
|
const {
|
|
data: {
|
|
data: { code, data },
|
|
},
|
|
msg,
|
|
} = await wxRequestPost(
|
|
url,
|
|
params,
|
|
{
|
|
// isMock: true,
|
|
isQuiet: false,
|
|
}
|
|
);
|
|
|
|
if (msg === "success" && code === 0) {
|
|
noticeList[index].readFlag='read'
|
|
|
|
this.setData({
|
|
noticeList
|
|
})
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
bindFilterNew() {
|
|
this.setData({
|
|
pageNo: 1,
|
|
pageSize: 20,
|
|
refresh: true,
|
|
noMore: false,
|
|
// noticeList:[]
|
|
});
|
|
this.bindFilter();
|
|
},
|
|
|
|
//点击筛选按钮
|
|
async bindFilter() {
|
|
|
|
let {
|
|
pageSize,
|
|
pageNo,
|
|
noticeList,
|
|
refresh,
|
|
noMore,
|
|
} = this.data;
|
|
if (noMore) return;
|
|
|
|
const params = {
|
|
|
|
pageSize: pageSize,
|
|
pageNo: pageNo,
|
|
};
|
|
|
|
// const url = "http://yapi.elinkservice.cn/mock/102/resi/partymember/icPartyAct/list";
|
|
const url = "message/icMessage/list";
|
|
const {
|
|
data: {
|
|
data: { code, data },
|
|
},
|
|
msg,
|
|
} = await wxRequestPost(url, params, {
|
|
//isMock: true,
|
|
// isQuiet: true
|
|
});
|
|
|
|
if (msg === "success" && code === 0) {
|
|
|
|
|
|
if (pageNo == 1) {
|
|
let oneSearch={
|
|
showType:'searchName',
|
|
searchTopic:'党建声音党建声音'
|
|
}
|
|
noticeList.push(oneSearch)
|
|
noticeList = data.list;
|
|
} else {
|
|
noticeList = noticeList.concat(data.list);
|
|
}
|
|
|
|
pageNo = pageNo + 1;
|
|
|
|
if (data.list.length < pageSize) {
|
|
noMore = true;
|
|
} else {
|
|
noMore = false;
|
|
}
|
|
if (refresh) {
|
|
refresh = false;
|
|
}
|
|
|
|
this.setData({
|
|
noticeList,
|
|
pageSize,
|
|
pageNo,
|
|
refresh,
|
|
noMore,
|
|
|
|
});
|
|
console.log(this.data.noticeList)
|
|
}
|
|
},
|
|
|
|
handleBack() {
|
|
wx.navigateBack({
|
|
delta: 1,
|
|
});
|
|
},
|
|
async handleFinishTask(e) {
|
|
const index = e.currentTarget.dataset.index;
|
|
const { taskList } = this.data;
|
|
const item = taskList[index];
|
|
if (item.finishFlag == "已完成") return false;
|
|
if (item.linkPage === "group") {
|
|
const pages = getCurrentPages();
|
|
let index = pages.findIndex((item) => item.route == "pages/main/index");
|
|
if (index !== -1) {
|
|
wx.navigateBack({
|
|
delta: pages.length - index - 1,
|
|
});
|
|
|
|
await nextTick(100);
|
|
|
|
app.switchTab("group");
|
|
} else {
|
|
wxNavigateTo("/pages/main/index", {
|
|
tab: "group",
|
|
});
|
|
}
|
|
} else if (item.linkPage === "heart") {
|
|
wxNavigateTo("/pages/heartNew/heartNew");
|
|
}
|
|
},
|
|
async getInfo() {
|
|
let customerId = app.globalData.customerId,
|
|
gridId = app.globalData.gridId;
|
|
const {
|
|
data: {
|
|
data: { code, data },
|
|
},
|
|
msg,
|
|
} = await wxRequestPost(
|
|
"resi/mine/mine/profile",
|
|
{
|
|
customerId,
|
|
gridId,
|
|
},
|
|
{
|
|
// isMock: true,
|
|
isQuiet: false,
|
|
}
|
|
);
|
|
|
|
if (msg === "success" && code === 0) {
|
|
console.log("data:", data);
|
|
this.setData({
|
|
info: data,
|
|
});
|
|
}
|
|
},
|
|
async getPartyInfo() {
|
|
|
|
const {
|
|
data: {
|
|
data: { code, data },
|
|
},
|
|
msg,
|
|
} = await wxRequestPost(
|
|
"resi/partymember/icPartyMember/partyinfo",
|
|
{},
|
|
{
|
|
// isMock: true,
|
|
isQuiet: false,
|
|
}
|
|
);
|
|
|
|
if (msg === "success" && code === 0) {
|
|
console.log("data:", data);
|
|
this.setData({
|
|
partyInfo: data,
|
|
});
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {},
|
|
});
|
|
|