修改页面显示逻辑
parent
94d5e96bbb
commit
1de488b3b7
|
|
@ -43,35 +43,30 @@ export const get_id = () => {
|
|||
};
|
||||
// 获取当前业务类型
|
||||
export const get_type = () => {
|
||||
let new_type = '';
|
||||
// 去除origin的数据
|
||||
const url = document.location.href;
|
||||
if (url.indexOf('type/') != -1) {
|
||||
new_type = url.substring(url.indexOf('type/') + 5);
|
||||
// 去除字符串的.html
|
||||
const dot_data = new_type.split('.')[0];
|
||||
if (dot_data != '') {
|
||||
new_type = dot_data.split('/')[0];
|
||||
}
|
||||
return new_type;
|
||||
} else {
|
||||
return new_type;
|
||||
}
|
||||
return data_handle('type/', '');
|
||||
}
|
||||
// 获取类型
|
||||
export const get_business = () => {
|
||||
let new_business = '';
|
||||
return data_handle('business/', '');
|
||||
}
|
||||
// 数据处理
|
||||
export const data_handle = (val: string, default_val: string): string => {
|
||||
let new_data = default_val;
|
||||
// 去除origin的数据
|
||||
const url = document.location.href;
|
||||
if (url.indexOf('business') != -1) {
|
||||
new_business = url.substring(url.indexOf('business/') + 9);
|
||||
if (url.indexOf(val) != -1) {
|
||||
new_data = url.substring(url.indexOf(val) + val.length);
|
||||
// 去除字符串的.html
|
||||
const dot_data = new_business.split('.')[0];
|
||||
if (dot_data != '') {
|
||||
new_business = dot_data.split('/')[0];
|
||||
// 去除并且数据
|
||||
if (new_data.indexOf('&') != -1) {
|
||||
new_data = new_data.split('&')[0];
|
||||
}
|
||||
return new_business;
|
||||
const dot_data = new_data.split('.')[0];
|
||||
if (dot_data != '') {
|
||||
new_data = dot_data.split('/')[0];
|
||||
}
|
||||
return new_data;
|
||||
} else {
|
||||
return new_business;
|
||||
return new_data;
|
||||
}
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ onMounted(() => {
|
|||
});
|
||||
const is_empty = ref(false);
|
||||
const init = () => {
|
||||
CommonAPI.getDynamicApi(common_store.common.config.app_tabbar_data_url, { type: get_type() })
|
||||
CommonAPI.getDynamicApi(common_store.common.config.app_tabbar_data_url, { business: get_business() })
|
||||
.then((res: any) => {
|
||||
if (res.data) {
|
||||
let data = res.data;
|
||||
|
|
@ -78,7 +78,6 @@ const save_disabled = ref(false);
|
|||
const save_event = () => {
|
||||
const clone_form = cloneDeep(form.value);
|
||||
const new_data = {
|
||||
type: get_type(),
|
||||
config: clone_form,
|
||||
business: get_business(),
|
||||
};
|
||||
|
|
@ -96,18 +95,6 @@ const save_event = () => {
|
|||
});
|
||||
};
|
||||
|
||||
const get_type = () => {
|
||||
let new_type = 'home';
|
||||
if (document.location.search.indexOf('/type/') != -1) {
|
||||
new_type = document.location.search.substring(document.location.search.indexOf('/type/') + 6);
|
||||
// 进行3次切割选择参数内容
|
||||
const result1 = splitAndGetFirst(new_type, '/');
|
||||
const result2 = splitAndGetFirst(result1, '&');
|
||||
return splitAndGetFirst(result2, '#');
|
||||
} else {
|
||||
return new_type;
|
||||
}
|
||||
};
|
||||
function splitAndGetFirst(str: string, separator: string): string {
|
||||
const data = str.split(separator);
|
||||
if (data.length > 1) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue