Browse Source

优化

master
zhaoyongnian 5 years ago
parent
commit
f8d9da3b55
  1. 175
      pages/indexNew/indexNew.js
  2. 19
      subpages/heart/pages/heartDetail/heartDetail.js
  3. 4
      subpages/home/pages/noticeDetail/noticeDetail.wxss
  4. 2
      subpages/understandJs/pages/delicious/delicious.js
  5. 2
      subpages/understandJs/pages/impression/impression.js
  6. 7
      utils/api.js

175
pages/indexNew/indexNew.js

@ -71,6 +71,7 @@ Page({
currentIndex: 0, currentIndex: 0,
loadMoreType: 'none', loadMoreType: 'none',
loadMoreVisible: false, loadMoreVisible: false,
defaultGridId:'',//默认网格
}, },
onShow: function() { onShow: function() {
if (wx.getStorageSync('token') != '' && wx.getStorageSync('token') != undefined && wx.getStorageSync('token') != null) { if (wx.getStorageSync('token') != '' && wx.getStorageSync('token') != undefined && wx.getStorageSync('token') != null) {
@ -95,6 +96,7 @@ Page({
shareType: options.shareType, shareType: options.shareType,
id: options.id, id: options.id,
type: options.type ? options.type : '', type: options.type ? options.type : '',
defaultGridId: options.defaultGridId ? options.defaultGridId : '',
} }
wx.setStorageSync('shareObj', JSON.stringify(para)) wx.setStorageSync('shareObj', JSON.stringify(para))
} }
@ -122,6 +124,22 @@ Page({
}, 700) }, 700)
// 检查版本更新 // 检查版本更新
checkoutVersion() checkoutVersion()
// 获取默认网格
this.getDefaultGridInfo()
},
// 获取默认网格
getDefaultGridInfo(){
let that = this
api.getDefaultGridInfo().then(res => {
if (res.code === 0 && res.msg === 'success') {
that.setData({
defaultGridId:res.data
})
}
}).catch(err => {
console.log(err)
})
}, },
//获取当前网格的id //获取当前网格的id
loadGridList () { loadGridList () {
@ -271,81 +289,37 @@ Page({
departmentName: res.data.grid departmentName: res.data.grid
}) })
if (state == '0') { // 优化注册流程
if (that.data.gid !== '') { //扫码进来的 if (that.data.gid) {
// 是否是网格长的情况 if (that.data.gid == 'gridLeader') {
if (that.data.gid == 'gridLeader') { // 是网格长,进网格长注册
wx.redirectTo({ wx.redirectTo({
url: '/pages/gridLeaderRegister/gridLeaderRegister' url: '/pages/gridLeaderRegister/gridLeaderRegister'
}) })
} else { // 不是网格长,进网格提示页 } else {
wx.redirectTo({ wx.redirectTo({
url: '/pages/formid/formid?gid=' + that.data.gid url: '/pages/formid/formid?gid=' + that.data.gid
}) })
} }
} else { // 直接进首页 } else {
that.getBannerList() if (state == '4') {
that.getFirstInfo()
that.getNoticeList()
that.getNewsList()
that.getIssueList()
that.getProjectList()
that.loadGridList()
if (wx.getStorageSync('shareObj')) { if (wx.getStorageSync('shareObj')) {
const para = JSON.parse(wx.getStorageSync('shareObj')) const para = JSON.parse(wx.getStorageSync('shareObj'))
if (para.shareType === 'newsDetail') {
wx.navigateTo({
url: `/subpages/heart/pages/heartDetail/heartDetail?id=${para.id}`
})
}
wx.removeStorageSync('shareObj')
}
}
} else if (state == '4') { //未注册,跳到我要注册页面
if (that.data.gid !== '') { //扫码进来的
// 扫码进来未注册的情况,先进到前置页面获取formid
// 是否是网格长的情况
if (that.data.gid == 'gridLeader') { // 是网格长
wx.redirectTo({ wx.redirectTo({
url: '/pages/gridLeaderRegister/gridLeaderRegister' url: '/pages/formid/formid?gid=' + para.defaultGridId
}) })
} else { } else if (app.globalData.tempGridId == '') {
wx.redirectTo({
url: '/pages/formid/formid?gid=' + that.data.gid
})
}
} else {
// 非扫码进入,通过搜索小程序直接进入的情况
wx.redirectTo({ wx.redirectTo({
url: '/pages/toRegister/toRegister' url: '/pages/toRegister/toRegister'
}) })
// if (app.globalData.tempGridId == '') {
// wx.redirectTo({ // todo:
// url: '/pages/toRegister/toRegister?code=' + code + '&t=' + date
// })
// } else {
// wx.redirectTo({
// url: '/pages/formid/formid?gid=' + app.globalData.tempGridId
// })
// }
}
} else { } else {
if (that.data.gid !== '') { //扫码进来的
// 是否是网格长的情况
if (that.data.gid == 'gridLeader') { // 是网格长,进网格长注册
wx.redirectTo({
url: '/pages/gridLeaderRegister/gridLeaderRegister'
})
} else { // 不是网格长,进网格提示页
wx.redirectTo({ wx.redirectTo({
url: '/pages/formid/formid?gid=' + that.data.gid url: '/pages/formid/formid?gid=' + that.data.gid
}) })
} }
} else { // 直接进首页 } else {
if (wx.getStorageSync('shareObj')) { if (wx.getStorageSync('shareObj')) {
const para = JSON.parse(wx.getStorageSync('shareObj')) const para = JSON.parse(wx.getStorageSync('shareObj'))
if (para.shareType === 'newsDetail') { if (para.shareType === 'heartDetail') {
wx.navigateTo({ wx.navigateTo({
url: `/subpages/heart/pages/heartDetail/heartDetail?id=${para.id}` url: `/subpages/heart/pages/heartDetail/heartDetail?id=${para.id}`
}) })
@ -361,6 +335,97 @@ Page({
that.loadGridList() that.loadGridList()
} }
} }
// if (state == '0') {
// if (that.data.gid !== '') { //扫码进来的
// // 是否是网格长的情况
// if (that.data.gid == 'gridLeader') { // 是网格长,进网格长注册
// wx.redirectTo({
// url: '/pages/gridLeaderRegister/gridLeaderRegister'
// })
// } else { // 不是网格长,进网格提示页
// wx.redirectTo({
// url: '/pages/formid/formid?gid=' + that.data.gid
// })
// }
// } else { // 直接进首页
// that.getBannerList()
// that.getFirstInfo()
// that.getNoticeList()
// that.getNewsList()
// that.getIssueList()
// that.getProjectList()
// that.loadGridList()
// if (wx.getStorageSync('shareObj')) {
// const para = JSON.parse(wx.getStorageSync('shareObj'))
// if (para.shareType === 'newsDetail') {
// wx.navigateTo({
// url: `/subpages/heart/pages/heartDetail/heartDetail?id=${para.id}`
// })
// }
// wx.removeStorageSync('shareObj')
// }
// }
// } else if (state == '4') { //未注册,跳到我要注册页面
// if (that.data.gid !== '') { //扫码进来的
// // 扫码进来未注册的情况,先进到前置页面获取formid
// // 是否是网格长的情况
// if (that.data.gid == 'gridLeader') { // 是网格长
// wx.redirectTo({
// url: '/pages/gridLeaderRegister/gridLeaderRegister'
// })
// } else {
// wx.redirectTo({
// url: '/pages/formid/formid?gid=' + that.data.gid
// })
// }
// } else {
// // 非扫码进入,通过搜索小程序直接进入的情况
// wx.redirectTo({
// url: '/pages/toRegister/toRegister'
// })
// // if (app.globalData.tempGridId == '') {
// // wx.redirectTo({ // todo:
// // url: '/pages/toRegister/toRegister?code=' + code + '&t=' + date
// // })
// // } else {
// // wx.redirectTo({
// // url: '/pages/formid/formid?gid=' + app.globalData.tempGridId
// // })
// // }
// }
// } else {
// if (that.data.gid !== '') { //扫码进来的
// // 是否是网格长的情况
// if (that.data.gid == 'gridLeader') { // 是网格长,进网格长注册
// wx.redirectTo({
// url: '/pages/gridLeaderRegister/gridLeaderRegister'
// })
// } else { // 不是网格长,进网格提示页
// wx.redirectTo({
// url: '/pages/formid/formid?gid=' + that.data.gid
// })
// }
// } else { // 直接进首页
// if (wx.getStorageSync('shareObj')) {
// const para = JSON.parse(wx.getStorageSync('shareObj'))
// if (para.shareType === 'newsDetail') {
// wx.navigateTo({
// url: `/subpages/heart/pages/heartDetail/heartDetail?id=${para.id}`
// })
// }
// wx.removeStorageSync('shareObj')
// }
// that.getBannerList()
// that.getFirstInfo()
// that.getNoticeList()
// that.getNewsList()
// that.getIssueList()
// that.getProjectList()
// that.loadGridList()
// }
// }
}) })
} else { } else {
console.log('登录失败' + res.errMsg) console.log('登录失败' + res.errMsg)
@ -427,7 +492,7 @@ Page({
}, },
// 我有事说 // 我有事说
wyss() { wyss() {
if(this.data.departmentId == '1264168301160857601'){//特殊网格处理 if(this.data.departmentId == this.data.defaultGridId){//特殊网格处理
wx.showToast({ wx.showToast({
title: '该板块只针对辖区内居民使用,请联系您所属网格的负责人索取二维码扫码进入', title: '该板块只针对辖区内居民使用,请联系您所属网格的负责人索取二维码扫码进入',
icon: 'none', icon: 'none',

19
subpages/heart/pages/heartDetail/heartDetail.js

@ -25,6 +25,7 @@ Page({
selectedTab: '',//用来判断详情是否显示志愿者打卡 selectedTab: '',//用来判断详情是否显示志愿者打卡
preloadVisible: true, preloadVisible: true,
timeJudge: false,//根据当前时间比较活动结束时间,判断活动是否已经结束,用以判断显示订单多多里面的志愿者 timeJudge: false,//根据当前时间比较活动结束时间,判断活动是否已经结束,用以判断显示订单多多里面的志愿者
defaultGridId:'',//默认网格
}, },
onLoad: function (options) { onLoad: function (options) {
console.log("当前时间" + getTimestamp()) console.log("当前时间" + getTimestamp())
@ -39,6 +40,8 @@ Page({
// if (this.data.actCurrentState == 2 || this.data.actCurrentState == 3 || this.data.actCurrentState == 4){ // if (this.data.actCurrentState == 2 || this.data.actCurrentState == 3 || this.data.actCurrentState == 4){
// this.clockList();//打卡列表 // this.clockList();//打卡列表
// } // }
// 获取默认网格
this.getDefaultGridInfo()
}, },
// 获取详情信息 // 获取详情信息
getDetail() { getDetail() {
@ -220,13 +223,27 @@ Page({
current: e.currentTarget.dataset.src current: e.currentTarget.dataset.src
}) })
}, },
// 获取默认网格
getDefaultGridInfo(){
let that = this
api.getDefaultGridInfo().then(res => {
if (res.code === 0 && res.msg === 'success') {
that.setData({
defaultGridId:res.data
})
}
}).catch(err => {
console.log(err)
})
},
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { onShareAppMessage: function () {
return { return {
title: '活动详情', title: '活动详情',
path: `/pages/indexNew/indexNew?shareType=newsDetail&id=${this.data.id}` path: `/pages/indexNew/indexNew?shareType=heartDetail&id=${this.data.id}&defaultGridId=${this.data.defaultGridId}`
} }
} }
}) })

4
subpages/home/pages/noticeDetail/noticeDetail.wxss

@ -70,3 +70,7 @@
text-indent: 76rpx; text-indent: 76rpx;
margin-top:22rpx; margin-top:22rpx;
} }
.richContent{
word-break: break-all;
}

2
subpages/understandJs/pages/delicious/delicious.js

@ -102,7 +102,7 @@ Page({
pageIndex: this.data.pageIndex + 1, pageIndex: this.data.pageIndex + 1,
pageSize: this.data.pageSize, pageSize: this.data.pageSize,
}) })
this.deptinfolist(); this.noticelist();
} }
}, },

2
subpages/understandJs/pages/impression/impression.js

@ -119,7 +119,7 @@ Page({
pageIndex: this.data.pageIndex + 1, pageIndex: this.data.pageIndex + 1,
pageSize: this.data.pageSize, pageSize: this.data.pageSize,
}) })
this.deptinfolist(); this.noticelist();
} }
}, },

7
utils/api.js

@ -49,7 +49,8 @@ module.exports = {
getWxPhone: getWxPhone, getWxPhone: getWxPhone,
completeResidentInfoV2: completeResidentInfoV2, completeResidentInfoV2: completeResidentInfoV2,
completePartyInfoV2: completePartyInfoV2, completePartyInfoV2: completePartyInfoV2,
userPointsRankinglist:userPointsRankinglist userPointsRankinglist:userPointsRankinglist,
getDefaultGridInfo:getDefaultGridInfo
} }
function getToken(wxCode) { function getToken(wxCode) {
@ -477,3 +478,7 @@ function getWxPhone({ wxCode, encryptedData, iv }) {
}) })
} }
// *****************************爱心互助接口***************************end // *****************************爱心互助接口***************************end
// 获取默认网格信息
function getDefaultGridInfo() {
return fly.get('dic/getDefaultGridInfo')
}
Loading…
Cancel
Save