Commit fe18956b by xinla

优化配置

1 parent cd99e1f4
const envs = { const envs = {
development: { development: {
BASE_URL: '/devMobile/saas/', // 路由基础路径 BASE_URL: '/', // 路由基础路径
BASE_API: 'http://demo.linkwechat.net/saas-dev-api', BASE_API: 'http://demo.linkwechat.net/saas-dev-api',
APPID: 'ww622fc852f79c3f13' APPID: 'ww622fc852f79c3f13', // 企业corpid (仟微科技)
AGENTID: '1000080', // 自建应用agentId (LinkWeChat)
}, },
test: { test: {
BASE_URL: '/mobile/', // 路由基础路径 BASE_URL: '/mobile/', // 路由基础路径
BASE_API: 'http://demo.linkwechat.net/linkwechat-api', BASE_API: 'http://demo.linkwechat.net/linkwechat-api',
APPID: 'ww622fc852f79c3f13' APPID: 'ww622fc852f79c3f13',
AGENTID: '1000080',
}, },
production: { production: {
BASE_URL: '/mobile/', // 路由基础路径 BASE_URL: '/mobile/', // 路由基础路径
BASE_API: 'http://demo.linkwechat.net/linkwechat-api', BASE_API: 'http://demo.linkwechat.net/linkwechat-api',
APPID: 'ww622fc852f79c3f13' APPID: 'ww622fc852f79c3f13',
AGENTID: '1000080',
}, },
} }
let env = envs[process.env.VUE_APP_ENV] let env = envs[process.env.VUE_APP_ENV]
......
...@@ -37,9 +37,12 @@ export default new Vuex.Store({ ...@@ -37,9 +37,12 @@ export default new Vuex.Store({
let query = param2Obj() //是否存在code let query = param2Obj() //是否存在code
// let code = query.code // let code = query.code
let appid = window.lwConfig.APPID || query.corpId let appid = window.lwConfig.APPID || query.corpId
let agentid = window.lwConfig.AGENTID || query.agentid
let local = window.location.origin.includes('localhost') let local = window.location.origin.includes('localhost')
? 'http://h5.linkwechat.cn/test.html':'http://demo.linkwechat.cn/mobile/#/index' ? 'http://h5.linkwechat.cn/test.html'
// : window.location.href : window.location.href
// : 'http://demo.linkwechat.cn/mobile/#/index'
// 第三方授权重定向回来手动刷新页面 // 第三方授权重定向回来手动刷新页面
if (code && window.lwConfig.APPID && count === 1) { if (code && window.lwConfig.APPID && count === 1) {
...@@ -51,8 +54,8 @@ export default new Vuex.Store({ ...@@ -51,8 +54,8 @@ export default new Vuex.Store({
count++ count++
//不存在就打开上面的地址进行授权 //不存在就打开上面的地址进行授权
let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent( let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent(
local local,
)}&response_type=code&scope=snsapi_privateinfo&state=linkwechat&agentid=1000002#wechat_redirect` )}&response_type=code&scope=snsapi_privateinfo&state=linkwechat&agentid=${agentid}#wechat_redirect`
// 注意:第三方授权重定向回来携带的code是直接拼接在url后面的,企微没有做查询字符串hash检测,eg:url***code=**** // 注意:第三方授权重定向回来携带的code是直接拼接在url后面的,企微没有做查询字符串hash检测,eg:url***code=****
// 由于上述原因router hash模式下,使用第三方授权重定向回来的时候不会刷新页面,解析code是需要注意 // 由于上述原因router hash模式下,使用第三方授权重定向回来的时候不会刷新页面,解析code是需要注意
// 使用其他授权模式无上述问题 // 使用其他授权模式无上述问题
...@@ -82,11 +85,12 @@ export default new Vuex.Store({ ...@@ -82,11 +85,12 @@ export default new Vuex.Store({
let corpInfo = dataUser.corpInfo let corpInfo = dataUser.corpInfo
dataUser.user.weUserId && sessionStorage.setItem('userId', dataUser.user.weUserId) // 当前 登录/使用 企业员工真实姓名大驼峰 eg:QinShiHuang dataUser.user.weUserId && sessionStorage.setItem('userId', dataUser.user.weUserId) // 当前 登录/使用 企业员工真实姓名大驼峰 eg:QinShiHuang
commit('userId', sessionStorage.userId) commit('userId', sessionStorage.userId)
corpInfo.appId && sessionStorage.setItem('appId', corpInfo.appId) // 租户微信公众号appid corpInfo.appId && sessionStorage.setItem('appId', corpInfo.appId) // 微信公众号appid
corpInfo.tenantId && sessionStorage.setItem('tenantId', corpInfo.tenantId) // 租户id
// corpInfo.tenantId && sessionStorage.setItem('tenantId', corpInfo.tenantId) // 租户id
//corpInfo.secret && sessionStorage.userId = store.userId = dataUser.user.weUserId //corpInfo.secret && sessionStorage.userId = store.userId = dataUser.user.weUserId
corpInfo.corpId && sessionStorage.setItem('corpId', corpInfo.corpId) // 服务商企业id sessionStorage.setItem('corpId', appid) // 企业id
corpInfo.agentId && sessionStorage.setItem('agentId', corpInfo.agentId) // 代开发应用agentId sessionStorage.setItem('agentId', agentid) // 自建应用agentId
// urlReplaceFirstHistory(window.location.href) // urlReplaceFirstHistory(window.location.href)
dataUser.user.companyName && dataUser.user.companyName &&
sessionStorage.setItem('companyName', dataUser.user.companyName) // 公司名称 sessionStorage.setItem('companyName', dataUser.user.companyName) // 公司名称
......
...@@ -24,7 +24,7 @@ const common = { ...@@ -24,7 +24,7 @@ const common = {
// 以下仅用于系统信息展示,不作为项目变量使用,请勿在代码中使用 // 以下仅用于系统信息展示,不作为项目变量使用,请勿在代码中使用
const project = { const project = {
_version: '1.0.1', // 当前版本信息 _version: '3.x', // 当前版本信息
_packageTime: process.env.VUE_APP_PACKETTIME, // 打包时间 _packageTime: process.env.VUE_APP_PACKETTIME, // 打包时间
_env: process.env.VUE_APP_ENV, // 前端系统环境模式 _env: process.env.VUE_APP_ENV, // 前端系统环境模式
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!