Commit 21f65129 authored by 杜国峰's avatar 杜国峰
Browse files

feat:域名替换

No related merge requests found
Showing with 26 additions and 14 deletions
+26 -14
......@@ -39,13 +39,14 @@ const confirm = (data) => {
```
### prop
| 参数 | 说明 | 类型 | 默认值 |
|------|------|------|------|
| visible | 显隐 | Boolean | false |
| defaults | 默认选中的成员的 user_uuid | Array | [] |
| disabledIds | 不可操作选中状态的成员 user_uuid | Array | [] |
| multiple | 多选 | Boolean | true |
| isRequired | 是否必选 | Boolean | false |
| 参数 | 说明 | 类型 | 默认值 |
|-------------|----------------------|---------|------|
| visible | 显隐 | Boolean | false |
| defaults | 默认选中的成员的 user_uuid | Array | [] |
| disabledIds | 不可操作选中状态的成员 user_uuid | Array | [] |
| multiple | 多选 | Boolean | true |
| isRequired | 是否必选 | Boolean | false |
| baseUrl | 接口baseUrl,不传会按照现有域名去取,如果后续域名变化,需要调用者自行传入接口地址 | String | |
### 事件
| 事件 | 说明 | 参数 |
......
{
"name": "select-dpt-user-dialog-hy",
"version": "0.0.8",
"version": "0.0.9",
"main": "src/selectDptUserDialogHy/SelectDptUserDialogHy.vue",
"scripts": {
"dev": "vite",
"dev": "vite dev --host",
"build": "vite build",
"preview": "vite preview"
},
......
......@@ -213,6 +213,7 @@ import {
api_personalDepList
} from '../utils/api'
import { debounce, findByKeyRecursively, mapObj } from '../utils/tools'
import { setBaseUrl } from '../utils/request'
// 所有部门id有两个,一个是 department_id, 一个是origin_department_id
// 分组和部门数据库中是两个不同的表,后端返的department_id可能会重复,拿到数据统一将department_id重写成 department_id + suffix形式作为部门key
......@@ -247,10 +248,11 @@ const props = defineProps({
isRequired: {
type: Boolean,
default: false
}
},
baseUrl: String
})
const emit = defineEmits(['update:visible', 'cancel', 'confirm'])
setBaseUrl(props.baseUrl)
const dptMembersMap = ref({ [TOP_DPT_ID]: [] }) // 部门id为key, 该部门成员list为value
const dptMembersCountMap = computed(() => {
return mapObj(dptMembersMap.value, (_, members) => {
......
......@@ -32,8 +32,14 @@ export function cancelRequest(cb) {
})
}
let baseUrl
export function setBaseUrl(base_url) {
if (base_url) {
baseUrl = base_url
}
}
function getBaseUrl() {
if (baseUrl) return baseUrl
const APP_BRANCH_NAME = getQueryObj().env || Cookies.get('APP_BRANCH_NAME')
if (
location.hostname === 'localhost' ||
......@@ -43,10 +49,10 @@ function getBaseUrl() {
) { // 本地开发或测试环境
return `https://qtabletestapi.qimingpian.cn${location.pathname.match(/(\/(v\d+|hotfix))?/)[0] || ''}`
} else if (
location.hostname.indexOf('qmpwork') !== -1 ||
location.hostname.indexOf('qmpone') !== -1 ||
APP_BRANCH_NAME === 'public'
) { // 公有云
return 'https://api.qmpwork.com'
return 'https://api.qmpone.com'
} else if (
location.hostname.indexOf('qmpoa') !== -1 ||
APP_BRANCH_NAME === 'private'
......@@ -73,6 +79,9 @@ export function getWholeApiUrl(apiUrl) {
}
service.interceptors.request.use(config => {
if (baseUrl) {
config.baseURL = baseUrl
}
config.url = getWholeApiUrl(config.url)
config.data = config.data || {}
removePending(config, true)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment