101 lines
2.7 KiB
Vue
101 lines
2.7 KiB
Vue
<script>
|
||
import { getVersions } from './apis/interfaces/versions'
|
||
export default {
|
||
onLaunch() {
|
||
//#ifdef H5
|
||
if (typeof WeixinJSBridge == 'object' && typeof WeixinJSBridge.invoke == 'function') {
|
||
handleFontSize()
|
||
} else {
|
||
document.addEventListener('WeixinJSBridgeReady', handleFontSize, false);
|
||
}
|
||
function handleFontSize() {
|
||
// 设置网页字体为默认大小
|
||
WeixinJSBridge.invoke('setFontSizeCallback', {
|
||
fontSize: 0
|
||
})
|
||
// 重写设置网页字体大小的事件
|
||
WeixinJSBridge.on('menu:setfont', function() {
|
||
WeixinJSBridge.invoke('setFontSizeCallback', {
|
||
fontSize: 0
|
||
})
|
||
})
|
||
}
|
||
//#endif
|
||
|
||
//#ifdef APP-PLUS
|
||
// 获取系统版本号
|
||
getVersions({
|
||
platform: plus.os.name,
|
||
version: plus.runtime.versionCode
|
||
}).then(res => {
|
||
if(res.update){
|
||
uni.showModal({
|
||
title: "更新提示",
|
||
content: res.note || '版本更新信息',
|
||
success: (res) => {
|
||
if (res.confirm) {
|
||
if (plus.os.name=="Android") {
|
||
plus.runtime.openURL("https://www.lianshang.vip/app");
|
||
} else{
|
||
uni.showToast({
|
||
title: 'IOS应用暂未上架,请打开测试工具点击更新'
|
||
})
|
||
}
|
||
}
|
||
}
|
||
})
|
||
}
|
||
}).catch(err => {
|
||
uni.showToast({
|
||
title: err.message,
|
||
icon : 'none'
|
||
})
|
||
})
|
||
//#endif
|
||
},
|
||
onShow() {
|
||
uni.getClipboardData({
|
||
success: res=> {
|
||
// 包含分享邀请码
|
||
if(res.data.indexOf('$InviTaTiOn$CoDe/$-?') === 2){
|
||
let parentId = res.data.replace('$InviTaTiOn$CoDe/$-?', '')
|
||
this.globalData.parentId = parentId.substr(0, 10)
|
||
if(res.data.indexOf('^GoodsId/$-?') === 30){
|
||
let goodsId = res.data.substr(42, res.data.length - 1)
|
||
setTimeout(() => {
|
||
if(this.$Route.name === 'goodsDetails' && this.$Route.query.id === goodsId) return
|
||
this.$Router.push({name: 'goodsDetails', params: {id: goodsId}})
|
||
}, 1000)
|
||
}
|
||
return
|
||
}
|
||
// 不包含用户信息
|
||
if(res.data.indexOf('^GoodsId/$-?') > -1){
|
||
let goodsId = res.data.substr(12, res.data.length - 1)
|
||
setTimeout(() => {
|
||
if(this.$Route.name === 'goodsDetails' && this.$Route.query.id === goodsId) return
|
||
this.$Router.push({name: 'goodsDetails', params: {id: goodsId}})
|
||
}, 1000)
|
||
}
|
||
}
|
||
})
|
||
},
|
||
onHide() {
|
||
console.log('App Hide');
|
||
},
|
||
globalData: {
|
||
mainColor: 'white',
|
||
parentId:''
|
||
}
|
||
};
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
@import 'uview-ui/index.scss';
|
||
|
||
page {
|
||
background: #f5f5f5;
|
||
-webkit-text-size-adjust: 100% !important;
|
||
}
|
||
</style>
|