优化 code获取

dev-1021
Seep 1 year ago
parent 1141d3d103
commit e4f3791d18
  1. 1
      common/auth.js
  2. 24
      pages/login/login.vue
  3. 2
      unpackage/dist/build/h5/index.html
  4. 1
      unpackage/dist/build/h5/static/js/index.db06b8f4.js
  5. 1
      unpackage/dist/build/h5/static/js/index.f9d46f1b.js
  6. 1
      unpackage/dist/build/h5/static/js/pages-login-login.16d56b95.js
  7. 1
      unpackage/dist/build/h5/static/js/pages-login-login.56f8facd.js

@ -62,6 +62,7 @@ export function removeAll() {
uni.removeStorageSync(USER_TOKEN)
uni.removeStorageSync(USER_INFO)
uni.removeStorageSync(AGENT_INFO)
uni.removeStorageSync('code')
}
/**

@ -67,7 +67,29 @@ export default {
checked:[],
};
},
onShow() {
this.H5Login()
},
methods:{
H5Login(){
let pageUrl = window.location.href;
let code =this.getQueryString('code');
let appid="wx15043fd052209ad4"
let redirect_uri = encodeURIComponent(pageUrl);
// let redirect_uri = pageUrl;
console.log(redirect_uri)
let authUrl =
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=STATE&connect_redirect=1#wechat_redirect`;
if (code) {
uni.setStorageSync("code",code)
} else {
window.location.href = authUrl;
console.log("没有code")
// return await Promise.reject("");
}
},
onRegister(){
uni.navigateTo({
url: '/pages/register/register'
@ -122,7 +144,7 @@ export default {
let code =this.getQueryString('code');
console.log(code,"lldd");
let appid="wx5a2c9f7e82918b85"
let appid="wx15043fd052209ad4"
let redirect_uri = encodeURIComponent(pageUrl);
// let redirect_uri = pageUrl;

@ -1,2 +1,2 @@
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>商城</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/static/index.97465e7b.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.aabf9ea3.js></script><script src=/static/js/index.f9d46f1b.js></script></body></html>
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/static/index.97465e7b.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.aabf9ea3.js></script><script src=/static/js/index.db06b8f4.js></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save