Commit 27e00ab0 by 高淑倩

集点

parent ce33a9e5
......@@ -56,6 +56,54 @@ wxService.page({
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) {
wx.showLoading({
......@@ -248,46 +296,46 @@ wxService.page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
const { memberId, member } = wx.getStorageSync('_baseUserInfo')
// 登录接口返回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
}
// const { memberId, member } = wx.getStorageSync('_baseUserInfo')
// // 登录接口返回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
})
}
// 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
// })
// }
},
/**
......
......@@ -14,7 +14,16 @@ wxService.page({
currentStatus: 2, // 活动状态 1 未生效 2 生效中 3 已失效 0 已删除
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({
* 生命周期函数--监听页面显示
*/
onShow() {
const { memberId, member } = wx.getStorageSync('_baseUserInfo')
this.getPointList()
// const { memberId, member } = wx.getStorageSync('_baseUserInfo')
// this.getPointList()
},
getPointList() {
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) {
})
}
export function getCurrentRouter () {
var pages = getCurrentPages() // 获取加载的页面
var currentPage = pages[pages.length - 1] // 获取当前页面的对象
return currentPage
}
export function getAppUserInfo () {
const userInfo = wx.getStorageSync('_userInfo')
if (userInfo) {
......
......@@ -19,6 +19,7 @@ import utils from './util'
const citysData = require('./city.js')
import { Integer } from './integerDigitalConvertion'
import * as watch from "./watch.js";
const pathData = require('./currentAccessiblePath.js')
let openCardLister = null
/**
......@@ -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() {
return new Promise((resolve, reject) => {
wx.getSystemInfo({
......@@ -500,6 +539,9 @@ class WXService extends Http {
config.data.currentPageRequireAuth = false;
// vip
config.data.isVip = ''
// 集点体验者
config.data.experAccessible;
const CONFIG_PAPGE = {
onLoad: function (...args) {
......@@ -536,6 +578,8 @@ class WXService extends Http {
_self.currentPage = page
config.onShow && config.onShow.apply(page, args)
wx.removeStorageSync('_premiumExpireTime')
// 获取当前页
let router = getCurrentRouter()
const baseUserInfo = wx.getStorageSync('_baseUserInfo')
const premiumExpireTime = baseUserInfo && baseUserInfo.member && baseUserInfo.member.premiumExpireTime || ''
......@@ -553,6 +597,20 @@ class WXService extends Http {
page.setData({
currentHasUserInfo: true,
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 {
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