提交 503379c3 作者: 毛细亚

同步代码

上级 b194b541
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>cebianlan</title><script defer="defer" src="static/js/app.46f55481.js"></script><link href="static/css/app.3ca40e10.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but cebianlan doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
\ No newline at end of file
"use strict";(self["webpackChunkcebianlan"]=self["webpackChunkcebianlan"]||[]).push([[155],{155:function(n,t,u){u.r(t),u.d(t,{default:function(){return r}});var a=function(){var n=this;n._self._c;return n._m(0)},e=[function(){var n=this,t=n._self._c;return t("div",{staticClass:"about"},[t("h1",[n._v("about")])])}],l=u(477),s={},c=(0,l.A)(s,a,e,!1,null,null,null),r=c.exports}}]);
//# sourceMappingURL=155.934a6805.js.map
\ No newline at end of file
{"version":3,"file":"static/js/155.934a6805.js","mappings":"6JAAA,IAAIA,EAAS,WAAkB,IAAIC,EAAIC,KAAQD,EAAIE,MAAMC,GAAG,OAAOH,EAAII,GAAG,EAC1E,EACIC,EAAkB,CAAC,WAAY,IAAIL,EAAIC,KAAKE,EAAGH,EAAIE,MAAMC,GAAG,OAAOA,EAAG,MAAM,CAACG,YAAY,SAAS,CAACH,EAAG,KAAK,CAACH,EAAIO,GAAG,YACvH,G,SCFIC,EAAS,CAAC,EAKVC,GAAY,OACdD,EACAT,EACAM,GACA,EACA,KACA,KACA,MAIF,EAAeI,EAAiB,O","sources":["webpack://cebianlan/./src/views/AboutView.vue","webpack://cebianlan/./src/views/AboutView.vue?d8cd"],"sourcesContent":["var render = function render(){var _vm=this,_c=_vm._self._c;return _vm._m(0)\n}\nvar staticRenderFns = [function (){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:\"about\"},[_c('h1',[_vm._v(\"about\")])])\n}]\n\nexport { render, staticRenderFns }","import { render, staticRenderFns } from \"./AboutView.vue?vue&type=template&id=70bd5d4c\"\nvar script = {}\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/.pnpm/vue-loader@15.11.1_@vue+compiler-sfc@3.5.14_css-loader@6.11.0_webpack@5.99.8__lodash@4._898f46ed7f437ee9a834018c670400fe/node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports"],"names":["render","_vm","this","_self","_c","_m","staticRenderFns","staticClass","_v","script","component"],"sourceRoot":""}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -3,7 +3,7 @@ import request from '@/utils/request'
export function getAuthUser(data) {
return request({
url: '/api/agent/getAuthUser',
url: '/api/sidebar_login/workWeiXin',
method: 'post',
data
})
......
......@@ -9,13 +9,15 @@ function Authorize() {
let redirectUrl = originUrl.split('?')[0];
let returnUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wweaefe716636df3d1&redirect_uri=${encodeURIComponent(redirectUrl)}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
window.location.href = returnUrl;
}
// 通过oAuth2授权获取当前用户userId
function getWxUserInfo(to, from, next, authCode,corp_id) {
function getWxUserInfo(to, from, next, authCode) {
console.log('进入getWxUserInfo',authCode)
getAuthUser({code:authCode,corp_id:'wweaefe716636df3d1'}).then((res) => {
let { code, data, message } = res || {};
if (code === 200) {
let { userId } = data || {};
console.log(res,'res')
if (res.status_code === 1) {
let { userId } = res.data || {};
if (userId) {
localStorage.setItem('userId', userId);
next();
......@@ -23,7 +25,6 @@ function getWxUserInfo(to, from, next, authCode,corp_id) {
Authorize(to)
}
} else {
console.log(message);
// PC端侧边栏tab页面切换后再切回来, 页面地址还是上次重定向后的带code的,此时code已经消费过一次,再调接口获取用户信息会失败, 所以加上重新授权的逻辑
Authorize(to)
}
......@@ -53,10 +54,12 @@ router.beforeEach((to, from, next) => {
// 判断是否是微信浏览器打开
let ua = navigator.userAgent.toLowerCase();
let isWeixin = ua.indexOf('micromessenger') != -1;
console.log('isWeixin',isWeixin)
if (!isWeixin) {
next()
return
}
console.log('进入router.beforeEach',to.query)
// 企微环境获取当前用户userId和外部客户externalUserId
let code = to.query.code || '';
let corp_id = to.query.corp_id || '';
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论