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
*/
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);
return true;
},
/**
@ -75,8 +83,26 @@ App({
* 当小程序启动或从后台进入前台显示会触发 onShow
*/
onShow(options) {
// 获取小程序基础信息
// this.getWxappBase();
let App = this;
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,
duration: 1500,
success() {
callback && (setTimeout(function() {
callback && (setTimeout(() => {
callback();
}, 1500));
}
@ -129,7 +155,7 @@ App({
content: msg,
showCancel: false,
success(res) {
// callback && (setTimeout(function() {
// callback && (setTimeout(() => {
// callback();
// }, 1500));
callback && callback();
@ -151,7 +177,7 @@ App({
// check_login = true;
// 构造get请求
let request = function() {
let request = () => {
data.token = wx.getStorageSync('token');
wx.request({
url: _this.api_root + url,
@ -170,7 +196,7 @@ App({
wx.hideNavigationBarLoading();
_this.doLogin(2);
} else if (res.data.code === 0) {
_this.showError(res.data.msg, function() {
_this.showError(res.data.msg, () => {
fail && fail(res);
});
return false;
@ -179,7 +205,7 @@ App({
}
},
fail(res) {
_this.showError(res.errMsg, function() {
_this.showError(res.errMsg, () => {
fail && fail(res);
});
},
@ -225,7 +251,7 @@ App({
_this.doLogin(1);
return false;
} else if (res.data.code === 0) {
_this.showError(res.data.msg, function() {
_this.showError(res.data.msg, () => {
fail && fail(res);
});
return false;
@ -234,7 +260,7 @@ App({
},
fail(res) {
// console.log(res);
_this.showError(res.errMsg, function() {
_this.showError(res.errMsg, () => {
fail && fail(res);
});
},
@ -262,11 +288,11 @@ App({
return false;
}
const updateManager = wx.getUpdateManager();
updateManager.onCheckForUpdate(function(res) {
updateManager.onCheckForUpdate(res => {
// 请求完新版本信息的回调
// console.log(res.hasUpdate)
});
updateManager.onUpdateReady(function() {
updateManager.onUpdateReady(() => {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,即将重启应用',
@ -279,7 +305,7 @@ App({
}
});
});
updateManager.onUpdateFailed(function() {
updateManager.onUpdateFailed(() => {
// 新的版本下载失败
wx.showModal({
title: '更新提示',

View File

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

View File

@ -133,7 +133,11 @@ Page({
dealerSubmsg = _this.data.submsgSetting.dealer;
dealerSubmsg.withdraw_01.template_id != '' && tmplIds.push(dealerSubmsg.withdraw_01.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({
tmplIds,
success(res) {},
@ -142,7 +146,6 @@ Page({
callback && callback();
},
});
}
},
/**

View File

@ -197,7 +197,8 @@ Page({
onTargetLiveRoomIndex(e) {
let roomId = e.currentTarget.dataset.id;
let customParams = {
path: 'pages/index/index'
path: 'pages/index/index',
referee_id: App.getUserId(), // 分销推荐人
};
wx.navigateTo({
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) {
let _this = this;
let tmplItem = _this.data.submsgSetting.order.refund.template_id;
if (tmplItem.length > 0) {
if (tmplItem.length == 0) {
callback && callback();
return;
}
wx.requestSubscribeMessage({
tmplIds: [tmplItem],
success(res) {},
@ -165,7 +169,6 @@ Page({
callback && callback();
},
});
}
},
})

View File

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

View File

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

View File

@ -512,7 +512,7 @@ Page({
sharp_goods_id: _this.data.sharp_goods_id,
});
return {
title: _this.data.detail.goods_name,
title: _this.data.goods.goods_name,
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;
}
view {
.view {
word-break: break-all;
/* overflow: auto; */
}
@ -146,7 +146,7 @@ view {
.wxParse-video-video {
width: 100%;
height: 100%;
/* height: 100%; */
}
.wxParse-img {