更新微信公众号登录

master
lemon橪 2021-10-29 16:34:41 +08:00
parent 8c72cdcb0a
commit 375653eb78
1 changed files with 69 additions and 42 deletions

View File

@ -1,5 +1,6 @@
<template>
<div class="wrapper">
<div v-if="!wechatLogin">
<u-navbar :is-back="showBack" :border-bottom="false"></u-navbar>
<div>
<div class="title">{{loginTitleWay[current].title}}</div>
@ -42,12 +43,15 @@
</div>
</div>
<myVerification v-if="codeFlag" @send="verification" class="verification" ref="verification" business="LOGIN" />
</div>
<view v-else>
<wechatH5Login />
</view>
</div>
</template>
<script>
import { openIdLogin ,loginCallback } from "@/api/connect.js";
import { openIdLogin, loginCallback } from "@/api/connect.js";
import api from "@/config/api.js";
import { sendMobile, smsLogin } from "@/api/login";
import myVerification from "@/components/verification/verification.vue"; //
@ -56,13 +60,15 @@ import verifyCode from "@/components/verify-code/verify-code";
import { getUserInfo } from "@/api/members";
import { whetherNavigate } from "@/utils/Foundation"; //
import storage from "@/utils/storage.js"; //
import wechatH5Login from "./wechatH5Login.vue";
import { webConnect } from "@/api/connect.js";
export default {
components: { myVerification, verifyCode },
components: { myVerification, verifyCode, wechatH5Login },
data() {
return {
uuid,
wechatLogin: false, //
flage: false, //
codeFlag: true, //
tips: "",
@ -117,7 +123,28 @@ export default {
],
};
},
onShow() {
//#ifdef H5
let isWXBrowser = /micromessenger/i.test(navigator.userAgent);
if (isWXBrowser) {
webConnect("WECHAT").then((res) => {
let data = res.data;
if (data.success) {
window.location = data.result;
}
});
}
//#endif
},
mounted() {
// #ifndef APP-PLUS
//
var ua = window.navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") {
this.wechatLogin = true;
return;
}
// #endif
/**
* 条件编译判断当前客户端类型
*/