优化无用代码

V0.1
yujialong 8 months ago
parent ec385dda77
commit e190b065b2
  1. 2
      src/components/Panel/index.vue
  2. 335
      src/data.ts
  3. 4
      src/layout/components/AppHeader.vue
  4. 8
      src/layout/components/AppSidebar/index.vue
  5. 9
      src/layout/components/Logo.vue
  6. 2
      src/main.ts
  7. 2
      src/permission.ts
  8. 10
      src/settings.ts
  9. 6
      src/views/product/bank/Detail.vue
  10. 1
      src/views/product/strategy/CardList.vue

@ -283,7 +283,6 @@ const { x, y, style } = useDraggable(container, {
}, },
}); });
console.log('最先:', route, route.path, route.query.token, param.token);
if (param.token) { if (param.token) {
// urlcookiecookie // urlcookiecookie
param.token && Cookies.set('sand-token', param.token); param.token && Cookies.set('sand-token', param.token);
@ -568,7 +567,6 @@ let reload = async (fromReload?: number) => {
}; };
// //
let submit = async () => { let submit = async () => {
console.log('submit:', submiting.value);
if (!submiting.value) { if (!submiting.value) {
submiting.value = true; submiting.value = true;
const checkpointId = Cookies.get('sand-level') ?? ''; const checkpointId = Cookies.get('sand-level') ?? '';

@ -1,335 +0,0 @@
import i18n from '@/i18n';
export function getPermsTreeData(): any[] {
const {
global: { t },
} = i18n;
return [
{
label: t('menu.home'),
key: 'home',
perms: ['auth'],
children: [
{
label: t('menu.personal'),
key: 'personal',
children: [
{
label: t('menu.personal.password'),
key: 'password:update',
perms: ['password:update'],
},
],
},
{
label: t('menu.content'),
key: 'content',
children: [
{
label: t('menu.content.article'),
key: 'article',
perms: ['article:page', 'article:list', 'channel:list', 'dict:list', 'model:list'],
children: [
{ label: t('list'), key: 'article:page' },
{ label: t('add'), key: 'article:create', perms: ['article:create'] },
{ label: t('edit'), key: 'article:update', perms: ['article:update', 'article:show'] },
{ label: t('delete'), key: 'article:delete', perms: ['article:delete'] },
],
},
{
label: t('menu.content.channel'),
key: 'channel',
perms: ['channel:page', 'channel:list'],
children: [
{ label: t('list'), key: 'channel:page' },
{ label: t('add'), key: 'channel:create', perms: ['channel:create'] },
{ label: t('edit'), key: 'channel:update', perms: ['channel:update', 'channel:show'] },
{ label: t('delete'), key: 'channel:delete', perms: ['channel:delete'] },
],
},
{
label: t('menu.content.blockItem'),
key: 'blockItem',
perms: ['blockItem:page', 'blockItem:list', 'block:list'],
children: [
{ label: t('list'), key: 'blockItem:page' },
{ label: t('add'), key: 'blockItem:create', perms: ['blockItem:create'] },
{ label: t('edit'), key: 'blockItem:update', perms: ['blockItem:update', 'blockItem:show'] },
{ label: t('delete'), key: 'blockItem:delete', perms: ['blockItem:delete'] },
],
},
{
label: t('menu.content.attachment'),
key: 'attachment',
perms: ['attachment:page', 'attachment:list'],
children: [
{ label: t('list'), key: 'attachment:page' },
{ label: t('add'), key: 'attachment:create', perms: ['attachment:create'] },
{ label: t('edit'), key: 'attachment:update', perms: ['attachment:update', 'attachment:show'] },
{ label: t('delete'), key: 'attachment:delete', perms: ['attachment:delete'] },
],
},
{
label: t('menu.content.generator'),
key: 'generator',
perms: ['generator:show', 'siteSettings:html:show', 'task:list', 'task:show', 'task:delete'],
children: [
{ label: t('generator.op.fulltext.reindexAll'), key: 'generator:fulltext:reindexAll', perms: ['generator:fulltext:reindexAll'] },
{ label: t('generator.op.fulltext.reindexSite'), key: 'generator:fulltext:reindexSite', perms: ['generator:fulltext:reindexSite'] },
{ label: t('generator.html'), key: 'generator:html', perms: ['generator:html'] },
{ label: t('site.settings.html'), key: 'siteSettings:html:update', perms: ['siteSettings:html:update', 'generator:html'] },
],
},
],
},
{
label: t('menu.config'),
key: 'config',
children: [
{
label: t('menu.config.globalSettings'),
key: 'globalSettings',
perms: ['globalSettings:show'],
children: [
{ label: t('global.settings.base'), key: 'globalSettings:base:update', perms: ['globalSettings:base:update'] },
{ label: t('global.settings.upload'), key: 'globalSettings:upload:update', perms: ['globalSettings:upload:update'] },
{ label: t('global.settings.customs'), key: 'globalSettings:customs:update', perms: ['globalSettings:customs:update'] },
],
},
{
label: t('menu.config.siteSettings'),
key: 'siteSettings',
perms: ['siteSettings:show'],
children: [
{ label: t('site.settings.base'), key: 'siteSettings:base:update', perms: ['siteSettings:base:update'] },
{ label: t('site.settings.watermark'), key: 'siteSettings:watermark:update', perms: ['siteSettings:watermark:update'] },
{ label: t('site.settings.customs'), key: 'siteSettings:customs:update', perms: ['siteSettings:customs:update'] },
],
},
{
label: t('menu.config.model'),
key: 'model',
perms: ['model:page', 'model:list'],
children: [
{ label: t('list'), key: 'model:page' },
{ label: t('add'), key: 'model:create', perms: ['model:create'] },
{ label: t('edit'), key: 'model:update', perms: ['model:update', 'model:show'] },
{ label: t('delete'), key: 'model:delete', perms: ['model:delete'] },
],
},
{
label: t('menu.config.block'),
key: 'block',
perms: ['block:page', 'block:list'],
children: [
{ label: t('list'), key: 'block:page' },
{ label: t('add'), key: 'block:create', perms: ['block:create'] },
{ label: t('edit'), key: 'block:update', perms: ['block:update', 'block:show'] },
{ label: t('delete'), key: 'block:delete', perms: ['block:delete'] },
],
},
{
label: t('menu.config.dictType'),
key: 'dictType',
perms: ['dictType:page', 'dictType:list'],
children: [
{ label: t('list'), key: 'dictType:page' },
{ label: t('add'), key: 'dictType:create', perms: ['dictType:create'] },
{ label: t('edit'), key: 'dictType:update', perms: ['dictType:update', 'dictType:show'] },
{ label: t('delete'), key: 'dictType:delete', perms: ['dictType:delete'] },
],
},
{
label: t('menu.config.dict'),
key: 'dict',
perms: ['dict:page', 'dict:list', 'dictType:list'],
children: [
{ label: t('list'), key: 'dict:page' },
{ label: t('add'), key: 'dict:create', perms: ['dict:create'] },
{ label: t('edit'), key: 'dict:update', perms: ['dict:update', 'dict:show'] },
{ label: t('delete'), key: 'dict:delete', perms: ['dict:delete'] },
],
},
],
},
{
label: t('menu.user'),
key: 'user',
children: [
{
label: t('menu.user.user'),
key: 'user',
perms: ['user:page', 'user:list', 'group:list', 'org:list'],
children: [
{ label: t('list'), key: 'user:page' },
{ label: t('add'), key: 'user:create', perms: ['user:create'] },
{ label: t('edit'), key: 'user:update', perms: ['user:update', 'user:show'] },
{ label: t('delete'), key: 'user:delete', perms: ['user:delete'] },
],
},
{
label: t('menu.user.role'),
key: 'role',
perms: ['role:page', 'role:list'],
children: [
{ label: t('list'), key: 'role:page' },
{ label: t('add'), key: 'role:create', perms: ['role:create'] },
{ label: t('edit'), key: 'role:update', perms: ['role:update', 'role:show'] },
{ label: t('delete'), key: 'role:delete', perms: ['role:delete'] },
],
},
{
label: t('menu.user.group'),
key: 'group',
perms: ['group:page', 'group:list'],
children: [
{ label: t('list'), key: 'group:page' },
{ label: t('add'), key: 'group:create', perms: ['group:create'] },
{ label: t('edit'), key: 'group:update', perms: ['group:update', 'group:show'] },
{ label: t('delete'), key: 'group:delete', perms: ['group:delete'] },
],
},
{
// label: t('menu.user.org'),
key: 'org',
perms: ['org:page', 'org:list'],
children: [
{ label: t('list'), key: 'org:page' },
{ label: t('add'), key: 'org:create', perms: ['org:create'] },
{ label: t('edit'), key: 'org:update', perms: ['org:update', 'org:show'] },
{ label: t('delete'), key: 'org:delete', perms: ['org:delete'] },
],
},
],
},
{
label: t('menu.system'),
key: 'system',
children: [
{
// label: t('menu.system.site'),
key: 'site',
perms: ['site:page', 'site:list', 'org:list', 'model:list', 'storage:list'],
children: [
{ label: t('list'), key: 'site:page' },
{ label: t('add'), key: 'site:create', perms: ['site:create'] },
{ label: t('edit'), key: 'site:update', perms: ['site:update', 'site:show'] },
{ label: t('delete'), key: 'site:delete', perms: ['site:delete'] },
],
},
{
label: t('menu.system.storage'),
key: 'storage',
perms: ['storage:page', 'storage:list'],
children: [
{ label: t('list'), key: 'storage:page' },
{ label: t('add'), key: 'storage:create', perms: ['storage:create'] },
{ label: t('edit'), key: 'storage:update', perms: ['storage:update', 'storage:show'] },
{ label: t('delete'), key: 'storage:delete', perms: ['storage:delete'] },
],
},
// {
// label: t('menu.system.task'),
// key: 'task',
// perms: ['task:page', 'task:list'],
// children: [
// { label: t('list'), key: 'task:page' },
// { label: t('add'), key: 'task:create', perms: ['task:create'] },
// { label: t('edit'), key: 'task:update', perms: ['task:update', 'task:show'] },
// { label: t('delete'), key: 'task:delete', perms: ['task:delete'] },
// ],
// },
],
},
],
},
];
}
export function getModelData(): any {
return {
article: {
mains: [
{ code: 'title', must: true, show: true, double: false, required: true },
{ code: 'subtitle', must: false, show: false, double: false, required: false },
{ code: 'fullTitle', must: false, show: false, double: false, required: false },
{ code: 'linkUrl', must: false, show: true, double: false, required: false },
{ code: 'seoKeywords', must: false, show: false, double: false, required: false },
{ code: 'seoDescription', must: false, show: true, double: false, required: false },
{ code: 'author', must: false, show: false, double: true, required: false },
{ code: 'editor', must: false, show: false, double: true, required: false },
{ code: 'image', must: false, show: true, double: false, required: false, type: 'image', imageWidth: 300, imageHeight: 200, imageMode: 'manual' },
{ code: 'file', must: false, show: false, double: false, required: false },
{ code: 'video', must: false, show: false, double: false, required: false },
{ code: 'doc', must: false, show: false, double: false, required: false },
{ code: 'imageList', must: false, show: false, double: false, required: false, type: 'imageList', imageMaxWidth: 1920, imageMaxHeight: 1920 },
{ code: 'fileList', must: false, show: false, double: false, required: false },
{ code: 'text', must: false, show: true, double: false, required: true },
],
asides: [
{ code: 'channel', must: true, show: true, required: true },
{ code: 'org', must: false, show: true, required: true },
{ code: 'publishDate', must: true, show: true, required: true },
// { code: 'offlineDate', must: false, show: true, required: false },
{ code: 'source', must: false, show: true, required: false },
{ code: 'articleTemplate', must: false, show: true, required: false },
{ code: 'allowComment', must: false, show: true, required: true },
{ code: 'user', must: false, show: false, required: true },
{ code: 'created', must: false, show: false, required: true },
{ code: 'modifiedUser', must: false, show: false, required: false },
{ code: 'modified', must: false, show: false, required: false },
],
},
channel: {
mains: [
{ code: 'name', must: true, show: true, double: true, required: true },
{ code: 'alias', must: true, show: true, double: true, required: true },
{ code: 'linkUrl', must: true, show: true, double: false, required: true },
{ code: 'seoTitle', must: false, show: true, double: true, required: false },
{ code: 'seoKeywords', must: false, show: true, double: true, required: false },
{ code: 'seoDescription', must: false, show: true, double: false, required: false },
{ code: 'channelTemplate', must: false, show: true, double: true, required: true },
{ code: 'articleTemplate', must: false, show: true, double: true, required: true },
{ code: 'channelModel', must: true, show: true, double: true, required: true },
{ code: 'articleModel', must: true, show: true, double: true, required: true },
{ code: 'group', must: false, show: true, double: false, required: true },
{ code: 'nav', must: false, show: true, double: true, required: true },
{ code: 'allowComment', must: false, show: true, double: true, required: true },
{ code: 'allowContribute', must: false, show: true, double: true, required: true },
{ code: 'allowSearch', must: false, show: true, double: true, required: true },
{ code: 'text', must: false, show: false, double: false, required: false },
],
asides: [
{ code: 'type', must: true, show: true, required: true },
{ code: 'parent', must: true, show: true, required: false },
{ code: 'pageSize', must: true, show: true, required: true },
],
},
};
}
export function mergeModelFields(defaultFields: any[], s: string | null | undefined, type: string): any[] {
const fields = JSON.parse(s || '[]');
const defaults = defaultFields.map((item: any) => ({ ...item, label: `${type}.${item.code}` }));
// 去除默认字段中不存在的字段
fields.filter((field: any) => defaults.findIndex((item) => item.code === field.code) !== -1);
defaults.forEach((item) => {
const index = fields.findIndex((it: any) => it.code === item.code);
if (index !== -1) {
// 加上缺失属性,覆盖不可改属性
fields[index] = { ...item, ...fields[index], must: item.must, label: item.label, type: item.type };
} else {
// 加上没有的字段
fields.push(item);
}
});
return fields;
}
export function arr2obj(arr: any[]) {
const obj: Record<string, any> = {};
arr.forEach((item: any) => {
obj[item.code] = item;
});
return obj;
}

@ -1,6 +1,6 @@
<template> <template>
<div class="width-[100%] flex justify-between items-center w-full py-6 lg:py-4 px-5 overflow-hidden bg-transparent"> <div class="width-[100%] flex justify-between items-center w-full py-6 lg:py-4 px-5 overflow-hidden bg-transparent">
<logo :collapse="collapse" /> <logo />
<div v-if="!hidePanel" <div v-if="!hidePanel"
class="inline-flex items-center"> class="inline-flex items-center">
<el-tooltip effect="light" <el-tooltip effect="light"
@ -27,7 +27,7 @@
import { ref, onMounted, computed } from 'vue'; import { ref, onMounted, computed } from 'vue';
import { useRouter, useRoute } from 'vue-router'; import { useRouter, useRoute } from 'vue-router';
import Settings from '@/settings'; import Settings from '@/settings';
import { currentUser, perm, logout } from '@/store/useCurrentUser'; import { logout } from '@/store/useCurrentUser';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import Logo from './Logo.vue'; import Logo from './Logo.vue';

@ -45,7 +45,6 @@
import { onMounted, ref, computed } from 'vue'; import { onMounted, ref, computed } from 'vue';
import { useRouter, useRoute } from 'vue-router'; import { useRouter, useRoute } from 'vue-router';
import Menus from './Menu.vue'; import Menus from './Menu.vue';
import Settings from '@/settings';
import { getOperationTime, saveOperationTime } from '@/api/config'; import { getOperationTime, saveOperationTime } from '@/api/config';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
@ -59,10 +58,15 @@ const levelId = +Cookies.get('sand-level');
const date = ref<string>(dayjs(new Date()).format('YYYY-MM-DD')); const date = ref<string>(dayjs(new Date()).format('YYYY-MM-DD'));
const diaDate = ref<string>(dayjs(new Date()).format('YYYY-M-D')); const diaDate = ref<string>(dayjs(new Date()).format('YYYY-M-D'));
const dateVisible = ref<boolean>(false); const dateVisible = ref<boolean>(false);
const roleIds = {
41: '产品经理',
42: '风控经理',
43: '专家委员会',
};
const roleName = computed(() => { const roleName = computed(() => {
if (route.query.role) { if (route.query.role) {
return Settings.roleIds[+route.query.role]; return roleIds[+route.query.role];
} else if (route.path.includes('insurance')) { } else if (route.path.includes('insurance')) {
return '保险产品经理'; return '保险产品经理';
} else if (route.path.includes('fund')) { } else if (route.path.includes('fund')) {

@ -2,8 +2,7 @@
<div class="flex items-center justify-center overflow-hidden"> <div class="flex items-center justify-center overflow-hidden">
<router-link class="whitespace-nowrap text-center" <router-link class="whitespace-nowrap text-center"
to="/"> to="/">
<h1 v-if="!collapse" <h1 class="ml-1 text-[22px] lg:text-lg leading-[1] font-bold text-[#333]">{{ title }}</h1>
class="ml-1 text-[22px] lg:text-lg leading-[1] font-bold text-[#333]">{{ title }}</h1>
</router-link> </router-link>
</div> </div>
</template> </template>
@ -14,12 +13,6 @@ import Settings from '@/settings';
export default defineComponent({ export default defineComponent({
name: 'SidebarLogo', name: 'SidebarLogo',
props: {
collapse: {
type: Boolean,
required: true,
},
},
data() { data() {
return { return {
title: Settings.title, title: Settings.title,

@ -1,6 +1,5 @@
import { createApp } from 'vue'; import { createApp } from 'vue';
import ElementPlus from 'element-plus'; import ElementPlus from 'element-plus';
// import Panel from '@/components/Panel/index.vue';
import App from './App.vue'; import App from './App.vue';
import router from './router'; import router from './router';
import i18n from './i18n'; import i18n from './i18n';
@ -15,5 +14,4 @@ const app = createApp(App)
// tinymce 对话框的层级太低,必须调低 ElementPlus 的 对话框层级(默认为2000) // tinymce 对话框的层级太低,必须调低 ElementPlus 的 对话框层级(默认为2000)
.use(ElementPlus, { zIndex: 500 }) .use(ElementPlus, { zIndex: 500 })
.use(i18n); .use(i18n);
// app.component('Panel', Panel);
app.mount('#app'); app.mount('#app');

@ -7,8 +7,6 @@ import router from './router';
NProgress.configure({ showSpinner: false }); // NProgress Configuration NProgress.configure({ showSpinner: false }); // NProgress Configuration
const LOGIN_PATH = '/login';
router.beforeEach(async (to: RouteLocationNormalized) => { router.beforeEach(async (to: RouteLocationNormalized) => {
NProgress.start(); NProgress.start();
return true; return true;

@ -1,15 +1,5 @@
export default { export default {
title: import.meta.env.VITE_APP_TITLE || '金融产品设计及数字化营销沙盘', title: import.meta.env.VITE_APP_TITLE || '金融产品设计及数字化营销沙盘',
showSettings: true,
/**
* @type {object}
* @description id
*/
roleIds: {
41: '产品经理',
42: '风控经理',
43: '专家委员会',
},
/** /**
* @type {array} * @type {array}
* @description * @description

@ -4,7 +4,7 @@
<el-tab-pane :label="status" <el-tab-pane :label="status"
name="tab1"> name="tab1">
<div class="h-[calc(100vh-170px)] pr-1 overflow-auto"> <div class="h-[calc(100vh-170px)] pr-1 overflow-auto">
<info @updateStatus="updateStatus" /> <info />
</div> </div>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
@ -17,10 +17,6 @@ import Info from './Info.vue';
const curTab = ref<string>('tab1'); const curTab = ref<string>('tab1');
const status = ref<string>('产品详情'); const status = ref<string>('产品详情');
const updateStatus = (val: string) => {
status.value = val;
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

@ -118,6 +118,7 @@ import { delCredit, listCredit } from '@/api/model';
import { useRouter, useRoute } from 'vue-router'; import { useRouter, useRoute } from 'vue-router';
import { ElMessage } from 'element-plus'; import { ElMessage } from 'element-plus';
import { getIds } from '@/utils/common'; import { getIds } from '@/utils/common';
import { Plus } from '@element-plus/icons-vue';
import Com1 from './150.vue'; import Com1 from './150.vue';
import Com2 from './151.vue'; import Com2 from './151.vue';
import Com3 from './152.vue'; import Com3 from './152.vue';

Loading…
Cancel
Save