46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
import Bus from "../bus.js";
|
||
import {readyPost,readyGet} from "./base.js"
|
||
|
||
const domain_zs = process.env.VUE_APP_ZS_AUTHORIZE_DOMAIN ;
|
||
const domain_xgl = process.env.VUE_APP_XGL_AUTHORIZE_DOMAIN ;
|
||
///////////////////////////
|
||
|
||
|
||
// 1.公众号网页授权
|
||
// 请求方法:get请求
|
||
// 请求链接:/wxauth/official/account/authorize
|
||
// 请求参数:
|
||
// redirectUrl 请求链接
|
||
// scope 授权类型:0用户授权,1静默授权
|
||
// 返回值:无
|
||
// 备注:回调页面URL后可能携带参数:token、userid、forceauth。
|
||
// 先取token,如有,表示登录成功(登录成功userid会有值),
|
||
// 如token无值,取forceauth,为1时表示需要进行0-用户授权跳转。
|
||
function get_authorize() {
|
||
let href = window.location.href
|
||
let h_idx = window.location.href.indexOf('#')
|
||
let out_href = href.slice(0,h_idx)
|
||
|
||
window.location.href = `${domain_zs}/wxauth/official/account/authorize?redirectUrl=${out_href}&scope=${1}"`
|
||
}
|
||
|
||
|
||
// 2.获取微信公众号jssdk
|
||
// 请求方法:get请求
|
||
// 请求链接:/wxauth/official/account/jssdk/get
|
||
// 请求参数:
|
||
// url 请求链接
|
||
function get_jssdk(params) {
|
||
// Bus.debug && (params.openid = Bus.testOpenId)
|
||
return readyGet(domain_zs + "/wxauth/official/account/jssdk/get", params)
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
export {
|
||
get_authorize,
|
||
get_jssdk,
|
||
}
|