|
|
|
const app = getApp()
|
|
|
|
var api = require("../../utils/api.js")
|
|
|
|
import {
|
|
|
|
getTimestamp
|
|
|
|
} from "../../utils/common"
|
|
|
|
import checkoutVersion from "../../utils/checkVersion"
|
|
|
|
|
|
|
|
Page({
|
|
|
|
data: {
|
|
|
|
first: true,
|
|
|
|
nomorenews: true,
|
|
|
|
departmentName: "",
|
|
|
|
departmentId: "",
|
|
|
|
options: {
|
|
|
|
autoplay: false,
|
|
|
|
circular: true,
|
|
|
|
interval: 3000,
|
|
|
|
duration: 100,
|
|
|
|
previousMargin: 50,
|
|
|
|
nextMargin: 0,
|
|
|
|
displayMultipleItems: 3,
|
|
|
|
currentSwiper: "",
|
|
|
|
},
|
|
|
|
options2: {
|
|
|
|
autoplay: false,
|
|
|
|
circular: true,
|
|
|
|
interval: 3000,
|
|
|
|
duration: 100,
|
|
|
|
previousMargin: 50,
|
|
|
|
nextMargin: 0,
|
|
|
|
displayMultipleItems: 3,
|
|
|
|
currentSwiper: "",
|
|
|
|
},
|
|
|
|
swiperBannerList: [],
|
|
|
|
swiperData: [{
|
|
|
|
headUrl: "",
|
|
|
|
linkType: 2,
|
|
|
|
name: "222"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
headUrl: "",
|
|
|
|
linkType: 2,
|
|
|
|
name: "222"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
fromScan: false,
|
|
|
|
gid: "",
|
|
|
|
nvabarData: {
|
|
|
|
showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
|
|
|
|
title: "e锦水", //导航栏 中间的标题
|
|
|
|
},
|
|
|
|
height: app.globalData.height * 2 + 20,
|
|
|
|
infoObj: [],
|
|
|
|
informationNum: 0, //新消息数量
|
|
|
|
unreadSignUpActNum: 0, //未查看报名中活动数量
|
|
|
|
noticeList: [],
|
|
|
|
innerHtmlStatus: true,
|
|
|
|
visibilityStatus: true,
|
|
|
|
pageNo: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
timestamp: getTimestamp(),
|
|
|
|
newsList: [],
|
|
|
|
issueList: [],
|
|
|
|
projectList: [],
|
|
|
|
colorList: ["#fdf6e3", "#e9ecf5", "#f7eedf", "#efd9cc", "#e1efff"],
|
|
|
|
statusHeight: 0, // 自定义头部状态栏高度
|
|
|
|
navigationHeight: 0, // 自定义头部导航栏高度
|
|
|
|
currentIndex: 0,
|
|
|
|
loadMoreType: "none",
|
|
|
|
loadMoreVisible: false,
|
|
|
|
defaultGridId:'',//默认网格
|
|
|
|
leaderGridId:'', //领导网格6.22
|
|
|
|
workGridId:'', //工作网格7.08
|
|
|
|
lbzxGridId:'', //老兵在线网格 10.14
|
|
|
|
zyzqnGridId:'',//志愿者去哪网格 10.14
|
|
|
|
sceneFrom:'', //通过扫码进入,跳转到?
|
|
|
|
completeInfoDialogVisible: false, //完善信息
|
|
|
|
homePagePhone: {},
|
|
|
|
fromprogram: '', //来自工作端=work 或者 数据分析端=leader 的跳转,
|
|
|
|
visible: false,
|
|
|
|
signMsg: '',
|
|
|
|
signCode: 0,
|
|
|
|
isSignUp: 0,
|
|
|
|
yjfw: {},
|
|
|
|
jmjs: {},
|
|
|
|
sxjs: {},
|
|
|
|
shouye: {},
|
|
|
|
tabRightList: [], //拼团购和顺道捎
|
|
|
|
},
|
|
|
|
onShow: function () {
|
|
|
|
if (wx.getStorageSync("token") != "" && wx.getStorageSync("token") != undefined && wx.getStorageSync("token") != null) {
|
|
|
|
if (!this.data.first) {
|
|
|
|
this.getUserInfo()
|
|
|
|
this.loadGridList()
|
|
|
|
this.getBannerList()
|
|
|
|
this.getFirstInfo()
|
|
|
|
// this.getNoticeList() //wxml 未启用
|
|
|
|
this.getIssueList()
|
|
|
|
this.getProjectList()
|
|
|
|
this.setData({
|
|
|
|
pageNo: 1,
|
|
|
|
newsList: []
|
|
|
|
})
|
|
|
|
this.getNewsList()
|
|
|
|
this.getModuleList()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onLoad: function (options) {
|
|
|
|
this.getResidentConfig()
|
|
|
|
this.getModuleList()
|
|
|
|
if (options.shareType) {
|
|
|
|
const para = {
|
|
|
|
shareType: options.shareType,
|
|
|
|
id: options.id,
|
|
|
|
detailId: options.detailId,
|
|
|
|
type: options.type ? options.type : "",
|
|
|
|
defaultGridId: options.defaultGridId ? options.defaultGridId : "",
|
|
|
|
}
|
|
|
|
wx.setStorageSync("shareObj", JSON.stringify(para))
|
|
|
|
}
|
|
|
|
if (options.scene) {
|
|
|
|
if (options.scene == 'module_ma_code_zyzqn' || options.scene == 'module_ma_code_lbzx') {
|
|
|
|
this.setData({
|
|
|
|
sceneFrom: options.scene,
|
|
|
|
statusHeight: app.globalData.deviceInfo.statusHeight,
|
|
|
|
navigationHeight: app.globalData.deviceInfo.navigationHeight
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
this.setData({
|
|
|
|
statusHeight: app.globalData.deviceInfo.statusHeight,
|
|
|
|
navigationHeight: app.globalData.deviceInfo.navigationHeight,
|
|
|
|
gridId: options.scene,
|
|
|
|
fromprogram: options.from,
|
|
|
|
gid: decodeURIComponent(options.scene)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.setData({
|
|
|
|
statusHeight: app.globalData.deviceInfo.statusHeight,
|
|
|
|
navigationHeight: app.globalData.deviceInfo.navigationHeight,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
// console.log('options:', options)
|
|
|
|
// if (options.scene) {
|
|
|
|
// this.setData({
|
|
|
|
// gid: decodeURIComponent(options.scene)
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
let that = this
|
|
|
|
setTimeout(function () {
|
|
|
|
that.getUserState()
|
|
|
|
}, 700)
|
|
|
|
// 检查版本更新
|
|
|
|
checkoutVersion()
|
|
|
|
},
|
|
|
|
//获取首页电话
|
|
|
|
getHomePhone () {
|
|
|
|
api.getHomePhone().then( res => {
|
|
|
|
if (res.code === 0 && res.msg === "success") {
|
|
|
|
this.data.homePagePhone = res.data[0]
|
|
|
|
this.setData({
|
|
|
|
homePagePhone: this.data.homePagePhone
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
api.getImgUrl("5").then(res => {
|
|
|
|
this.data.tabRightList = []
|
|
|
|
res.data.forEach(item => {
|
|
|
|
if (item.imgCode == 'ptg-sy' || item.imgCode == 'sds-sy') {
|
|
|
|
this.data.tabRightList.push(item)
|
|
|
|
this.setData({
|
|
|
|
tabRightList: this.data.tabRightList
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 获取默认网格
|
|
|
|
getResidentConfig (){
|
|
|
|
let that = this
|
|
|
|
api.getResidentConfig().then(res => {
|
|
|
|
if (res.code === 0 && res.msg === "success") {
|
|
|
|
res.data.forEach(item => {
|
|
|
|
if (item.residentType === "default_grid" && item.residentCode === "default_grid") {
|
|
|
|
that.setData({
|
|
|
|
defaultGridId:item.residentValue
|
|
|
|
})
|
|
|
|
} else if (item.residentType === "default_grid" && item.residentCode === "leader_grid") {
|
|
|
|
that.setData({
|
|
|
|
leaderGridId:item.residentValue
|
|
|
|
})
|
|
|
|
} else if (item.residentType === 'default_grid' && item.residentCode === 'work_grid') {
|
|
|
|
that.setData({
|
|
|
|
workGridId:item.residentValue
|
|
|
|
})
|
|
|
|
} else if (item.residentType === 'default_grid' && item.residentCode === 'module_ma_code_lbzx') {
|
|
|
|
that.setData({
|
|
|
|
lbzxGridId:item.residentValue
|
|
|
|
})
|
|
|
|
} else if (item.residentType === 'default_grid' && item.residentCode === 'module_ma_code_zyzqn') {
|
|
|
|
that.setData({
|
|
|
|
zyzqnGridId:item.residentValue
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
//获取当前网格的id
|
|
|
|
loadGridList () {
|
|
|
|
let that = this
|
|
|
|
api.getGridList().then(res => {
|
|
|
|
if (res.code === 0 && res.msg === "success") {
|
|
|
|
if (res.data.length > 0) {
|
|
|
|
that.setData({
|
|
|
|
departmentId: res.data[0].gridId
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getBannerList: function () {
|
|
|
|
let that = this
|
|
|
|
api.bannerList("0").then(function (res) {
|
|
|
|
// console.log('res==', res.data)
|
|
|
|
that.setData({
|
|
|
|
swiperBannerList: res.data
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getProjectList () {
|
|
|
|
let that = this
|
|
|
|
let para = {
|
|
|
|
pageIndex: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
searchContent: "",
|
|
|
|
timestamp: getTimestamp(),
|
|
|
|
categoryId: ""
|
|
|
|
}
|
|
|
|
api.getProjectList(para).then(function (res) {
|
|
|
|
that.setData({
|
|
|
|
projectList: res.data
|
|
|
|
})
|
|
|
|
// console.log('newsList', that.data.newsList)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getIssueList () {
|
|
|
|
let that = this
|
|
|
|
let para = {
|
|
|
|
pageIndex: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
searchContent: "",
|
|
|
|
orderType: "1",
|
|
|
|
timestamp: getTimestamp(),
|
|
|
|
categoryId: ""
|
|
|
|
}
|
|
|
|
api.getIssueList(para).then(function (res) {
|
|
|
|
that.setData({
|
|
|
|
issueList: res.data
|
|
|
|
})
|
|
|
|
// console.log('newsList', that.data.newsList)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getNewsList: function () {
|
|
|
|
let that = this
|
|
|
|
let para = {
|
|
|
|
pageIndex: 1,
|
|
|
|
pageSize: 5,
|
|
|
|
timestamp: getTimestamp()
|
|
|
|
}
|
|
|
|
api.newsList(para).then(function (res) {
|
|
|
|
that.setData({
|
|
|
|
first: false,
|
|
|
|
newsList: that.data.newsList.concat(res.data),
|
|
|
|
loadMoreType: res.data.length === that.data.pageSize ? "loading" : "none",
|
|
|
|
})
|
|
|
|
}).catch(() => {
|
|
|
|
that.setData({
|
|
|
|
loadMoreType: "none",
|
|
|
|
newsList: []
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getModuleList: function () {
|
|
|
|
let params = {
|
|
|
|
pageIndex: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
pid: '0'
|
|
|
|
}
|
|
|
|
api.moduleCategory(params).then(res => {
|
|
|
|
console.log('获取模块列表',res.data)
|
|
|
|
res.data.forEach( item => {
|
|
|
|
if (item.categoryCode == 'sxjs') {
|
|
|
|
this.data.sxjs = { ...item }
|
|
|
|
this.setData({
|
|
|
|
sxjs: this.data.sxjs
|
|
|
|
})
|
|
|
|
} else if (item.categoryCode == 'jmjs') {
|
|
|
|
this.data.jmjs = { ...item }
|
|
|
|
this.setData({
|
|
|
|
jmjs: this.data.jmjs
|
|
|
|
})
|
|
|
|
} else if (item.categoryCode == 'yjfw') {
|
|
|
|
this.data.yjfw = { ...item }
|
|
|
|
this.setData({
|
|
|
|
yjfw: this.data.yjfw
|
|
|
|
})
|
|
|
|
} else if (item.categoryCode == 'mudule_yqfk') {
|
|
|
|
this.data.shouye = { ...item }
|
|
|
|
this.setData({
|
|
|
|
shouye: this.data.shouye
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
onReachBottom () {
|
|
|
|
this.setData({
|
|
|
|
loadMoreVisible: true
|
|
|
|
})
|
|
|
|
if (this.data.loadMoreType === "loading") {
|
|
|
|
console.log("加载翻页")
|
|
|
|
this.setData({
|
|
|
|
pageNo: this.data.pageNo + 1,
|
|
|
|
pageSize: this.data.pageSize,
|
|
|
|
pageIndex: getTimestamp()
|
|
|
|
})
|
|
|
|
this.getNewsList()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
toDetail (e) {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: "/subpages/home/pages/newsDetail/newsDetail?id=" + e.currentTarget.dataset.id
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getFirstInfo: function () {
|
|
|
|
let that = this
|
|
|
|
api.getFirstInfo().then(function (res) {
|
|
|
|
if (res.data !== null) {
|
|
|
|
that.data.infoObj = [ ...res.data ]
|
|
|
|
that.data.infoObj.forEach(item => {
|
|
|
|
if (item.dataType == 'informationNum') {
|
|
|
|
that.setData({
|
|
|
|
informationNum: item.num
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if (item.dataType == 'unreadSignUpActNum') {
|
|
|
|
that.setData({
|
|
|
|
unreadSignUpActNum: item.num
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getNoticeList: function () {
|
|
|
|
let para = {
|
|
|
|
pageIndex: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
timestamp: getTimestamp()
|
|
|
|
}
|
|
|
|
let that = this
|
|
|
|
api.noticelist(para).then(function (res) {
|
|
|
|
if (res.data !== null) {
|
|
|
|
that.setData({
|
|
|
|
noticeList: res.data
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 根据微信code查询用户当前状态
|
|
|
|
getUserState: function () {
|
|
|
|
let that = this
|
|
|
|
wx.login({
|
|
|
|
success (res) {
|
|
|
|
if (res.code) {
|
|
|
|
let code = res.code
|
|
|
|
api.getToken(code).then(function (res) {
|
|
|
|
let state = res.data.userState
|
|
|
|
// console.log(state)
|
|
|
|
// console.log('date', Date.parse(new Date()))
|
|
|
|
app.globalData.infoCompleted = state
|
|
|
|
wx.removeStorageSync("topGridName")
|
|
|
|
wx.setStorageSync("topGridName", res.data.grid)
|
|
|
|
wx.removeStorageSync("token")
|
|
|
|
wx.setStorageSync("token", res.data.token)
|
|
|
|
that.setData({
|
|
|
|
departmentName: res.data.grid
|
|
|
|
})
|
|
|
|
|
|
|
|
// 优化注册流程
|
|
|
|
if (that.data.gid && !that.data.fromprogram) {
|
|
|
|
if (that.data.gid == "gridLeader") {
|
|
|
|
wx.redirectTo({
|
|
|
|
url: "/pages/gridLeaderRegister/gridLeaderRegister"
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
wx.redirectTo({
|
|
|
|
url: "/pages/formid/formid?gid=" + that.data.gid
|
|
|
|
})
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (state == "4") {
|
|
|
|
if (wx.getStorageSync("shareObj")) {
|
|
|
|
const para = JSON.parse(wx.getStorageSync("shareObj"))
|
|
|
|
wx.redirectTo({
|
|
|
|
url: "/pages/formid/formid?gid=" + para.defaultGridId
|
|
|
|
})
|
|
|
|
} else if (that.data.sceneFrom!='') {
|
|
|
|
if (that.data.sceneFrom == 'module_ma_code_zyzqn') {
|
|
|
|
wx.redirectTo({
|
|
|
|
url: "/pages/formid/formid?gid=" + that.data.zyzqnGridId+'&module=module_ma_code_zyzqn'
|
|
|
|
})
|
|
|
|
} else if (that.data.sceneFrom == 'module_ma_code_lbzx') {
|
|
|
|
wx.redirectTo({
|
|
|
|
url: "/pages/formid/formid?gid=" + that.data.lbzxGridId+'&module=module_ma_code_lbzx'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
} else if (that.data.fromprogram) {
|
|
|
|
wx.redirectTo({
|
|
|
|
url: "/pages/formid/formid?gid=" + that.data.gid
|
|
|
|
})
|
|
|
|
} else if (app.globalData.tempGridId == "") {
|
|
|
|
wx.redirectTo({
|
|
|
|
url: "/pages/toRegister/toRegister"
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
wx.redirectTo({
|
|
|
|
url: "/pages/formid/formid?gid=" + that.data.gid
|
|
|
|
})
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (that.data.sceneFrom == 'module_ma_code_zyzqn') {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: "/pages/heartNew/heartNew"
|
|
|
|
})
|
|
|
|
} else if (that.data.sceneFrom == 'module_ma_code_lbzx') {
|
|
|
|
that.toLaoBingZaiXian(1)
|
|
|
|
}
|
|
|
|
if (wx.getStorageSync("shareObj")) {
|
|
|
|
const para = JSON.parse(wx.getStorageSync("shareObj"))
|
|
|
|
if (para.shareType === "heartDetail") {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/subpages/heart/pages/heartDetail/heartDetail?id=${para.id}`
|
|
|
|
})
|
|
|
|
} else if (para.shareType === 'newsDetail') {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/subpages/home/pages/newsDetail/newsDetail?id=${para.detailId}`
|
|
|
|
})
|
|
|
|
} else if (para.shareType === 'groupBuyDetail') {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/subpages/heart/pages/groupBuyDetail/groupBuyDetail?id=${para.detailId}`
|
|
|
|
})
|
|
|
|
}
|
|
|
|
wx.removeStorageSync("shareObj")
|
|
|
|
}
|
|
|
|
// that.getResidentConfig()
|
|
|
|
that.getHomePhone()
|
|
|
|
that.getUserInfo()
|
|
|
|
that.loadGridList()
|
|
|
|
that.getBannerList()
|
|
|
|
that.getFirstInfo()
|
|
|
|
// that.getNoticeList()
|
|
|
|
that.getNewsList()
|
|
|
|
that.getIssueList()
|
|
|
|
that.getProjectList()
|
|
|
|
// that.getModuleList()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
console.log("登录失败" + res.errMsg)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
changeGrid () {
|
|
|
|
this.setData({
|
|
|
|
departmentId: ''
|
|
|
|
})
|
|
|
|
wx.navigateTo({
|
|
|
|
url: "/subpages/changegrid/pages/changeGrid/changeGrid"
|
|
|
|
})
|
|
|
|
},
|
|
|
|
swiperChange: function (e) {
|
|
|
|
if (e.detail.source === "touch") {
|
|
|
|
this.setData({
|
|
|
|
currentIndex: e.detail.current
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
swiperChange2: function (e) {
|
|
|
|
this.setData({
|
|
|
|
"options2.currentSwiper": e.detail.current,
|
|
|
|
currentIndex: e.detail.current
|
|
|
|
})
|
|
|
|
},
|
|
|
|
//跳转到 书香锦水 页面
|
|
|
|
toSxjs () {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/subpages/oneKeyService/pages/moduleList/moduleList?pid=${this.data.sxjs.id}&bannerflag=${this.data.sxjs.bannerFlag}&categorycode=${this.data.sxjs.categoryCode}&modulestyle=${this.data.sxjs.moduleStyle}&categoryname=${this.data.sxjs.categoryName}`
|
|
|
|
})
|
|
|
|
},
|
|
|
|
//跳转到 页面
|
|
|
|
toShouye () {
|
|
|
|
//如果是 详情样式,直接跳转详情页面
|
|
|
|
if (this.data.shouye.moduleStyle == '4') {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/subpages/oneKeyService/pages/noticeDetail/noticeDetail?pid=${this.data.shouye.pid}&bannerflag=${this.data.shouye.bannerFlag}&categorycode=${this.data.shouye.categoryCode}&modulestyle=${this.data.shouye.moduleStyle}&categoryname=${this.data.shouye.categoryName}`
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/subpages/oneKeyService/pages/moduleList/moduleList?pid=${this.data.shouye.id}&bannerflag=${this.data.shouye.bannerFlag}&categorycode=${this.data.shouye.categoryCode}&modulestyle=${this.data.shouye.moduleStyle}&categoryname=${this.data.shouye.categoryName}`
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
//跳转到 一键服务页面(新) 2020.07.15
|
|
|
|
toOneKeyService () {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/subpages/oneKeyService/pages/index/index?pid=${this.data.yjfw.id}&title=一键服务`
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 点击-更多,跳转通知列表
|
|
|
|
moreNotice () {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: "/subpages/home/pages/noticeNew/noticeNew"
|
|
|
|
})
|
|
|
|
// wx.miniProgram.navigateTo({ url: '/pages/detail/detail?weburl=' + encodeURIComponent(global.baseURL + 'notice?departmentName=' + sessionStorage.getItem('departmentName')) })
|
|
|
|
},
|
|
|
|
// 跳转我的消息
|
|
|
|
toInfoList () {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: "/subpages/home/pages/info/info"
|
|
|
|
})
|
|
|
|
// wx.miniProgram.navigateTo({ url: '/pages/detail/detail?weburl=' + encodeURIComponent(global.baseURL + 'info') })
|
|
|
|
},
|
|
|
|
//了解锦水
|
|
|
|
toUnderstandJs (){
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/subpages/oneKeyService/pages/index/index?pid=${this.data.jmjs.id}&title=解码锦水`
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
// 跳转到banner详情
|
|
|
|
navigatetoBannerDetail (e) {
|
|
|
|
const {
|
|
|
|
id,
|
|
|
|
url,
|
|
|
|
newsflag
|
|
|
|
} = e.currentTarget.dataset
|
|
|
|
console.log(id, url, newsflag)
|
|
|
|
if (newsflag == "0") {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/subpages/home/pages/webview/webview?url=${url}`
|
|
|
|
})
|
|
|
|
} else if (newsflag == "1") {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/subpages/home/pages/newsDetail/newsDetail?id=${id}`
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 我有事说
|
|
|
|
wyss () {
|
|
|
|
if (this.data.departmentId == '') {
|
|
|
|
return
|
|
|
|
} else if(this.data.departmentId == this.data.leaderGridId){
|
|
|
|
this.wysy()
|
|
|
|
} else if(this.data.departmentId == this.data.workGridId){
|
|
|
|
this.wysz()
|
|
|
|
} else if(this.data.departmentId == this.data.defaultGridId){ //特殊网格处理
|
|
|
|
wx.showToast({
|
|
|
|
title: "该板块只针对辖区内居民使用,请联系您所属网格的负责人索取二维码扫码进入",
|
|
|
|
icon: "none",
|
|
|
|
duration: 3000
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: "../discussion/discussion"
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 我有事阅 6.22 ->数据端
|
|
|
|
wysy() {
|
|
|
|
if(this.data.departmentId != this.data.leaderGridId){//领导网格处理
|
|
|
|
wx.showToast({
|
|
|
|
title: "无法使用该板块",
|
|
|
|
icon: "none",
|
|
|
|
duration: 3000
|
|
|
|
})
|
|
|
|
}else{
|
|
|
|
if (this.verifyCompleteInfo()) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
api.getScrip().then(res => {
|
|
|
|
if (res.code === 0 && res.msg === "success") {
|
|
|
|
console.log("getScrip",res.data)
|
|
|
|
wx.navigateToMiniProgram({
|
|
|
|
appId: "wx3ea0a6fb71ddf659",
|
|
|
|
path: "pages/login/login?scrip="+res.data,
|
|
|
|
extraData: {
|
|
|
|
scrip: res.data
|
|
|
|
},
|
|
|
|
envVersion: "release",//trial //develop
|
|
|
|
success (res) {
|
|
|
|
console.log(res)
|
|
|
|
},
|
|
|
|
fail (err) {
|
|
|
|
console.log(err)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 我有事做 7.08 ->工作端
|
|
|
|
wysz() {
|
|
|
|
if(this.data.departmentId != this.data.workGridId){//工作网格处理
|
|
|
|
wx.showToast({
|
|
|
|
title: '无法使用该板块',
|
|
|
|
icon: 'none',
|
|
|
|
duration: 3000
|
|
|
|
})
|
|
|
|
}else{
|
|
|
|
if (this.verifyCompleteInfo()) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
api.getScrip().then(res => {
|
|
|
|
if (res.code === 0 && res.msg === 'success') {
|
|
|
|
console.log('getScrip',res.data)
|
|
|
|
wx.navigateToMiniProgram({
|
|
|
|
appId: 'wx826a8435db9e0947',
|
|
|
|
path: 'pages/login/login?scrip='+res.data,
|
|
|
|
extraData: {
|
|
|
|
scrip: res.data
|
|
|
|
},
|
|
|
|
envVersion: 'release',//trial //develop
|
|
|
|
success(res) {
|
|
|
|
console.log(res)
|
|
|
|
},
|
|
|
|
fail(err) {
|
|
|
|
console.log(err)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
dqhd() {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: "../../subpages/associationNew/pages/associationlist/associationlist"
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 积分排名
|
|
|
|
gointegralCentre () {
|
|
|
|
api.getUserInfo().then(res => {
|
|
|
|
// console.log('用户信息', res)
|
|
|
|
wx.navigateTo({
|
|
|
|
url: "../../subpages/integralCentre/pages/index/index?points=" + res.data.points + '&pointsTotle=' + (res.data.pointsTotle || 0)
|
|
|
|
})
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// 志愿者去哪
|
|
|
|
goheart () {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: "../heartNew/heartNew"
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 跳转我的
|
|
|
|
toMine () {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: "../mine/mine"
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 暂未开通模块显示敬请期待
|
|
|
|
noMore () {
|
|
|
|
wx.showToast({
|
|
|
|
title: "暂无更多消息~",
|
|
|
|
icon: "none",
|
|
|
|
duration: 1000
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
//功能暂未开放
|
|
|
|
nofunction () {
|
|
|
|
wx.showToast({
|
|
|
|
title: "敬请期待",
|
|
|
|
icon: "none",
|
|
|
|
duration: 1000
|
|
|
|
})
|
|
|
|
},
|
|
|
|
//拨打电话
|
|
|
|
getPhone (e) {
|
|
|
|
// return false
|
|
|
|
wx.showModal({
|
|
|
|
title: "拨打电话",
|
|
|
|
content: "",
|
|
|
|
cancelColor: "#29B9A5",
|
|
|
|
confirmColor: "#29B9A5",
|
|
|
|
success: (res) => {
|
|
|
|
if (res.confirm) {
|
|
|
|
console.log("用户点击确定")
|
|
|
|
wx.makePhoneCall({
|
|
|
|
phoneNumber: e.currentTarget.dataset.number
|
|
|
|
})
|
|
|
|
} else if (res.cancel) {
|
|
|
|
console.log("用户点击取消")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 检查 是否完善信息6.22
|
|
|
|
verifyCompleteInfo () {
|
|
|
|
if (app.globalData.infoCompleted == 0) {
|
|
|
|
this.setData({
|
|
|
|
completeInfoDialogVisible: !this.data.completeInfoDialogVisible
|
|
|
|
})
|
|
|
|
return true
|
|
|
|
} else {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 获取用户信息
|
|
|
|
getUserInfo () {
|
|
|
|
api.getUserInfo().then(res => {
|
|
|
|
console.log("用户信息", res)
|
|
|
|
this.setData({
|
|
|
|
isSignUp: res.data.isSignUp
|
|
|
|
})
|
|
|
|
}).catch(err => {
|
|
|
|
this.setData({
|
|
|
|
isSignUp: 0
|
|
|
|
})
|
|
|
|
console.log(err)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
//签到 2020.07.31
|
|
|
|
toSignIn () {
|
|
|
|
if (this.verifyCompleteInfo()) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if (this.data.isSignUp == 1) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
api.userInfoSignUp().then(res => {
|
|
|
|
console.log(res.data)
|
|
|
|
if (res.code === 0) {
|
|
|
|
// 显示提醒
|
|
|
|
this.setData({
|
|
|
|
signCode: res.code,
|
|
|
|
signMsg: res.data,
|
|
|
|
visible: true
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
this.setData({
|
|
|
|
signCode: res.code,
|
|
|
|
signMsg: res.msg,
|
|
|
|
visible: true
|
|
|
|
});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 关闭签到提醒
|
|
|
|
onClose() {
|
|
|
|
this.getUserInfo()
|
|
|
|
this.setData({
|
|
|
|
visible: false
|
|
|
|
});
|
|
|
|
},
|
|
|
|
//跳转到新老兵在线2020.11.02
|
|
|
|
toLaoBingZaiXian(page) {
|
|
|
|
let params = {
|
|
|
|
pageIndex: page,
|
|
|
|
pageSize: 10,
|
|
|
|
pid: this.data.yjfw.id
|
|
|
|
}
|
|
|
|
let op = {}
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
api.moduleCategory(params).then(res => {
|
|
|
|
// console.log('toLBZX',res.data)
|
|
|
|
res.data.forEach(item => {
|
|
|
|
if (item.categoryCode == 'notice_yjfu_lbzx') {
|
|
|
|
op = { ...item }
|
|
|
|
}
|
|
|
|
})
|
|
|
|
if (Object.keys(op).length > 0) {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/subpages/oneKeyService/pages/moduleList/moduleList?pid=${op.id}&bannerflag=${op.bannerFlag}&categorycode=${op.categoryCode}&modulestyle=${op.moduleStyle}&categoryname=${op.categoryName}`
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
if (res.data.length == 10) {
|
|
|
|
page++
|
|
|
|
this.toLaoBingZaiXian(page)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
resolve(true)
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
reject(false)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
//拼团购/顺道捎 跳转 2021.03.31
|
|
|
|
toJumpPage (e) {
|
|
|
|
if (e.currentTarget.dataset.code == 'ptg-sy') {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/subpages/heart/pages/groupBuyList/groupBuyList?title=${e.currentTarget.dataset.title}`
|
|
|
|
})
|
|
|
|
} else if (e.currentTarget.dataset.code == 'sds-sy') {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/subpages/heart/pages/dropByList/dropByList?title=${e.currentTarget.dataset.title}`
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
})
|