修改请求地址和上传管理的权限校验
parent
d30902d716
commit
0f5b59b1d0
|
|
@ -208,7 +208,7 @@ const get_import_list = (type?: string) => {
|
|||
...form.value,
|
||||
is_already_buy: form.value.status ? '1' : '0',
|
||||
};
|
||||
CommonAPI.getDynamicApi(common_store.common.diy_market_url, new_data)
|
||||
CommonAPI.getDynamicApi(common_store.common.config.diy_market_url, new_data)
|
||||
.then((res: any) => {
|
||||
const data = res.data;
|
||||
form.value.data_total = data.data_total;
|
||||
|
|
@ -265,7 +265,7 @@ interface install_data {
|
|||
}
|
||||
const install = async (item: install_data) => {
|
||||
let new_data = item;
|
||||
CommonAPI.getDynamicApi(common_store.common.diy_install_url ,item)
|
||||
CommonAPI.getDynamicApi(common_store.common.config.diy_install_url ,item)
|
||||
.then((res: any) => {
|
||||
switch (item.opt) {
|
||||
case 'url':
|
||||
|
|
@ -282,7 +282,9 @@ const install = async (item: install_data) => {
|
|||
break;
|
||||
case 'install':
|
||||
ElMessage.success(res.msg);
|
||||
history.pushState({}, '', '?s=diy/saveinfo/id/' + res.data + '.html');
|
||||
if (import.meta.env.VITE_APP_BASE_API == '/dev-admin') {
|
||||
history.pushState({}, '', '?s=diy/saveinfo/id/' + res.data + '.html');
|
||||
}
|
||||
Loading_text.value = '';
|
||||
loading.value = false;
|
||||
// 解除禁用效果
|
||||
|
|
@ -318,10 +320,12 @@ const confirm_event = () => {
|
|||
if (file_list.value && file_list.value[0].raw) {
|
||||
form_data.append('file', file_list.value[0]?.raw);
|
||||
}
|
||||
CommonAPI.getDynamicApi(common_store.common.diy_upload_url, form_data, true)
|
||||
CommonAPI.getDynamicApi(common_store.common.config.diy_upload_url, form_data, true)
|
||||
.then((res: any) => {
|
||||
ElMessage.success(res.msg);
|
||||
history.pushState({}, '', '?s=diy/saveinfo/id/' + res.data + '.html');
|
||||
if (import.meta.env.VITE_APP_BASE_API == '/dev-admin') {
|
||||
history.pushState({}, '', '?s=diy/saveinfo/id/' + res.data + '.html');
|
||||
}
|
||||
close_event();
|
||||
emit('confirm');
|
||||
})
|
||||
|
|
|
|||
|
|
@ -21,14 +21,14 @@
|
|||
<icon name="search" size="18"></icon>
|
||||
</template>
|
||||
</el-input>
|
||||
<icon name="add" size="18" class="c-pointer" @click="add_type"></icon>
|
||||
<icon v-if="attachment_category_operate.is_add == '1'" name="add" size="18" class="c-pointer" @click="add_type"></icon>
|
||||
</div>
|
||||
<el-scrollbar height="490px">
|
||||
<el-tree ref="treeRef" v-loading="tree_loading" :current-node-key="type_data[0].id" class="filter-tree" :data="type_data" node-key="id" highlight-current :props="defaultProps" empty-text="无数据" default-expand-all :filter-node-method="filter_node" @node-click="tree_node_event">
|
||||
<template #default="{ node, data }">
|
||||
<div class="custom-tree-node flex-row jc-sb gap-10 align-c w pr-10" :class="data.is_enable == 0 || node.parent.data.is_enable == 0 ? 'disabled bg-red' : ''">
|
||||
<div class="flex-1 flex-width text-line-1 block">{{ data.name }}</div>
|
||||
<div v-if="data.id" class="flex-row gap-10 cr-9 category-operate c-pointer">
|
||||
<div v-if="data.id && (attachment_category_operate.is_add == '1' || attachment_category_operate.is_edit == '1' || attachment_category_operate.is_del == '1')" class="flex-row gap-10 cr-9 category-operate c-pointer">
|
||||
<el-popover placement="bottom" width="70" trigger="hover">
|
||||
<template #reference>
|
||||
<div class="tree-operate-btn">
|
||||
|
|
@ -36,9 +36,9 @@
|
|||
</div>
|
||||
</template>
|
||||
<div class="flex-col gap-12 tree-operate">
|
||||
<div v-if="data.pid == 0" class="flex-row gap-5 c-pointer w item" @click.stop="append_type_event(data)"><icon class="icon" name="add" size="12"></icon>新增</div>
|
||||
<div class="flex-row gap-5 c-pointer w item" @click.stop="edit_type_event(data)"><icon class="icon" name="edit" size="12"></icon>编辑</div>
|
||||
<div class="flex-row gap-5 c-pointer w item" @click.stop="remove_type_event(node, data)"><icon class="icon" name="del" size="12"></icon>删除</div>
|
||||
<div v-if="data.pid == 0 && attachment_category_operate.is_add == '1'" class="flex-row gap-5 c-pointer w item" @click.stop="append_type_event(data)"><icon class="icon" name="add" size="12"></icon>新增</div>
|
||||
<div v-if="attachment_category_operate.is_edit == '1'" class="flex-row gap-5 c-pointer w item" @click.stop="edit_type_event(data)"><icon class="icon" name="edit" size="12"></icon>编辑</div>
|
||||
<div v-if="attachment_category_operate.is_del == '1'" class="flex-row gap-5 c-pointer w item" @click.stop="remove_type_event(node, data)"><icon class="icon" name="del" size="12"></icon>删除</div>
|
||||
</div>
|
||||
</el-popover>
|
||||
</div>
|
||||
|
|
@ -50,10 +50,10 @@
|
|||
<div class="right-content flex-1 flex-width">
|
||||
<div class="flex-row jc-sb align-c mb-15">
|
||||
<div class="right-operate flex-row">
|
||||
<el-button type="primary" plain @click="upload_model_open">上传{{ upload_type_name }}</el-button>
|
||||
<el-button @click="mult_del_event">删除{{ upload_type_name }}</el-button>
|
||||
<el-button v-if="attachment_operate.is_upload == '1'" type="primary" plain @click="upload_model_open">上传{{ upload_type_name }}</el-button>
|
||||
<el-button v-if="attachment_operate.is_del == '1'" @click="mult_del_event">删除{{ upload_type_name }}</el-button>
|
||||
<!-- <el-cascader :show-all-levels="false" clearable></el-cascader> -->
|
||||
<div class="right-classify ml-12">
|
||||
<div v-if="attachment_operate.is_move == '1'" class="right-classify ml-12">
|
||||
<transform-category :data="type_data_list" :check-img-ids="check_img_ids" :type="upload_type_name" :placeholder="upload_type_name + '移动至'" @call-back="transform_category_event"></transform-category>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -97,13 +97,13 @@
|
|||
</div>
|
||||
<div class="operate">
|
||||
<div class="operate-content flex-row jc-sa align-c">
|
||||
<div class="flex-1 tc c-pointer" @click.stop="edit_event(item, index)">
|
||||
<div v-if="attachment_operate.is_edit == '1'" class="flex-1 tc c-pointer" @click.stop="edit_event(item, index)">
|
||||
<icon name="edit" class="flex-1" size="14" color="f"></icon>
|
||||
</div>
|
||||
<div v-if="upload_type != 'file'" class="operate-icon flex-1 tc c-pointer" @click.stop="preview_event(item, index)">
|
||||
<icon name="eye" size="14" color="f"></icon>
|
||||
</div>
|
||||
<div class="flex-1 tc c-pointer" @click.stop="del_event(item)">
|
||||
<div v-if="attachment_operate.is_del == '1'" class="flex-1 tc c-pointer" @click.stop="del_event(item)">
|
||||
<icon name="del" size="14" color="f"></icon>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -295,6 +295,10 @@ const props = defineProps({
|
|||
});
|
||||
|
||||
const model_value_upload = defineModel({ type: Array as PropType<uploadList[]>, default: [] });
|
||||
// 分类权限控制
|
||||
const attachment_category_operate = computed(() => common_store.common.config.attachment_category_operate);
|
||||
// 附件管理权限
|
||||
const attachment_operate = computed(() => common_store.common.config.attachment_operate);
|
||||
|
||||
const view_list_value = ref<uploadList[]>([]);
|
||||
// 弹窗显示
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ const sync_sys_event = () => {
|
|||
config: clone_form,
|
||||
};
|
||||
app?.appContext.config.globalProperties.$common.message_box('将数据同步到系统底部菜单,确定继续吗?', 'warning').then(() => {
|
||||
CommonAPI.getDynamicApi(common_store.common.app_tabbar_save_url, new_data).then((res: any) => {
|
||||
CommonAPI.getDynamicApi(common_store.common.config.app_tabbar_save_url, new_data).then((res: any) => {
|
||||
ElMessage.success('同步成功');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,14 +8,6 @@ export const commonStore = defineStore('common', () => {
|
|||
const is_tabs_0_up = ref(false);
|
||||
const header_height = ref(0);
|
||||
const common = ref({
|
||||
app_tabbar_data_url: '' as string, //获取tabbar列表
|
||||
app_tabbar_save_url: '' as string, //保存tabbar
|
||||
diy_detail_url: '' as string, //获取diy详情
|
||||
diy_download_url: '' as string, //diy导出
|
||||
diy_install_url: '' as string, //diy导入 -- 安装
|
||||
diy_market_url: '' as string, //diy导入--获取列表
|
||||
diy_save_url: '' as string, //diy导入--保存
|
||||
diy_upload_url: '' as string, //diy导入
|
||||
article_category: [] as any[], //---- 文章分类
|
||||
blog_category: [] as any[], //---- 文章分类
|
||||
attachment_category: [] as any[], //---- 附件分类
|
||||
|
|
@ -44,6 +36,16 @@ export const commonStore = defineStore('common', () => {
|
|||
site_logo_wap: '',
|
||||
site_logo: '',
|
||||
site_name: '',
|
||||
app_tabbar_data_url: '' as string, //获取tabbar列表
|
||||
app_tabbar_save_url: '' as string, //保存tabbar
|
||||
diy_detail_url: '' as string, //获取diy详情
|
||||
diy_download_url: '' as string, //diy导出
|
||||
diy_install_url: '' as string, //diy导入 -- 安装
|
||||
diy_market_url: '' as string, //diy导入--获取列表
|
||||
diy_save_url: '' as string, //diy导入--保存
|
||||
diy_upload_url: '' as string, //diy导入
|
||||
attachment_category_operate: {} as any, // 附件分类权限
|
||||
attachment_operate: {} as any, // 附件权限
|
||||
} as any, // 基础数据配置参数
|
||||
preview_url: '',
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import axios, { InternalAxiosRequestConfig, AxiosResponse } from 'axios';
|
||||
import { ElMessage, ElMessageBox, type MessageHandler } from 'element-plus';
|
||||
import { get_cookie } from './index';
|
||||
import { get_type } from './common';
|
||||
import { get_id, get_type } from './common';
|
||||
|
||||
// 提示拦截
|
||||
|
||||
|
|
@ -51,6 +51,8 @@ service.interceptors.request.use(
|
|||
config.url = config.url + '&token=' + (JSON.parse(cookie) !== 'null' ? JSON.parse(cookie)?.token : '');
|
||||
}
|
||||
}
|
||||
// 添加diy_id和diy_type参数
|
||||
config.url = `${config.url}&diy_id=${ get_id() }&diy_type=${ get_type() }`;
|
||||
// 判断是否是包含不需要认证的接口
|
||||
const release_list = release_url.filter(item => config.url?.includes(item));
|
||||
if (release_list.length === 0) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import axios, { InternalAxiosRequestConfig, AxiosResponse } from 'axios';
|
||||
import { ElMessage, ElMessageBox, type MessageHandler } from 'element-plus';
|
||||
import { get_cookie } from './index';
|
||||
import { get_type } from './common';
|
||||
import { get_id, get_type } from './common';
|
||||
|
||||
// 提示拦截
|
||||
|
||||
|
|
@ -51,6 +51,8 @@ service.interceptors.request.use(
|
|||
config.url = config.url + '&token=' + (JSON.parse(cookie) !== 'null' ? JSON.parse(cookie)?.token : '');
|
||||
}
|
||||
}
|
||||
// 添加diy_id和diy_type参数
|
||||
config.url = `${config.url}&diy_id=${ get_id() }&diy_type=${ get_type() }`;
|
||||
// 判断是否是包含不需要认证的接口
|
||||
const release_list = release_url.filter(item => config.url?.includes(item));
|
||||
if (release_list.length === 0) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import axios, { InternalAxiosRequestConfig, AxiosResponse } from 'axios';
|
||||
import { ElMessage, ElMessageBox, type MessageHandler } from 'element-plus';
|
||||
import { get_cookie } from './index';
|
||||
import { get_type } from '@/utils/common';
|
||||
import { get_id, get_type } from '@/utils/common';
|
||||
// 提示拦截
|
||||
let messageInstance: MessageHandler;
|
||||
const message_error = (info: string) => {
|
||||
|
|
@ -46,6 +46,8 @@ service.interceptors.request.use(
|
|||
config.url = config.url + '&token=' + (JSON.parse(cookie) !== 'null' ? JSON.parse(cookie)?.token : '');
|
||||
}
|
||||
}
|
||||
// 添加diy_id和diy_type参数
|
||||
config.url = `${config.url}&diy_id=${ get_id() }&diy_type=${ get_type() }`;
|
||||
// 判断是否是包含不需要认证的接口
|
||||
const release_list = release_url.filter(item => config.url?.includes(item));
|
||||
if (release_list.length === 0) {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { is_obj, set_cookie, get_cookie } from '@/utils';
|
||||
import { is_obj, set_cookie, get_cookie, get_math } from '@/utils';
|
||||
import { Settings, AppMain } from './components/index';
|
||||
import defaultSettings from './components/main/index';
|
||||
import defaultConfigSetting from '@/config/setting';
|
||||
|
|
@ -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 } from '@/utils/common';
|
||||
import { get_id, get_type } from '@/utils/common';
|
||||
const common_store = commonStore();
|
||||
interface diy_data_item {
|
||||
id: string;
|
||||
|
|
@ -134,11 +134,12 @@ const clear_data_event = () => {
|
|||
onMounted(() => {
|
||||
common_init();
|
||||
});
|
||||
|
||||
const is_empty = ref(false);
|
||||
const empty_data = ref('编辑数据有误');
|
||||
const init = () => {
|
||||
if (get_id()) {
|
||||
CommonAPI.getDynamicApi(common_store.common.diy_detail_url, { id: get_id() }).then((res: any) => {
|
||||
CommonAPI.getDynamicApi(common_store.common.config.diy_detail_url, { id: get_id() }).then((res: any) => {
|
||||
const new_data = res.data?.data || undefined;
|
||||
if (new_data) {
|
||||
let data = form_data_transfor_diy_data(new_data);
|
||||
|
|
@ -168,10 +169,16 @@ const init = () => {
|
|||
loading_event();
|
||||
});
|
||||
} else {
|
||||
temp_form.value.header.com_data = defaultSettings.header_nav;
|
||||
temp_form.value.footer.com_data = defaultSettings.footer_nav;
|
||||
form.value = cloneDeep(temp_form.value);
|
||||
loading_event();
|
||||
if (import.meta.env.VITE_APP_BASE_API == '/dev-admin') {
|
||||
temp_form.value.header.com_data = defaultSettings.header_nav;
|
||||
temp_form.value.footer.com_data = defaultSettings.footer_nav;
|
||||
form.value = cloneDeep(temp_form.value);
|
||||
loading_event();
|
||||
} else {
|
||||
is_empty.value = true;
|
||||
empty_data.value = '没有数据ID';
|
||||
loading_event();
|
||||
}
|
||||
}
|
||||
};
|
||||
// 数据合并
|
||||
|
|
@ -216,7 +223,8 @@ const default_merge = (data: any, key: string) => {
|
|||
};
|
||||
|
||||
// 初始化公共数据
|
||||
const common_init = () => {
|
||||
const token = ref('');
|
||||
const common_init = async () => {
|
||||
if (get_cookie('attachment_host') || get_cookie('attachment_host') !== 'null' || get_cookie('attachment_host') !== null) {
|
||||
CommonAPI.getInit().then((res: any) => {
|
||||
common_store.set_common(res.data);
|
||||
|
|
@ -224,8 +232,7 @@ const common_init = () => {
|
|||
init();
|
||||
});
|
||||
} else {
|
||||
// 将localStorage中的数据读取出
|
||||
// 判断localStorage中是否有数据
|
||||
// 将localStorage中的数据读取出,判断localStorage中是否有数据
|
||||
if (localStorage.getItem('diy_init_common')) {
|
||||
const data = JSON.parse(localStorage.getItem('diy_init_common') || '');
|
||||
common_store.set_common(data);
|
||||
|
|
@ -234,6 +241,17 @@ const common_init = () => {
|
|||
init();
|
||||
}
|
||||
}
|
||||
// 获取用户id
|
||||
if (import.meta.env.VITE_APP_BASE_API == '/dev-admin') {
|
||||
let temp_data = await import(import.meta.env.VITE_APP_BASE_API == '/dev-admin' ? '../../../temp.d.ts' : '../../../temp_pro.d.ts');
|
||||
token.value = '&token=' + temp_data.default.temp_token;
|
||||
} else {
|
||||
// 如果是shop认为是多商户插件使用user_info的cookie
|
||||
const cookie = get_type() == 'shop' ? get_cookie('user_info') : get_cookie('admin_info');
|
||||
if (cookie && cookie !== null && cookie !== 'null') {
|
||||
token.value = '&token=' + JSON.parse(cookie).token;
|
||||
}
|
||||
}
|
||||
};
|
||||
// 加载动画
|
||||
const loading = ref(true);
|
||||
|
|
@ -458,7 +476,7 @@ const save_formmat_form_data = (data: diy_data_item, close: boolean = false, is_
|
|||
});
|
||||
// 数据改造
|
||||
const new_data = diy_data_transfor_form_data(clone_form);
|
||||
CommonAPI.getDynamicApi(common_store.common.diy_save_url, new_data)
|
||||
CommonAPI.getDynamicApi(common_store.common.config.diy_save_url, new_data)
|
||||
.then((res) => {
|
||||
setTimeout(() => {
|
||||
save_disabled.value = false;
|
||||
|
|
@ -480,17 +498,31 @@ const save_formmat_form_data = (data: diy_data_item, close: boolean = false, is_
|
|||
} else {
|
||||
// 判断是否需要导出
|
||||
if (is_export) {
|
||||
const index = window.location.href.lastIndexOf('?s=');
|
||||
const pro_url = window.location.href.substring(0, index);
|
||||
const new_url = import.meta.env.VITE_APP_BASE_API == '/dev-admin' ? import.meta.env.VITE_APP_BASE_API_URL : pro_url;
|
||||
window.open(new_url + '?s=diyapi/diydownload/id/' + res.data + '.html', '_blank');
|
||||
const download = common_store.common.config.diy_download_url;
|
||||
if (download == '') {
|
||||
ElMessage.error('请先配置导出地址');
|
||||
return;
|
||||
} else {
|
||||
let uuid_val = '';
|
||||
if (get_cookie('uuid_name')) {
|
||||
uuid_val = get_cookie('uuid_name');
|
||||
} else {
|
||||
uuid_val = get_math();
|
||||
set_cookie('uuid_name', uuid_val);
|
||||
}
|
||||
const symbol = download?.includes('?') ? '&' : '?';
|
||||
window.open(`${download}${ symbol }id=${ res.data }&token=${ token.value }&uuid=${uuid_val}`);
|
||||
}
|
||||
}
|
||||
if (is_preview) {
|
||||
preview_dialog.value = true;
|
||||
diy_id.value = String(res.data);
|
||||
}
|
||||
form.value.id = String(res.data);
|
||||
history.pushState({}, '', '?s=diy/saveinfo/id/' + res.data + '.html');
|
||||
// 本地的时候会补id参数
|
||||
if (import.meta.env.VITE_APP_BASE_API == '/dev-admin') {
|
||||
history.pushState({}, '', '?s=diy/saveinfo/id/' + res.data + '.html');
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ onMounted(() => {
|
|||
});
|
||||
const is_empty = ref(false);
|
||||
const init = () => {
|
||||
CommonAPI.getDynamicApi(common_store.common.app_tabbar_data_url, { type: get_type() })
|
||||
CommonAPI.getDynamicApi(common_store.common.config.app_tabbar_data_url, { type: get_type() })
|
||||
.then((res: any) => {
|
||||
if (res.data) {
|
||||
let data = res.data;
|
||||
|
|
@ -82,7 +82,7 @@ const save_event = () => {
|
|||
};
|
||||
save_disabled.value = true;
|
||||
// 数据改造
|
||||
CommonAPI.getDynamicApi(common_store.common.app_tabbar_save_url, new_data).then((res: any) => {
|
||||
CommonAPI.getDynamicApi(common_store.common.config.app_tabbar_save_url, new_data).then((res: any) => {
|
||||
// 如果是导出或预览模式,则不显示保存成功的消息
|
||||
ElMessage.success('保存成功');
|
||||
setTimeout(() => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue