Commit 27e00ab0 by 高淑倩

集点

parent ce33a9e5
...@@ -56,6 +56,54 @@ wxService.page({ ...@@ -56,6 +56,54 @@ wxService.page({
this.generatePointObject(tentacleInfo); this.generatePointObject(tentacleInfo);
} }
}, },
watch: {
experAccessible(newVal, oldVal) {
if (newVal) {
// 登录接口返回err
const reLoginErrFlag = wx.getStorageSync('reLoginErr')
const baseUserInfo = wx.getStorageSync('_baseUserInfo')
let id
if (baseUserInfo && !reLoginErrFlag) {
this.setData({
isAuthorization: false
}, () => {
const option = this.options || {}
const { scene } = option
if (scene) {
let idParam = decodeURIComponent(scene).split('&')[0]
let shareId = idParam && idParam.split('=')[1] || 0
id = shareId
} else {
id = option.id
}
if (id) {
this.setData({
id
}, () => {
this.getPointDetail(id)
})
}
// 隐藏 dialog
this.isShowDialog(false)
})
}
else if (!baseUserInfo && reLoginErrFlag) {
this.setData({
isAuthorization: true
})
}
else {
this.setData({
isAuthorization: true
})
}
} else {
// 去别的页面
wxService.router(`/subPackage/page/pages/goToHome/goToHome`).replace()
}
}
},
// 集点详情 // 集点详情
getPointDetail(id) { getPointDetail(id) {
wx.showLoading({ wx.showLoading({
...@@ -248,46 +296,46 @@ wxService.page({ ...@@ -248,46 +296,46 @@ wxService.page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
const { memberId, member } = wx.getStorageSync('_baseUserInfo') // const { memberId, member } = wx.getStorageSync('_baseUserInfo')
// 登录接口返回err // // 登录接口返回err
const reLoginErrFlag = wx.getStorageSync('reLoginErr') // const reLoginErrFlag = wx.getStorageSync('reLoginErr')
const baseUserInfo = wx.getStorageSync('_baseUserInfo') // const baseUserInfo = wx.getStorageSync('_baseUserInfo')
let id // let id
if (baseUserInfo && !reLoginErrFlag){ // if (baseUserInfo && !reLoginErrFlag){
this.setData({ // this.setData({
isAuthorization: false // isAuthorization: false
},()=>{ // },()=>{
const option = this.options || {} // const option = this.options || {}
const { scene } = option // const { scene } = option
if (scene) { // if (scene) {
let idParam = decodeURIComponent(scene).split('&')[0] // let idParam = decodeURIComponent(scene).split('&')[0]
let shareId = idParam && idParam.split('=')[1] || 0 // let shareId = idParam && idParam.split('=')[1] || 0
id = shareId // id = shareId
} else { // } else {
id = option.id // id = option.id
} // }
if (id) { // if (id) {
this.setData({ // this.setData({
id // id
}, () => { // }, () => {
this.getPointDetail(id) // this.getPointDetail(id)
}) // })
} // }
// 隐藏 dialog // // 隐藏 dialog
this.isShowDialog(false) // this.isShowDialog(false)
}) // })
} // }
else if(!baseUserInfo && reLoginErrFlag){ // else if(!baseUserInfo && reLoginErrFlag){
this.setData({ // this.setData({
isAuthorization: true // isAuthorization: true
}) // })
} // }
else { // else {
this.setData({ // this.setData({
isAuthorization: true // isAuthorization: true
}) // })
} // }
}, },
/** /**
......
...@@ -14,7 +14,16 @@ wxService.page({ ...@@ -14,7 +14,16 @@ wxService.page({
currentStatus: 2, // 活动状态 1 未生效 2 生效中 3 已失效 0 已删除 currentStatus: 2, // 活动状态 1 未生效 2 生效中 3 已失效 0 已删除
currentTimeStatus: 1, // 1 进行中 2 已结束 3 未开始 currentTimeStatus: 1, // 1 进行中 2 已结束 3 未开始
}, },
watch: {
experAccessible(newVal, oldVal) {
if(newVal) {
this.getPointList()
} else {
// 去别的页面
wxService.router(`/subPackage/page/pages/goToHome/goToHome`).replace()
}
}
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
...@@ -41,8 +50,8 @@ wxService.page({ ...@@ -41,8 +50,8 @@ wxService.page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {
const { memberId, member } = wx.getStorageSync('_baseUserInfo') // const { memberId, member } = wx.getStorageSync('_baseUserInfo')
this.getPointList() // this.getPointList()
}, },
getPointList() { getPointList() {
wx.showLoading({ wx.showLoading({
......
var pathJson = {
'7.1': [ // 版本对应路径
'pages/pointList/pointList',
'pages/pointDetail/pointDetail'
]
}
module.exports = pathJson
\ No newline at end of file
...@@ -79,6 +79,12 @@ export function getC3 (c2Name) { ...@@ -79,6 +79,12 @@ export function getC3 (c2Name) {
}) })
} }
export function getCurrentRouter () {
var pages = getCurrentPages() // 获取加载的页面
var currentPage = pages[pages.length - 1] // 获取当前页面的对象
return currentPage
}
export function getAppUserInfo () { export function getAppUserInfo () {
const userInfo = wx.getStorageSync('_userInfo') const userInfo = wx.getStorageSync('_userInfo')
if (userInfo) { if (userInfo) {
......
...@@ -19,6 +19,7 @@ import utils from './util' ...@@ -19,6 +19,7 @@ import utils from './util'
const citysData = require('./city.js') const citysData = require('./city.js')
import { Integer } from './integerDigitalConvertion' import { Integer } from './integerDigitalConvertion'
import * as watch from "./watch.js"; import * as watch from "./watch.js";
const pathData = require('./currentAccessiblePath.js')
let openCardLister = null let openCardLister = null
/** /**
...@@ -368,6 +369,44 @@ class WXService extends Http { ...@@ -368,6 +369,44 @@ class WXService extends Http {
}) })
} }
getAssPath() {
const paths = pathData
let pathArr = []
for (const key in paths) {
if (paths.hasOwnProperty(key)) {
let pathObj = {}
pathObj[key] = paths[key]
pathArr.push(pathObj)
}
}
return pathArr
}
trialList() {
let localPath = this.getAssPath()
wx.showLoading({
title: '加载中'
})
return this.get(`/member/trial/list`).then(res => {
if (res) {
const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
// 对应的path
let currentPaths = [];
localPath.forEach(item => {
if (item.hasOwnProperty(data)) {
currentPaths = item[data]
} else {
console.log(222);
}
})
return Promise.resolve({ currentPaths })
}
}
})
}
getSystemInfo() { getSystemInfo() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
wx.getSystemInfo({ wx.getSystemInfo({
...@@ -500,6 +539,9 @@ class WXService extends Http { ...@@ -500,6 +539,9 @@ class WXService extends Http {
config.data.currentPageRequireAuth = false; config.data.currentPageRequireAuth = false;
// vip // vip
config.data.isVip = '' config.data.isVip = ''
// 集点体验者
config.data.experAccessible;
const CONFIG_PAPGE = { const CONFIG_PAPGE = {
onLoad: function (...args) { onLoad: function (...args) {
...@@ -536,6 +578,8 @@ class WXService extends Http { ...@@ -536,6 +578,8 @@ class WXService extends Http {
_self.currentPage = page _self.currentPage = page
config.onShow && config.onShow.apply(page, args) config.onShow && config.onShow.apply(page, args)
wx.removeStorageSync('_premiumExpireTime') wx.removeStorageSync('_premiumExpireTime')
// 获取当前页
let router = getCurrentRouter()
const baseUserInfo = wx.getStorageSync('_baseUserInfo') const baseUserInfo = wx.getStorageSync('_baseUserInfo')
const premiumExpireTime = baseUserInfo && baseUserInfo.member && baseUserInfo.member.premiumExpireTime || '' const premiumExpireTime = baseUserInfo && baseUserInfo.member && baseUserInfo.member.premiumExpireTime || ''
...@@ -553,6 +597,20 @@ class WXService extends Http { ...@@ -553,6 +597,20 @@ class WXService extends Http {
page.setData({ page.setData({
currentHasUserInfo: true, currentHasUserInfo: true,
isVip: vipFlag isVip: vipFlag
},()=>{
_self.trialList().then(res => {
if (!res) return false
const { currentPaths } = res
if (currentPaths.indexOf(router.route) > -1 && isExperiencer) {
this.setData({
experAccessible: true
})
} else {
this.setData({
experAccessible: false
})
}
})
}); });
} else { } else {
page.setData({ page.setData({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment