修改页面权限控制
parent
1fcec31046
commit
30bd427d70
|
|
@ -22,6 +22,9 @@ export const commonStore = defineStore('common', () => {
|
||||||
goods_order_by_type_list: [] as any[], //---- 商品排序
|
goods_order_by_type_list: [] as any[], //---- 商品排序
|
||||||
data_order_by_rule_list: [] as any[], //---- 数据排序
|
data_order_by_rule_list: [] as any[], //---- 数据排序
|
||||||
brand_order_by_type_list: [] as any[], //---- 品牌排序
|
brand_order_by_type_list: [] as any[], //---- 品牌排序
|
||||||
|
diy_config_operate: {
|
||||||
|
is_base_data: 1, //---- 是否需要基础数据
|
||||||
|
} as any, //---- diy配置权限
|
||||||
config: {
|
config: {
|
||||||
common_amap_map_ak: '',
|
common_amap_map_ak: '',
|
||||||
common_amap_map_safety_ak: '',
|
common_amap_map_safety_ak: '',
|
||||||
|
|
|
||||||
|
|
@ -15,32 +15,63 @@ export const font_weight = [
|
||||||
{ name: '正常', value: '400' },
|
{ name: '正常', value: '400' },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从URL中提取指定前缀后的ID值
|
||||||
|
* @param prefix 前缀字符串
|
||||||
|
* @returns 提取的ID值
|
||||||
|
*/
|
||||||
|
const extractIdFromUrl = (prefix: string): string => {
|
||||||
|
const url = document.location.href;
|
||||||
|
const startIndex = url.indexOf(prefix);
|
||||||
|
if (startIndex === -1) return '';
|
||||||
|
|
||||||
|
// 计算起始位置(包含前缀)
|
||||||
|
const start = startIndex + prefix.length;
|
||||||
|
let result = url.substring(start);
|
||||||
|
|
||||||
|
// 移除.html后缀
|
||||||
|
const dotIndex = result.indexOf('.');
|
||||||
|
if (dotIndex !== -1) {
|
||||||
|
result = result.substring(0, dotIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 移除查询参数
|
||||||
|
const andIndex = result.indexOf('&');
|
||||||
|
if (andIndex !== -1) {
|
||||||
|
result = result.substring(0, andIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 移除路径分隔符后的部分
|
||||||
|
const slashIndex = result.indexOf('/');
|
||||||
|
if (slashIndex !== -1) {
|
||||||
|
result = result.substring(0, slashIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
// 截取document.location.search字符串内id/后面的所有字段
|
// 截取document.location.search字符串内id/后面的所有字段
|
||||||
export const get_id = () => {
|
export const get_id = () => {
|
||||||
let new_id = '';
|
// 先尝试匹配 id/ 模式
|
||||||
// 去除origin的数据
|
|
||||||
const url = document.location.href;
|
const url = document.location.href;
|
||||||
if (url.indexOf('id/') != -1) {
|
const idIndex = url.indexOf('id/');
|
||||||
new_id = url.substring(url.indexOf('id/') + 3);
|
if (idIndex !== -1) {
|
||||||
// 去除字符串的.html
|
const result = url.substring(idIndex + 3);
|
||||||
let html_index = new_id.indexOf('.html');
|
const htmlIndex = result.indexOf('.html');
|
||||||
if (html_index != -1) {
|
if (htmlIndex !== -1) {
|
||||||
new_id = new_id.substring(0, html_index);
|
return result.substring(0, htmlIndex);
|
||||||
}
|
}
|
||||||
return new_id;
|
return result.split('.')[0].split('/')[0];
|
||||||
} else if (url.indexOf('-saveinfo') != -1) {
|
|
||||||
new_id = url.substring(url.indexOf('-saveinfo-') + 10);
|
|
||||||
// 去除字符串的.html
|
|
||||||
const dot_data = new_id.split('.')[0];
|
|
||||||
if (dot_data != '') {
|
|
||||||
new_id = dot_data.split('/')[0];
|
|
||||||
}
|
|
||||||
return new_id;
|
|
||||||
} else {
|
|
||||||
return new_id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 尝试匹配-saveinfo-模式
|
||||||
|
const saveinfoResult = extractIdFromUrl('-saveinfo-');
|
||||||
|
if (saveinfoResult) return saveinfoResult;
|
||||||
|
|
||||||
|
// 尝试匹配-forminputinfo-模式
|
||||||
|
return extractIdFromUrl('-diyinfo-');
|
||||||
};
|
};
|
||||||
|
|
||||||
// 获取当前业务类型
|
// 获取当前业务类型
|
||||||
export const get_type = () => {
|
export const get_type = () => {
|
||||||
return data_handle('type/', '');
|
return data_handle('type/', '');
|
||||||
|
|
|
||||||
|
|
@ -5,17 +5,17 @@
|
||||||
<!-- <icon name="arrow-left" color="f">返回</icon> -->
|
<!-- <icon name="arrow-left" color="f">返回</icon> -->
|
||||||
<div class="flex-row align-c">
|
<div class="flex-row align-c">
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<div class="flex-row align-c gap-10 c-pointer" @click="dialog_visible = true">
|
<div :class="[{'c-pointer': common_store_config?.diy_config_operate?.is_base_data == 1}, 'flex-row align-c gap-10']" @click="common_store_config?.diy_config_operate?.is_base_data == 1 ? dialog_visible = true : ''">
|
||||||
<image-empty :src="modelValue.logo" class="round img" error-img-style="width: 2.2rem;height: 2.2rem;" />
|
<image-empty :src="modelValue.logo" class="round img" error-img-style="width: 2.2rem;height: 2.2rem;" />
|
||||||
<div>{{ modelValue.name }}</div>
|
<div>{{ modelValue.name }}</div>
|
||||||
<icon name="edit" color="#7DBEFF"></icon>
|
<icon v-if="common_store_config?.diy_config_operate?.is_base_data == 1" name="edit" color="#7DBEFF"></icon>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-right">
|
<div class="nav-right">
|
||||||
<el-button class="btn-plain" @click="upload_manage">上传管理</el-button>
|
<el-button v-if="common_store_config?.diy_config_operate?.is_upload_admin == 1" class="btn-plain" @click="upload_manage">上传管理</el-button>
|
||||||
<el-button class="btn-plain" :class="saveDisabled ? 'disabled' : ''" :disabled="saveDisabled" @click="preview_event">预览</el-button>
|
<el-button v-if="common_store_config.preview_url !== ''" class="btn-plain" :class="saveDisabled ? 'disabled' : ''" :disabled="saveDisabled" @click="preview_event">预览</el-button>
|
||||||
<el-button class="btn-plain" :class="saveDisabled ? 'disabled' : ''" :disabled="saveDisabled" @click="save_event">仅保存</el-button>
|
<el-button class="btn-plain" :class="saveDisabled ? 'disabled' : ''" :disabled="saveDisabled" @click="save_event">仅保存</el-button>
|
||||||
<el-button class="btn-white" :class="saveDisabled ? 'disabled' : ''" :disabled="saveDisabled" @click="save_close_event">保存关闭</el-button>
|
<el-button class="btn-white" :class="saveDisabled ? 'disabled' : ''" :disabled="saveDisabled" @click="save_close_event">保存关闭</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -53,6 +53,8 @@
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { FormInstance, FormRules } from 'element-plus';
|
import { FormInstance, FormRules } from 'element-plus';
|
||||||
|
import { commonStore } from '@/store';
|
||||||
|
const common_store = commonStore();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
saveDisabled: {
|
saveDisabled: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
|
@ -60,6 +62,8 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const modelValue = defineModel({ type: Object, default: {} });
|
const modelValue = defineModel({ type: Object, default: {} });
|
||||||
|
// 公共配置项
|
||||||
|
const common_store_config = computed(() => common_store.common.config);
|
||||||
// #region 变量 --------------------start
|
// #region 变量 --------------------start
|
||||||
const is_custom_dialog = ref(false);
|
const is_custom_dialog = ref(false);
|
||||||
const dialog_visible = ref(false);
|
const dialog_visible = ref(false);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue