Commit 52207aa2 by wangyalan-git

添加

parent 162955ff
...@@ -18,28 +18,29 @@ App({ ...@@ -18,28 +18,29 @@ App({
overShare: function () { overShare: function () {
//监听路由切换 //监听路由切换
//间接实现全局设置分享内容 //间接实现全局设置分享内容
var that = this
wx.onAppRoute(function (res) { wx.onAppRoute(function (res) {
//获取加载的页面 //获取加载的页面
let pages = getCurrentPages(), let pages = getCurrentPages(),
//获取当前页面的对象 //获取当前页面的对象
view = pages[pages.length - 1], view = pages[pages.length - 1],
data; data;
if (view) { if (view) {
data = view.data; data = view.data;
console.log('是否重写分享方法', this.globalData.userInfo); console.log('是否重写分享方法', that.globalData.userInfo);
if (!data.isOverShare) { if (!data.isOverShare) {
data.isOverShare = true; data.isOverShare = true;
view.onShareAppMessage = function () { view.onShareAppMessage = function () {
//你的分享配置 //你的分享配置
return { return {
title: '中厦全供', title: '中厦全供',
path: '/pages/index/index?shareCode='+ this.globalData.userInfo.shareCode path: '/pages/index/index?shareCode=' + that.globalData.userInfo.shareCode
}; };
} }
}
} }
}
}) })
}, },
globalData: { globalData: {
userInfo: '', userInfo: '',
// 定义全局请求队列 // 定义全局请求队列
......
...@@ -80,12 +80,14 @@ Page({ ...@@ -80,12 +80,14 @@ Page({
}, },
onShow: function () { onShow: function () {
console.log('页面参路径',this.options)
var that =this
wx.getSetting({ wx.getSetting({
success(res) { success(res) {
if (!res.authSetting['scope.userInfo']) { if (!res.authSetting['scope.userInfo']) {
if (this.options.shareCode) { if (that.options.shareCode) {
wx.navigateTo({ wx.navigateTo({
url: '/pages/login/login?shareCode=' + this.options.shareCode, url: '/pages/login/login?shareCode=' + that.options.shareCode,
}) })
} else { } else {
wx.navigateTo({ wx.navigateTo({
...@@ -93,8 +95,8 @@ Page({ ...@@ -93,8 +95,8 @@ Page({
}) })
} }
} else { } else {
if (this.options.shareCode) { if (that.options.shareCode) {
this.boundParentByShareCode(options.shareCode); // 绑定内容获取 that.boundParentByShareCode(options.shareCode); // 绑定内容获取
} }
} }
} }
......
{ {
"usingComponents": { "usingComponents": {},
"painter": "/components/painter/painter"
},
"navigationBarTitleText": "邀请海报", "navigationBarTitleText": "邀请海报",
"navigationBarBackgroundColor": "#000000", "navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "white" "navigationBarTextStyle": "white"
......
var domain = "http://192.168.31.110:8086/capi"; //统一接口域名,测试环境 var domain = "http://192.168.31.113:8086/capi"; //统一接口域名,测试环境
exports.domain = domain; exports.domain = domain;
...@@ -91,7 +91,7 @@ var getToken = function () { ...@@ -91,7 +91,7 @@ var getToken = function () {
wx.setStorageSync('token', ''); wx.setStorageSync('token', '');
} else { } else {
wx.setStorageSync('token', 'bearer' + result.access_token); //把token存入缓存,请求接口数据时要用 wx.setStorageSync('token', 'bearer' + result.access_token); //把token存入缓存,请求接口数据时要用
this.getUserInfo() getUserInfo()
} }
var globalData = getApp().globalData; var globalData = getApp().globalData;
globalData.isLanding = false; globalData.isLanding = false;
...@@ -112,10 +112,11 @@ function getUserInfo() { ...@@ -112,10 +112,11 @@ function getUserInfo() {
data: {}, data: {},
callBack: (res) => { callBack: (res) => {
console.log('用户信息', res.result) console.log('用户信息', res.result)
var app = getApp();
app.globalData.userInfo = res.result app.globalData.userInfo = res.result
} }
}; };
http.request(params); request(params);
} }
// 更新用户头像昵称 // 更新用户头像昵称
function updateUserInfo() { function updateUserInfo() {
......
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