授权页支持通过 domain 参数切换请求域名
This commit is contained in:
parent
1bdc9ecf2f
commit
d5bff9fa3f
|
|
@ -50,6 +50,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getEnvironment } from '@/utils/env.js';
|
import { getEnvironment } from '@/utils/env.js';
|
||||||
|
import domainMap from '@/utils/domain.js';
|
||||||
import http from '@/request/request.js';
|
import http from '@/request/request.js';
|
||||||
import pagesConfig from '@/pages.json';
|
import pagesConfig from '@/pages.json';
|
||||||
import wx from 'weixin-js-sdk';
|
import wx from 'weixin-js-sdk';
|
||||||
|
|
@ -80,6 +81,7 @@ export default {
|
||||||
this.code = params.code || '';
|
this.code = params.code || '';
|
||||||
this.queryState = params.state || '';
|
this.queryState = params.state || '';
|
||||||
this.exuid = params.exuid || '';
|
this.exuid = params.exuid || '';
|
||||||
|
this.domain = params.domain || '';
|
||||||
if(this.queryState) this.$store.dispatch('setCurrentUid', (params.state || '').replace(/^uid/, '') || '');
|
if(this.queryState) this.$store.dispatch('setCurrentUid', (params.state || '').replace(/^uid/, '') || '');
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -93,15 +95,9 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getBaseUrl() {
|
getBaseUrl() {
|
||||||
// return 'https://point.agrimedia.cn';
|
// 进入项目时若携带 domain 字段且能在 utils/domain.js 中对应上,
|
||||||
return window.location.origin;
|
// 则使用对应的属性值作为请求前置域名,否则默认使用 HOST
|
||||||
// // #ifdef H5
|
return domainMap[this.domain] || domainMap.HOST;
|
||||||
// return window.location.origin;
|
|
||||||
// // #endif
|
|
||||||
// // #ifndef H5
|
|
||||||
// // 非 H5 平台(小程序/App)需配置为已备案的 H5 域名
|
|
||||||
return 'https://tpoint.agrimedia.cn';
|
|
||||||
// // #endif
|
|
||||||
},
|
},
|
||||||
|
|
||||||
handleAuth() {
|
handleAuth() {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
export default {
|
||||||
|
// 默认请当前访问地址域名
|
||||||
|
HOST: `${window.location.protocol}//${window.location.host}`,
|
||||||
|
// 线上环境域名
|
||||||
|
POINT: 'https://point.agrimedia.cn',
|
||||||
|
// 测试环境域名
|
||||||
|
T_POINT: 'https://tpoint.agrimedia.cn',
|
||||||
|
// 线上环境域名
|
||||||
|
APIPOINT: 'https://aipoint.zdyyai.com',
|
||||||
|
// 测试环境域名
|
||||||
|
T_APIPOINT: 'https://taipoint.agrimedia.cn',
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue