This commit is contained in:
周中平 2020-08-28 10:49:15 +08:00
parent 25542e0535
commit 054ace2994
10 changed files with 95 additions and 56 deletions

52
app.js
View File

@ -60,8 +60,16 @@ App({
* 记录推荐人id * 记录推荐人id
*/ */
saveRefereeId(refereeId) { saveRefereeId(refereeId) {
if (!wx.getStorageSync('referee_id')) let App = this;
refereeId = parseInt(refereeId);
if (refereeId <= 0 || refereeId == App.getUserId()) {
return false;
}
if (wx.getStorageSync('referee_id')) {
return false;
}
wx.setStorageSync('referee_id', refereeId); wx.setStorageSync('referee_id', refereeId);
return true;
}, },
/** /**
@ -75,8 +83,26 @@ App({
* 当小程序启动或从后台进入前台显示会触发 onShow * 当小程序启动或从后台进入前台显示会触发 onShow
*/ */
onShow(options) { onShow(options) {
// 获取小程序基础信息 let App = this;
// this.getWxappBase(); try {
const livePlayer = requirePlugin('live-player-plugin');
if (options.scene == 1007 || options.scene == 1008 || options.scene == 1044) {
livePlayer.getShareParams()
.then(res => {
// 直播页面的自定义参数
let customParams = res.custom_params;
console.log('get custom params', customParams);
// 记录推荐人ID
if (customParams.hasOwnProperty('referee_id')) {
App.saveRefereeId(customParams['referee_id']);
}
}).catch(err => {
console.log('get share params', err)
});
}
} catch (error) {
}
}, },
/** /**
@ -113,7 +139,7 @@ App({
mask: true, mask: true,
duration: 1500, duration: 1500,
success() { success() {
callback && (setTimeout(function() { callback && (setTimeout(() => {
callback(); callback();
}, 1500)); }, 1500));
} }
@ -129,7 +155,7 @@ App({
content: msg, content: msg,
showCancel: false, showCancel: false,
success(res) { success(res) {
// callback && (setTimeout(function() { // callback && (setTimeout(() => {
// callback(); // callback();
// }, 1500)); // }, 1500));
callback && callback(); callback && callback();
@ -151,7 +177,7 @@ App({
// check_login = true; // check_login = true;
// 构造get请求 // 构造get请求
let request = function() { let request = () => {
data.token = wx.getStorageSync('token'); data.token = wx.getStorageSync('token');
wx.request({ wx.request({
url: _this.api_root + url, url: _this.api_root + url,
@ -170,7 +196,7 @@ App({
wx.hideNavigationBarLoading(); wx.hideNavigationBarLoading();
_this.doLogin(2); _this.doLogin(2);
} else if (res.data.code === 0) { } else if (res.data.code === 0) {
_this.showError(res.data.msg, function() { _this.showError(res.data.msg, () => {
fail && fail(res); fail && fail(res);
}); });
return false; return false;
@ -179,7 +205,7 @@ App({
} }
}, },
fail(res) { fail(res) {
_this.showError(res.errMsg, function() { _this.showError(res.errMsg, () => {
fail && fail(res); fail && fail(res);
}); });
}, },
@ -225,7 +251,7 @@ App({
_this.doLogin(1); _this.doLogin(1);
return false; return false;
} else if (res.data.code === 0) { } else if (res.data.code === 0) {
_this.showError(res.data.msg, function() { _this.showError(res.data.msg, () => {
fail && fail(res); fail && fail(res);
}); });
return false; return false;
@ -234,7 +260,7 @@ App({
}, },
fail(res) { fail(res) {
// console.log(res); // console.log(res);
_this.showError(res.errMsg, function() { _this.showError(res.errMsg, () => {
fail && fail(res); fail && fail(res);
}); });
}, },
@ -262,11 +288,11 @@ App({
return false; return false;
} }
const updateManager = wx.getUpdateManager(); const updateManager = wx.getUpdateManager();
updateManager.onCheckForUpdate(function(res) { updateManager.onCheckForUpdate(res => {
// 请求完新版本信息的回调 // 请求完新版本信息的回调
// console.log(res.hasUpdate) // console.log(res.hasUpdate)
}); });
updateManager.onUpdateReady(function() { updateManager.onUpdateReady(() => {
wx.showModal({ wx.showModal({
title: '更新提示', title: '更新提示',
content: '新版本已经准备好,即将重启应用', content: '新版本已经准备好,即将重启应用',
@ -279,7 +305,7 @@ App({
} }
}); });
}); });
updateManager.onUpdateFailed(function() { updateManager.onUpdateFailed(() => {
// 新的版本下载失败 // 新的版本下载失败
wx.showModal({ wx.showModal({
title: '更新提示', title: '更新提示',

View File

@ -24,7 +24,7 @@ page {
.no-more { .no-more {
text-align: center; text-align: center;
color: #737373; color: #737373;
padding: 10px 0; padding: 20rpx 0;
} }
.yoshop-notcont { .yoshop-notcont {

View File

@ -133,7 +133,11 @@ Page({
dealerSubmsg = _this.data.submsgSetting.dealer; dealerSubmsg = _this.data.submsgSetting.dealer;
dealerSubmsg.withdraw_01.template_id != '' && tmplIds.push(dealerSubmsg.withdraw_01.template_id); dealerSubmsg.withdraw_01.template_id != '' && tmplIds.push(dealerSubmsg.withdraw_01.template_id);
dealerSubmsg.withdraw_02.template_id != '' && tmplIds.push(dealerSubmsg.withdraw_02.template_id); dealerSubmsg.withdraw_02.template_id != '' && tmplIds.push(dealerSubmsg.withdraw_02.template_id);
if (tmplIds.length > 0) {
if (tmplIds.length == 0) {
callback && callback();
return;
}
wx.requestSubscribeMessage({ wx.requestSubscribeMessage({
tmplIds, tmplIds,
success(res) {}, success(res) {},
@ -142,7 +146,6 @@ Page({
callback && callback(); callback && callback();
}, },
}); });
}
}, },
/** /**

View File

@ -197,7 +197,8 @@ Page({
onTargetLiveRoomIndex(e) { onTargetLiveRoomIndex(e) {
let roomId = e.currentTarget.dataset.id; let roomId = e.currentTarget.dataset.id;
let customParams = { let customParams = {
path: 'pages/index/index' path: 'pages/index/index',
referee_id: App.getUserId(), // 分销推荐人
}; };
wx.navigateTo({ wx.navigateTo({
url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${roomId}&custom_params=${encodeURIComponent(JSON.stringify(customParams))}` url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${roomId}&custom_params=${encodeURIComponent(JSON.stringify(customParams))}`

View File

@ -156,7 +156,11 @@ Page({
_onRequestSubscribeMessage(callback) { _onRequestSubscribeMessage(callback) {
let _this = this; let _this = this;
let tmplItem = _this.data.submsgSetting.order.refund.template_id; let tmplItem = _this.data.submsgSetting.order.refund.template_id;
if (tmplItem.length > 0) {
if (tmplItem.length == 0) {
callback && callback();
return;
}
wx.requestSubscribeMessage({ wx.requestSubscribeMessage({
tmplIds: [tmplItem], tmplIds: [tmplItem],
success(res) {}, success(res) {},
@ -165,7 +169,6 @@ Page({
callback && callback(); callback && callback();
}, },
}); });
}
}, },
}) })

View File

@ -55,7 +55,11 @@ Page({
_onRequestSubscribeMessage(callback) { _onRequestSubscribeMessage(callback) {
let _this = this; let _this = this;
let tmplItem = _this.data.setting.order_submsg.active_status; let tmplItem = _this.data.setting.order_submsg.active_status;
if (tmplItem.length > 0) {
if (tmplItem.length == 0) {
callback && callback();
return;
}
wx.requestSubscribeMessage({ wx.requestSubscribeMessage({
tmplIds: [tmplItem], tmplIds: [tmplItem],
success(res) {}, success(res) {},
@ -64,7 +68,6 @@ Page({
callback && callback(); callback && callback();
}, },
}); });
}
}, },
/** /**

View File

@ -156,7 +156,11 @@ Page({
_onRequestSubscribeMessage(callback) { _onRequestSubscribeMessage(callback) {
let _this = this; let _this = this;
let tmplItem = _this.data.submsgSetting.order.refund.template_id; let tmplItem = _this.data.submsgSetting.order.refund.template_id;
if (tmplItem.length > 0) {
if (tmplItem.length == 0) {
callback && callback();
return;
}
wx.requestSubscribeMessage({ wx.requestSubscribeMessage({
tmplIds: [tmplItem], tmplIds: [tmplItem],
success(res) {}, success(res) {},
@ -165,7 +169,6 @@ Page({
callback && callback(); callback && callback();
}, },
}); });
}
}, },
}) })

View File

@ -512,7 +512,7 @@ Page({
sharp_goods_id: _this.data.sharp_goods_id, sharp_goods_id: _this.data.sharp_goods_id,
}); });
return { return {
title: _this.data.detail.goods_name, title: _this.data.goods.goods_name,
path: `/pages/sharp/goods/index?${params}` path: `/pages/sharp/goods/index?${params}`
}; };
}, },

View File

@ -1,3 +1,3 @@
{ {
"version": "1.1.41" "version": "1.1.42"
} }

View File

@ -6,7 +6,7 @@
line-height: 1.8; line-height: 1.8;
} }
view { .view {
word-break: break-all; word-break: break-all;
/* overflow: auto; */ /* overflow: auto; */
} }
@ -146,7 +146,7 @@ view {
.wxParse-video-video { .wxParse-video-video {
width: 100%; width: 100%;
height: 100%; /* height: 100%; */
} }
.wxParse-img { .wxParse-img {