|
|
@ -3,7 +3,6 @@ const api = require("../../utils/api") |
|
|
|
const homeApi = require("../../utils/home") |
|
|
|
const global = require("../../utils/config") |
|
|
|
import checkoutVersion from "../../utils/checkVersion" |
|
|
|
// import regeneratorRuntime from "../../utils/runtime.js"
|
|
|
|
Page({ |
|
|
|
data: { |
|
|
|
statusHeight: 0, // 自定义头部状态栏高度
|
|
|
@ -30,7 +29,6 @@ Page({ |
|
|
|
street: "", //所在街道
|
|
|
|
isCarryLoad: false, |
|
|
|
userId: "", |
|
|
|
|
|
|
|
// userInfo: {
|
|
|
|
// nickname: "",
|
|
|
|
// mobile: "",
|
|
|
@ -43,32 +41,20 @@ Page({ |
|
|
|
communityId: "", // 社区id
|
|
|
|
}, |
|
|
|
|
|
|
|
async onLoad(options) { |
|
|
|
// wx.showLoading({
|
|
|
|
// title: "加载中,请稍后",
|
|
|
|
// mask: true
|
|
|
|
// })
|
|
|
|
this.initLoad() |
|
|
|
onLoad() { |
|
|
|
this.initLoad(); |
|
|
|
this.setData({ |
|
|
|
statusHeight: app.globalData.deviceInfo.statusHeight, |
|
|
|
navigationHeight: app.globalData.deviceInfo.navigationHeight, |
|
|
|
}) |
|
|
|
|
|
|
|
await this.getUserState() |
|
|
|
this.data.isCarryLoad = true |
|
|
|
}, |
|
|
|
|
|
|
|
onTabItemTap() { |
|
|
|
this.getUserState() |
|
|
|
}, |
|
|
|
onShow() { |
|
|
|
}); |
|
|
|
// 检查版本更新
|
|
|
|
checkoutVersion() |
|
|
|
// this.getFirstInfo()
|
|
|
|
checkoutVersion(); |
|
|
|
this.data.isCarryLoad = true; |
|
|
|
}, |
|
|
|
onHide(){ |
|
|
|
onShow() {}, |
|
|
|
onHide() { |
|
|
|
let token = wx.getStorageSync("token") |
|
|
|
if(!token){ |
|
|
|
if (!token) { |
|
|
|
wx.reLaunch({ |
|
|
|
url: '/pages/login/login' |
|
|
|
}) |
|
|
@ -77,74 +63,11 @@ Page({ |
|
|
|
onReachBottom() { |
|
|
|
this.setData({ |
|
|
|
loadMoreVisible: true |
|
|
|
}) |
|
|
|
}); |
|
|
|
if (this.data.loadMoreType === "loading") { |
|
|
|
this.data.pageNo += 1 |
|
|
|
// this.getNewsList()
|
|
|
|
} |
|
|
|
}, |
|
|
|
// 根据微信code查询用户当前状态
|
|
|
|
getUserState() { |
|
|
|
// let that = this
|
|
|
|
// wx.showLoading({
|
|
|
|
// title: '登录中',
|
|
|
|
// mask:true
|
|
|
|
// })
|
|
|
|
// wx.login({
|
|
|
|
// success(res) {
|
|
|
|
// if (res.code) {
|
|
|
|
// let code = res.code
|
|
|
|
// api.getToken(code).then(res => {
|
|
|
|
// wx.hideLoading()
|
|
|
|
// const state = res.data.userState
|
|
|
|
// app.globalData.infoCompleted = state
|
|
|
|
// wx.setStorageSync("topGridName", res.data.grid)
|
|
|
|
// wx.setStorageSync("gridId", res.data.gridId) //当前网格id,新闻、议题、项目分享时用
|
|
|
|
// wx.setStorageSync("token", res.data.token)
|
|
|
|
// wx.setStorageSync("userId", res.data.userId)
|
|
|
|
// that.setData({
|
|
|
|
// departmentName: res.data.grid,
|
|
|
|
// departmentId: res.data.gridId,
|
|
|
|
// userId: res.data.userId
|
|
|
|
// })
|
|
|
|
// // that.getComplete()
|
|
|
|
// // that.getUserLoginlog()
|
|
|
|
// if (state == "4") {
|
|
|
|
// // 非扫码进入,通过搜索小程序直接进入的情况
|
|
|
|
// if (wx.getStorageSync("shareObj")) {
|
|
|
|
// const para = JSON.parse(wx.getStorageSync("shareObj"))
|
|
|
|
// app.globalData.tempGridId = "1222489495054602241"
|
|
|
|
// wx.redirectTo({
|
|
|
|
// url: "/pages/formid/formid?gid=1222489495054602241"
|
|
|
|
// })
|
|
|
|
// } else {
|
|
|
|
// wx.redirectTo({
|
|
|
|
// url: "/pages/formid/formid?gid=1222489495054602241"
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// if (wx.getStorageSync("shareObj")) {
|
|
|
|
// const para = JSON.parse(wx.getStorageSync("shareObj"))
|
|
|
|
// if (para.shareType === "newsDetail") {
|
|
|
|
// wx.navigateTo({
|
|
|
|
// url: `/subpages/home/pages/newsDetail/newsDetail?id=${para.detailId}`
|
|
|
|
// })
|
|
|
|
// } else if (para.shareType === "discussionDetail") {
|
|
|
|
// wx.navigateTo({
|
|
|
|
// url: `/subpages/discussion/pages/discussionDetail/discussionDetail?detailId=${para.detailId}&type=${para.type}&showClassify=${para.showClassify}`
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// wx.removeStorageSync("shareObj")
|
|
|
|
// }
|
|
|
|
// that.initLoad()
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// } else {
|
|
|
|
// console.log("登录失败" + res.errMsg)
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
}, |
|
|
|
handleXinxin() { |
|
|
|
wx.navigateToMiniProgram({ |
|
|
|
appId: 'wxf09c0e08ffee7711', |
|
|
@ -220,7 +143,6 @@ Page({ |
|
|
|
}, |
|
|
|
// 初始化加载
|
|
|
|
initLoad() { |
|
|
|
// timestamp: getTimestamp(),
|
|
|
|
this.setData({ |
|
|
|
pageNo: 1, |
|
|
|
pageSize: 10, |
|
|
@ -228,19 +150,8 @@ Page({ |
|
|
|
loadMoreType: "loading", |
|
|
|
loadMoreVisible: false |
|
|
|
}) |
|
|
|
// this.getBannerList()
|
|
|
|
// this.getIndexSudokuState()
|
|
|
|
// this.getProjectList()
|
|
|
|
// this.getInfoList()
|
|
|
|
// this.getUnreadNum()
|
|
|
|
// this.getNewsList()
|
|
|
|
this.getUserInfo() |
|
|
|
// this.getAppMenu()
|
|
|
|
}, |
|
|
|
// onShow() {
|
|
|
|
// this.getUnreadNum()
|
|
|
|
// },
|
|
|
|
// 切换网格,跳转到网格列表
|
|
|
|
changeGrid() { |
|
|
|
wx.navigateTo({ |
|
|
|
url: "/subpages/changegrid/pages/changeGrid/changeGrid" |
|
|
|