修改diy显示逻辑
parent
f02eb13bf5
commit
94d5e96bbb
|
|
@ -7,7 +7,8 @@ class CommonAPI {
|
||||||
/** 链接初始化接口 */
|
/** 链接初始化接口 */
|
||||||
static getInit() {
|
static getInit() {
|
||||||
const new_type = get_type();
|
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({
|
return request({
|
||||||
url: `diyapi/init`,
|
url: `diyapi/init`,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ export const get_id = () => {
|
||||||
return new_id;
|
return new_id;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
// 获取当前业务类型
|
||||||
export const get_type = () => {
|
export const get_type = () => {
|
||||||
let new_type = '';
|
let new_type = '';
|
||||||
// 去除origin的数据
|
// 去除origin的数据
|
||||||
|
|
@ -57,4 +57,21 @@ export const get_type = () => {
|
||||||
} else {
|
} else {
|
||||||
return new_type;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -28,7 +28,7 @@ import { diyData, headerAndFooter, diyConfig } from '@/api/diy';
|
||||||
import CommonAPI from '@/api/common';
|
import CommonAPI from '@/api/common';
|
||||||
import { commonStore } from '@/store';
|
import { commonStore } from '@/store';
|
||||||
import { magic_config } from '@/config/const/tabs-magic';
|
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();
|
const common_store = commonStore();
|
||||||
interface diy_data_item {
|
interface diy_data_item {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
@ -644,6 +644,7 @@ const diy_data_transfor_form_data = (clone_form: diy_data_item) => {
|
||||||
name: clone_form.model.name,
|
name: clone_form.model.name,
|
||||||
is_enable: clone_form.model.is_enable,
|
is_enable: clone_form.model.is_enable,
|
||||||
describe: clone_form.model.describe,
|
describe: clone_form.model.describe,
|
||||||
|
business: get_business(),
|
||||||
config: JSON.stringify({
|
config: JSON.stringify({
|
||||||
header: clone_form.header,
|
header: clone_form.header,
|
||||||
footer: clone_form.footer,
|
footer: clone_form.footer,
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import defaultSettings from './components/main/index';
|
||||||
import { cloneDeep } from 'lodash';
|
import { cloneDeep } from 'lodash';
|
||||||
import CommonAPI from '@/api/common';
|
import CommonAPI from '@/api/common';
|
||||||
import { commonStore } from '@/store';
|
import { commonStore } from '@/store';
|
||||||
|
import { get_business } from '@/utils/common';
|
||||||
const common_store = commonStore();
|
const common_store = commonStore();
|
||||||
const temp_form = ref(defaultSettings.footer_nav);
|
const temp_form = ref(defaultSettings.footer_nav);
|
||||||
const form = ref<any>({});
|
const form = ref<any>({});
|
||||||
|
|
@ -79,6 +80,7 @@ const save_event = () => {
|
||||||
const new_data = {
|
const new_data = {
|
||||||
type: get_type(),
|
type: get_type(),
|
||||||
config: clone_form,
|
config: clone_form,
|
||||||
|
business: get_business(),
|
||||||
};
|
};
|
||||||
save_disabled.value = true;
|
save_disabled.value = true;
|
||||||
// 数据改造
|
// 数据改造
|
||||||
|
|
@ -93,6 +95,7 @@ const save_event = () => {
|
||||||
save_disabled.value = false;
|
save_disabled.value = false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const get_type = () => {
|
const get_type = () => {
|
||||||
let new_type = 'home';
|
let new_type = 'home';
|
||||||
if (document.location.search.indexOf('/type/') != -1) {
|
if (document.location.search.indexOf('/type/') != -1) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue