|
|
@ -44,10 +44,10 @@ Page({ |
|
|
|
}, |
|
|
|
|
|
|
|
async onLoad(options) { |
|
|
|
wx.showLoading({ |
|
|
|
title: "加载中,请稍后", |
|
|
|
mask: true |
|
|
|
}) |
|
|
|
// wx.showLoading({
|
|
|
|
// title: "加载中,请稍后",
|
|
|
|
// mask: true
|
|
|
|
// })
|
|
|
|
this.setData({ |
|
|
|
statusHeight: app.globalData.deviceInfo.statusHeight, |
|
|
|
navigationHeight: app.globalData.deviceInfo.navigationHeight, |
|
|
@ -82,65 +82,65 @@ Page({ |
|
|
|
}, |
|
|
|
// 根据微信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) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
// 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({ |
|
|
|