Commit cc662a3e authored by Xuguangxing's avatar Xuguangxing

feat: 处理原生浏览器和微信浏览器差异

parent 536b25df
......@@ -86,14 +86,15 @@ const mutations = {
confirmButtonText: '打开微信小程序',
onConfirm: () => {
// todo 跳转到小程序
const getScheme = async function() {
let getScheme = async function() {
const [res] = await groupBuy.getScheme({
miniUrl: 'pages/user/login'
});
const url = res;
window.location.href = url;
window.location.href = url; // todo 需要验证
};
getScheme();
getScheme = null;
}
});
}
......
......@@ -29,6 +29,9 @@
</div>
</template>
<script>
import { isApp, isWxMp } from '@/service/validation.service';
import Bridge from '@qg/js-bridge';
import MpBridge from '@/service/mp';
export default {
name: 'BottomNav',
props: {
......@@ -59,10 +62,44 @@ export default {
default: 2
}
},
data() {
return {
nativeBridge: null
};
},
methods: {
checkLogin() {
const vccToken = localStorage.get('vccToken');
return vccToken ? true : false;
const needLogin = vccToken ? true : false;
if (needLogin) {
if (isApp) this.nativeBridge = new Bridge();
else if (isWxMp) this.nativeBridge = new MpBridge();
this.$dialog({
message: '参与拼团活动需要您先进行登录哦~',
title: '',
showCancelButton: false,
confirmButtonText: '登录',
onConfirm: () => {
if (isWxMp) {
this.nativeBridge.openNewUrl({
newUrl: `/pages/user/login`
});
} else if (isApp) {
// todo 向app要一个scheme
this.nativeBridge.openNewUrl({
newUrl: ``
});
} else {
this.$dialog({
message: '请在App或小程序中参与活动~',
title: '',
showCancelButton: false,
confirmButtonText: '我知道了'
});
}
}
});
}
},
joinGroup() {
// 参团
......
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