Commit aff342bb by xinla

--no commit message

1 parent 441791e5
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0, user-scalable=no"> <meta name="viewport"
content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0, user-scalable=no">
<title>linke-wechat</title> <title>linke-wechat</title>
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<img src='' class='posterImg'/> <img src='' class='posterImg' />
<div class="footerLink"> <div class="footerLink">
<div class="sharePic" >分享图片</div> <div class="sharePic">分享图片</div>
<div class="myTaskDetail">我的邀请任务进度</div> <div class="myTaskDetail">我的邀请任务进度</div>
</div> </div>
</div> </div>
</body> </body>
</html> </html>
\ No newline at end of file \ No newline at end of file
// import vconsole from 'vconsole' import vconsole from 'vconsole'
$(function () { $(function () {
var dpr, rem, scale var dpr, rem, scale
var docEl = document.documentElement var docEl = document.documentElement
...@@ -31,6 +31,5 @@ $(function () { ...@@ -31,6 +31,5 @@ $(function () {
window.dpr = dpr window.dpr = dpr
window.rem = rem window.rem = rem
// var myConsole = new vconsole() new vconsole()
console.log('hello')
}) })
...@@ -23,7 +23,7 @@ const request = (url, params, method = 'get') => { ...@@ -23,7 +23,7 @@ const request = (url, params, method = 'get') => {
}, },
error(err) { error(err) {
// console.log(err.status) // console.log(err.status)
alert(url + err.status) alert(url + ',错误码:' + err.status)
reject(err) reject(err)
} }
}) })
......
import config from './contant' import config from './contant'
export function getUrlParam (name) { export function getUrlParam(name) {
let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')
let r = window.location.search.substr(1).match(reg); let r = window.location.search.substr(1).match(reg)
if (r != null) { if (r != null) {
return unescape(r[2]); return unescape(r[2])
} }
return null; return null
} }
export function getWxCode(){ export function getWxCode() {
let appid = "wxa57479bcd3f15461"; let appid = 'wx8bfe6bc2ca5c45ae' // 公众号appid
let code = getUrlParam("code"); //是否存在code let code = getUrlParam('code') //是否存在code
let local = window.location.origin.includes('localhost')?'http://h5.linkwechat.cn/test.html': window.location.href; let local = window.location.origin.includes('localhost')
// let local = 'http://h5.x*****o.com/' ? 'http://h5.linkwechat.cn/test.html'
if (code == null || code === "") { : window.location.href
//不存在就打开上面的地址进行授权 // let local = 'http://h5.x*****o.com/'
window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent(local)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect` if (code == null || code === '') {
//不存在就打开上面的地址进行授权
window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent(
local
)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
return false
// window.location.href =
// `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent(local)}&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect`;
}else{
config.code = code
}
}
\ No newline at end of file \ No newline at end of file
return false
// window.location.href =
// `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent(local)}&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect`;
} else {
config.code = code
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!