修改diy显示逻辑

v1.4.1
于肖磊 2025-10-09 15:58:28 +08:00
parent f02eb13bf5
commit 94d5e96bbb
4 changed files with 25 additions and 3 deletions

View File

@ -7,7 +7,8 @@ class CommonAPI {
/** 链接初始化接口 */
static getInit() {
const new_type = get_type();
if (isEmpty(new_type)) {
const location_host = document.location.host;
if (isEmpty(new_type) || location_host.indexOf('#/tabbar') !== -1) {
return request({
url: `diyapi/init`,
method: 'post',

View File

@ -41,7 +41,7 @@ export const get_id = () => {
return new_id;
}
};
// 获取当前业务类型
export const get_type = () => {
let new_type = '';
// 去除origin的数据
@ -57,4 +57,21 @@ export const get_type = () => {
} else {
return new_type;
}
}
// 获取类型
export const get_business = () => {
let new_business = '';
// 去除origin的数据
const url = document.location.href;
if (url.indexOf('business') != -1) {
new_business = url.substring(url.indexOf('business/') + 9);
// 去除字符串的.html
const dot_data = new_business.split('.')[0];
if (dot_data != '') {
new_business = dot_data.split('/')[0];
}
return new_business;
} else {
return new_business;
}
}

View File

@ -28,7 +28,7 @@ import { diyData, headerAndFooter, diyConfig } from '@/api/diy';
import CommonAPI from '@/api/common';
import { commonStore } from '@/store';
import { magic_config } from '@/config/const/tabs-magic';
import { get_id, get_type } from '@/utils/common';
import { get_business, get_id, get_type } from '@/utils/common';
const common_store = commonStore();
interface diy_data_item {
id: string;
@ -644,6 +644,7 @@ const diy_data_transfor_form_data = (clone_form: diy_data_item) => {
name: clone_form.model.name,
is_enable: clone_form.model.is_enable,
describe: clone_form.model.describe,
business: get_business(),
config: JSON.stringify({
header: clone_form.header,
footer: clone_form.footer,

View File

@ -24,6 +24,7 @@ import defaultSettings from './components/main/index';
import { cloneDeep } from 'lodash';
import CommonAPI from '@/api/common';
import { commonStore } from '@/store';
import { get_business } from '@/utils/common';
const common_store = commonStore();
const temp_form = ref(defaultSettings.footer_nav);
const form = ref<any>({});
@ -79,6 +80,7 @@ const save_event = () => {
const new_data = {
type: get_type(),
config: clone_form,
business: get_business(),
};
save_disabled.value = true;
//
@ -93,6 +95,7 @@ const save_event = () => {
save_disabled.value = false;
});
};
const get_type = () => {
let new_type = 'home';
if (document.location.search.indexOf('/type/') != -1) {