🎉代码规范强制使用单引号并取消行末分号

This commit is contained in:
chuzhixin 2020-10-08 13:32:23 +08:00
parent 17b7022545
commit f6c412f4e9
149 changed files with 6875 additions and 6885 deletions

View File

@ -3,24 +3,24 @@ module.exports = {
env: {
node: true,
},
extends: ["plugin:vue/recommended", "@vue/prettier"],
extends: ['plugin:vue/recommended', '@vue/prettier'],
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
"vue/no-v-html": "off",
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'vue/no-v-html': 'off',
},
parserOptions: {
parser: "babel-eslint",
parser: 'babel-eslint',
},
overrides: [
{
files: [
"**/__tests__/*.{j,t}s?(x)",
"**/tests/unit/**/*.spec.{j,t}s?(x)",
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)',
],
env: {
jest: true,
},
},
],
};
}

View File

@ -1,3 +1,3 @@
module.exports = {
extends: ["stylelint-config-recess-order", "stylelint-config-prettier"],
};
extends: ['stylelint-config-recess-order', 'stylelint-config-prettier'],
}

View File

@ -1,3 +1,3 @@
module.exports = {
presets: ["@vue/cli-plugin-babel/preset"],
};
presets: ['@vue/cli-plugin-babel/preset'],
}

View File

@ -1,23 +1,23 @@
const data = [
{
title: "vue-admin-beautiful-pro 1.7版本已发布,点我提前体验",
url: "https://chu1204505056.gitee.io/vue-admin-beautiful-pro/#/index",
title: 'vue-admin-beautiful-pro 1.7版本已发布,点我提前体验',
url: 'https://chu1204505056.gitee.io/vue-admin-beautiful-pro/#/index',
},
{
title: "vue-admin-beautifulantdv vue3.0版本已发布,点我提前体验",
url: "https://chu1204505056.gitee.io/vue-admin-beautiful-mini/#/index",
title: 'vue-admin-beautifulantdv vue3.0版本已发布,点我提前体验',
url: 'https://chu1204505056.gitee.io/vue-admin-beautiful-mini/#/index',
},
];
]
module.exports = [
{
url: "/ad/getList",
type: "get",
url: '/ad/getList',
type: 'get',
response() {
return {
code: 200,
msg: "success",
msg: 'success',
data,
};
}
},
},
];
]

View File

@ -1,194 +1,194 @@
const data = [
{
content: "在github上获得了第一个star感恩一位名叫Bequiet2014的github用户",
timestamp: "2020-03-23",
content: '在github上获得了第一个star感恩一位名叫Bequiet2014的github用户',
timestamp: '2020-03-23',
},
{
content: "增加更换主题功能",
timestamp: "2020-04-10",
content: '增加更换主题功能',
timestamp: '2020-04-10',
},
{
content: "大幅精简代码",
timestamp: "2020-04-14",
content: '大幅精简代码',
timestamp: '2020-04-14',
},
{
content: "修复群友反馈的bug",
timestamp: "2020-04-16",
content: '修复群友反馈的bug',
timestamp: '2020-04-16',
},
{
content: "剔除maptalks",
timestamp: "2020-04-17",
content: '剔除maptalks',
timestamp: '2020-04-17',
},
{
content:
"换行符统一修改为lf 支持苹果 linux windows协同开发 强制开启最严格eslint规则 不要哭 严格是有好处的",
timestamp: "2020-04-17",
'换行符统一修改为lf 支持苹果 linux windows协同开发 强制开启最严格eslint规则 不要哭 严格是有好处的',
timestamp: '2020-04-17',
},
{
content: "彻底完成手机端适配,记录这一天熬夜到了晚上三点",
timestamp: "2020-04-18",
content: '彻底完成手机端适配,记录这一天熬夜到了晚上三点',
timestamp: '2020-04-18',
},
{
content:
"删除babel-polyfill 提高打包速度 减少压缩体积放弃ie是这个项目做出的最伟大的决定",
timestamp: "2020-04-18",
'删除babel-polyfill 提高打包速度 减少压缩体积放弃ie是这个项目做出的最伟大的决定',
timestamp: '2020-04-18',
},
{
content: "源码精简至800k",
timestamp: "2020-04-19",
content: '源码精简至800k',
timestamp: '2020-04-19',
},
{
content: "添加视频播放器组件",
timestamp: "2020-04-20",
content: '添加视频播放器组件',
timestamp: '2020-04-20',
},
{
content: "修复路由懒加载 完善主题配色",
timestamp: "2020-04-22",
content: '修复路由懒加载 完善主题配色',
timestamp: '2020-04-22',
},
{
content: "修复全局axios拦截 加快动画展示效果 修改登录页样式",
timestamp: "2020-04-24",
content: '修复全局axios拦截 加快动画展示效果 修改登录页样式',
timestamp: '2020-04-24',
},
{
content: "简化权限与登录逻辑 更新mockServer",
timestamp: "2020-04-25",
content: '简化权限与登录逻辑 更新mockServer',
timestamp: '2020-04-25',
},
{
content: "优化登录退出逻辑 代码更清晰 退出不再重载网页 改为重载路由形式",
timestamp: "2020-04-26",
content: '优化登录退出逻辑 代码更清晰 退出不再重载网页 改为重载路由形式',
timestamp: '2020-04-26',
},
{
content: "无端的指责只会让我更加努力 修复sidebar 简化permission",
timestamp: "2020-04-28",
content: '无端的指责只会让我更加努力 修复sidebar 简化permission',
timestamp: '2020-04-28',
},
{
content: "又是一个深夜 实现了表格增删改查的一键生成",
timestamp: "2020-04-30",
content: '又是一个深夜 实现了表格增删改查的一键生成',
timestamp: '2020-04-30',
},
{
content: "大幅优化tagsview标签动画",
timestamp: "2020-05-02",
content: '大幅优化tagsview标签动画',
timestamp: '2020-05-02',
},
{
content: "三种图标组件实现mock模拟分页",
timestamp: "2020-05-03",
content: '三种图标组件实现mock模拟分页',
timestamp: '2020-05-03',
},
{
content: "添加了markdown编辑器组件",
timestamp: "2020-05-04",
content: '添加了markdown编辑器组件',
timestamp: '2020-05-04',
},
{
content: "添加stylelint-plus自动规整排序样式",
timestamp: "2020-05-06",
content: '添加stylelint-plus自动规整排序样式',
timestamp: '2020-05-06',
},
{
content: "添加商城模板",
timestamp: "2020-05-12",
content: '添加商城模板',
timestamp: '2020-05-12',
},
{
content: "github标星超过1000 感恩",
timestamp: "2020-05-13",
content: 'github标星超过1000 感恩',
timestamp: '2020-05-13',
},
{
content: "添加验证码组件",
timestamp: "2020-05-14",
content: '添加验证码组件',
timestamp: '2020-05-14',
},
{
content: "修复横向菜单bug",
timestamp: "2020-05-16",
content: '修复横向菜单bug',
timestamp: '2020-05-16',
},
{
content: "又被人骂了 挺好的 让我下定决心重写了tabsBar",
timestamp: "2020-05-20",
content: '又被人骂了 挺好的 让我下定决心重写了tabsBar',
timestamp: '2020-05-20',
},
{
content: "仿ant-design 添加雪花屏",
timestamp: "2020-05-26",
content: '仿ant-design 添加雪花屏',
timestamp: '2020-05-26',
},
{
content: "添加人员管理模块",
timestamp: "2020-06-02",
content: '添加人员管理模块',
timestamp: '2020-06-02',
},
{
content: "github标星超过2000 感恩",
timestamp: "2020-06-03",
content: 'github标星超过2000 感恩',
timestamp: '2020-06-03',
},
{
content: "添加炫酷地图组件",
timestamp: "2020-06-11",
content: '添加炫酷地图组件',
timestamp: '2020-06-11',
},
{
content: "抽离更多公共配置,框架使用更顺手",
timestamp: "2020-06-19",
content: '抽离更多公共配置,框架使用更顺手',
timestamp: '2020-06-19',
},
{
content: "彻底完成了tabsBar多标签页的重构",
timestamp: "2020-06-22",
content: '彻底完成了tabsBar多标签页的重构',
timestamp: '2020-06-22',
},
{
content: "感恩github标星过3.0K 祝大家端午节快乐",
timestamp: "2020-06-25",
content: '感恩github标星过3.0K 祝大家端午节快乐',
timestamp: '2020-06-25',
},
{
content: "彻底重构了SideBar与TopBar 大幅精简dom渲染逻辑 全球首发",
timestamp: "2020-06-25",
content: '彻底重构了SideBar与TopBar 大幅精简dom渲染逻辑 全球首发',
timestamp: '2020-06-25',
},
{
content: "添加菜单管理",
timestamp: "2020-07-7",
content: '添加菜单管理',
timestamp: '2020-07-7',
},
{
content: "首次采用sass-loader 9.0写法感谢github用户 shaonialife",
timestamp: "2020-07-7",
content: '首次采用sass-loader 9.0写法感谢github用户 shaonialife',
timestamp: '2020-07-7',
},
{
content: "添加vue-amap组件",
timestamp: "2020-07-11",
content: '添加vue-amap组件',
timestamp: '2020-07-11',
},
{
content: "修改zx-layouts引入方式",
timestamp: "2020-07-15",
content: '修改zx-layouts引入方式',
timestamp: '2020-07-15',
},
{
content:
"记录这一天vue-admin-beautiful在插件市场、百度已花费超过1万元广告费用希望一切都值得",
timestamp: "2020-07-18",
'记录这一天vue-admin-beautiful在插件市场、百度已花费超过1万元广告费用希望一切都值得',
timestamp: '2020-07-18',
},
{
content: "主题配置添加绿荫草场、荣耀典藏、暗黑之子模式",
timestamp: "2020-07-18",
content: '主题配置添加绿荫草场、荣耀典藏、暗黑之子模式',
timestamp: '2020-07-18',
},
{
content: "全局axios请求全面支持Status Code拦截处理",
timestamp: "2020-07-29",
content: '全局axios请求全面支持Status Code拦截处理',
timestamp: '2020-07-29',
},
{
content: "重构全局loadding加载代码",
timestamp: "2020-07-31",
content: '重构全局loadding加载代码',
timestamp: '2020-07-31',
},
{
content: "升级stylelint自动排序功能",
timestamp: "2020-08-25",
content: '升级stylelint自动排序功能',
timestamp: '2020-08-25',
},
{
content: "修复视频播放器组件重载路由失效的bug",
timestamp: "2020-09-03",
content: '修复视频播放器组件重载路由失效的bug',
timestamp: '2020-09-03',
},
{
content: "修复极个别情况image-loader打包报错",
timestamp: "2020-09-18",
content: '修复极个别情况image-loader打包报错',
timestamp: '2020-09-18',
},
{
content: "全网首个基于vue3.0开发的admin框架已发布具体请访问github",
timestamp: "2020-09-22",
content: '全网首个基于vue3.0开发的admin框架已发布具体请访问github',
timestamp: '2020-09-22',
},
{
content: "完善路由后端渲染方案,弃用之前写法",
timestamp: "2020-09-30",
content: '完善路由后端渲染方案,弃用之前写法',
timestamp: '2020-09-30',
},
{
content: "大版本迭代请关注github tag",
timestamp: "2020-09-30",
content: '大版本迭代请关注github tag',
timestamp: '2020-09-30',
},
/* {
content:
@ -196,22 +196,22 @@ const data = [
timestamp: "2020-10-01",
}, */
{
content: "凌晨两点我累了移除无用组件精简package",
timestamp: "2020-10-02",
content: '凌晨两点我累了移除无用组件精简package',
timestamp: '2020-10-02',
},
];
]
module.exports = [
{
url: "/changeLog/getList",
type: "post",
url: '/changeLog/getList',
type: 'post',
response() {
return {
code: 200,
msg: "success",
msg: 'success',
totalCount: 999,
data: data,
};
}
},
},
];
]

View File

@ -1,324 +1,324 @@
const data = [
"alphabetical_sorting",
"alphabetical_sorting",
"alarm_clock",
"area_chart",
"approval",
"answers",
"approve",
"assistant",
"automotive",
"automatic",
"bad_decision",
"bar_chart",
"bearish",
"biomass",
"biohazard",
"binoculars",
"bookmark",
"briefcase",
"biotech",
"broken_link",
"business",
"bullish",
"business_contact",
"businesswoman",
"cable_release",
"calculator",
"businessman",
"calendar",
"butting_in",
"call_transfer",
"callback",
"camcorder",
"camera",
"camcorder_pro",
"cancel",
"camera_addon",
"camera_identificatio",
"capacitor",
"candle_sticks",
"checkmark",
"circuit",
"charge_battery",
"clear_filters",
"clapperboard",
"clock",
"close_up_mode",
"collaboration",
"cell_phone",
"collapse",
"collect",
"cloth",
"combo_chart",
"comments",
"conference_call",
"compact_camera",
"contacts",
"copyleft",
"copyright",
"crystal_oscillator",
"cursor",
"currency_exchange",
"customer_support",
"dam",
"data_backup",
"data_configuration",
"data_encryption",
"data_protection",
"data_recovery",
"database",
"data_sheet",
"debt",
"decision",
"delete_column",
"delete_database",
"department",
"delete_row",
"deployment",
"dislike",
"disapprove",
"disclaimer",
"display",
"document",
"do_not_insert",
"do_not_mix",
"do_not_inhale",
"donate",
"down",
"doughnut_chart",
"down_left",
"down_right",
"download",
"edit_image",
"electrical_sensor",
"electrical_threshold",
"electricity",
"electro_devices",
"electronics",
"empty_battery",
"empty_filter",
"empty_trash",
"end_call",
"engineering",
"entering_heaven_aliv",
"expand",
"export",
"expired",
"factory",
"factory_breakdown",
"external",
"faq",
"feed_in",
"file",
"feedback",
"film",
"filled_filter",
"filing_cabinet",
"film_reel",
"flash_auto",
"fine_print",
"flash_off",
"flash_on",
"flow_chart",
"folder",
"frame",
"full_battery",
"full_trash",
"gallery",
"generic_sorting_asc",
"generic_sorting_desc",
"genealogy",
"globe",
"good_decision",
"headset",
"grid",
"graduation_cap",
"heat_map",
"high_priority",
"high_battery",
"image_file",
"home",
"idea",
"import",
"in_transit",
"integrated_webcam",
"inspection",
"invite",
"internal",
"ipad",
"info",
"iphone",
"kindle",
"key",
"landscape",
"left",
"left_down",
"left_up",
"leave",
"like_placeholder",
"light_at_the_end_of_",
"library",
"line_chart",
"link",
"like",
"lock",
"list",
"lock_landscape",
"low_battery",
"lock_portrait",
"low_priority",
"make_decision",
"medium_priority",
"manager",
"menu",
"middle_battery",
"minus",
"missed_call",
"mind_map",
"mms",
"multiple_cameras",
"money_transfer",
"music",
"multiple_devices",
"multiple_smartphones",
"multiple_inputs",
"negative_dynamic",
"neutral_decision",
"night_landscape",
"news",
"neutral_trading",
"night_portrait",
"no_idea",
"next",
"no_video",
"nook",
"ok",
"org_unit",
"opened_folder",
"old_time_camera",
"online_support",
"organization",
"package",
"paid",
"parallel_tasks",
"overtime",
"panorama",
"phone",
"phone_android",
"photo_reel",
"pie_chart",
"picture",
"planner",
"plus",
"podium_with_audience",
"podium_without_speak",
"podium_with_speaker",
"previous",
"portrait_mode",
"positive_dynamic",
"privacy",
"process",
"puzzle",
"questions",
"print",
"radar_plot",
"rating",
"ratings",
"reading",
"redo",
"reading_ebook",
"refresh",
"registered_trademark",
"right",
"reuse",
"remove_image",
"right_down",
"right_up",
"rotate_to_portrait",
"rules",
"rotate_camera",
"rotate_to_landscape",
"ruler",
"scatter_plot",
"search",
"safe",
"self_service_kiosk",
"selfie",
"serial_tasks",
"sales_performance",
"settings",
"services",
"share",
"shipped",
"sim_card",
"shop",
"service_mark",
"sim_card_chip",
"signature",
"smartphone_tablet",
"sound_recording_copy",
"sms",
"speaker",
"slr_back_side",
"start",
"stack_of_photos",
"statistics",
"sports_mode",
"support",
"synchronize",
"switch_camera",
"survey",
"tablet_android",
"template",
"trademark",
"todo_list",
"touchscreen_smartpho",
"timeline",
"tree_structure",
"undo",
"up_left",
"two_smartphones",
"unlock",
"up",
"up_right",
"upload",
"video_call",
"video_file",
"view_details",
"video_projector",
"vip",
"voice_presentation",
"webcam",
"voicemail",
"workflow",
"about",
"accept_database",
"add_image",
"add_column",
"add_database",
"add_row",
];
'alphabetical_sorting',
'alphabetical_sorting',
'alarm_clock',
'area_chart',
'approval',
'answers',
'approve',
'assistant',
'automotive',
'automatic',
'bad_decision',
'bar_chart',
'bearish',
'biomass',
'biohazard',
'binoculars',
'bookmark',
'briefcase',
'biotech',
'broken_link',
'business',
'bullish',
'business_contact',
'businesswoman',
'cable_release',
'calculator',
'businessman',
'calendar',
'butting_in',
'call_transfer',
'callback',
'camcorder',
'camera',
'camcorder_pro',
'cancel',
'camera_addon',
'camera_identificatio',
'capacitor',
'candle_sticks',
'checkmark',
'circuit',
'charge_battery',
'clear_filters',
'clapperboard',
'clock',
'close_up_mode',
'collaboration',
'cell_phone',
'collapse',
'collect',
'cloth',
'combo_chart',
'comments',
'conference_call',
'compact_camera',
'contacts',
'copyleft',
'copyright',
'crystal_oscillator',
'cursor',
'currency_exchange',
'customer_support',
'dam',
'data_backup',
'data_configuration',
'data_encryption',
'data_protection',
'data_recovery',
'database',
'data_sheet',
'debt',
'decision',
'delete_column',
'delete_database',
'department',
'delete_row',
'deployment',
'dislike',
'disapprove',
'disclaimer',
'display',
'document',
'do_not_insert',
'do_not_mix',
'do_not_inhale',
'donate',
'down',
'doughnut_chart',
'down_left',
'down_right',
'download',
'edit_image',
'electrical_sensor',
'electrical_threshold',
'electricity',
'electro_devices',
'electronics',
'empty_battery',
'empty_filter',
'empty_trash',
'end_call',
'engineering',
'entering_heaven_aliv',
'expand',
'export',
'expired',
'factory',
'factory_breakdown',
'external',
'faq',
'feed_in',
'file',
'feedback',
'film',
'filled_filter',
'filing_cabinet',
'film_reel',
'flash_auto',
'fine_print',
'flash_off',
'flash_on',
'flow_chart',
'folder',
'frame',
'full_battery',
'full_trash',
'gallery',
'generic_sorting_asc',
'generic_sorting_desc',
'genealogy',
'globe',
'good_decision',
'headset',
'grid',
'graduation_cap',
'heat_map',
'high_priority',
'high_battery',
'image_file',
'home',
'idea',
'import',
'in_transit',
'integrated_webcam',
'inspection',
'invite',
'internal',
'ipad',
'info',
'iphone',
'kindle',
'key',
'landscape',
'left',
'left_down',
'left_up',
'leave',
'like_placeholder',
'light_at_the_end_of_',
'library',
'line_chart',
'link',
'like',
'lock',
'list',
'lock_landscape',
'low_battery',
'lock_portrait',
'low_priority',
'make_decision',
'medium_priority',
'manager',
'menu',
'middle_battery',
'minus',
'missed_call',
'mind_map',
'mms',
'multiple_cameras',
'money_transfer',
'music',
'multiple_devices',
'multiple_smartphones',
'multiple_inputs',
'negative_dynamic',
'neutral_decision',
'night_landscape',
'news',
'neutral_trading',
'night_portrait',
'no_idea',
'next',
'no_video',
'nook',
'ok',
'org_unit',
'opened_folder',
'old_time_camera',
'online_support',
'organization',
'package',
'paid',
'parallel_tasks',
'overtime',
'panorama',
'phone',
'phone_android',
'photo_reel',
'pie_chart',
'picture',
'planner',
'plus',
'podium_with_audience',
'podium_without_speak',
'podium_with_speaker',
'previous',
'portrait_mode',
'positive_dynamic',
'privacy',
'process',
'puzzle',
'questions',
'print',
'radar_plot',
'rating',
'ratings',
'reading',
'redo',
'reading_ebook',
'refresh',
'registered_trademark',
'right',
'reuse',
'remove_image',
'right_down',
'right_up',
'rotate_to_portrait',
'rules',
'rotate_camera',
'rotate_to_landscape',
'ruler',
'scatter_plot',
'search',
'safe',
'self_service_kiosk',
'selfie',
'serial_tasks',
'sales_performance',
'settings',
'services',
'share',
'shipped',
'sim_card',
'shop',
'service_mark',
'sim_card_chip',
'signature',
'smartphone_tablet',
'sound_recording_copy',
'sms',
'speaker',
'slr_back_side',
'start',
'stack_of_photos',
'statistics',
'sports_mode',
'support',
'synchronize',
'switch_camera',
'survey',
'tablet_android',
'template',
'trademark',
'todo_list',
'touchscreen_smartpho',
'timeline',
'tree_structure',
'undo',
'up_left',
'two_smartphones',
'unlock',
'up',
'up_right',
'upload',
'video_call',
'video_file',
'view_details',
'video_projector',
'vip',
'voice_presentation',
'webcam',
'voicemail',
'workflow',
'about',
'accept_database',
'add_image',
'add_column',
'add_database',
'add_row',
]
module.exports = [
{
url: "/colorfulIcon/getList",
type: "post",
url: '/colorfulIcon/getList',
type: 'post',
response(config) {
const { title, pageNo = 1, pageSize = 72 } = config.body;
const { title, pageNo = 1, pageSize = 72 } = config.body
let mockList = data.filter((item) => {
if (title && item.indexOf(title) < 0) return false;
return true;
});
if (title && item.indexOf(title) < 0) return false
return true
})
const pageList = mockList.filter(
(item, index) =>
index < pageSize * pageNo && index >= pageSize * (pageNo - 1)
);
)
return {
code: 200,
msg: "success",
msg: 'success',
totalCount: mockList.length,
data: pageList,
};
}
},
},
];
]

View File

@ -1,43 +1,43 @@
const { mock } = require("mockjs");
const { mock } = require('mockjs')
const List = [];
const count = 999;
let num = 0;
const List = []
const count = 999
let num = 0
for (let i = 0; i < count; i++) {
List.push(
mock({
uuid: "@uuid",
uuid: '@uuid',
image: `https://picsum.photos/300/600?random=${num++}`,
title: "@ctitle",
description: "@csentence",
link: "https://www.baidu.com",
price: "@integer(100, 500)",
"status|1": [1, 0],
"isRecommend|1": [1, 0],
title: '@ctitle',
description: '@csentence',
link: 'https://www.baidu.com',
price: '@integer(100, 500)',
'status|1': [1, 0],
'isRecommend|1': [1, 0],
})
);
)
}
module.exports = [
{
url: "/goodsList/getList",
type: "post",
url: '/goodsList/getList',
type: 'post',
response(config) {
const { title = "", pageNo = 1, pageSize = 20 } = config.body;
const { title = '', pageNo = 1, pageSize = 20 } = config.body
let mockList = List.filter((item) => {
if (title && item.title.indexOf(title) < 0) return false;
return true;
});
if (title && item.title.indexOf(title) < 0) return false
return true
})
const pageList = mockList.filter(
(item, index) =>
index < pageSize * pageNo && index >= pageSize * (pageNo - 1)
);
)
return {
code: 200,
msg: "success",
msg: 'success',
totalCount: count,
data: pageList,
};
}
},
},
];
]

File diff suppressed because it is too large Load Diff

View File

@ -1,51 +1,51 @@
module.exports = [
{
url: "/menuManagement/getTree",
type: "post",
url: '/menuManagement/getTree',
type: 'post',
response() {
return {
code: 200,
msg: "success",
msg: 'success',
totalCount: 999,
data: [
{
id: "root",
label: "全部角色",
id: 'root',
label: '全部角色',
children: [
{
id: "@id",
permission: "admin",
label: "admin角色",
id: '@id',
permission: 'admin',
label: 'admin角色',
},
{
id: "@id",
permission: "editor",
label: "editor角色",
id: '@id',
permission: 'editor',
label: 'editor角色',
},
],
},
],
};
}
},
},
{
url: "/menuManagement/doEdit",
type: "post",
url: '/menuManagement/doEdit',
type: 'post',
response() {
return {
code: 200,
msg: "模拟保存成功",
};
msg: '模拟保存成功',
}
},
},
{
url: "/menuManagement/doDelete",
type: "post",
url: '/menuManagement/doDelete',
type: 'post',
response() {
return {
code: 200,
msg: "模拟删除成功",
};
msg: '模拟删除成功',
}
},
},
];
]

View File

@ -1,33 +1,33 @@
const data = [
{
title:
"鸣谢尤雨溪、蒋豪群、element-ui、唐金州、花裤衩、贤心、iView、uView的开源项目给我带来的很多的灵感弱小的人才习惯嘲讽与否定内心强大的人从不吝啬赞美与鼓励人生在世得到每个人的认可几乎是痴心妄想我也只是一条略懂前端的咸鱼可我仍一直怀揣着改变世界的梦想希望我们每个人不管过程怎样结局都是美好的。",
'鸣谢尤雨溪、蒋豪群、element-ui、唐金州、花裤衩、贤心、iView、uView的开源项目给我带来的很多的灵感弱小的人才习惯嘲讽与否定内心强大的人从不吝啬赞美与鼓励人生在世得到每个人的认可几乎是痴心妄想我也只是一条略懂前端的咸鱼可我仍一直怀揣着改变世界的梦想希望我们每个人不管过程怎样结局都是美好的。',
closable: false,
type: "success",
type: 'success',
},
{
title:
"作者寄语感谢Star感恩相遇愿世间美好与我们环环相扣加油屏幕前的我们打破桎梏坚守初心。其实人生改变命运的机会并没有太多我们并不是不优秀我们也并不是一无是处我们也希望驻足山巅被众人仰望也许我们缺少的只是一个机会缺少的只是生命中的导师我希望这个框架帮助到更多的人希望有一天我们面试的时候不再胆怯希望有一天别人看到的不仅仅是你的努力还有你的功成名就出人头地。",
'作者寄语感谢Star感恩相遇愿世间美好与我们环环相扣加油屏幕前的我们打破桎梏坚守初心。其实人生改变命运的机会并没有太多我们并不是不优秀我们也并不是一无是处我们也希望驻足山巅被众人仰望也许我们缺少的只是一个机会缺少的只是生命中的导师我希望这个框架帮助到更多的人希望有一天我们面试的时候不再胆怯希望有一天别人看到的不仅仅是你的努力还有你的功成名就出人头地。',
closable: false,
type: "warning",
type: 'warning',
},
{
title:
"随笔:我一直在寻找开源的真谛,我一直再想什么是开源,我一开始觉得免费就是开源,好像又不是。我理解的开源是:你也开源,我也开源,大家一起贡献,相互帮助。我最担心的事情是:我一个小人物,去伺候一众的伸手党,我想,这不是开源该有的氛围。我还太年轻,不懂什么是格局,我只知道,无私的帮助他人,能给我带来快乐,却不能给我带来收入,当然,有时候,快乐对我来说就已经足够了。可惜我是一个人,没有精力帮助到每一个人,可惜这个世界需要赚钱,才能过上平凡的生活,可惜了我的梦想,这个物欲横流的时代,理想主义的我们,即使内心坚决如铁,也似乎寸步难行。",
'随笔:我一直在寻找开源的真谛,我一直再想什么是开源,我一开始觉得免费就是开源,好像又不是。我理解的开源是:你也开源,我也开源,大家一起贡献,相互帮助。我最担心的事情是:我一个小人物,去伺候一众的伸手党,我想,这不是开源该有的氛围。我还太年轻,不懂什么是格局,我只知道,无私的帮助他人,能给我带来快乐,却不能给我带来收入,当然,有时候,快乐对我来说就已经足够了。可惜我是一个人,没有精力帮助到每一个人,可惜这个世界需要赚钱,才能过上平凡的生活,可惜了我的梦想,这个物欲横流的时代,理想主义的我们,即使内心坚决如铁,也似乎寸步难行。',
closable: false,
type: "success",
type: 'success',
},
];
]
module.exports = [
{
url: "/notice/getList",
type: "post",
url: '/notice/getList',
type: 'post',
response() {
return {
code: 200,
msg: "success",
msg: 'success',
data,
};
}
},
},
];
]

View File

@ -1,42 +1,42 @@
const { mock } = require("mockjs");
const { mock } = require('mockjs')
module.exports = [
{
url: "/personalCenter/getList",
type: "post",
url: '/personalCenter/getList',
type: 'post',
response(config) {
return {
code: 200,
msg: "success",
msg: 'success',
totalCount: 999,
data: mock({
"data|10": [
'data|10': [
{
id: "@id",
id: '@id',
},
],
}).data,
};
}
},
},
{
url: "/personalCenter/doEdit",
type: "post",
url: '/personalCenter/doEdit',
type: 'post',
response() {
return {
code: 200,
msg: "模拟保存成功",
};
msg: '模拟保存成功',
}
},
},
{
url: "/personalCenter/doDelete",
type: "post",
url: '/personalCenter/doDelete',
type: 'post',
response() {
return {
code: 200,
msg: "模拟删除成功",
};
msg: '模拟删除成功',
}
},
},
];
]

File diff suppressed because it is too large Load Diff

View File

@ -1,53 +1,53 @@
const totalCount = 2;
const totalCount = 2
const List = [
{
id: "@id",
permission: "admin",
id: '@id',
permission: 'admin',
},
{
id: "@id",
permission: "editor",
id: '@id',
permission: 'editor',
},
];
]
module.exports = [
{
url: "/roleManagement/getList",
type: "post",
url: '/roleManagement/getList',
type: 'post',
response(config) {
const { title = "", pageNo = 1, pageSize = 20 } = config.body;
const { title = '', pageNo = 1, pageSize = 20 } = config.body
let mockList = List.filter((item) => {
return !(title && item.title.indexOf(title) < 0);
});
return !(title && item.title.indexOf(title) < 0)
})
const pageList = mockList.filter(
(item, index) =>
index < pageSize * pageNo && index >= pageSize * (pageNo - 1)
);
)
return {
code: 200,
msg: "success",
msg: 'success',
totalCount,
data: pageList,
};
}
},
},
{
url: "/roleManagement/doEdit",
type: "post",
url: '/roleManagement/doEdit',
type: 'post',
response() {
return {
code: 200,
msg: "模拟保存成功",
};
msg: '模拟保存成功',
}
},
},
{
url: "/roleManagement/doDelete",
type: "post",
url: '/roleManagement/doDelete',
type: 'post',
response() {
return {
code: 200,
msg: "模拟删除成功",
};
msg: '模拟删除成功',
}
},
},
];
]

View File

@ -1,317 +1,317 @@
const data = [
{
path: "/",
component: "Layout",
redirect: "index",
path: '/',
component: 'Layout',
redirect: 'index',
children: [
{
path: "index",
name: "Index",
component: "@/views/index/index",
path: 'index',
name: 'Index',
component: '@/views/index/index',
meta: {
title: "首页",
icon: "home",
title: '首页',
icon: 'home',
affix: true,
},
},
],
},
{
path: "/personnelManagement",
component: "Layout",
redirect: "noRedirect",
name: "PersonnelManagement",
meta: { title: "人员", icon: "users-cog", permissions: ["admin"] },
path: '/personnelManagement',
component: 'Layout',
redirect: 'noRedirect',
name: 'PersonnelManagement',
meta: { title: '人员', icon: 'users-cog', permissions: ['admin'] },
children: [
{
path: "userManagement",
name: "UserManagement",
component: "@/views/personnelManagement/userManagement/index",
meta: { title: "用户管理" },
path: 'userManagement',
name: 'UserManagement',
component: '@/views/personnelManagement/userManagement/index',
meta: { title: '用户管理' },
},
{
path: "roleManagement",
name: "RoleManagement",
component: "@/views/personnelManagement/roleManagement/index",
meta: { title: "角色管理" },
path: 'roleManagement',
name: 'RoleManagement',
component: '@/views/personnelManagement/roleManagement/index',
meta: { title: '角色管理' },
},
{
path: "menuManagement",
name: "MenuManagement",
component: "@/views/personnelManagement/menuManagement/index",
meta: { title: "菜单管理", badge: "New" },
path: 'menuManagement',
name: 'MenuManagement',
component: '@/views/personnelManagement/menuManagement/index',
meta: { title: '菜单管理', badge: 'New' },
},
],
},
{
path: "/vab",
component: "Layout",
redirect: "noRedirect",
name: "Vab",
path: '/vab',
component: 'Layout',
redirect: 'noRedirect',
name: 'Vab',
alwaysShow: true,
meta: { title: "组件", icon: "cloud" },
meta: { title: '组件', icon: 'cloud' },
children: [
{
path: "permissions",
name: "Permission",
component: "@/views/vab/permissions/index",
path: 'permissions',
name: 'Permission',
component: '@/views/vab/permissions/index',
meta: {
title: "权限控制",
permissions: ["admin", "editor"],
badge: "New",
title: '权限控制',
permissions: ['admin', 'editor'],
badge: 'New',
},
},
{
path: "icon",
component: "EmptyLayout",
redirect: "noRedirect",
name: "Icon",
path: 'icon',
component: 'EmptyLayout',
redirect: 'noRedirect',
name: 'Icon',
meta: {
title: "图标",
permissions: ["admin"],
title: '图标',
permissions: ['admin'],
},
children: [
{
path: "awesomeIcon",
name: "AwesomeIcon",
component: "@/views/vab/icon/index",
meta: { title: "常规图标" },
path: 'awesomeIcon',
name: 'AwesomeIcon',
component: '@/views/vab/icon/index',
meta: { title: '常规图标' },
},
{
path: "remixIcon",
name: "RemixIcon",
component: "@/views/vab/icon/remixIcon",
meta: { title: "小清新图标" },
path: 'remixIcon',
name: 'RemixIcon',
component: '@/views/vab/icon/remixIcon',
meta: { title: '小清新图标' },
},
{
path: "colorfulIcon",
name: "ColorfulIcon",
component: "@/views/vab/icon/colorfulIcon",
meta: { title: "多彩图标" },
path: 'colorfulIcon',
name: 'ColorfulIcon',
component: '@/views/vab/icon/colorfulIcon',
meta: { title: '多彩图标' },
},
],
},
{
path: "table",
component: "@/views/vab/table/index",
name: "Table",
path: 'table',
component: '@/views/vab/table/index',
name: 'Table',
meta: {
title: "表格",
permissions: ["admin"],
title: '表格',
permissions: ['admin'],
},
},
{
path: "map",
name: "Map",
component: "@/views/vab/map/index",
meta: { title: "地图", permissions: ["admin"], badge: "Pro" },
path: 'map',
name: 'Map',
component: '@/views/vab/map/index',
meta: { title: '地图', permissions: ['admin'], badge: 'Pro' },
},
{
path: "webSocket",
name: "WebSocket",
component: "@/views/vab/webSocket/index",
meta: { title: "webSocket", permissions: ["admin"] },
path: 'webSocket',
name: 'WebSocket',
component: '@/views/vab/webSocket/index',
meta: { title: 'webSocket', permissions: ['admin'] },
},
{
path: "form",
name: "Form",
component: "@/views/vab/form/index",
meta: { title: "表单", permissions: ["admin"] },
path: 'form',
name: 'Form',
component: '@/views/vab/form/index',
meta: { title: '表单', permissions: ['admin'] },
},
{
path: "element",
name: "Element",
component: "@/views/vab/element/index",
meta: { title: "常用组件", permissions: ["admin"] },
path: 'element',
name: 'Element',
component: '@/views/vab/element/index',
meta: { title: '常用组件', permissions: ['admin'] },
},
{
path: "tree",
name: "Tree",
component: "@/views/vab/tree/index",
meta: { title: "树", permissions: ["admin"] },
path: 'tree',
name: 'Tree',
component: '@/views/vab/tree/index',
meta: { title: '树', permissions: ['admin'] },
},
{
path: "card",
name: "Card",
component: "@/views/vab/card/index",
meta: { title: "卡片", permissions: ["admin"] },
path: 'card',
name: 'Card',
component: '@/views/vab/card/index',
meta: { title: '卡片', permissions: ['admin'] },
},
{
path: "verify",
name: "Verify",
component: "@/views/vab/verify/index",
meta: { title: "验证码", permissions: ["admin"] },
path: 'verify',
name: 'Verify',
component: '@/views/vab/verify/index',
meta: { title: '验证码', permissions: ['admin'] },
},
{
path: "menu1",
component: "@/views/vab/nested/menu1/index",
name: "Menu1",
path: 'menu1',
component: '@/views/vab/nested/menu1/index',
name: 'Menu1',
alwaysShow: true,
meta: {
title: "嵌套路由 1",
permissions: ["admin"],
title: '嵌套路由 1',
permissions: ['admin'],
},
children: [
{
path: "menu1-1",
name: "Menu1-1",
path: 'menu1-1',
name: 'Menu1-1',
alwaysShow: true,
meta: { title: "嵌套路由 1-1" },
component: "@/views/vab/nested/menu1/menu1-1/index",
meta: { title: '嵌套路由 1-1' },
component: '@/views/vab/nested/menu1/menu1-1/index',
children: [
{
path: "menu1-1-1",
name: "Menu1-1-1",
meta: { title: "嵌套路由 1-1-1" },
component: "@/views/vab/nested/menu1/menu1-1/menu1-1-1/index",
path: 'menu1-1-1',
name: 'Menu1-1-1',
meta: { title: '嵌套路由 1-1-1' },
component: '@/views/vab/nested/menu1/menu1-1/menu1-1-1/index',
},
],
},
],
},
{
path: "magnifier",
name: "Magnifier",
component: "@/views/vab/magnifier/index",
meta: { title: "放大镜", permissions: ["admin"] },
path: 'magnifier',
name: 'Magnifier',
component: '@/views/vab/magnifier/index',
meta: { title: '放大镜', permissions: ['admin'] },
},
{
path: "echarts",
name: "Echarts",
component: "@/views/vab/echarts/index",
meta: { title: "图表", permissions: ["admin"] },
path: 'echarts',
name: 'Echarts',
component: '@/views/vab/echarts/index',
meta: { title: '图表', permissions: ['admin'] },
},
{
path: "loading",
name: "Loading",
component: "@/views/vab/loading/index",
meta: { title: "loading", permissions: ["admin"] },
path: 'loading',
name: 'Loading',
component: '@/views/vab/loading/index',
meta: { title: 'loading', permissions: ['admin'] },
},
{
path: "player",
name: "Player",
component: "@/views/vab/player/index",
meta: { title: "视频播放器", permissions: ["admin"] },
path: 'player',
name: 'Player',
component: '@/views/vab/player/index',
meta: { title: '视频播放器', permissions: ['admin'] },
},
{
path: "markdownEditor",
name: "MarkdownEditor",
component: "@/views/vab/markdownEditor/index",
meta: { title: "markdown编辑器", permissions: ["admin"] },
path: 'markdownEditor',
name: 'MarkdownEditor',
component: '@/views/vab/markdownEditor/index',
meta: { title: 'markdown编辑器', permissions: ['admin'] },
},
{
path: "editor",
name: "Editor",
component: "@/views/vab/editor/index",
meta: { title: "富文本编辑器", permissions: ["admin"], badge: "New" },
path: 'editor',
name: 'Editor',
component: '@/views/vab/editor/index',
meta: { title: '富文本编辑器', permissions: ['admin'], badge: 'New' },
},
{
path: "backToTop",
name: "BackToTop",
component: "@/views/vab/backToTop/index",
meta: { title: "返回顶部", permissions: ["admin"] },
path: 'backToTop',
name: 'BackToTop',
component: '@/views/vab/backToTop/index',
meta: { title: '返回顶部', permissions: ['admin'] },
},
{
path: "lodash",
name: "Lodash",
component: "@/views/vab/lodash/index",
meta: { title: "lodash", permissions: ["admin"] },
path: 'lodash',
name: 'Lodash',
component: '@/views/vab/lodash/index',
meta: { title: 'lodash', permissions: ['admin'] },
},
{
path: "imgComparison",
name: "ImgComparison",
component: "@/views/vab/imgComparison/index",
meta: { title: "图像拖拽比对", permissions: ["admin"] },
path: 'imgComparison',
name: 'ImgComparison',
component: '@/views/vab/imgComparison/index',
meta: { title: '图像拖拽比对', permissions: ['admin'] },
},
{
path: "smallComponents",
name: "SmallComponents",
component: "@/views/vab/smallComponents/index",
meta: { title: "小组件", permissions: ["admin"] },
path: 'smallComponents',
name: 'SmallComponents',
component: '@/views/vab/smallComponents/index',
meta: { title: '小组件', permissions: ['admin'] },
},
{
path: "upload",
name: "Upload",
component: "@/views/vab/upload/index",
meta: { title: "上传", permissions: ["admin"] },
path: 'upload',
name: 'Upload',
component: '@/views/vab/upload/index',
meta: { title: '上传', permissions: ['admin'] },
},
{
path: "log",
name: "Log",
component: "@/views/vab/errorLog/index",
meta: { title: "错误日志模拟", permissions: ["admin"] },
path: 'log',
name: 'Log',
component: '@/views/vab/errorLog/index',
meta: { title: '错误日志模拟', permissions: ['admin'] },
},
{
path: "more",
name: "More",
component: "@/views/vab/more/index",
meta: { title: "关于", permissions: ["admin"] },
path: 'more',
name: 'More',
component: '@/views/vab/more/index',
meta: { title: '关于', permissions: ['admin'] },
},
],
},
{
path: "/mall",
component: "Layout",
redirect: "noRedirect",
name: "Mall",
path: '/mall',
component: 'Layout',
redirect: 'noRedirect',
name: 'Mall',
meta: {
title: "商城",
icon: "shopping-cart",
permissions: ["admin"],
title: '商城',
icon: 'shopping-cart',
permissions: ['admin'],
},
children: [
{
path: "pay",
name: "Pay",
component: "@/views/mall/pay/index",
path: 'pay',
name: 'Pay',
component: '@/views/mall/pay/index',
meta: {
title: "支付",
title: '支付',
noKeepAlive: true,
},
children: null,
},
{
path: "goodsList",
name: "GoodsList",
component: "@/views/mall/goodsList/index",
path: 'goodsList',
name: 'GoodsList',
component: '@/views/mall/goodsList/index',
meta: {
title: "商品列表",
title: '商品列表',
},
},
],
},
{
path: "/error",
component: "EmptyLayout",
redirect: "noRedirect",
name: "Error",
meta: { title: "错误页", icon: "bug" },
path: '/error',
component: 'EmptyLayout',
redirect: 'noRedirect',
name: 'Error',
meta: { title: '错误页', icon: 'bug' },
children: [
{
path: "401",
name: "Error401",
component: "@/views/401",
meta: { title: "401" },
path: '401',
name: 'Error401',
component: '@/views/401',
meta: { title: '401' },
},
{
path: "404",
name: "Error404",
component: "@/views/404",
meta: { title: "404" },
path: '404',
name: 'Error404',
component: '@/views/404',
meta: { title: '404' },
},
],
},
];
]
module.exports = [
{
url: "/menu/navigate",
type: "post",
url: '/menu/navigate',
type: 'post',
response() {
return { code: 200, msg: "success", data: data };
return { code: 200, msg: 'success', data: data }
},
},
];
]

View File

@ -1,88 +1,88 @@
const { mock } = require("mockjs");
const { handleRandomImage } = require("../utils");
const { mock } = require('mockjs')
const { handleRandomImage } = require('../utils')
const List = [];
const count = 999;
const List = []
const count = 999
for (let i = 0; i < count; i++) {
List.push(
mock({
uuid: "@uuid",
id: "@id",
title: "@csentence(1, 2)",
"status|1": ["published", "draft", "deleted"],
author: "@cname",
datetime: "@datetime",
pageViews: "@integer(300, 5000)",
uuid: '@uuid',
id: '@id',
title: '@csentence(1, 2)',
'status|1': ['published', 'draft', 'deleted'],
author: '@cname',
datetime: '@datetime',
pageViews: '@integer(300, 5000)',
img: handleRandomImage(200, 200),
smallImg: handleRandomImage(40, 40),
switch: "@boolean",
percent: "@integer(80,99)",
switch: '@boolean',
percent: '@integer(80,99)',
})
);
)
}
module.exports = [
{
url: "/table/getList",
type: "post",
url: '/table/getList',
type: 'post',
response(config) {
if (!config.body) {
return {
code: 200,
msg: "success",
msg: 'success',
totalCount: count,
data: mock({
"data|50": [
'data|50': [
{
id: "@id",
title: "@csentence(1, 2)",
"status|1": ["published", "draft", "deleted"],
author: "@cname",
datetime: "@datetime",
pageViews: "@integer(300, 5000)",
id: '@id',
title: '@csentence(1, 2)',
'status|1': ['published', 'draft', 'deleted'],
author: '@cname',
datetime: '@datetime',
pageViews: '@integer(300, 5000)',
img: handleRandomImage(200, 200),
smallImg: handleRandomImage(40, 40),
switch: "@boolean",
percent: "@integer(80,99)",
switch: '@boolean',
percent: '@integer(80,99)',
},
],
}).data,
};
}
}
const { title = "", pageNo = 1, pageSize = 20 } = config.body;
const { title = '', pageNo = 1, pageSize = 20 } = config.body
let mockList = List.filter((item) => {
return !(title && item.title.indexOf(title) < 0);
});
return !(title && item.title.indexOf(title) < 0)
})
const pageList = mockList.filter(
(item, index) =>
index < pageSize * pageNo && index >= pageSize * (pageNo - 1)
);
)
return {
code: 200,
msg: "success",
msg: 'success',
totalCount: count,
data: pageList,
};
}
},
},
{
url: "/table/doEdit",
type: "post",
url: '/table/doEdit',
type: 'post',
response() {
return {
code: 200,
msg: "模拟保存成功",
};
msg: '模拟保存成功',
}
},
},
{
url: "/table/doDelete",
type: "post",
url: '/table/doDelete',
type: 'post',
response() {
return {
code: 200,
msg: "模拟删除成功",
};
msg: '模拟删除成功',
}
},
},
];
]

View File

@ -1,38 +1,38 @@
const data = [
{
id: "1",
parentId: "0",
name: "root",
title: "root",
text: "root",
value: "1",
id: '1',
parentId: '0',
name: 'root',
title: 'root',
text: 'root',
value: '1',
rank: 1,
children: [
{
id: "32816b88ff72423f960e7d492a386131",
parentId: "1",
name: "一级",
title: "一级",
text: "一级",
value: "32816b88ff72423f960e7d492a386131",
id: '32816b88ff72423f960e7d492a386131',
parentId: '1',
name: '一级',
title: '一级',
text: '一级',
value: '32816b88ff72423f960e7d492a386131',
rank: 2,
children: [
{
id: "9e11afc35d55475fb0bd3164b9684cbe",
parentId: "32816b88ff72423f960e7d492a386131",
name: "二级",
title: "二级",
text: "二级",
value: "9e11afc35d55475fb0bd3164b9684cbe",
id: '9e11afc35d55475fb0bd3164b9684cbe',
parentId: '32816b88ff72423f960e7d492a386131',
name: '二级',
title: '二级',
text: '二级',
value: '9e11afc35d55475fb0bd3164b9684cbe',
rank: 3,
children: [
{
id: "4cc1b04635e4444292526c5391699077",
parentId: "9e11afc35d55475fb0bd3164b9684cbe",
name: "三级",
title: "三级",
text: "三级",
value: "4cc1b04635e4444292526c5391699077",
id: '4cc1b04635e4444292526c5391699077',
parentId: '9e11afc35d55475fb0bd3164b9684cbe',
name: '三级',
title: '三级',
text: '三级',
value: '4cc1b04635e4444292526c5391699077',
rank: 4,
children: [],
},
@ -42,13 +42,13 @@ const data = [
},
],
},
];
]
module.exports = [
{
url: "/tree/list",
type: "post",
url: '/tree/list',
type: 'post',
response() {
return { code: 200, msg: "success", data };
return { code: 200, msg: 'success', data }
},
},
];
]

View File

@ -1,95 +1,95 @@
const accessTokens = {
admin: "admin-accessToken",
editor: "editor-accessToken",
test: "test-accessToken",
};
admin: 'admin-accessToken',
editor: 'editor-accessToken',
test: 'test-accessToken',
}
module.exports = [
{
url: "/publicKey",
type: "post",
url: '/publicKey',
type: 'post',
response() {
return {
code: 200,
msg: "success",
msg: 'success',
data: {
mockServer: true,
publicKey:
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBT2vr+dhZElF73FJ6xiP181txKWUSNLPQQlid6DUJhGAOZblluafIdLmnUyKE8mMHhT3R+Ib3ssZcJku6Hn72yHYj/qPkCGFv0eFo7G+GJfDIUeDyalBN0QsuiE/XzPHJBuJDfRArOiWvH0BXOv5kpeXSXM8yTt5Na1jAYSiQ/wIDAQAB",
'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBT2vr+dhZElF73FJ6xiP181txKWUSNLPQQlid6DUJhGAOZblluafIdLmnUyKE8mMHhT3R+Ib3ssZcJku6Hn72yHYj/qPkCGFv0eFo7G+GJfDIUeDyalBN0QsuiE/XzPHJBuJDfRArOiWvH0BXOv5kpeXSXM8yTt5Na1jAYSiQ/wIDAQAB',
},
};
}
},
},
{
url: "/login",
type: "post",
url: '/login',
type: 'post',
response(config) {
const { username } = config.body;
const accessToken = accessTokens[username];
const { username } = config.body
const accessToken = accessTokens[username]
if (!accessToken) {
return {
code: 500,
msg: "帐户或密码不正确。",
};
msg: '帐户或密码不正确。',
}
}
return {
code: 200,
msg: "success",
msg: 'success',
data: { accessToken },
};
}
},
},
{
url: "/register",
type: "post",
url: '/register',
type: 'post',
response() {
return {
code: 200,
msg: "模拟注册成功",
};
msg: '模拟注册成功',
}
},
},
{
url: "/userInfo",
type: "post",
url: '/userInfo',
type: 'post',
response(config) {
const { accessToken } = config.body;
let permissions = ["admin"];
let username = "admin";
if ("admin-accessToken" === accessToken) {
permissions = ["admin"];
username = "admin";
const { accessToken } = config.body
let permissions = ['admin']
let username = 'admin'
if ('admin-accessToken' === accessToken) {
permissions = ['admin']
username = 'admin'
}
if ("editor-accessToken" === accessToken) {
permissions = ["editor"];
username = "editor";
if ('editor-accessToken' === accessToken) {
permissions = ['editor']
username = 'editor'
}
if ("test-accessToken" === accessToken) {
permissions = ["admin", "editor"];
username = "test";
if ('test-accessToken' === accessToken) {
permissions = ['admin', 'editor']
username = 'test'
}
return {
code: 200,
msg: "success",
msg: 'success',
data: {
permissions,
username,
"avatar|1": [
"https://i.gtimg.cn/club/item/face/img/2/15922_100.gif",
"https://i.gtimg.cn/club/item/face/img/8/15918_100.gif",
'avatar|1': [
'https://i.gtimg.cn/club/item/face/img/2/15922_100.gif',
'https://i.gtimg.cn/club/item/face/img/8/15918_100.gif',
],
},
};
}
},
},
{
url: "/logout",
type: "post",
url: '/logout',
type: 'post',
response() {
return {
code: 200,
msg: "success",
};
msg: 'success',
}
},
},
];
]

View File

@ -1,70 +1,70 @@
const totalCount = 3;
const totalCount = 3
const List = [
{
id: "@id",
username: "admin",
password: "admin",
email: "@email",
permissions: ["admin"],
datatime: "@datetime",
id: '@id',
username: 'admin',
password: 'admin',
email: '@email',
permissions: ['admin'],
datatime: '@datetime',
},
{
id: "@id",
username: "editor",
password: "editor",
email: "@email",
permissions: ["editor"],
datatime: "@datetime",
id: '@id',
username: 'editor',
password: 'editor',
email: '@email',
permissions: ['editor'],
datatime: '@datetime',
},
{
id: "@id",
username: "test",
password: "test",
email: "@email",
permissions: ["admin", "editor"],
datatime: "@datetime",
id: '@id',
username: 'test',
password: 'test',
email: '@email',
permissions: ['admin', 'editor'],
datatime: '@datetime',
},
];
]
module.exports = [
{
url: "/userManagement/getList",
type: "post",
url: '/userManagement/getList',
type: 'post',
response(config) {
const { title = "", pageNo = 1, pageSize = 20 } = config.body;
const { title = '', pageNo = 1, pageSize = 20 } = config.body
let mockList = List.filter((item) => {
if (title && item.title.indexOf(title) < 0) return false;
return true;
});
if (title && item.title.indexOf(title) < 0) return false
return true
})
const pageList = mockList.filter(
(item, index) =>
index < pageSize * pageNo && index >= pageSize * (pageNo - 1)
);
)
return {
code: 200,
msg: "success",
msg: 'success',
totalCount,
data: pageList,
};
}
},
},
{
url: "/userManagement/doEdit",
type: "post",
url: '/userManagement/doEdit',
type: 'post',
response() {
return {
code: 200,
msg: "模拟保存成功",
};
msg: '模拟保存成功',
}
},
},
{
url: "/userManagement/doDelete",
type: "post",
url: '/userManagement/doDelete',
type: 'post',
response() {
return {
code: 200,
msg: "模拟删除成功",
};
msg: '模拟删除成功',
}
},
},
];
]

View File

@ -3,14 +3,14 @@
* @description 导入所有 controller 模块npm run serve时在node环境中自动输出controller文件夹下Mock接口请勿修改
*/
const { handleMockArray } = require("./utils");
const { handleMockArray } = require('./utils')
const mocks = [];
const mockArray = handleMockArray();
const mocks = []
const mockArray = handleMockArray()
mockArray.forEach((item) => {
const obj = require(item);
mocks.push(...obj);
});
const obj = require(item)
mocks.push(...obj)
})
module.exports = {
mocks,
};
}

View File

@ -1,10 +1,10 @@
const chokidar = require("chokidar");
const bodyParser = require("body-parser");
const chalk = require("chalk");
const path = require("path");
const Mock = require("mockjs");
const { baseURL } = require("../src/config/settings");
const mockDir = path.join(process.cwd(), "mock");
const chokidar = require('chokidar')
const bodyParser = require('body-parser')
const chalk = require('chalk')
const path = require('path')
const Mock = require('mockjs')
const { baseURL } = require('../src/config/settings')
const mockDir = path.join(process.cwd(), 'mock')
/**
*
@ -12,21 +12,21 @@ const mockDir = path.join(process.cwd(), "mock");
* @returns {{mockStartIndex: number, mockRoutesLength: number}}
*/
const registerRoutes = (app) => {
let mockLastIndex;
const { mocks } = require("./index.js");
let mockLastIndex
const { mocks } = require('./index.js')
const mocksForServer = mocks.map((route) => {
return responseFake(route.url, route.type, route.response);
});
return responseFake(route.url, route.type, route.response)
})
for (const mock of mocksForServer) {
app[mock.type](mock.url, mock.response);
mockLastIndex = app._router.stack.length;
app[mock.type](mock.url, mock.response)
mockLastIndex = app._router.stack.length
}
const mockRoutesLength = Object.keys(mocksForServer).length;
const mockRoutesLength = Object.keys(mocksForServer).length
return {
mockRoutesLength: mockRoutesLength,
mockStartIndex: mockLastIndex - mockRoutesLength,
};
};
}
}
/**
*
@ -38,56 +38,56 @@ const registerRoutes = (app) => {
const responseFake = (url, type, respond) => {
return {
url: new RegExp(`${baseURL}${url}`),
type: type || "get",
type: type || 'get',
response(req, res) {
res.status(200);
if (JSON.stringify(req.body) !== "{}") {
console.log(chalk.green(`> 请求地址:${req.path}`));
console.log(chalk.green(`> 请求参数:${JSON.stringify(req.body)}\n`));
res.status(200)
if (JSON.stringify(req.body) !== '{}') {
console.log(chalk.green(`> 请求地址:${req.path}`))
console.log(chalk.green(`> 请求参数:${JSON.stringify(req.body)}\n`))
} else {
console.log(chalk.green(`> 请求地址:${req.path}\n`));
console.log(chalk.green(`> 请求地址:${req.path}\n`))
}
res.json(
Mock.mock(respond instanceof Function ? respond(req, res) : respond)
);
)
},
};
};
}
}
/**
*
* @param app
*/
module.exports = (app) => {
app.use(bodyParser.json());
app.use(bodyParser.json())
app.use(
bodyParser.urlencoded({
extended: true,
})
);
)
const mockRoutes = registerRoutes(app);
let mockRoutesLength = mockRoutes.mockRoutesLength;
let mockStartIndex = mockRoutes.mockStartIndex;
const mockRoutes = registerRoutes(app)
let mockRoutesLength = mockRoutes.mockRoutesLength
let mockStartIndex = mockRoutes.mockStartIndex
chokidar
.watch(mockDir, {
ignoreInitial: true,
})
.on("all", (event) => {
if (event === "change" || event === "add") {
.on('all', (event) => {
if (event === 'change' || event === 'add') {
try {
app._router.stack.splice(mockStartIndex, mockRoutesLength);
app._router.stack.splice(mockStartIndex, mockRoutesLength)
Object.keys(require.cache).forEach((item) => {
if (item.includes(mockDir)) {
delete require.cache[require.resolve(item)];
delete require.cache[require.resolve(item)]
}
});
const mockRoutes = registerRoutes(app);
mockRoutesLength = mockRoutes.mockRoutesLength;
mockStartIndex = mockRoutes.mockStartIndex;
})
const mockRoutes = registerRoutes(app)
mockRoutesLength = mockRoutes.mockRoutesLength
mockStartIndex = mockRoutes.mockStartIndex
} catch (error) {
console.log(chalk.red(error));
console.log(chalk.red(error))
}
}
});
};
})
}

View File

@ -1,6 +1,6 @@
const { Random } = require("mockjs");
const { join } = require("path");
const fs = require("fs");
const { Random } = require('mockjs')
const { join } = require('path')
const fs = require('fs')
/**
* @author chuzhixin 1204505056@qq.com 不想保留author可删除
@ -10,7 +10,7 @@ const fs = require("fs");
* @returns {string}
*/
function handleRandomImage(width = 50, height = 50) {
return `https://picsum.photos/${width}/${height}?random=${Random.guid()}`;
return `https://picsum.photos/${width}/${height}?random=${Random.guid()}`
}
/**
@ -19,25 +19,25 @@ function handleRandomImage(width = 50, height = 50) {
* @returns {[]}
*/
function handleMockArray() {
const mockArray = [];
const mockArray = []
const getFiles = (jsonPath) => {
const jsonFiles = [];
const jsonFiles = []
const findJsonFile = (path) => {
const files = fs.readdirSync(path);
const files = fs.readdirSync(path)
files.forEach((item) => {
const fPath = join(path, item);
const stat = fs.statSync(fPath);
if (stat.isDirectory() === true) findJsonFile(item);
if (stat.isFile() === true) jsonFiles.push(item);
});
};
findJsonFile(jsonPath);
jsonFiles.forEach((item) => mockArray.push(`./controller/${item}`));
};
getFiles("mock/controller");
return mockArray;
const fPath = join(path, item)
const stat = fs.statSync(fPath)
if (stat.isDirectory() === true) findJsonFile(item)
if (stat.isFile() === true) jsonFiles.push(item)
})
}
findJsonFile(jsonPath)
jsonFiles.forEach((item) => mockArray.push(`./controller/${item}`))
}
getFiles('mock/controller')
return mockArray
}
module.exports = {
handleRandomImage,
handleMockArray,
};
}

View File

@ -16,7 +16,7 @@
"lint:style": "stylelint-config-prettier-check",
"inspect": "vue-cli-service inspect",
"template": "plop",
"clear": "rimraf node_modules&&cnpm i",
"clear": "rimraf node_modules&&npm install --registry=https://registry.npm.taobao.org&&cnpm i image-webpack-loader -D",
"use:npm": "nrm use npm",
"use:taobao": "nrm use taobao",
"update": "ncu -u&&cnpm i",

View File

@ -1,13 +1,13 @@
const viewGenerator = require("zx-templates/view/prompt");
const curdGenerator = require("zx-templates/curd/prompt");
const componentGenerator = require("zx-templates/component/prompt");
const mockGenerator = require("zx-templates/mock/prompt");
const vuexGenerator = require("zx-templates/vuex/prompt");
const viewGenerator = require('zx-templates/view/prompt')
const curdGenerator = require('zx-templates/curd/prompt')
const componentGenerator = require('zx-templates/component/prompt')
const mockGenerator = require('zx-templates/mock/prompt')
const vuexGenerator = require('zx-templates/vuex/prompt')
module.exports = (plop) => {
plop.setGenerator("view", viewGenerator);
plop.setGenerator("curd", curdGenerator);
plop.setGenerator("component", componentGenerator);
plop.setGenerator("mock&api", mockGenerator);
plop.setGenerator("vuex", vuexGenerator);
};
plop.setGenerator('view', viewGenerator)
plop.setGenerator('curd', curdGenerator)
plop.setGenerator('component', componentGenerator)
plop.setGenerator('mock&api', mockGenerator)
plop.setGenerator('vuex', vuexGenerator)
}

View File

@ -2,15 +2,15 @@ module.exports = {
printWidth: 80,
tabWidth: 2,
useTabs: false,
semi: true,
singleQuote: false,
quoteProps: "as-needed",
semi: false,
singleQuote: true,
quoteProps: 'as-needed',
jsxSingleQuote: false,
trailingComma: "es5",
trailingComma: 'es5',
bracketSpacing: true,
jsxBracketSameLine: false,
arrowParens: "always",
htmlWhitespaceSensitivity: "ignore",
arrowParens: 'always',
htmlWhitespaceSensitivity: 'ignore',
vueIndentScriptAndStyle: true,
endOfLine: "lf",
};
endOfLine: 'lf',
}

View File

@ -17,13 +17,13 @@
<meta name="author" content="<%= VUE_APP_AUTHOR %>" />
<link rel="stylesheet" href="<%= BASE_URL %>static/css/loading.css" />
<script>
var _hmt = _hmt || [];
(function () {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?7174bade1219f9cc272e7978f9523fc8";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
var _hmt = _hmt || []
;(function () {
var hm = document.createElement('script')
hm.src = 'https://hm.baidu.com/hm.js?7174bade1219f9cc272e7978f9523fc8'
var s = document.getElementsByTagName('script')[0]
s.parentNode.insertBefore(hm, s)
})()
</script>
</head>
<body>
@ -45,8 +45,8 @@
</div>
</div>
<script>
/^http(s*):\/\//.test(location.href) ||
alert("基于vue-admin-beautiful开发的项目需要部署到服务器下访问");
;/^http(s*):\/\//.test(location.href) ||
alert('基于vue-admin-beautiful开发的项目需要部署到服务器下访问')
</script>
</body>
</html>

View File

@ -6,7 +6,7 @@
<script>
export default {
name: "App",
name: 'App',
mounted() {},
};
}
</script>

View File

@ -1,9 +1,9 @@
import request from "@/utils/request";
import request from '@/utils/request'
export function getList(data) {
return request({
url: "/ad/getList",
method: "get",
url: '/ad/getList',
method: 'get',
data,
});
})
}

View File

@ -1,9 +1,9 @@
import request from "@/utils/request";
import request from '@/utils/request'
export function getList(data) {
return request({
url: "/changeLog/getList",
method: "post",
url: '/changeLog/getList',
method: 'post',
data,
});
})
}

View File

@ -1,9 +1,9 @@
import request from "@/utils/request";
import request from '@/utils/request'
export function getIconList(data) {
return request({
url: "/colorfulIcon/getList",
method: "post",
url: '/colorfulIcon/getList',
method: 'post',
data,
});
})
}

View File

@ -1,20 +1,20 @@
import request from "axios";
import request from 'axios'
export function getRepos(params) {
return request({
url: "https://api.github.com/repos/chuzhixin/vue-admin-beautiful",
method: "get",
url: 'https://api.github.com/repos/chuzhixin/vue-admin-beautiful',
method: 'get',
params,
timeout: 10000,
});
})
}
export function getStargazers(params) {
return request({
url:
"https://api.github.com/repos/chuzhixin/vue-admin-beautiful/stargazers",
method: "get",
'https://api.github.com/repos/chuzhixin/vue-admin-beautiful/stargazers',
method: 'get',
params,
timeout: 10000,
});
})
}

View File

@ -1,9 +1,9 @@
import request from "@/utils/request";
import request from '@/utils/request'
export function getList(data) {
return request({
url: "/goodsList/getList",
method: "post",
url: '/goodsList/getList',
method: 'post',
data,
});
})
}

View File

@ -1,9 +1,9 @@
import request from "@/utils/request";
import request from '@/utils/request'
export function getIconList(data) {
return request({
url: "/icon/getList",
method: "post",
url: '/icon/getList',
method: 'post',
data,
});
})
}

View File

@ -1,8 +1,8 @@
import request from "axios";
import request from 'axios'
export function getList() {
return request({
url: "https://cdn.jsdelivr.net/gh/prettier/prettier@master/docs/options.md",
method: "get",
});
url: 'https://cdn.jsdelivr.net/gh/prettier/prettier@master/docs/options.md',
method: 'get',
})
}

View File

@ -1,25 +1,25 @@
import request from "@/utils/request";
import request from '@/utils/request'
export function getTree(data) {
return request({
url: "/menuManagement/getTree",
method: "post",
url: '/menuManagement/getTree',
method: 'post',
data,
});
})
}
export function doEdit(data) {
return request({
url: "/menuManagement/doEdit",
method: "post",
url: '/menuManagement/doEdit',
method: 'post',
data,
});
})
}
export function doDelete(data) {
return request({
url: "/menuManagement/doDelete",
method: "post",
url: '/menuManagement/doDelete',
method: 'post',
data,
});
})
}

View File

@ -1,8 +1,8 @@
import request from "@/utils/request";
import request from '@/utils/request'
export function getNoticeList() {
return request({
url: "/notice/getList",
method: "post",
});
url: '/notice/getList',
method: 'post',
})
}

View File

@ -1,25 +1,25 @@
import request from "@/utils/request";
import request from '@/utils/request'
export function getList(data) {
return request({
url: "/personalCenter/getList",
method: "post",
url: '/personalCenter/getList',
method: 'post',
data,
});
})
}
export function doEdit(data) {
return request({
url: "/personalCenter/doEdit",
method: "post",
url: '/personalCenter/doEdit',
method: 'post',
data,
});
})
}
export function doDelete(data) {
return request({
url: "/personalCenter/doDelete",
method: "post",
url: '/personalCenter/doDelete',
method: 'post',
data,
});
})
}

View File

@ -1,8 +1,8 @@
import request from "@/utils/request";
import request from '@/utils/request'
export function getPublicKey() {
return request({
url: "/publicKey",
method: "post",
});
url: '/publicKey',
method: 'post',
})
}

View File

@ -1,9 +1,9 @@
import request from "@/utils/request";
import request from '@/utils/request'
export function getIconList(data) {
return request({
url: "/remixIcon/getList",
method: "post",
url: '/remixIcon/getList',
method: 'post',
data,
});
})
}

View File

@ -1,25 +1,25 @@
import request from "@/utils/request";
import request from '@/utils/request'
export function getList(data) {
return request({
url: "/roleManagement/getList",
method: "post",
url: '/roleManagement/getList',
method: 'post',
data,
});
})
}
export function doEdit(data) {
return request({
url: "/roleManagement/doEdit",
method: "post",
url: '/roleManagement/doEdit',
method: 'post',
data,
});
})
}
export function doDelete(data) {
return request({
url: "/roleManagement/doDelete",
method: "post",
url: '/roleManagement/doDelete',
method: 'post',
data,
});
})
}

View File

@ -1,9 +1,9 @@
import request from "@/utils/request";
import request from '@/utils/request'
export function getRouterList(data) {
return request({
url: "/menu/navigate",
method: "post",
url: '/menu/navigate',
method: 'post',
data,
});
})
}

View File

@ -1,25 +1,25 @@
import request from "@/utils/request";
import request from '@/utils/request'
export function getList(data) {
return request({
url: "/table/getList",
method: "post",
url: '/table/getList',
method: 'post',
data,
});
})
}
export function doEdit(data) {
return request({
url: "/table/doEdit",
method: "post",
url: '/table/doEdit',
method: 'post',
data,
});
})
}
export function doDelete(data) {
return request({
url: "/table/doDelete",
method: "post",
url: '/table/doDelete',
method: 'post',
data,
});
})
}

View File

@ -1,9 +1,9 @@
import request from "@/utils/request";
import request from '@/utils/request'
export function getTreeList(data) {
return request({
url: "/tree/list",
method: "post",
url: '/tree/list',
method: 'post',
data,
});
})
}

View File

@ -1,38 +1,38 @@
import request from "@/utils/request";
import { encryptedData } from "@/utils/encrypt";
import { loginRSA, tokenName } from "@/config/settings";
import request from '@/utils/request'
import { encryptedData } from '@/utils/encrypt'
import { loginRSA, tokenName } from '@/config/settings'
export async function login(data) {
if (loginRSA) {
data = await encryptedData(data);
data = await encryptedData(data)
}
return request({
url: "/login",
method: "post",
url: '/login',
method: 'post',
data,
});
})
}
export function getUserInfo(accessToken) {
return request({
url: "/userInfo",
method: "post",
url: '/userInfo',
method: 'post',
data: {
[tokenName]: accessToken,
},
});
})
}
export function logout() {
return request({
url: "/logout",
method: "post",
});
url: '/logout',
method: 'post',
})
}
export function register() {
return request({
url: "/register",
method: "post",
});
url: '/register',
method: 'post',
})
}

View File

@ -1,25 +1,25 @@
import request from "@/utils/request";
import request from '@/utils/request'
export function getList(data) {
return request({
url: "/userManagement/getList",
method: "post",
url: '/userManagement/getList',
method: 'post',
data,
});
})
}
export function doEdit(data) {
return request({
url: "/userManagement/doEdit",
method: "post",
url: '/userManagement/doEdit',
method: 'post',
data,
});
})
}
export function doDelete(data) {
return request({
url: "/userManagement/doDelete",
method: "post",
url: '/userManagement/doDelete',
method: 'post',
data,
});
})
}

View File

@ -1,8 +1,8 @@
import Vue from "vue";
import { ColorfullIcon } from "@/layouts/components";
import Vue from 'vue'
import { ColorfullIcon } from '@/layouts/components'
Vue.component("VabColorfulIcon", ColorfullIcon);
const req = require.context("./svg", false, /\.svg$/),
Vue.component('VabColorfulIcon', ColorfullIcon)
const req = require.context('./svg', false, /\.svg$/),
requireAll = (requireContext) => {
/*let a = requireContext.keys().map(requireContext);
let arr = [];
@ -12,6 +12,6 @@ const req = require.context("./svg", false, /\.svg$/),
arr.push(icon);
}
console.log(JSON.stringify(arr));*/
return requireContext.keys().map(requireContext);
};
requireAll(req);
return requireContext.keys().map(requireContext)
}
requireAll(req)

View File

@ -32,132 +32,132 @@
<script>
export default {
name: "SelectTreeTemplate",
name: 'SelectTreeTemplate',
props: {
/* 树形结构数据 */
treeOptions: {
type: Array,
default: () => {
return [];
return []
},
},
/* 单选/多选 */
selectType: {
type: String,
default: () => {
return "single";
return 'single'
},
},
/* 初始选中值key */
selectedKey: {
type: String,
default: () => {
return "";
return ''
},
},
/* 初始选中值name */
selectedValue: {
type: String,
default: () => {
return "";
return ''
},
},
/* 可做选择的层级 */
selectLevel: {
type: [String, Number],
default: () => {
return "";
return ''
},
},
/* 可清空选项 */
clearable: {
type: Boolean,
default: () => {
return true;
return true
},
},
},
data() {
return {
defaultProps: {
children: "children",
label: "name",
children: 'children',
label: 'name',
},
defaultSelectedKeys: [], //
currentNodeKey: this.selectedKey,
selectValue:
this.selectType == "multiple"
? this.selectedValue.split(",")
this.selectType == 'multiple'
? this.selectedValue.split(',')
: this.selectedValue, //label
selectKey:
this.selectType == "multiple"
? this.selectedKey.split(",")
this.selectType == 'multiple'
? this.selectedKey.split(',')
: this.selectedKey, //value
};
}
},
mounted() {
const that = this;
this.initTree();
const that = this
this.initTree()
},
methods: {
//
initTree() {
const that = this;
const that = this
if (that.selectedKey) {
that.defaultSelectedKeys = that.selectedKey.split(","); //
if (that.selectType == "single") {
that.$refs.treeOption.setCurrentKey(that.selectedKey); //
that.defaultSelectedKeys = that.selectedKey.split(',') //
if (that.selectType == 'single') {
that.$refs.treeOption.setCurrentKey(that.selectedKey) //
} else {
that.$refs.treeOption.setCheckedKeys(that.defaultSelectedKeys);
that.$refs.treeOption.setCheckedKeys(that.defaultSelectedKeys)
}
}
},
//
clearHandle() {
const that = this;
this.selectValue = "";
this.selectKey = "";
this.defaultSelectedKeys = [];
this.currentNodeKey = "";
this.clearSelected();
if (that.selectType == "single") {
that.$refs.treeOption.setCurrentKey(""); //
const that = this
this.selectValue = ''
this.selectKey = ''
this.defaultSelectedKeys = []
this.currentNodeKey = ''
this.clearSelected()
if (that.selectType == 'single') {
that.$refs.treeOption.setCurrentKey('') //
} else {
that.$refs.treeOption.setCheckedKeys([]);
that.$refs.treeOption.setCheckedKeys([])
}
},
/* 清空选中样式 */
clearSelected() {
const allNode = document.querySelectorAll("#treeOption .el-tree-node");
allNode.forEach((element) => element.classList.remove("is-current"));
const allNode = document.querySelectorAll('#treeOption .el-tree-node')
allNode.forEach((element) => element.classList.remove('is-current'))
},
// select
removeTag(val) {
this.$refs.treeOption.setCheckedKeys([]);
this.$refs.treeOption.setCheckedKeys([])
},
//
nodeClick(data, node, el) {
if (data.rank >= this.selectLevel) {
this.selectValue = data.name;
this.selectKey = data.id;
this.selectValue = data.name
this.selectKey = data.id
}
},
//
checkNode(data, node, el) {
const checkedNodes = this.$refs.treeOption.getCheckedNodes();
const keyArr = [];
const valueArr = [];
const checkedNodes = this.$refs.treeOption.getCheckedNodes()
const keyArr = []
const valueArr = []
checkedNodes.forEach((item) => {
if (item.rank >= this.selectLevel) {
keyArr.push(item.id);
valueArr.push(item.name);
keyArr.push(item.id)
valueArr.push(item.name)
}
});
this.selectValue = valueArr;
this.selectKey = keyArr;
})
this.selectValue = valueArr
this.selectKey = keyArr
},
},
};
}
</script>
<style lang="scss" scoped>

View File

@ -24,12 +24,12 @@
<script>
export default {
name: "VabCharge",
name: 'VabCharge',
props: {
styleObj: {
type: Object,
default: () => {
return {};
return {}
},
},
startVal: {
@ -44,16 +44,16 @@
data() {
return {
decimals: 2,
prefix: "",
suffix: "%",
separator: ",",
prefix: '',
suffix: '%',
separator: ',',
duration: 3000,
};
}
},
created() {},
mounted() {},
methods: {},
};
}
</script>
<style lang="scss" scoped>
@ -104,7 +104,7 @@
left: 50%;
width: 200px;
height: 200px;
content: "";
content: '';
background-color: #00ff6f;
border-radius: 42% 38% 62% 49% / 45%;
transform: translate(-50%, -50%) rotate(0);
@ -118,7 +118,7 @@
z-index: 99;
width: 176px;
height: 176px;
content: "";
content: '';
background-color: #000;
border-radius: 50%;
transform: translate(-50%, -50%);

View File

@ -18,16 +18,16 @@
<script>
export default {
name: "VabImage",
name: 'VabImage',
components: {},
props: {
bigSrc: {
type: String,
default: "",
default: '',
},
smallSrc: {
type: String,
default: "",
default: '',
},
percent: {
type: Number,
@ -35,19 +35,19 @@
},
},
data() {
return {};
return {}
},
created() {},
mounted() {},
methods: {
clickBig() {
this.$emit("click-big");
this.$emit('click-big')
},
clickSmall() {
this.$emit("click-small");
this.$emit('click-small')
},
},
};
}
</script>
<style lang="scss" scoped>

View File

@ -26,40 +26,40 @@
<script>
export default {
name: "VabProfile",
name: 'VabProfile',
props: {
styleObj: {
type: Object,
default: () => {
return {};
return {}
},
},
username: {
type: String,
default: "",
default: '',
},
avatar: {
type: String,
default: "",
default: '',
},
iconArray: {
type: Array,
default: () => {
return [
{ icon: "bell", url: "" },
{ icon: "bookmark", url: "" },
{ icon: "cloud-sun", url: "" },
];
{ icon: 'bell', url: '' },
{ icon: 'bookmark', url: '' },
{ icon: 'cloud-sun', url: '' },
]
},
},
},
data() {
return {};
return {}
},
created() {},
mounted() {},
methods: {},
};
}
</script>
<style lang="scss" scoped>
@ -161,7 +161,7 @@
width: 100%;
height: 100%;
color: black;
content: "";
content: '';
background: #35b9f1;
transform: scaleX(0);
transform-origin: left;
@ -207,7 +207,7 @@
left: 0;
width: 100%;
height: 100%;
content: "";
content: '';
border-radius: inherit;
transform: scale(0);
}

View File

@ -6,22 +6,22 @@
<script>
export default {
name: "VabSnow",
name: 'VabSnow',
props: {
styleObj: {
type: Object,
default: () => {
return {};
return {}
},
},
},
data() {
return {};
return {}
},
created() {},
mounted() {},
methods: {},
};
}
</script>
<style lang="scss" scoped>

View File

@ -75,19 +75,19 @@
</template>
<script>
import { baseURL, tokenName } from "@/config/settings";
import { baseURL, tokenName } from '@/config/settings'
export default {
name: "VabUpload",
name: 'VabUpload',
props: {
url: {
type: String,
default: "/upload",
default: '/upload',
required: true,
},
name: {
type: String,
default: "file",
default: 'file',
required: true,
},
limit: {
@ -106,106 +106,106 @@
show: false,
loading: false,
dialogVisible: false,
dialogImageUrl: "",
action: "https://vab-unicloud-3a9da9.service.tcloudbase.com/upload",
dialogImageUrl: '',
action: 'https://vab-unicloud-3a9da9.service.tcloudbase.com/upload',
headers: {},
fileList: [],
picture: "picture",
picture: 'picture',
imgNum: 0,
imgSuccessNum: 0,
imgErrorNum: 0,
typeList: null,
title: "上传",
title: '上传',
dialogFormVisible: false,
data: {},
};
}
},
computed: {
percentage() {
if (this.allImgNum == 0) return 0;
return this.$baseLodash.round(this.imgNum / this.allImgNum, 2) * 100;
if (this.allImgNum == 0) return 0
return this.$baseLodash.round(this.imgNum / this.allImgNum, 2) * 100
},
},
methods: {
submitUpload() {
this.$refs.upload.submit();
this.$refs.upload.submit()
},
handleProgress(event, file, fileList) {
this.loading = true;
this.show = true;
this.loading = true
this.show = true
},
handleChange(file, fileList) {
if (file.size > 1048576 * this.size) {
fileList.map((item, index) => {
if (item === file) {
fileList.splice(index, 1);
fileList.splice(index, 1)
}
});
this.fileList = fileList;
})
this.fileList = fileList
} else {
this.allImgNum = fileList.length;
this.allImgNum = fileList.length
}
},
handleSuccess(response, file, fileList) {
this.imgNum = this.imgNum + 1;
this.imgSuccessNum = this.imgSuccessNum + 1;
this.imgNum = this.imgNum + 1
this.imgSuccessNum = this.imgSuccessNum + 1
if (fileList.length === this.imgNum) {
setTimeout(() => {
this.$baseMessage(
`上传完成! 共上传${fileList.length}张图片`,
"success"
);
}, 1000);
'success'
)
}, 1000)
}
setTimeout(() => {
this.loading = false;
this.show = false;
}, 1000);
this.loading = false
this.show = false
}, 1000)
},
handleError(err, file, fileList) {
this.imgNum = this.imgNum + 1;
this.imgErrorNum = this.imgErrorNum + 1;
this.imgNum = this.imgNum + 1
this.imgErrorNum = this.imgErrorNum + 1
this.$baseMessage(
`文件[${file.raw.name}]上传失败,文件大小为${this.$baseLodash.round(
file.raw.size / 1024,
0
)}KB`,
"error"
);
'error'
)
setTimeout(() => {
this.loading = false;
this.show = false;
}, 1000);
this.loading = false
this.show = false
}, 1000)
},
handleRemove(file, fileList) {
this.imgNum = this.imgNum - 1;
this.allNum = this.allNum - 1;
this.imgNum = this.imgNum - 1
this.allNum = this.allNum - 1
},
handlePreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
this.dialogImageUrl = file.url
this.dialogVisible = true
},
handleExceed(files, fileList) {
this.$baseMessage(
`当前限制选择 ${this.limit} 个文件,本次选择了
${files.length}
个文件`,
"error"
);
'error'
)
},
handleShow(data) {
this.title = "上传";
this.data = data;
this.dialogFormVisible = true;
this.title = '上传'
this.data = data
this.dialogFormVisible = true
},
handleClose() {
this.fileList = [];
this.picture = "picture";
this.allImgNum = 0;
this.imgNum = 0;
this.imgSuccessNum = 0;
this.imgErrorNum = 0;
this.fileList = []
this.picture = 'picture'
this.allImgNum = 0
this.imgNum = 0
this.imgSuccessNum = 0
this.imgErrorNum = 0
/* if ("development" === process.env.NODE_ENV) {
this.api = process.env.VUE_APP_BASE_API;
} else {
@ -213,10 +213,10 @@
}
this.action = this.api + this.url; */
this.dialogFormVisible = false;
this.dialogFormVisible = false
},
},
};
}
</script>
<style lang="scss" scoped>

View File

@ -2,6 +2,6 @@
* @description 导出自定义配置
**/
const config = {
layout: "vertical",
};
module.exports = config;
layout: 'vertical',
}
module.exports = config

View File

@ -1,8 +1,8 @@
/**
* @description 导出默认配置(通用配置|主题配置|网络配置)
**/
const setting = require("./setting.config");
const theme = require("./theme.config");
const network = require("./net.config");
const setting = require('./setting.config')
const theme = require('./theme.config')
const network = require('./net.config')
module.exports = { setting, theme, network };
module.exports = { setting, theme, network }

View File

@ -3,7 +3,7 @@
**/
const network = {
//配后端数据的接收方式application/json;charset=UTF-8或者application/x-www-form-urlencoded;charset=UTF-8
contentType: "application/json;charset=UTF-8",
contentType: 'application/json;charset=UTF-8',
//消息框消失时间
messageDuration: 3000,
//最长请求时间
@ -14,5 +14,5 @@ const network = {
invalidCode: 402,
//无权限code
noPermissionCode: 401,
};
module.exports = network;
}
module.exports = network

View File

@ -3,26 +3,26 @@
*/
const setting = {
// 开发以及部署时的URL
publicPath: "",
publicPath: '',
// 生产环境构建文件的目录名
outputDir: "dist",
outputDir: 'dist',
// 放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录。
assetsDir: "static",
assetsDir: 'static',
// 开发环境每次保存时是否输出为eslint编译警告
lintOnSave: true,
// 进行编译的依赖
transpileDependencies: ["vue-echarts", "resize-detector"],
transpileDependencies: ['vue-echarts', 'resize-detector'],
// 默认的接口地址 如果是开发环境和生产环境走vab-mock-server当然你也可以选择自己配置成需要的接口地址
baseURL:
process.env.NODE_ENV === "development"
? "vab-mock-server"
: "vab-mock-server",
process.env.NODE_ENV === 'development'
? 'vab-mock-server'
: 'vab-mock-server',
//标题 (包括初次加载雪花屏的标题 页面的标题 浏览器的标题)
title: "vue-admin-beautiful",
title: 'vue-admin-beautiful',
//简写
abbreviation: "vab",
abbreviation: 'vab',
//开发环境端口号
devPort: "80",
devPort: '80',
//版本号
version: process.env.VUE_APP_VERSION,
//烦请保留package.json作者信息 即可免费商用
@ -34,42 +34,42 @@ const setting = {
//缓存路由的最大数量
keepAliveMaxNum: 99,
// 路由模式,可选值为 history 或 hash
routerMode: "hash",
routerMode: 'hash',
//不经过token校验的路由
routesWhiteList: ["/login", "/register", "/404", "/401"],
routesWhiteList: ['/login', '/register', '/404', '/401'],
//加载时显示文字
loadingText: "正在加载中...",
loadingText: '正在加载中...',
//token名称
tokenName: "accessToken",
tokenName: 'accessToken',
//token在localStorage、sessionStorage存储的key的名称
tokenTableName: "vue-admin-beautiful",
tokenTableName: 'vue-admin-beautiful',
//token存储位置localStorage sessionStorage
storage: "localStorage",
storage: 'localStorage',
//token失效回退到登录页时是否记录本次的路由
recordRoute: true,
//是否显示logo不显示时设置false显示时请填写remixIcon图标名称暂时只支持设置remixIcon
logo: "vuejs-fill",
logo: 'vuejs-fill',
//是否显示在页面高亮错误
errorLog: ["development"],
errorLog: ['development'],
//是否开启登录拦截
loginInterception: true,
//是否开启登录RSA加密
loginRSA: false,
//intelligence和all两种方式前者后端权限只控制permissions不控制view文件的import前后端配合减轻后端工作量all方式完全交给后端前端只负责加载
authentication: "intelligence",
authentication: 'intelligence',
//vertical布局时是否只保持一个子菜单的展开
uniqueOpened: true,
//vertical布局时默认展开的菜单path使用逗号隔开建议只展开一个
defaultOopeneds: ["/vab"],
defaultOopeneds: ['/vab'],
//需要加loading层的请求防止重复提交
debounce: ["doEdit"],
debounce: ['doEdit'],
//需要自动注入并加载的模块
providePlugin: { maptalks: "maptalks", "window.maptalks": "maptalks" },
providePlugin: { maptalks: 'maptalks', 'window.maptalks': 'maptalks' },
//npm run build时是否自动生成7z压缩包
build7z: false,
//代码生成机生成在view下的文件夹名称
templateFolder: "project",
templateFolder: 'project',
//是否显示终端donation打印
donation: true,
};
module.exports = setting;
}
module.exports = setting

View File

@ -3,12 +3,12 @@
*/
const theme = {
//是否国定头部 固定fixed 不固定noFixed
header: "fixed",
header: 'fixed',
//横纵布局 horizontal vertical
layout: "vertical",
layout: 'vertical',
//是否开启主题配置按钮
themeBar: true,
//是否显示多标签页
tabsBar: true,
};
module.exports = theme;
}
module.exports = theme

View File

@ -2,84 +2,81 @@
* @author chuzhixin 1204505056@qq.com 不想保留author可删除
* @description 路由守卫目前两种模式all模式与intelligence模式
*/
import router from "@/router";
import store from "@/store";
import VabProgress from "nprogress";
import "nprogress/nprogress.css";
import getPageTitle from "@/utils/pageTitle";
import router from '@/router'
import store from '@/store'
import VabProgress from 'nprogress'
import 'nprogress/nprogress.css'
import getPageTitle from '@/utils/pageTitle'
import {
authentication,
loginInterception,
progressBar,
recordRoute,
routesWhiteList,
} from "./settings";
} from './settings'
VabProgress.configure({
easing: "ease",
easing: 'ease',
speed: 500,
trickleSpeed: 200,
showSpinner: false,
});
})
router.beforeResolve(async (to, from, next) => {
if (progressBar) VabProgress.start();
let hasToken = store.getters["user/accessToken"];
if (progressBar) VabProgress.start()
let hasToken = store.getters['user/accessToken']
if (!loginInterception) hasToken = true;
if (!loginInterception) hasToken = true
if (hasToken) {
if (to.path === "/login") {
next({ path: "/" });
if (progressBar) VabProgress.done();
if (to.path === '/login') {
next({ path: '/' })
if (progressBar) VabProgress.done()
} else {
const hasPermissions =
store.getters["user/permissions"] &&
store.getters["user/permissions"].length > 0;
store.getters['user/permissions'] &&
store.getters['user/permissions'].length > 0
if (hasPermissions) {
next();
next()
} else {
try {
let permissions;
let permissions
if (!loginInterception) {
//settings.js loginInterception为false时创建虚拟权限
await store.dispatch("user/setPermissions", ["admin"]);
permissions = ["admin"];
await store.dispatch('user/setPermissions', ['admin'])
permissions = ['admin']
} else {
permissions = await store.dispatch("user/getUserInfo");
permissions = await store.dispatch('user/getUserInfo')
}
let accessRoutes = [];
if (authentication === "intelligence") {
accessRoutes = await store.dispatch(
"routes/setRoutes",
permissions
);
} else if (authentication === "all") {
accessRoutes = await store.dispatch("routes/setAllRoutes");
let accessRoutes = []
if (authentication === 'intelligence') {
accessRoutes = await store.dispatch('routes/setRoutes', permissions)
} else if (authentication === 'all') {
accessRoutes = await store.dispatch('routes/setAllRoutes')
}
router.addRoutes(accessRoutes);
next({ ...to, replace: true });
router.addRoutes(accessRoutes)
next({ ...to, replace: true })
} catch {
await store.dispatch("user/resetAccessToken");
if (progressBar) VabProgress.done();
await store.dispatch('user/resetAccessToken')
if (progressBar) VabProgress.done()
}
}
}
} else {
if (routesWhiteList.indexOf(to.path) !== -1) {
next();
next()
} else {
if (recordRoute) {
next(`/login?redirect=${to.path}`);
next(`/login?redirect=${to.path}`)
} else {
next("/login");
next('/login')
}
if (progressBar) VabProgress.done();
if (progressBar) VabProgress.done()
}
}
document.title = getPageTitle(to.meta.title);
});
document.title = getPageTitle(to.meta.title)
})
router.afterEach(() => {
if (progressBar) VabProgress.done();
});
if (progressBar) VabProgress.done()
})

View File

@ -2,8 +2,8 @@
* @description 3个子配置通用配置|主题配置|网络配置建议在当前目录下修改config.js修改配置会覆盖默认配置也可以直接修改默认配置
*/
//默认配置
const { setting, theme, network } = require("./default");
const { setting, theme, network } = require('./default')
//自定义配置
const config = require("./config");
const config = require('./config')
//导出配置(以自定义配置为主)
module.exports = Object.assign({}, setting, theme, network, config);
module.exports = Object.assign({}, setting, theme, network, config)

View File

@ -16,24 +16,24 @@
</div>
</template>
<script>
import { getList } from "@/api/ad";
import { getList } from '@/api/ad'
export default {
data() {
return {
nodeEnv: process.env.NODE_ENV,
adList: [],
};
}
},
created() {
this.fetchData();
this.fetchData()
},
methods: {
async fetchData() {
const { data } = await getList();
this.adList = data;
const { data } = await getList()
this.adList = data
},
},
};
}
</script>
<style lang="scss" scoped>
.vab-ad {

View File

@ -14,16 +14,16 @@
</template>
<script>
import { mapActions, mapGetters } from "vuex";
import { mapActions, mapGetters } from 'vuex'
import {
copyright,
footerCopyright,
keepAliveMaxNum,
title,
} from "@/config/settings";
} from '@/config/settings'
export default {
name: "AppMain",
name: 'AppMain',
data() {
return {
show: false,
@ -33,50 +33,50 @@
keepAliveMaxNum,
routerView: true,
footerCopyright,
};
}
},
computed: {
...mapGetters({
visitedRoutes: "tabsBar/visitedRoutes",
device: "settings/device",
visitedRoutes: 'tabsBar/visitedRoutes',
device: 'settings/device',
}),
cachedRoutes() {
const cachedRoutesArr = [];
const cachedRoutesArr = []
this.visitedRoutes.forEach((item) => {
if (!item.meta.noKeepAlive) {
cachedRoutesArr.push(item.name);
cachedRoutesArr.push(item.name)
}
});
return cachedRoutesArr;
})
return cachedRoutesArr
},
key() {
return this.$route.path;
return this.$route.path
},
},
watch: {
$route: {
handler(route) {
if ("mobile" === this.device) this.foldSideBar();
if ('mobile' === this.device) this.foldSideBar()
},
immediate: true,
},
},
created() {
//
this.$baseEventBus.$on("reload-routerview", () => {
this.routerView = false;
this.$baseEventBus.$on('reload-routerview', () => {
this.routerView = false
this.$nextTick(() => {
this.routerView = true;
});
});
this.routerView = true
})
})
},
mounted() {},
methods: {
...mapActions({
foldSideBar: "settings/foldSideBar",
foldSideBar: 'settings/foldSideBar',
}),
},
};
}
</script>
<style lang="scss" scoped>

View File

@ -18,54 +18,54 @@
</template>
<script>
import { mapGetters } from "vuex";
import { recordRoute } from "@/config/settings";
import { mapGetters } from 'vuex'
import { recordRoute } from '@/config/settings'
export default {
name: "Avatar",
name: 'Avatar',
computed: {
...mapGetters({
avatar: "user/avatar",
username: "user/username",
avatar: 'user/avatar',
username: 'user/username',
}),
},
methods: {
handleCommand(command) {
switch (command) {
case "logout":
this.logout();
break;
case "personalCenter":
this.personalCenter();
break;
case "github":
window.open("https://github.com/chuzhixin/vue-admin-beautiful");
break;
case "gitee":
window.open("https://gitee.com/chu1204505056/vue-admin-beautiful");
break;
case 'logout':
this.logout()
break
case 'personalCenter':
this.personalCenter()
break
case 'github':
window.open('https://github.com/chuzhixin/vue-admin-beautiful')
break
case 'gitee':
window.open('https://gitee.com/chu1204505056/vue-admin-beautiful')
break
}
},
personalCenter() {
this.$router.push("/personalCenter/personalCenter");
this.$router.push('/personalCenter/personalCenter')
},
logout() {
this.$baseConfirm(
"您确定要退出" + this.$baseTitle + "吗?",
'您确定要退出' + this.$baseTitle + '吗?',
null,
async () => {
await this.$store.dispatch("user/logout");
await this.$store.dispatch('user/logout')
if (recordRoute) {
const fullPath = this.$route.fullPath;
this.$router.push(`/login?redirect=${fullPath}`);
const fullPath = this.$route.fullPath
this.$router.push(`/login?redirect=${fullPath}`)
} else {
this.$router.push("/login");
this.$router.push('/login')
}
}
);
)
},
},
};
}
</script>
<style lang="scss" scoped>
.avatar-dropdown {

View File

@ -8,25 +8,25 @@
<script>
export default {
name: "Breadcrumb",
name: 'Breadcrumb',
data() {
return {
list: this.getBreadcrumb(),
};
}
},
watch: {
$route() {
this.list = this.getBreadcrumb();
this.list = this.getBreadcrumb()
},
},
methods: {
getBreadcrumb() {
return this.$route.matched.filter(
(item) => item.name && item.meta.title
);
)
},
},
};
}
</script>
<style lang="scss" scoped>

View File

@ -14,23 +14,23 @@
</div>
</template>
<script>
import { mapGetters } from "vuex";
import { logo } from "@/config/settings";
import { mapGetters } from 'vuex'
import { logo } from '@/config/settings'
export default {
name: "Logo",
name: 'Logo',
data() {
return {
title: this.$baseTitle,
};
}
},
computed: {
...mapGetters({
logo: "settings/logo",
layout: "settings/layout",
logo: 'settings/logo',
layout: 'settings/layout',
}),
},
};
}
</script>
<style lang="scss" scoped>
@mixin container {

View File

@ -36,7 +36,7 @@
</template>
<script>
import { mapActions, mapGetters } from "vuex";
import { mapActions, mapGetters } from 'vuex'
import {
Avatar,
@ -44,10 +44,10 @@
ErrorLog,
FullScreenBar,
ThemeBar,
} from "@/layouts/components";
} from '@/layouts/components'
export default {
name: "NavBar",
name: 'NavBar',
components: {
Avatar,
Breadcrumb,
@ -58,32 +58,32 @@
data() {
return {
pulse: false,
};
}
},
computed: {
...mapGetters({
collapse: "settings/collapse",
visitedRoutes: "tabsBar/visitedRoutes",
device: "settings/device",
routes: "routes/routes",
collapse: 'settings/collapse',
visitedRoutes: 'tabsBar/visitedRoutes',
device: 'settings/device',
routes: 'routes/routes',
}),
},
methods: {
...mapActions({
changeCollapse: "settings/changeCollapse",
changeCollapse: 'settings/changeCollapse',
}),
handleCollapse() {
this.changeCollapse();
this.changeCollapse()
},
async refreshRoute() {
this.$baseEventBus.$emit("reload-routerview");
this.pulse = true;
this.$baseEventBus.$emit('reload-routerview')
this.pulse = true
setTimeout(() => {
this.pulse = false;
}, 1000);
this.pulse = false
}, 1000)
},
},
};
}
</script>
<style lang="scss" scoped>

View File

@ -66,119 +66,119 @@
</template>
<script>
import variables from "@/styles/variables.scss";
import { mapActions, mapGetters } from "vuex";
import { layout as defaultLayout } from "@/config/settings";
import variables from '@/styles/variables.scss'
import { mapActions, mapGetters } from 'vuex'
import { layout as defaultLayout } from '@/config/settings'
export default {
name: "ThemeBar",
name: 'ThemeBar',
data() {
return {
drawerVisible: false,
theme: {
name: "default",
layout: "",
header: "",
tabsBar: "",
name: 'default',
layout: '',
header: '',
tabsBar: '',
},
};
}
},
computed: {
...mapGetters({
layout: "settings/layout",
header: "settings/header",
tabsBar: "settings/tabsBar",
themeBar: "settings/themeBar",
layout: 'settings/layout',
header: 'settings/header',
tabsBar: 'settings/tabsBar',
themeBar: 'settings/themeBar',
}),
},
created() {
this.$baseEventBus.$on("theme", () => {
this.handleOpenThemeBar();
});
const theme = localStorage.getItem("vue-admin-beautiful-theme");
this.$baseEventBus.$on('theme', () => {
this.handleOpenThemeBar()
})
const theme = localStorage.getItem('vue-admin-beautiful-theme')
if (null !== theme) {
this.theme = JSON.parse(theme);
this.handleSetTheme();
this.theme = JSON.parse(theme)
this.handleSetTheme()
} else {
this.theme.layout = this.layout;
this.theme.header = this.header;
this.theme.tabsBar = this.tabsBar;
this.theme.layout = this.layout
this.theme.header = this.header
this.theme.tabsBar = this.tabsBar
}
},
methods: {
...mapActions({
changeLayout: "settings/changeLayout",
changeHeader: "settings/changeHeader",
changeTabsBar: "settings/changeTabsBar",
changeLayout: 'settings/changeLayout',
changeHeader: 'settings/changeHeader',
changeTabsBar: 'settings/changeTabsBar',
}),
handleIsMobile() {
return document.body.getBoundingClientRect().width - 1 < 992;
return document.body.getBoundingClientRect().width - 1 < 992
},
handleOpenThemeBar() {
this.drawerVisible = true;
this.drawerVisible = true
},
handleSetTheme() {
let { name, layout, header, tabsBar } = this.theme;
let { name, layout, header, tabsBar } = this.theme
localStorage.setItem(
"vue-admin-beautiful-theme",
'vue-admin-beautiful-theme',
`{
"name":"${name}",
"layout":"${layout}",
"header":"${header}",
"tabsBar":"${tabsBar}"
}`
);
if (!this.handleIsMobile()) this.changeLayout(layout);
this.changeHeader(header);
this.changeTabsBar(tabsBar);
)
if (!this.handleIsMobile()) this.changeLayout(layout)
this.changeHeader(header)
this.changeTabsBar(tabsBar)
document.getElementsByTagName(
"body"
)[0].className = `vue-admin-beautiful-theme-${name}`;
this.drawerVisible = false;
'body'
)[0].className = `vue-admin-beautiful-theme-${name}`
this.drawerVisible = false
},
handleSaveTheme() {
this.handleSetTheme();
this.handleSetTheme()
},
handleSetDfaultTheme() {
let { name } = this.theme;
let { name } = this.theme
document
.getElementsByTagName("body")[0]
.classList.remove(`vue-admin-beautiful-theme-${name}`);
localStorage.removeItem("vue-admin-beautiful-theme");
this.$refs["form"].resetFields();
Object.assign(this.$data, this.$options.data());
this.changeHeader(defaultLayout);
this.theme.name = "default";
this.theme.layout = this.layout;
this.theme.header = this.header;
this.theme.tabsBar = this.tabsBar;
this.drawerVisible = false;
.getElementsByTagName('body')[0]
.classList.remove(`vue-admin-beautiful-theme-${name}`)
localStorage.removeItem('vue-admin-beautiful-theme')
this.$refs['form'].resetFields()
Object.assign(this.$data, this.$options.data())
this.changeHeader(defaultLayout)
this.theme.name = 'default'
this.theme.layout = this.layout
this.theme.header = this.header
this.theme.tabsBar = this.tabsBar
this.drawerVisible = false
},
handleGetCode() {
const url =
"https://github.com/chuzhixin/vue-admin-beautiful/tree/master/src/views";
let path = this.$route.path + "/index.vue";
if (path === "/vab/menu1/menu1-1/menu1-1-1/index.vue") {
path = "/vab/nested/menu1/menu1-1/menu1-1-1/index.vue";
'https://github.com/chuzhixin/vue-admin-beautiful/tree/master/src/views'
let path = this.$route.path + '/index.vue'
if (path === '/vab/menu1/menu1-1/menu1-1-1/index.vue') {
path = '/vab/nested/menu1/menu1-1/menu1-1-1/index.vue'
}
if (path === "/vab/icon/awesomeIcon/index.vue") {
path = "/vab/icon/index.vue";
if (path === '/vab/icon/awesomeIcon/index.vue') {
path = '/vab/icon/index.vue'
}
if (path === "/vab/icon/remixIcon/index.vue") {
path = "/vab/icon/remixIcon.vue";
if (path === '/vab/icon/remixIcon/index.vue') {
path = '/vab/icon/remixIcon.vue'
}
if (path === "/vab/icon/colorfulIcon/index.vue") {
path = "/vab/icon/colorfulIcon.vue";
if (path === '/vab/icon/colorfulIcon/index.vue') {
path = '/vab/icon/colorfulIcon.vue'
}
if (path === "/vab/table/comprehensiveTable/index.vue") {
path = "/vab/table/index.vue";
if (path === '/vab/table/comprehensiveTable/index.vue') {
path = '/vab/table/index.vue'
}
if (path === "/vab/table/inlineEditTable/index.vue") {
path = "/vab/table/inlineEditTable.vue";
if (path === '/vab/table/inlineEditTable/index.vue') {
path = '/vab/table/inlineEditTable.vue'
}
window.open(url + path);
window.open(url + path)
},
},
};
}
</script>
<style lang="scss" scoped>

View File

@ -4,27 +4,27 @@
* 当然也存在一定的弊端给开发者自定义增加了一定的困难
* 如果您一定要进行高度自定义请仔细阅读讨论群文档layouts本地化篇
*/
export { default as ColorfullIcon } from "zx-layouts/ColorfullIcon";
export { default as RemixIcon } from "zx-layouts/RemixIcon";
export { default as VabDrag } from "zx-layouts/Drag";
export { default as VabPermissions } from "zx-layouts/Permissions";
export { default as VabQueryForm } from "zx-layouts/VabQueryForm/export";
export { default as ColorfullIcon } from 'zx-layouts/ColorfullIcon'
export { default as RemixIcon } from 'zx-layouts/RemixIcon'
export { default as VabDrag } from 'zx-layouts/Drag'
export { default as VabPermissions } from 'zx-layouts/Permissions'
export { default as VabQueryForm } from 'zx-layouts/VabQueryForm/export'
//本地化logo、默认使用svg如需变更为png更改logo源码即可
export { default as Logo } from "./Logo";
export { default as Logo } from './Logo'
//本地化头像组件
export { default as Avatar } from "./Avatar";
export { default as Avatar } from './Avatar'
//本地化广告组件如不需要全局搜索ad组件删掉即可
export { default as Ad } from "./Ad";
export { default as Ad } from './Ad'
//本地化AppMain组件
export { default as AppMain } from "./AppMain";
export { default as TabsBar } from "zx-layouts/TabsBar";
export { default as SideBar } from "zx-layouts/SideBar";
export { default as AppMain } from './AppMain'
export { default as TabsBar } from 'zx-layouts/TabsBar'
export { default as SideBar } from 'zx-layouts/SideBar'
//本地化Breadcrumb组件
export { default as Breadcrumb } from "./Breadcrumb";
export { default as FullScreenBar } from "zx-layouts/FullScreenBar";
export { default as ErrorLog } from "zx-layouts/ErrorLog";
export { default as Breadcrumb } from './Breadcrumb'
export { default as FullScreenBar } from 'zx-layouts/FullScreenBar'
export { default as ErrorLog } from 'zx-layouts/ErrorLog'
//本地化ThemeBar组件
export { default as ThemeBar } from "./ThemeBar";
export { default as TopBar } from "zx-layouts/TopBar";
export { default as ThemeBar } from './ThemeBar'
export { default as TopBar } from 'zx-layouts/TopBar'
//本地化NavBar组件
export { default as NavBar } from "./NavBar";
export { default as NavBar } from './NavBar'

View File

@ -52,11 +52,11 @@
</template>
<script>
import { Ad, AppMain, NavBar, SideBar, TabsBar, TopBar } from "./components";
import { mapActions, mapGetters } from "vuex";
import { tokenName } from "@/config/settings";
import { Ad, AppMain, NavBar, SideBar, TabsBar, TopBar } from './components'
import { mapActions, mapGetters } from 'vuex'
import { tokenName } from '@/config/settings'
export default {
name: "Layout",
name: 'Layout',
components: {
Ad,
TopBar,
@ -66,88 +66,88 @@
TabsBar,
},
data() {
return { oldLayout: "" };
return { oldLayout: '' }
},
computed: {
...mapGetters({
layout: "settings/layout",
tabsBar: "settings/tabsBar",
collapse: "settings/collapse",
header: "settings/header",
device: "settings/device",
layout: 'settings/layout',
tabsBar: 'settings/tabsBar',
collapse: 'settings/collapse',
header: 'settings/header',
device: 'settings/device',
}),
classObj() {
return {
mobile: this.device === "mobile",
};
mobile: this.device === 'mobile',
}
},
},
beforeMount() {
window.addEventListener("resize", this.handleResize);
window.addEventListener('resize', this.handleResize)
},
beforeDestroy() {
window.removeEventListener("resize", this.handleResize);
window.removeEventListener('resize', this.handleResize)
},
mounted() {
this.oldLayout = this.layout;
const userAgent = navigator.userAgent;
if (userAgent.includes("Juejin")) {
this.oldLayout = this.layout
const userAgent = navigator.userAgent
if (userAgent.includes('Juejin')) {
this.$baseAlert(
"vue-admin-beautiful不支持在掘金内置浏览器演示请手动复制以下地址到浏览器中查看http://mpfhrd48.sanxing.uz7.cn/vue-admin-beautiful"
);
'vue-admin-beautiful不支持在掘金内置浏览器演示请手动复制以下地址到浏览器中查看http://mpfhrd48.sanxing.uz7.cn/vue-admin-beautiful'
)
}
const isMobile = this.handleIsMobile();
const isMobile = this.handleIsMobile()
if (isMobile) {
if (isMobile) {
//访
this.$store.dispatch("settings/changeLayout", "vertical");
this.$store.dispatch('settings/changeLayout', 'vertical')
} else {
this.$store.dispatch("settings/changeLayout", this.oldLayout);
this.$store.dispatch('settings/changeLayout', this.oldLayout)
}
this.$store.dispatch("settings/toggleDevice", "mobile");
this.$store.dispatch('settings/toggleDevice', 'mobile')
setTimeout(() => {
this.$store.dispatch("settings/foldSideBar");
}, 2000);
this.$store.dispatch('settings/foldSideBar')
}, 2000)
} else {
this.$store.dispatch("settings/openSideBar");
this.$store.dispatch('settings/openSideBar')
}
this.$nextTick(() => {
window.addEventListener(
"storage",
'storage',
(e) => {
if (e.key === tokenName || e.key === null) window.location.reload();
if (e.key === tokenName || e.key === null) window.location.reload()
if (e.key === tokenName && e.value === null)
window.location.reload();
window.location.reload()
},
false
);
});
)
})
},
methods: {
...mapActions({
handleFoldSideBar: "settings/foldSideBar",
handleFoldSideBar: 'settings/foldSideBar',
}),
handleIsMobile() {
return document.body.getBoundingClientRect().width - 1 < 992;
return document.body.getBoundingClientRect().width - 1 < 992
},
handleResize() {
if (!document.hidden) {
const isMobile = this.handleIsMobile();
const isMobile = this.handleIsMobile()
if (isMobile) {
//访
this.$store.dispatch("settings/changeLayout", "vertical");
this.$store.dispatch('settings/changeLayout', 'vertical')
} else {
this.$store.dispatch("settings/changeLayout", this.oldLayout);
this.$store.dispatch('settings/changeLayout', this.oldLayout)
}
this.$store.dispatch(
"settings/toggleDevice",
isMobile ? "mobile" : "desktop"
);
'settings/toggleDevice',
isMobile ? 'mobile' : 'desktop'
)
}
},
},
};
}
</script>
<style lang="scss" scoped>

View File

@ -1,23 +1,23 @@
import Vue from "vue";
import App from "./App";
import store from "./store";
import router from "./router";
import "./plugins";
import Vue from 'vue'
import App from './App'
import store from './store'
import router from './router'
import './plugins'
/**
* @author chuzhixin 1204505056@qq.com 不想保留author可删除
* @description 生产环境默认都使用mock如果正式用于生产环境时记得去掉
*/
if (process.env.NODE_ENV === "production") {
const { mockXHR } = require("@/utils/static");
mockXHR();
if (process.env.NODE_ENV === 'production') {
const { mockXHR } = require('@/utils/static')
mockXHR()
}
Vue.config.productionTip = false;
Vue.config.productionTip = false
new Vue({
el: "#vue-admin-beautiful",
el: '#vue-admin-beautiful',
router,
store,
render: (h) => h(App),
});
})

View File

@ -1,11 +1,11 @@
import "echarts";
import "echarts/map/js/china";
import "echarts/map/js/world";
import 'echarts'
import 'echarts/map/js/china'
import 'echarts/map/js/world'
import "echarts-wordcloud";
import 'echarts-wordcloud'
import VabChart from "vue-echarts";
import theme from "./vab-echarts-theme.json";
import VabChart from 'vue-echarts'
import theme from './vab-echarts-theme.json'
VabChart.registerTheme("vab-echarts-theme", theme);
export default VabChart;
VabChart.registerTheme('vab-echarts-theme', theme)
export default VabChart

View File

@ -1,9 +1,9 @@
import Vue from "vue";
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/display.css";
import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/display.css'
import "@/styles/element-variables.scss";
import '@/styles/element-variables.scss'
Vue.use(ElementUI, {
size: "small",
});
size: 'small',
})

View File

@ -1,20 +1,20 @@
/* 公共引入,勿随意修改,修改时需经过确认 */
import Vue from "vue";
import "./element";
import "./support";
import "@/styles/vab.scss";
import "@/remixIcon";
import "@/colorfulIcon";
import "@/config/permission";
import "@/utils/errorLog";
import "./vabIcon";
import Vue from 'vue'
import './element'
import './support'
import '@/styles/vab.scss'
import '@/remixIcon'
import '@/colorfulIcon'
import '@/config/permission'
import '@/utils/errorLog'
import './vabIcon'
import Vab from "@/utils/vab";
import { VabDrag, VabPermissions, VabQueryForm } from "@/layouts/components";
import VabCount from "zx-count";
import Vab from '@/utils/vab'
import { VabDrag, VabPermissions, VabQueryForm } from '@/layouts/components'
import VabCount from 'zx-count'
Vue.use(Vab);
Vue.use(VabPermissions);
Vue.use(VabDrag);
Vue.use(VabQueryForm);
Vue.use(VabCount);
Vue.use(Vab)
Vue.use(VabPermissions)
Vue.use(VabDrag)
Vue.use(VabQueryForm)
Vue.use(VabCount)

View File

@ -1,21 +1,21 @@
import { MessageBox } from "element-ui";
import { donation } from "@/config/settings";
import { dependencies, repository } from "../../package.json";
import { MessageBox } from 'element-ui'
import { donation } from '@/config/settings'
import { dependencies, repository } from '../../package.json'
if (!!window.ActiveXObject || "ActiveXObject" in window) {
if (!!window.ActiveXObject || 'ActiveXObject' in window) {
MessageBox({
title: "温馨提示",
title: '温馨提示',
message:
'自2015年3月起微软已宣布弃用IE且不再对IE提供任何更新维护请<a target="_blank" style="color:blue" href="https://www.microsoft.com/zh-cn/edge/">点击此处</a>访问微软官网更新浏览器,如果您使用的是双核浏览器,请您切换浏览器内核为极速模式',
type: "warning",
type: 'warning',
showClose: false,
showConfirmButton: false,
closeOnClickModal: false,
closeOnPressEscape: false,
closeOnHashChange: false,
dangerouslyUseHTMLString: true,
});
})
}
if (!dependencies["zx-icon"] || !dependencies["zx-layouts"]) {
document.body.innerHTML = "";
if (!dependencies['zx-icon'] || !dependencies['zx-layouts']) {
document.body.innerHTML = ''
}

View File

@ -1,3 +1,3 @@
import VabComparison from "zx-comparison";
import VabComparison from 'zx-comparison'
export default VabComparison;
export default VabComparison

View File

@ -1,4 +1,4 @@
import Vue from "vue";
import VabIcon from "zx-icon";
import Vue from 'vue'
import VabIcon from 'zx-icon'
Vue.component("VabIcon", VabIcon);
Vue.component('VabIcon', VabIcon)

View File

@ -1,3 +1,3 @@
import VabMagnifier from "zx-magnifie";
import VabMagnifier from 'zx-magnifie'
export default VabMagnifier;
export default VabMagnifier

View File

@ -1,5 +1,5 @@
import ZxMarkdownEditor from "zx-markdown-editor";
import "zx-markdown-editor/dist/zx-markdown-editor.css";
import ZxMarkdownEditor from 'zx-markdown-editor'
import 'zx-markdown-editor/dist/zx-markdown-editor.css'
const VabMarkdownEditor = ZxMarkdownEditor;
export default VabMarkdownEditor;
const VabMarkdownEditor = ZxMarkdownEditor
export default VabMarkdownEditor

View File

@ -1,7 +1,7 @@
import { Custom, Flv, Hls, Mp4 } from "zx-player";
import { Custom, Flv, Hls, Mp4 } from 'zx-player'
const VabPlayerMp4 = Mp4;
const VabPlayerHls = Hls;
const VabPlayerFlv = Flv;
const VabPlayerCustom = Custom;
export { VabPlayerMp4, VabPlayerHls, VabPlayerFlv, VabPlayerCustom };
const VabPlayerMp4 = Mp4
const VabPlayerHls = Hls
const VabPlayerFlv = Flv
const VabPlayerCustom = Custom
export { VabPlayerMp4, VabPlayerHls, VabPlayerFlv, VabPlayerCustom }

View File

@ -1,4 +1,4 @@
import "zx-quill/dist/zx-quill.css";
import VabQuill from "zx-quill";
import 'zx-quill/dist/zx-quill.css'
import VabQuill from 'zx-quill'
export default VabQuill;
export default VabQuill

View File

@ -1,4 +1,4 @@
import VabVerify from "zx-verify";
import "zx-verify/dist/zx-verify.css";
import VabVerify from 'zx-verify'
import 'zx-verify/dist/zx-verify.css'
export default VabVerify;
export default VabVerify

View File

@ -1,8 +1,8 @@
import Vue from "vue";
import { RemixIcon } from "@/layouts/components";
import Vue from 'vue'
import { RemixIcon } from '@/layouts/components'
Vue.component("VabRemixIcon", RemixIcon);
const req = require.context("./svg", false, /\.svg$/),
Vue.component('VabRemixIcon', RemixIcon)
const req = require.context('./svg', false, /\.svg$/),
requireAll = (requireContext) => {
/*let a = requireContext.keys().map(requireContext);
let arr = [];
@ -12,6 +12,6 @@ const req = require.context("./svg", false, /\.svg$/),
arr.push(icon);
}
console.log(JSON.stringify(arr));*/
return requireContext.keys().map(requireContext);
};
requireAll(req);
return requireContext.keys().map(requireContext)
}
requireAll(req)

View File

@ -3,51 +3,51 @@
* @description router全局配置如有必要可分文件抽离其中asyncRoutes只有在intelligence模式下才会用到vip文档中已提供路由的基础图标与小清新图标的配置方案请仔细阅读
*/
import Vue from "vue";
import VueRouter from "vue-router";
import Layout from "@/layouts";
import EmptyLayout from "@/layouts/EmptyLayout";
import { publicPath, routerMode } from "@/config/settings";
import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/layouts'
import EmptyLayout from '@/layouts/EmptyLayout'
import { publicPath, routerMode } from '@/config/settings'
Vue.use(VueRouter);
Vue.use(VueRouter)
export const constantRoutes = [
{
path: "/login",
component: () => import("@/views/login/index"),
path: '/login',
component: () => import('@/views/login/index'),
hidden: true,
},
{
path: "/register",
component: () => import("@/views/register/index"),
path: '/register',
component: () => import('@/views/register/index'),
hidden: true,
},
{
path: "/401",
name: "401",
component: () => import("@/views/401"),
path: '/401',
name: '401',
component: () => import('@/views/401'),
hidden: true,
},
{
path: "/404",
name: "404",
component: () => import("@/views/404"),
path: '/404',
name: '404',
component: () => import('@/views/404'),
hidden: true,
},
];
]
export const asyncRoutes = [
{
path: "/",
path: '/',
component: Layout,
redirect: "index",
redirect: 'index',
children: [
{
path: "index",
name: "Index",
component: () => import("@/views/index/index"),
path: 'index',
name: 'Index',
component: () => import('@/views/index/index'),
meta: {
title: "首页",
icon: "home",
title: '首页',
icon: 'home',
affix: true,
},
},
@ -72,322 +72,322 @@ export const asyncRoutes = [
}, */
{
path: "/vab",
path: '/vab',
component: Layout,
redirect: "noRedirect",
name: "Vab",
redirect: 'noRedirect',
name: 'Vab',
alwaysShow: true,
meta: { title: "组件", icon: "box-open" },
meta: { title: '组件', icon: 'box-open' },
children: [
{
path: "permissions",
name: "Permission",
component: () => import("@/views/vab/permissions/index"),
path: 'permissions',
name: 'Permission',
component: () => import('@/views/vab/permissions/index'),
meta: {
title: "角色权限",
permissions: ["admin", "editor"],
title: '角色权限',
permissions: ['admin', 'editor'],
},
},
{
path: "icon",
path: 'icon',
component: EmptyLayout,
redirect: "noRedirect",
name: "Icon",
redirect: 'noRedirect',
name: 'Icon',
meta: {
title: "图标",
permissions: ["admin"],
title: '图标',
permissions: ['admin'],
},
children: [
{
path: "awesomeIcon",
name: "AwesomeIcon",
component: () => import("@/views/vab/icon/index"),
meta: { title: "常规图标" },
path: 'awesomeIcon',
name: 'AwesomeIcon',
component: () => import('@/views/vab/icon/index'),
meta: { title: '常规图标' },
},
{
path: "remixIcon",
name: "RemixIcon",
component: () => import("@/views/vab/icon/remixIcon"),
meta: { title: "小清新图标" },
path: 'remixIcon',
name: 'RemixIcon',
component: () => import('@/views/vab/icon/remixIcon'),
meta: { title: '小清新图标' },
},
{
path: "colorfulIcon",
name: "ColorfulIcon",
component: () => import("@/views/vab/icon/colorfulIcon"),
meta: { title: "多彩图标" },
path: 'colorfulIcon',
name: 'ColorfulIcon',
component: () => import('@/views/vab/icon/colorfulIcon'),
meta: { title: '多彩图标' },
},
],
},
{
path: "table",
component: () => import("@/views/vab/table/index"),
name: "Table",
path: 'table',
component: () => import('@/views/vab/table/index'),
name: 'Table',
meta: {
title: "表格",
permissions: ["admin"],
title: '表格',
permissions: ['admin'],
},
},
{
path: "map",
component: () => import("@/views/vab/map/index"),
name: "Map",
path: 'map',
component: () => import('@/views/vab/map/index'),
name: 'Map',
meta: {
title: "地图",
permissions: ["admin"],
title: '地图',
permissions: ['admin'],
},
},
{
path: "webSocket",
name: "WebSocket",
component: () => import("@/views/vab/webSocket/index"),
meta: { title: "webSocket", permissions: ["admin"] },
path: 'webSocket',
name: 'WebSocket',
component: () => import('@/views/vab/webSocket/index'),
meta: { title: 'webSocket', permissions: ['admin'] },
},
{
path: "form",
name: "Form",
component: () => import("@/views/vab/form/index"),
meta: { title: "表单", permissions: ["admin"] },
path: 'form',
name: 'Form',
component: () => import('@/views/vab/form/index'),
meta: { title: '表单', permissions: ['admin'] },
},
{
path: "element",
name: "Element",
component: () => import("@/views/vab/element/index"),
meta: { title: "常用组件", permissions: ["admin"] },
path: 'element',
name: 'Element',
component: () => import('@/views/vab/element/index'),
meta: { title: '常用组件', permissions: ['admin'] },
},
{
path: "tree",
name: "Tree",
component: () => import("@/views/vab/tree/index"),
meta: { title: "树", permissions: ["admin"] },
path: 'tree',
name: 'Tree',
component: () => import('@/views/vab/tree/index'),
meta: { title: '树', permissions: ['admin'] },
},
{
path: "card",
name: "Card",
component: () => import("@/views/vab/card/index"),
meta: { title: "卡片", permissions: ["admin"] },
path: 'card',
name: 'Card',
component: () => import('@/views/vab/card/index'),
meta: { title: '卡片', permissions: ['admin'] },
},
{
path: "verify",
name: "Verify",
component: () => import("@/views/vab/verify/index"),
meta: { title: "验证码", permissions: ["admin"] },
path: 'verify',
name: 'Verify',
component: () => import('@/views/vab/verify/index'),
meta: { title: '验证码', permissions: ['admin'] },
},
{
path: "menu1",
component: () => import("@/views/vab/nested/menu1/index"),
name: "Menu1",
path: 'menu1',
component: () => import('@/views/vab/nested/menu1/index'),
name: 'Menu1',
alwaysShow: true,
meta: {
title: "嵌套路由 1",
permissions: ["admin"],
title: '嵌套路由 1',
permissions: ['admin'],
},
children: [
{
path: "menu1-1",
name: "Menu1-1",
path: 'menu1-1',
name: 'Menu1-1',
alwaysShow: true,
meta: { title: "嵌套路由 1-1" },
component: () => import("@/views/vab/nested/menu1/menu1-1/index"),
meta: { title: '嵌套路由 1-1' },
component: () => import('@/views/vab/nested/menu1/menu1-1/index'),
children: [
{
path: "menu1-1-1",
name: "Menu1-1-1",
meta: { title: "嵌套路由 1-1-1" },
path: 'menu1-1-1',
name: 'Menu1-1-1',
meta: { title: '嵌套路由 1-1-1' },
component: () =>
import("@/views/vab/nested/menu1/menu1-1/menu1-1-1/index"),
import('@/views/vab/nested/menu1/menu1-1/menu1-1-1/index'),
},
],
},
],
},
{
path: "magnifier",
name: "Magnifier",
component: () => import("@/views/vab/magnifier/index"),
meta: { title: "放大镜", permissions: ["admin"] },
path: 'magnifier',
name: 'Magnifier',
component: () => import('@/views/vab/magnifier/index'),
meta: { title: '放大镜', permissions: ['admin'] },
},
{
path: "echarts",
name: "Echarts",
component: () => import("@/views/vab/echarts/index"),
meta: { title: "图表", permissions: ["admin"] },
path: 'echarts',
name: 'Echarts',
component: () => import('@/views/vab/echarts/index'),
meta: { title: '图表', permissions: ['admin'] },
},
{
path: "loading",
name: "Loading",
component: () => import("@/views/vab/loading/index"),
meta: { title: "loading", permissions: ["admin"] },
path: 'loading',
name: 'Loading',
component: () => import('@/views/vab/loading/index'),
meta: { title: 'loading', permissions: ['admin'] },
},
{
path: "player",
name: "Player",
component: () => import("@/views/vab/player/index"),
meta: { title: "视频播放器", permissions: ["admin"] },
path: 'player',
name: 'Player',
component: () => import('@/views/vab/player/index'),
meta: { title: '视频播放器', permissions: ['admin'] },
},
{
path: "markdownEditor",
name: "MarkdownEditor",
component: () => import("@/views/vab/markdownEditor/index"),
meta: { title: "markdown编辑器", permissions: ["admin"] },
path: 'markdownEditor',
name: 'MarkdownEditor',
component: () => import('@/views/vab/markdownEditor/index'),
meta: { title: 'markdown编辑器', permissions: ['admin'] },
},
{
path: "editor",
name: "Editor",
component: () => import("@/views/vab/editor/index"),
path: 'editor',
name: 'Editor',
component: () => import('@/views/vab/editor/index'),
meta: {
title: "富文本编辑器",
permissions: ["admin"],
badge: "New",
title: '富文本编辑器',
permissions: ['admin'],
badge: 'New',
},
},
{
path: "backToTop",
name: "BackToTop",
component: () => import("@/views/vab/backToTop/index"),
meta: { title: "返回顶部", permissions: ["admin"] },
path: 'backToTop',
name: 'BackToTop',
component: () => import('@/views/vab/backToTop/index'),
meta: { title: '返回顶部', permissions: ['admin'] },
},
{
path: "lodash",
name: "Lodash",
component: () => import("@/views/vab/lodash/index"),
meta: { title: "lodash", permissions: ["admin"] },
path: 'lodash',
name: 'Lodash',
component: () => import('@/views/vab/lodash/index'),
meta: { title: 'lodash', permissions: ['admin'] },
},
{
path: "imgComparison",
name: "ImgComparison",
component: () => import("@/views/vab/imgComparison/index"),
meta: { title: "图像拖拽比对", permissions: ["admin"] },
path: 'imgComparison',
name: 'ImgComparison',
component: () => import('@/views/vab/imgComparison/index'),
meta: { title: '图像拖拽比对', permissions: ['admin'] },
},
{
path: "smallComponents",
name: "SmallComponents",
component: () => import("@/views/vab/smallComponents/index"),
meta: { title: "小组件", permissions: ["admin"] },
path: 'smallComponents',
name: 'SmallComponents',
component: () => import('@/views/vab/smallComponents/index'),
meta: { title: '小组件', permissions: ['admin'] },
},
{
path: "upload",
name: "Upload",
component: () => import("@/views/vab/upload/index"),
meta: { title: "上传", permissions: ["admin"] },
path: 'upload',
name: 'Upload',
component: () => import('@/views/vab/upload/index'),
meta: { title: '上传', permissions: ['admin'] },
},
{
path: "log",
name: "Log",
component: () => import("@/views/vab/errorLog/index"),
meta: { title: "错误日志模拟", permissions: ["admin"] },
path: 'log',
name: 'Log',
component: () => import('@/views/vab/errorLog/index'),
meta: { title: '错误日志模拟', permissions: ['admin'] },
},
{
path:
"https://github.com/chuzhixin/vue-admin-beautiful?utm_source=gold_browser_extension",
name: "ExternalLink",
'https://github.com/chuzhixin/vue-admin-beautiful?utm_source=gold_browser_extension',
name: 'ExternalLink',
meta: {
title: "外链",
target: "_blank",
permissions: ["admin", "editor"],
badge: "New",
title: '外链',
target: '_blank',
permissions: ['admin', 'editor'],
badge: 'New',
},
},
{
path: "more",
name: "More",
component: () => import("@/views/vab/more/index"),
meta: { title: "关于", permissions: ["admin"] },
path: 'more',
name: 'More',
component: () => import('@/views/vab/more/index'),
meta: { title: '关于', permissions: ['admin'] },
},
],
},
{
path: "/personnelManagement",
path: '/personnelManagement',
component: Layout,
redirect: "noRedirect",
name: "PersonnelManagement",
meta: { title: "配置", icon: "users-cog", permissions: ["admin"] },
redirect: 'noRedirect',
name: 'PersonnelManagement',
meta: { title: '配置', icon: 'users-cog', permissions: ['admin'] },
children: [
{
path: "userManagement",
name: "UserManagement",
path: 'userManagement',
name: 'UserManagement',
component: () =>
import("@/views/personnelManagement/userManagement/index"),
meta: { title: "用户管理" },
import('@/views/personnelManagement/userManagement/index'),
meta: { title: '用户管理' },
},
{
path: "roleManagement",
name: "RoleManagement",
path: 'roleManagement',
name: 'RoleManagement',
component: () =>
import("@/views/personnelManagement/roleManagement/index"),
meta: { title: "角色管理" },
import('@/views/personnelManagement/roleManagement/index'),
meta: { title: '角色管理' },
},
{
path: "menuManagement",
name: "MenuManagement",
path: 'menuManagement',
name: 'MenuManagement',
component: () =>
import("@/views/personnelManagement/menuManagement/index"),
meta: { title: "菜单管理", badge: "New" },
import('@/views/personnelManagement/menuManagement/index'),
meta: { title: '菜单管理', badge: 'New' },
},
],
},
{
path: "/mall",
path: '/mall',
component: Layout,
redirect: "noRedirect",
name: "Mall",
redirect: 'noRedirect',
name: 'Mall',
meta: {
title: "商城",
icon: "shopping-cart",
permissions: ["admin"],
title: '商城',
icon: 'shopping-cart',
permissions: ['admin'],
},
children: [
{
path: "pay",
name: "Pay",
component: () => import("@/views/mall/pay/index"),
path: 'pay',
name: 'Pay',
component: () => import('@/views/mall/pay/index'),
meta: {
title: "支付",
title: '支付',
noKeepAlive: true,
},
children: null,
},
{
path: "goodsList",
name: "GoodsList",
component: () => import("@/views/mall/goodsList/index"),
path: 'goodsList',
name: 'GoodsList',
component: () => import('@/views/mall/goodsList/index'),
meta: {
title: "商品列表",
title: '商品列表',
},
},
],
},
{
path: "/error",
path: '/error',
component: EmptyLayout,
redirect: "noRedirect",
name: "Error",
meta: { title: "错误页", icon: "bug" },
redirect: 'noRedirect',
name: 'Error',
meta: { title: '错误页', icon: 'bug' },
children: [
{
path: "401",
name: "Error401",
component: () => import("@/views/401"),
meta: { title: "401" },
path: '401',
name: 'Error401',
component: () => import('@/views/401'),
meta: { title: '401' },
},
{
path: "404",
name: "Error404",
component: () => import("@/views/404"),
meta: { title: "404" },
path: '404',
name: 'Error404',
component: () => import('@/views/404'),
meta: { title: '404' },
},
],
},
{
path: "*",
redirect: "/404",
path: '*',
redirect: '/404',
hidden: true,
},
];
]
const router = new VueRouter({
base: publicPath,
@ -396,14 +396,14 @@ const router = new VueRouter({
y: 0,
}),
routes: constantRoutes,
});
})
//注释的地方是允许路由重复点击,如果你觉得框架路由跳转规范太过严格可选择放开
const originalPush = VueRouter.prototype.push;
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location, onResolve, onReject) {
if (onResolve || onReject)
return originalPush.call(this, location, onResolve, onReject);
return originalPush.call(this, location).catch((err) => err);
};
return originalPush.call(this, location, onResolve, onReject)
return originalPush.call(this, location).catch((err) => err)
}
export function resetRouter() {
router.matcher = new VueRouter({
@ -413,7 +413,7 @@ export function resetRouter() {
y: 0,
}),
routes: constantRoutes,
}).matcher;
}).matcher
}
export default router;
export default router

View File

@ -3,20 +3,20 @@
* @description 导入所有 vuex 模块自动加入namespaced:true用于解决vuex命名冲突请勿修改
*/
import Vue from "vue";
import Vuex from "vuex";
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex);
const files = require.context("./modules", false, /\.js$/);
const modules = {};
Vue.use(Vuex)
const files = require.context('./modules', false, /\.js$/)
const modules = {}
files.keys().forEach((key) => {
modules[key.replace(/(\.\/|\.js)/g, "")] = files(key).default;
});
modules[key.replace(/(\.\/|\.js)/g, '')] = files(key).default
})
Object.keys(modules).forEach((key) => {
modules[key]["namespaced"] = true;
});
modules[key]['namespaced'] = true
})
const store = new Vuex.Store({
modules,
});
export default store;
})
export default store

View File

@ -3,24 +3,24 @@
* @description 异常捕获的状态拦截请勿修改
*/
const state = { errorLogs: [] };
const state = { errorLogs: [] }
const getters = {
errorLogs: (state) => state.errorLogs,
};
}
const mutations = {
addErrorLog(state, errorLog) {
state.errorLogs.push(errorLog);
state.errorLogs.push(errorLog)
},
clearErrorLog: (state) => {
state.errorLogs.splice(0);
state.errorLogs.splice(0)
},
};
}
const actions = {
addErrorLog({ commit }, errorLog) {
commit("addErrorLog", errorLog);
commit('addErrorLog', errorLog)
},
clearErrorLog({ commit }) {
commit("clearErrorLog");
commit('clearErrorLog')
},
};
export default { state, getters, mutations, actions };
}
export default { state, getters, mutations, actions }

View File

@ -2,46 +2,46 @@
* @author chuzhixin 1204505056@qq.com 不想保留author可删除
* @description 路由拦截状态管理目前两种模式all模式与intelligence模式其中partialRoutes是菜单暂未使用
*/
import { asyncRoutes, constantRoutes } from "@/router";
import { getRouterList } from "@/api/router";
import { convertRouter, filterAsyncRoutes } from "@/utils/handleRoutes";
import { asyncRoutes, constantRoutes } from '@/router'
import { getRouterList } from '@/api/router'
import { convertRouter, filterAsyncRoutes } from '@/utils/handleRoutes'
const state = { routes: [], partialRoutes: [] };
const state = { routes: [], partialRoutes: [] }
const getters = {
routes: (state) => state.routes,
partialRoutes: (state) => state.partialRoutes,
};
}
const mutations = {
setRoutes(state, routes) {
state.routes = constantRoutes.concat(routes);
state.routes = constantRoutes.concat(routes)
},
setAllRoutes(state, routes) {
state.routes = constantRoutes.concat(routes);
state.routes = constantRoutes.concat(routes)
},
setPartialRoutes(state, routes) {
state.partialRoutes = constantRoutes.concat(routes);
state.partialRoutes = constantRoutes.concat(routes)
},
};
}
const actions = {
async setRoutes({ commit }, permissions) {
//开源版只过滤动态路由permissionsadmin不再默认拥有全部权限
const finallyAsyncRoutes = await filterAsyncRoutes(
[...asyncRoutes],
permissions
);
commit("setRoutes", finallyAsyncRoutes);
return finallyAsyncRoutes;
)
commit('setRoutes', finallyAsyncRoutes)
return finallyAsyncRoutes
},
async setAllRoutes({ commit }) {
let { data } = await getRouterList();
data.push({ path: "*", redirect: "/404", hidden: true });
let accessRoutes = convertRouter(data);
commit("setAllRoutes", accessRoutes);
return accessRoutes;
let { data } = await getRouterList()
data.push({ path: '*', redirect: '/404', hidden: true })
let accessRoutes = convertRouter(data)
commit('setAllRoutes', accessRoutes)
return accessRoutes
},
setPartialRoutes({ commit }, accessRoutes) {
commit("setPartialRoutes", accessRoutes);
return accessRoutes;
commit('setPartialRoutes', accessRoutes)
return accessRoutes
},
};
export default { state, getters, mutations, actions };
}
export default { state, getters, mutations, actions }

View File

@ -3,20 +3,20 @@
* @description 所有全局配置的状态管理如无必要请勿修改
*/
import defaultSettings from "@/config/settings";
import defaultSettings from '@/config/settings'
const { tabsBar, logo, layout, header, themeBar } = defaultSettings;
const { tabsBar, logo, layout, header, themeBar } = defaultSettings
const theme =
JSON.parse(localStorage.getItem("vue-admin-beautiful-theme")) || "";
JSON.parse(localStorage.getItem('vue-admin-beautiful-theme')) || ''
const state = {
tabsBar: theme.tabsBar || tabsBar,
logo,
collapse: false,
layout: theme.layout || layout,
header: theme.header || header,
device: "desktop",
device: 'desktop',
themeBar,
};
}
const getters = {
collapse: (state) => state.collapse,
device: (state) => state.device,
@ -25,51 +25,51 @@ const getters = {
logo: (state) => state.logo,
tabsBar: (state) => state.tabsBar,
themeBar: (state) => state.themeBar,
};
}
const mutations = {
changeLayout: (state, layout) => {
if (layout) state.layout = layout;
if (layout) state.layout = layout
},
changeHeader: (state, header) => {
if (header) state.header = header;
if (header) state.header = header
},
changeTabsBar: (state, tabsBar) => {
if (tabsBar) state.tabsBar = tabsBar;
if (tabsBar) state.tabsBar = tabsBar
},
changeCollapse: (state) => {
state.collapse = !state.collapse;
state.collapse = !state.collapse
},
foldSideBar: (state) => {
state.collapse = true;
state.collapse = true
},
openSideBar: (state) => {
state.collapse = false;
state.collapse = false
},
toggleDevice: (state, device) => {
state.device = device;
state.device = device
},
};
}
const actions = {
changeLayout({ commit }, layout) {
commit("changeLayout", layout);
commit('changeLayout', layout)
},
changeHeader({ commit }, header) {
commit("changeHeader", header);
commit('changeHeader', header)
},
changeTabsBar({ commit }, tabsBar) {
commit("changeTabsBar", tabsBar);
commit('changeTabsBar', tabsBar)
},
changeCollapse({ commit }) {
commit("changeCollapse");
commit('changeCollapse')
},
foldSideBar({ commit }) {
commit("foldSideBar");
commit('foldSideBar')
},
openSideBar({ commit }) {
commit("openSideBar");
commit('openSideBar')
},
toggleDevice({ commit }, device) {
commit("toggleDevice", device);
commit('toggleDevice', device)
},
};
export default { state, getters, mutations, actions };
}
export default { state, getters, mutations, actions }

View File

@ -3,19 +3,19 @@
* @description 代码生成机状态管理
*/
const state = { srcCode: "" };
const state = { srcCode: '' }
const getters = {
srcTableCode: (state) => state.srcCode,
};
}
const mutations = {
setTableCode(state, srcCode) {
state.srcCode = srcCode;
state.srcCode = srcCode
},
};
}
const actions = {
setTableCode({ commit }, srcCode) {
commit("setTableCode", srcCode);
commit('setTableCode', srcCode)
},
};
export default { state, getters, mutations, actions };
}
export default { state, getters, mutations, actions }

View File

@ -5,108 +5,108 @@
const state = {
visitedRoutes: [],
};
}
const getters = {
visitedRoutes: (state) => state.visitedRoutes,
};
}
const mutations = {
addVisitedRoute(state, route) {
let target = state.visitedRoutes.find((item) => item.path === route.path);
let target = state.visitedRoutes.find((item) => item.path === route.path)
if (target) {
if (route.fullPath !== target.fullPath) Object.assign(target, route);
return;
if (route.fullPath !== target.fullPath) Object.assign(target, route)
return
}
state.visitedRoutes.push(Object.assign({}, route));
state.visitedRoutes.push(Object.assign({}, route))
},
delVisitedRoute(state, route) {
state.visitedRoutes.forEach((item, index) => {
if (item.path === route.path) state.visitedRoutes.splice(index, 1);
});
if (item.path === route.path) state.visitedRoutes.splice(index, 1)
})
},
delOthersVisitedRoute(state, route) {
state.visitedRoutes = state.visitedRoutes.filter(
(item) => item.meta.affix || item.path === route.path
);
)
},
delLeftVisitedRoute(state, route) {
let index = state.visitedRoutes.length;
let index = state.visitedRoutes.length
state.visitedRoutes = state.visitedRoutes.filter((item) => {
if (item.name === route.name) index = state.visitedRoutes.indexOf(item);
return item.meta.affix || index <= state.visitedRoutes.indexOf(item);
});
if (item.name === route.name) index = state.visitedRoutes.indexOf(item)
return item.meta.affix || index <= state.visitedRoutes.indexOf(item)
})
},
delRightVisitedRoute(state, route) {
let index = state.visitedRoutes.length;
let index = state.visitedRoutes.length
state.visitedRoutes = state.visitedRoutes.filter((item) => {
if (item.name === route.name) index = state.visitedRoutes.indexOf(item);
return item.meta.affix || index >= state.visitedRoutes.indexOf(item);
});
if (item.name === route.name) index = state.visitedRoutes.indexOf(item)
return item.meta.affix || index >= state.visitedRoutes.indexOf(item)
})
},
delAllVisitedRoutes(state) {
state.visitedRoutes = state.visitedRoutes.filter((item) => item.meta.affix);
state.visitedRoutes = state.visitedRoutes.filter((item) => item.meta.affix)
},
updateVisitedRoute(state, route) {
state.visitedRoutes.forEach((item) => {
if (item.path === route.path) item = Object.assign(item, route);
});
if (item.path === route.path) item = Object.assign(item, route)
})
},
};
}
const actions = {
addVisitedRoute({ commit }, route) {
commit("addVisitedRoute", route);
commit('addVisitedRoute', route)
},
async delRoute({ dispatch, state }, route) {
await dispatch("delVisitedRoute", route);
await dispatch('delVisitedRoute', route)
return {
visitedRoutes: [...state.visitedRoutes],
};
}
},
delVisitedRoute({ commit, state }, route) {
commit("delVisitedRoute", route);
return [...state.visitedRoutes];
commit('delVisitedRoute', route)
return [...state.visitedRoutes]
},
async delOthersRoutes({ dispatch, state }, route) {
await dispatch("delOthersVisitedRoute", route);
await dispatch('delOthersVisitedRoute', route)
return {
visitedRoutes: [...state.visitedRoutes],
};
}
},
async delLeftRoutes({ dispatch, state }, route) {
await dispatch("delLeftVisitedRoute", route);
await dispatch('delLeftVisitedRoute', route)
return {
visitedRoutes: [...state.visitedRoutes],
};
}
},
async delRightRoutes({ dispatch, state }, route) {
await dispatch("delRightVisitedRoute", route);
await dispatch('delRightVisitedRoute', route)
return {
visitedRoutes: [...state.visitedRoutes],
};
}
},
delOthersVisitedRoute({ commit, state }, route) {
commit("delOthersVisitedRoute", route);
return [...state.visitedRoutes];
commit('delOthersVisitedRoute', route)
return [...state.visitedRoutes]
},
delLeftVisitedRoute({ commit, state }, route) {
commit("delLeftVisitedRoute", route);
return [...state.visitedRoutes];
commit('delLeftVisitedRoute', route)
return [...state.visitedRoutes]
},
delRightVisitedRoute({ commit, state }, route) {
commit("delRightVisitedRoute", route);
return [...state.visitedRoutes];
commit('delRightVisitedRoute', route)
return [...state.visitedRoutes]
},
async delAllRoutes({ dispatch, state }, route) {
await dispatch("delAllVisitedRoutes", route);
await dispatch('delAllVisitedRoutes', route)
return {
visitedRoutes: [...state.visitedRoutes],
};
}
},
delAllVisitedRoutes({ commit, state }) {
commit("delAllVisitedRoutes");
return [...state.visitedRoutes];
commit('delAllVisitedRoutes')
return [...state.visitedRoutes]
},
updateVisitedRoute({ commit }, route) {
commit("updateVisitedRoute", route);
commit('updateVisitedRoute', route)
},
};
export default { state, getters, mutations, actions };
}
export default { state, getters, mutations, actions }

View File

@ -3,97 +3,97 @@
* @description 登录获取用户信息退出登录清除accessToken逻辑不建议修改
*/
import Vue from "vue";
import { getUserInfo, login, logout } from "@/api/user";
import Vue from 'vue'
import { getUserInfo, login, logout } from '@/api/user'
import {
getAccessToken,
removeAccessToken,
setAccessToken,
} from "@/utils/accessToken";
import { resetRouter } from "@/router";
import { title, tokenName } from "@/config/settings";
} from '@/utils/accessToken'
import { resetRouter } from '@/router'
import { title, tokenName } from '@/config/settings'
const state = {
accessToken: getAccessToken(),
username: "",
avatar: "",
username: '',
avatar: '',
permissions: [],
};
}
const getters = {
accessToken: (state) => state.accessToken,
username: (state) => state.username,
avatar: (state) => state.avatar,
permissions: (state) => state.permissions,
};
}
const mutations = {
setAccessToken(state, accessToken) {
state.accessToken = accessToken;
setAccessToken(accessToken);
state.accessToken = accessToken
setAccessToken(accessToken)
},
setUsername(state, username) {
state.username = username;
state.username = username
},
setAvatar(state, avatar) {
state.avatar = avatar;
state.avatar = avatar
},
setPermissions(state, permissions) {
state.permissions = permissions;
state.permissions = permissions
},
};
}
const actions = {
setPermissions({ commit }, permissions) {
commit("setPermissions", permissions);
commit('setPermissions', permissions)
},
async login({ commit }, userInfo) {
const { data } = await login(userInfo);
const accessToken = data[tokenName];
const { data } = await login(userInfo)
const accessToken = data[tokenName]
if (accessToken) {
commit("setAccessToken", accessToken);
const hour = new Date().getHours();
commit('setAccessToken', accessToken)
const hour = new Date().getHours()
const thisTime =
hour < 8
? "早上好"
? '早上好'
: hour <= 11
? "上午好"
? '上午好'
: hour <= 13
? "中午好"
? '中午好'
: hour < 18
? "下午好"
: "晚上好";
Vue.prototype.$baseNotify(`欢迎登录${title}`, `${thisTime}`);
? '下午好'
: '晚上好'
Vue.prototype.$baseNotify(`欢迎登录${title}`, `${thisTime}`)
} else {
Vue.prototype.$baseMessage(
`登录接口异常,未正确返回${tokenName}...`,
"error"
);
'error'
)
}
},
async getUserInfo({ commit, state }) {
const { data } = await getUserInfo(state.accessToken);
const { data } = await getUserInfo(state.accessToken)
if (!data) {
Vue.prototype.$baseMessage("验证失败,请重新登录...", "error");
return false;
Vue.prototype.$baseMessage('验证失败,请重新登录...', 'error')
return false
}
let { permissions, username, avatar } = data;
let { permissions, username, avatar } = data
if (permissions && username && Array.isArray(permissions)) {
commit("setPermissions", permissions);
commit("setUsername", username);
commit("setAvatar", avatar);
return permissions;
commit('setPermissions', permissions)
commit('setUsername', username)
commit('setAvatar', avatar)
return permissions
} else {
Vue.prototype.$baseMessage("用户信息接口异常", "error");
return false;
Vue.prototype.$baseMessage('用户信息接口异常', 'error')
return false
}
},
async logout({ dispatch }) {
await logout(state.accessToken);
await dispatch("resetAccessToken");
await resetRouter();
await logout(state.accessToken)
await dispatch('resetAccessToken')
await resetRouter()
},
resetAccessToken({ commit }) {
commit("setPermissions", []);
commit("setAccessToken", "");
removeAccessToken();
commit('setPermissions', [])
commit('setAccessToken', '')
removeAccessToken()
},
};
export default { state, getters, mutations, actions };
}
export default { state, getters, mutations, actions }

View File

@ -1,4 +1,4 @@
import { storage, tokenTableName } from "@/config/settings";
import { storage, tokenTableName } from '@/config/settings'
/**
* @author chuzhixin 1204505056@qq.com 不想保留author可删除
@ -7,15 +7,15 @@ import { storage, tokenTableName } from "@/config/settings";
*/
export function getAccessToken() {
if (storage) {
if ("localStorage" === storage) {
return localStorage.getItem(tokenTableName);
} else if ("sessionStorage" === storage) {
return sessionStorage.getItem(tokenTableName);
if ('localStorage' === storage) {
return localStorage.getItem(tokenTableName)
} else if ('sessionStorage' === storage) {
return sessionStorage.getItem(tokenTableName)
} else {
return localStorage.getItem(tokenTableName);
return localStorage.getItem(tokenTableName)
}
} else {
return localStorage.getItem(tokenTableName);
return localStorage.getItem(tokenTableName)
}
}
@ -27,15 +27,15 @@ export function getAccessToken() {
*/
export function setAccessToken(accessToken) {
if (storage) {
if ("localStorage" === storage) {
return localStorage.setItem(tokenTableName, accessToken);
} else if ("sessionStorage" === storage) {
return sessionStorage.setItem(tokenTableName, accessToken);
if ('localStorage' === storage) {
return localStorage.setItem(tokenTableName, accessToken)
} else if ('sessionStorage' === storage) {
return sessionStorage.setItem(tokenTableName, accessToken)
} else {
return localStorage.setItem(tokenTableName, accessToken);
return localStorage.setItem(tokenTableName, accessToken)
}
} else {
return localStorage.setItem(tokenTableName, accessToken);
return localStorage.setItem(tokenTableName, accessToken)
}
}
@ -46,14 +46,14 @@ export function setAccessToken(accessToken) {
*/
export function removeAccessToken() {
if (storage) {
if ("localStorage" === storage) {
return localStorage.removeItem(tokenTableName);
} else if ("sessionStorage" === storage) {
return sessionStorage.clear();
if ('localStorage' === storage) {
return localStorage.removeItem(tokenTableName)
} else if ('sessionStorage' === storage) {
return sessionStorage.clear()
} else {
return localStorage.removeItem(tokenTableName);
return localStorage.removeItem(tokenTableName)
}
} else {
return localStorage.removeItem(tokenTableName);
return localStorage.removeItem(tokenTableName)
}
}

View File

@ -1,12 +1,12 @@
import Vue from "vue";
import Clipboard from "clipboard";
import Vue from 'vue'
import Clipboard from 'clipboard'
function clipboardSuccess() {
Vue.prototype.$baseMessage("复制成功", "success");
Vue.prototype.$baseMessage('复制成功', 'success')
}
function clipboardError() {
Vue.prototype.$baseMessage("复制失败", "error");
Vue.prototype.$baseMessage('复制失败', 'error')
}
/**
@ -18,14 +18,14 @@ function clipboardError() {
export default function handleClipboard(text, event) {
const clipboard = new Clipboard(event.target, {
text: () => text,
});
clipboard.on("success", () => {
clipboardSuccess();
clipboard.destroy();
});
clipboard.on("error", () => {
clipboardError();
clipboard.destroy();
});
clipboard.onClick(event);
})
clipboard.on('success', () => {
clipboardSuccess()
clipboard.destroy()
})
clipboard.on('error', () => {
clipboardError()
clipboard.destroy()
})
clipboard.onClick(event)
}

View File

@ -1,8 +1,8 @@
import { JSEncrypt } from "jsencrypt";
import { getPublicKey } from "@/api/publicKey";
import { JSEncrypt } from 'jsencrypt'
import { getPublicKey } from '@/api/publicKey'
const privateKey =
"MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAMFPa+v52FkSUXvcUnrGI/XzW3EpZRI0s9BCWJ3oNQmEYA5luWW5p8h0uadTIoTyYweFPdH4hveyxlwmS7oefvbIdiP+o+QIYW/R4Wjsb4Yl8MhR4PJqUE3RCy6IT9fM8ckG4kN9ECs6Ja8fQFc6/mSl5dJczzJO3k1rWMBhKJD/AgMBAAECgYEAucMakH9dWeryhrYoRHcXo4giPVJsH9ypVt4KzmOQY/7jV7KFQK3x//27UoHfUCak51sxFw9ek7UmTPM4HjikA9LkYeE7S381b4QRvFuf3L6IbMP3ywJnJ8pPr2l5SqQ00W+oKv+w/VmEsyUHr+k4Z+4ik+FheTkVWp566WbqFsECQQDjYaMcaKw3j2Zecl8T6eUe7fdaRMIzp/gcpPMfT/9rDzIQk+7ORvm1NI9AUmFv/FAlfpuAMrdL2n7p9uznWb7RAkEA2aP934kbXg5bdV0R313MrL+7WTK/qdcYxATUbMsMuWWQBoS5irrt80WCZbG48hpocJavLNjbtrjmUX3CuJBmzwJAOJg8uP10n/+ZQzjEYXh+BszEHDuw+pp8LuT/fnOy5zrJA0dO0RjpXijO3vuiNPVgHXT9z1LQPJkNrb5ACPVVgQJBALPeb4uV0bNrJDUb5RB4ghZnIxv18CcaqNIft7vuGCcFBAIPIRTBprR+RuVq+xHDt3sNXdsvom4h49+Hky1b0ksCQBBwUtVaqH6ztCtwUF1j2c/Zcrt5P/uN7IHAd44K0gIJc1+Csr3qPG+G2yoqRM8KVqLI8Z2ZYn9c+AvEE+L9OQY=";
'MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAMFPa+v52FkSUXvcUnrGI/XzW3EpZRI0s9BCWJ3oNQmEYA5luWW5p8h0uadTIoTyYweFPdH4hveyxlwmS7oefvbIdiP+o+QIYW/R4Wjsb4Yl8MhR4PJqUE3RCy6IT9fM8ckG4kN9ECs6Ja8fQFc6/mSl5dJczzJO3k1rWMBhKJD/AgMBAAECgYEAucMakH9dWeryhrYoRHcXo4giPVJsH9ypVt4KzmOQY/7jV7KFQK3x//27UoHfUCak51sxFw9ek7UmTPM4HjikA9LkYeE7S381b4QRvFuf3L6IbMP3ywJnJ8pPr2l5SqQ00W+oKv+w/VmEsyUHr+k4Z+4ik+FheTkVWp566WbqFsECQQDjYaMcaKw3j2Zecl8T6eUe7fdaRMIzp/gcpPMfT/9rDzIQk+7ORvm1NI9AUmFv/FAlfpuAMrdL2n7p9uznWb7RAkEA2aP934kbXg5bdV0R313MrL+7WTK/qdcYxATUbMsMuWWQBoS5irrt80WCZbG48hpocJavLNjbtrjmUX3CuJBmzwJAOJg8uP10n/+ZQzjEYXh+BszEHDuw+pp8LuT/fnOy5zrJA0dO0RjpXijO3vuiNPVgHXT9z1LQPJkNrb5ACPVVgQJBALPeb4uV0bNrJDUb5RB4ghZnIxv18CcaqNIft7vuGCcFBAIPIRTBprR+RuVq+xHDt3sNXdsvom4h49+Hky1b0ksCQBBwUtVaqH6ztCtwUF1j2c/Zcrt5P/uN7IHAd44K0gIJc1+Csr3qPG+G2yoqRM8KVqLI8Z2ZYn9c+AvEE+L9OQY='
/**
* @author chuzhixin 1204505056@qq.com 不想保留author可删除
@ -11,23 +11,23 @@ const privateKey =
* @returns {Promise<{param: PromiseLike<ArrayBuffer>}|*>}
*/
export async function encryptedData(data) {
let publicKey = "";
const res = await getPublicKey();
publicKey = res.data.publicKey;
let publicKey = ''
const res = await getPublicKey()
publicKey = res.data.publicKey
if (res.data.mockServer) {
publicKey = "";
publicKey = ''
}
if (publicKey == "") {
return data;
if (publicKey == '') {
return data
}
const encrypt = new JSEncrypt();
const encrypt = new JSEncrypt()
encrypt.setPublicKey(
`-----BEGIN PUBLIC KEY-----${publicKey}-----END PUBLIC KEY-----`
);
data = encrypt.encrypt(JSON.stringify(data));
)
data = encrypt.encrypt(JSON.stringify(data))
return {
param: data,
};
}
}
/**
@ -37,10 +37,10 @@ export async function encryptedData(data) {
* @returns {PromiseLike<ArrayBuffer>}
*/
export function decryptedData(data) {
const decrypt = new JSEncrypt();
const decrypt = new JSEncrypt()
decrypt.setPrivateKey(
`-----BEGIN RSA PRIVATE KEY-----${privateKey}-----END RSA PRIVATE KEY-----`
);
data = decrypt.decrypt(JSON.stringify(data));
return data;
)
data = decrypt.decrypt(JSON.stringify(data))
return data
}

View File

@ -1,25 +1,25 @@
import Vue from "vue";
import store from "@/store";
import { isArray, isString } from "@/utils/validate";
import { errorLog } from "@/config/settings";
import Vue from 'vue'
import store from '@/store'
import { isArray, isString } from '@/utils/validate'
import { errorLog } from '@/config/settings'
const needErrorLog = errorLog;
const needErrorLog = errorLog
const checkNeed = () => {
const env = process.env.NODE_ENV;
const env = process.env.NODE_ENV
if (isString(needErrorLog)) {
return env === needErrorLog;
return env === needErrorLog
}
if (isArray(needErrorLog)) {
return needErrorLog.includes(env);
return needErrorLog.includes(env)
}
return false;
};
return false
}
if (checkNeed()) {
Vue.config.errorHandler = (err, vm, info) => {
console.error("vue-admin-beautiful错误拦截:", err, vm, info);
const url = window.location.href;
console.error('vue-admin-beautiful错误拦截:', err, vm, info)
const url = window.location.href
Vue.nextTick(() => {
store.dispatch("errorLog/addErrorLog", { err, vm, info, url });
});
};
store.dispatch('errorLog/addErrorLog', { err, vm, info, url })
})
}
}

View File

@ -7,23 +7,23 @@
export function convertRouter(asyncRoutes) {
return asyncRoutes.map((route) => {
if (route.component) {
if (route.component === "Layout") {
route.component = (resolve) => require(["@/layouts"], resolve);
} else if (route.component === "EmptyLayout") {
if (route.component === 'Layout') {
route.component = (resolve) => require(['@/layouts'], resolve)
} else if (route.component === 'EmptyLayout') {
route.component = (resolve) =>
require(["@/layouts/EmptyLayout"], resolve);
require(['@/layouts/EmptyLayout'], resolve)
} else {
const index = route.component.indexOf("views");
const index = route.component.indexOf('views')
const path =
index > 0 ? route.component.slice(index) : `views/${route.component}`;
route.component = (resolve) => require([`@/${path}`], resolve);
index > 0 ? route.component.slice(index) : `views/${route.component}`
route.component = (resolve) => require([`@/${path}`], resolve)
}
}
if (route.children && route.children.length)
route.children = convertRouter(route.children);
if (route.children && route.children.length === 0) delete route.children;
return route;
});
route.children = convertRouter(route.children)
if (route.children && route.children.length === 0) delete route.children
return route
})
}
/**
@ -35,9 +35,9 @@ export function convertRouter(asyncRoutes) {
*/
function hasPermission(permissions, route) {
if (route.meta && route.meta.permissions) {
return permissions.some((role) => route.meta.permissions.includes(role));
return permissions.some((role) => route.meta.permissions.includes(role))
} else {
return true;
return true
}
}
@ -49,15 +49,15 @@ function hasPermission(permissions, route) {
* @returns {[]}
*/
export function filterAsyncRoutes(routes, permissions) {
const finallyRoutes = [];
const finallyRoutes = []
routes.forEach((route) => {
const item = { ...route };
const item = { ...route }
if (hasPermission(permissions, item)) {
if (item.children) {
item.children = filterAsyncRoutes(item.children, permissions);
item.children = filterAsyncRoutes(item.children, permissions)
}
finallyRoutes.push(item);
finallyRoutes.push(item)
}
});
return finallyRoutes;
})
return finallyRoutes
}

View File

@ -7,20 +7,20 @@
*/
export function parseTime(time, cFormat) {
if (arguments.length === 0) {
return null;
return null
}
const format = cFormat || "{y}-{m}-{d} {h}:{i}:{s}";
let date;
if (typeof time === "object") {
date = time;
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
let date
if (typeof time === 'object') {
date = time
} else {
if (typeof time === "string" && /^[0-9]+$/.test(time)) {
time = parseInt(time);
if (typeof time === 'string' && /^[0-9]+$/.test(time)) {
time = parseInt(time)
}
if (typeof time === "number" && time.toString().length === 10) {
time = time * 1000;
if (typeof time === 'number' && time.toString().length === 10) {
time = time * 1000
}
date = new Date(time);
date = new Date(time)
}
const formatObj = {
y: date.getFullYear(),
@ -30,18 +30,18 @@ export function parseTime(time, cFormat) {
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay(),
};
}
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
let value = formatObj[key];
if (key === "a") {
return ["日", "一", "二", "三", "四", "五", "六"][value];
let value = formatObj[key]
if (key === 'a') {
return ['日', '一', '二', '三', '四', '五', '六'][value]
}
if (result.length > 0 && value < 10) {
value = "0" + value;
value = '0' + value
}
return value || 0;
});
return time_str;
return value || 0
})
return time_str
}
/**
@ -52,40 +52,40 @@ export function parseTime(time, cFormat) {
* @returns {string}
*/
export function formatTime(time, option) {
if (("" + time).length === 10) {
time = parseInt(time) * 1000;
if (('' + time).length === 10) {
time = parseInt(time) * 1000
} else {
time = +time;
time = +time
}
const d = new Date(time);
const now = Date.now();
const d = new Date(time)
const now = Date.now()
const diff = (now - d) / 1000;
const diff = (now - d) / 1000
if (diff < 30) {
return "刚刚";
return '刚刚'
} else if (diff < 3600) {
// less 1 hour
return Math.ceil(diff / 60) + "分钟前";
return Math.ceil(diff / 60) + '分钟前'
} else if (diff < 3600 * 24) {
return Math.ceil(diff / 3600) + "小时前";
return Math.ceil(diff / 3600) + '小时前'
} else if (diff < 3600 * 24 * 2) {
return "1天前";
return '1天前'
}
if (option) {
return parseTime(time, option);
return parseTime(time, option)
} else {
return (
d.getMonth() +
1 +
"月" +
'月' +
d.getDate() +
"日" +
'日' +
d.getHours() +
"时" +
'时' +
d.getMinutes() +
"分"
);
'分'
)
}
}
@ -96,9 +96,9 @@ export function formatTime(time, option) {
* @returns {{}|any}
*/
export function paramObj(url) {
const search = url.split("?")[1];
const search = url.split('?')[1]
if (!search) {
return {};
return {}
}
return JSON.parse(
'{"' +
@ -106,9 +106,9 @@ export function paramObj(url) {
.replace(/"/g, '\\"')
.replace(/&/g, '","')
.replace(/=/g, '":"')
.replace(/\+/g, " ") +
.replace(/\+/g, ' ') +
'"}'
);
)
}
/**
@ -119,27 +119,27 @@ export function paramObj(url) {
*/
export function translateDataToTree(data) {
const parent = data.filter(
(value) => value.parentId === "undefined" || value.parentId == null
);
(value) => value.parentId === 'undefined' || value.parentId == null
)
const children = data.filter(
(value) => value.parentId !== "undefined" && value.parentId != null
);
(value) => value.parentId !== 'undefined' && value.parentId != null
)
const translator = (parent, children) => {
parent.forEach((parent) => {
children.forEach((current, index) => {
if (current.parentId === parent.id) {
const temp = JSON.parse(JSON.stringify(children));
temp.splice(index, 1);
translator([current], temp);
typeof parent.children !== "undefined"
const temp = JSON.parse(JSON.stringify(children))
temp.splice(index, 1)
translator([current], temp)
typeof parent.children !== 'undefined'
? parent.children.push(current)
: (parent.children = [current]);
: (parent.children = [current])
}
});
});
};
translator(parent, children);
return parent;
})
})
}
translator(parent, children)
return parent
}
/**
@ -149,24 +149,24 @@ export function translateDataToTree(data) {
* @returns {[]}
*/
export function translateTreeToData(data) {
const result = [];
const result = []
data.forEach((item) => {
const loop = (data) => {
result.push({
id: data.id,
name: data.name,
parentId: data.parentId,
});
const child = data.children;
})
const child = data.children
if (child) {
for (let i = 0; i < child.length; i++) {
loop(child[i]);
loop(child[i])
}
}
};
loop(item);
});
return result;
}
loop(item)
})
return result
}
/**
@ -176,19 +176,19 @@ export function translateTreeToData(data) {
* @returns {string}
*/
export function tenBitTimestamp(time) {
const date = new Date(time * 1000);
const y = date.getFullYear();
let m = date.getMonth() + 1;
m = m < 10 ? "" + m : m;
let d = date.getDate();
d = d < 10 ? "" + d : d;
let h = date.getHours();
h = h < 10 ? "0" + h : h;
let minute = date.getMinutes();
let second = date.getSeconds();
minute = minute < 10 ? "0" + minute : minute;
second = second < 10 ? "0" + second : second;
return y + "年" + m + "月" + d + "日 " + h + ":" + minute + ":" + second; //组合
const date = new Date(time * 1000)
const y = date.getFullYear()
let m = date.getMonth() + 1
m = m < 10 ? '' + m : m
let d = date.getDate()
d = d < 10 ? '' + d : d
let h = date.getHours()
h = h < 10 ? '0' + h : h
let minute = date.getMinutes()
let second = date.getSeconds()
minute = minute < 10 ? '0' + minute : minute
second = second < 10 ? '0' + second : second
return y + '年' + m + '月' + d + '日 ' + h + ':' + minute + ':' + second //组合
}
/**
@ -198,19 +198,19 @@ export function tenBitTimestamp(time) {
* @returns {string}
*/
export function thirteenBitTimestamp(time) {
const date = new Date(time / 1);
const y = date.getFullYear();
let m = date.getMonth() + 1;
m = m < 10 ? "" + m : m;
let d = date.getDate();
d = d < 10 ? "" + d : d;
let h = date.getHours();
h = h < 10 ? "0" + h : h;
let minute = date.getMinutes();
let second = date.getSeconds();
minute = minute < 10 ? "0" + minute : minute;
second = second < 10 ? "0" + second : second;
return y + "年" + m + "月" + d + "日 " + h + ":" + minute + ":" + second; //组合
const date = new Date(time / 1)
const y = date.getFullYear()
let m = date.getMonth() + 1
m = m < 10 ? '' + m : m
let d = date.getDate()
d = d < 10 ? '' + d : d
let h = date.getHours()
h = h < 10 ? '0' + h : h
let minute = date.getMinutes()
let second = date.getSeconds()
minute = minute < 10 ? '0' + minute : minute
second = second < 10 ? '0' + second : second
return y + '年' + m + '月' + d + '日 ' + h + ':' + minute + ':' + second //组合
}
/**
@ -220,12 +220,12 @@ export function thirteenBitTimestamp(time) {
* @returns {string}
*/
export function uuid(length = 32) {
const num = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
let str = "";
const num = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
let str = ''
for (let i = 0; i < length; i++) {
str += num.charAt(Math.floor(Math.random() * num.length));
str += num.charAt(Math.floor(Math.random() * num.length))
}
return str;
return str
}
/**
@ -236,7 +236,7 @@ export function uuid(length = 32) {
* @returns {number}
*/
export function random(m, n) {
return Math.floor(Math.random() * (m - n) + n);
return Math.floor(Math.random() * (m - n) + n)
}
/**
@ -247,10 +247,10 @@ export function random(m, n) {
export const on = (function () {
return function (element, event, handler, useCapture = false) {
if (element && event && handler) {
element.addEventListener(event, handler, useCapture);
element.addEventListener(event, handler, useCapture)
}
};
})();
}
})()
/**
* @author chuzhixin 1204505056@qq.com 不想保留author可删除
@ -260,7 +260,7 @@ export const on = (function () {
export const off = (function () {
return function (element, event, handler, useCapture = false) {
if (element && event) {
element.removeEventListener(event, handler, useCapture);
element.removeEventListener(event, handler, useCapture)
}
};
})();
}
})()

View File

@ -1,4 +1,4 @@
import { title } from "@/config/settings";
import { title } from '@/config/settings'
/**
* @author chuzhixin 1204505056@qq.com 不想保留author可删除
@ -8,7 +8,7 @@ import { title } from "@/config/settings";
*/
export default function getPageTitle(pageTitle) {
if (pageTitle) {
return `${pageTitle}-${title}`;
return `${pageTitle}-${title}`
}
return `${title}`;
return `${title}`
}

View File

@ -1,4 +1,4 @@
import store from "@/store";
import store from '@/store'
/**
* @author chuzhixin 1204505056@qq.com 不想保留author可删除
@ -8,13 +8,13 @@ import store from "@/store";
*/
export default function checkPermission(value) {
if (value && value instanceof Array && value.length > 0) {
const permissions = store.getters["user/permissions"];
const permissionPermissions = value;
const permissions = store.getters['user/permissions']
const permissionPermissions = value
return permissions.some((role) => {
return permissionPermissions.includes(role);
});
return permissionPermissions.includes(role)
})
} else {
return false;
return false
}
}

View File

@ -1,5 +1,5 @@
import Vue from "vue";
import axios from "axios";
import Vue from 'vue'
import axios from 'axios'
import {
baseURL,
contentType,
@ -10,13 +10,13 @@ import {
successCode,
tokenName,
loginInterception,
} from "@/config/settings";
import store from "@/store";
import qs from "qs";
import router from "@/router";
import { isArray } from "@/utils/validate";
} from '@/config/settings'
import store from '@/store'
import qs from 'qs'
import router from '@/router'
import { isArray } from '@/utils/validate'
let loadingInstance;
let loadingInstance
/**
* @author chuzhixin 1204505056@qq.com 不想保留author可删除
@ -27,99 +27,99 @@ let loadingInstance;
const handleCode = (code, msg) => {
switch (code) {
case invalidCode:
Vue.prototype.$baseMessage(msg || `后端接口${code}异常`, "error");
store.dispatch("user/resetAccessToken").catch(() => {});
Vue.prototype.$baseMessage(msg || `后端接口${code}异常`, 'error')
store.dispatch('user/resetAccessToken').catch(() => {})
if (loginInterception) {
location.reload();
location.reload()
}
break;
break
case noPermissionCode:
router.push({ path: "/401" }).catch(() => {});
break;
router.push({ path: '/401' }).catch(() => {})
break
default:
Vue.prototype.$baseMessage(msg || `后端接口${code}异常`, "error");
break;
Vue.prototype.$baseMessage(msg || `后端接口${code}异常`, 'error')
break
}
};
}
const instance = axios.create({
baseURL,
timeout: requestTimeout,
headers: {
"Content-Type": contentType,
'Content-Type': contentType,
},
});
})
instance.interceptors.request.use(
(config) => {
if (store.getters["user/accessToken"]) {
config.headers[tokenName] = store.getters["user/accessToken"];
if (store.getters['user/accessToken']) {
config.headers[tokenName] = store.getters['user/accessToken']
}
//这里会过滤所有为空、0、false的key如果不需要请自行注释
if (config.data)
config.data = Vue.prototype.$baseLodash.pickBy(
config.data,
Vue.prototype.$baseLodash.identity
);
)
if (
config.data &&
config.headers["Content-Type"] ===
"application/x-www-form-urlencoded;charset=UTF-8"
config.headers['Content-Type'] ===
'application/x-www-form-urlencoded;charset=UTF-8'
)
config.data = qs.stringify(config.data);
config.data = qs.stringify(config.data)
if (debounce.some((item) => config.url.includes(item)))
loadingInstance = Vue.prototype.$baseLoading();
return config;
loadingInstance = Vue.prototype.$baseLoading()
return config
},
(error) => {
return Promise.reject(error);
return Promise.reject(error)
}
);
)
instance.interceptors.response.use(
(response) => {
if (loadingInstance) loadingInstance.close();
if (loadingInstance) loadingInstance.close()
const { data, config } = response;
const { code, msg } = data;
const { data, config } = response
const { code, msg } = data
// 操作正常Code数组
const codeVerificationArray = isArray(successCode)
? [...successCode]
: [...[successCode]];
: [...[successCode]]
// 是否操作正常
if (codeVerificationArray.includes(code)) {
return data;
return data
} else {
handleCode(code, msg);
handleCode(code, msg)
return Promise.reject(
"vue-admin-beautiful请求异常拦截:" +
JSON.stringify({ url: config.url, code, msg }) || "Error"
);
'vue-admin-beautiful请求异常拦截:' +
JSON.stringify({ url: config.url, code, msg }) || 'Error'
)
}
},
(error) => {
if (loadingInstance) loadingInstance.close();
const { response, message } = error;
if (loadingInstance) loadingInstance.close()
const { response, message } = error
if (error.response && error.response.data) {
const { status, data } = response;
handleCode(status, data.msg || message);
return Promise.reject(error);
const { status, data } = response
handleCode(status, data.msg || message)
return Promise.reject(error)
} else {
let { message } = error;
if (message === "Network Error") {
message = "后端接口连接异常";
let { message } = error
if (message === 'Network Error') {
message = '后端接口连接异常'
}
if (message.includes("timeout")) {
message = "后端接口请求超时";
if (message.includes('timeout')) {
message = '后端接口请求超时'
}
if (message.includes("Request failed with status code")) {
const code = message.substr(message.length - 3);
message = "后端接口" + code + "异常";
if (message.includes('Request failed with status code')) {
const code = message.substr(message.length - 3)
message = '后端接口' + code + '异常'
}
Vue.prototype.$baseMessage(message || `后端接口未知异常`, "error");
return Promise.reject(error);
Vue.prototype.$baseMessage(message || `后端接口未知异常`, 'error')
return Promise.reject(error)
}
}
);
)
export default instance;
export default instance

View File

@ -2,51 +2,51 @@
* @author chuzhixin 1204505056@qq.com
* @description 导入所有 controller 模块浏览器环境中自动输出controller文件夹下Mock接口请勿修改
*/
import Mock from "mockjs";
import { paramObj } from "@/utils/index";
import Mock from 'mockjs'
import { paramObj } from '@/utils/index'
const mocks = [];
const files = require.context("../../mock/controller", false, /\.js$/);
const mocks = []
const files = require.context('../../mock/controller', false, /\.js$/)
files.keys().forEach((key) => {
mocks.push(...files(key));
});
mocks.push(...files(key))
})
export function mockXHR() {
Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send;
Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send
Mock.XHR.prototype.send = function () {
if (this.custom.xhr) {
this.custom.xhr.withCredentials = this.withCredentials || false;
this.custom.xhr.withCredentials = this.withCredentials || false
if (this.responseType) {
this.custom.xhr.responseType = this.responseType;
this.custom.xhr.responseType = this.responseType
}
}
this.proxy_send(...arguments);
};
this.proxy_send(...arguments)
}
function XHRHttpRequst(respond) {
return function (options) {
let result;
let result
if (respond instanceof Function) {
const { body, type, url } = options;
const { body, type, url } = options
result = respond({
method: type,
body: JSON.parse(body),
query: paramObj(url),
});
})
} else {
result = respond;
result = respond
}
return Mock.mock(result);
};
return Mock.mock(result)
}
}
mocks.forEach((item) => {
Mock.mock(
new RegExp(item.url),
item.type || "get",
item.type || 'get',
XHRHttpRequst(item.response)
);
});
)
})
}

View File

@ -1,74 +1,74 @@
import { loadingText, messageDuration, title } from "@/config/settings";
import * as lodash from "lodash";
import { Loading, Message, MessageBox, Notification } from "element-ui";
import store from "@/store";
import { getAccessToken } from "@/utils/accessToken";
import { loadingText, messageDuration, title } from '@/config/settings'
import * as lodash from 'lodash'
import { Loading, Message, MessageBox, Notification } from 'element-ui'
import store from '@/store'
import { getAccessToken } from '@/utils/accessToken'
const accessToken = store.getters["user/accessToken"];
const layout = store.getters["settings/layout"];
const accessToken = store.getters['user/accessToken']
const layout = store.getters['settings/layout']
const install = (Vue, opts = {}) => {
/* 全局accessToken */
Vue.prototype.$baseAccessToken = () => {
return accessToken || getAccessToken();
};
return accessToken || getAccessToken()
}
/* 全局标题 */
Vue.prototype.$baseTitle = (() => {
return title;
})();
return title
})()
/* 全局加载层 */
Vue.prototype.$baseLoading = (index, text) => {
let loading;
let loading
if (!index) {
loading = Loading.service({
lock: true,
text: text || loadingText,
background: "hsla(0,0%,100%,.8)",
});
background: 'hsla(0,0%,100%,.8)',
})
} else {
loading = Loading.service({
lock: true,
text: text || loadingText,
spinner: "vab-loading-type" + index,
background: "hsla(0,0%,100%,.8)",
});
spinner: 'vab-loading-type' + index,
background: 'hsla(0,0%,100%,.8)',
})
}
return loading;
};
return loading
}
/* 全局多彩加载层 */
Vue.prototype.$baseColorfullLoading = (index, text) => {
let loading;
let loading
if (!index) {
loading = Loading.service({
lock: true,
text: text || loadingText,
spinner: "dots-loader",
background: "hsla(0,0%,100%,.8)",
});
spinner: 'dots-loader',
background: 'hsla(0,0%,100%,.8)',
})
} else {
switch (index) {
case 1:
index = "dots";
break;
index = 'dots'
break
case 2:
index = "gauge";
break;
index = 'gauge'
break
case 3:
index = "inner-circles";
break;
index = 'inner-circles'
break
case 4:
index = "plus";
break;
index = 'plus'
break
}
loading = Loading.service({
lock: true,
text: text || loadingText,
spinner: index + "-loader",
background: "hsla(0,0%,100%,.8)",
});
spinner: index + '-loader',
background: 'hsla(0,0%,100%,.8)',
})
}
return loading;
};
return loading
}
/* 全局Message */
Vue.prototype.$baseMessage = (message, type) => {
Message({
@ -78,103 +78,103 @@ const install = (Vue, opts = {}) => {
type: type,
dangerouslyUseHTMLString: true,
duration: messageDuration,
});
};
})
}
/* 全局Alert */
Vue.prototype.$baseAlert = (content, title, callback) => {
MessageBox.alert(content, title || "温馨提示", {
confirmButtonText: "确定",
MessageBox.alert(content, title || '温馨提示', {
confirmButtonText: '确定',
dangerouslyUseHTMLString: true,
callback: (action) => {
if (callback) {
callback();
callback()
}
},
});
};
})
}
/* 全局Confirm */
Vue.prototype.$baseConfirm = (content, title, callback1, callback2) => {
MessageBox.confirm(content, title || "温馨提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
MessageBox.confirm(content, title || '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
closeOnClickModal: false,
type: "warning",
type: 'warning',
})
.then(() => {
if (callback1) {
callback1();
callback1()
}
})
.catch(() => {
if (callback2) {
callback2();
callback2()
}
});
};
})
}
/* 全局Notification */
Vue.prototype.$baseNotify = (message, title, type, position) => {
Notification({
title: title,
message: message,
position: position || "top-right",
type: type || "success",
position: position || 'top-right',
type: type || 'success',
duration: messageDuration,
});
};
})
}
/* 全局TableHeight */
Vue.prototype.$baseTableHeight = (formType) => {
let height = window.innerHeight;
let paddingHeight = 400;
const formHeight = 50;
let height = window.innerHeight
let paddingHeight = 400
const formHeight = 50
if (layout === "vertical") {
paddingHeight = 340;
if (layout === 'vertical') {
paddingHeight = 340
}
if ("number" == typeof formType) {
height = height - paddingHeight - formHeight * formType;
if ('number' == typeof formType) {
height = height - paddingHeight - formHeight * formType
} else {
height = height - paddingHeight;
height = height - paddingHeight
}
return height;
};
return height
}
/* 全局map图层 */
Vue.prototype.$baseMap = () => {
return new maptalks.Map("map", {
return new maptalks.Map('map', {
center: [116.41348403785, 39.910843952376],
zoom: 12,
minZoom: 1,
maxZoom: 19,
spatialReference: {
projection: "baidu",
projection: 'baidu',
},
attribution: {
content: "&copy; vue-admin-beautiful",
content: '&copy; vue-admin-beautiful',
},
baseLayer: new maptalks.TileLayer("base", {
cssFilter: "sepia(100%) invert(90%)",
baseLayer: new maptalks.TileLayer('base', {
cssFilter: 'sepia(100%) invert(90%)',
urlTemplate:
"http://online{s}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles=pl&scaler=1&p=1",
'http://online{s}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles=pl&scaler=1&p=1',
subdomains: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
attribution:
'&copy; <a target="_blank" href="http://map.baidu.com">Baidu</a>',
}),
});
};
})
}
/* 全局lodash */
Vue.prototype.$baseLodash = lodash;
Vue.prototype.$baseLodash = lodash
/* 全局事件总线 */
Vue.prototype.$baseEventBus = new Vue();
};
if (typeof window !== "undefined" && window.Vue) {
install(window.Vue);
Vue.prototype.$baseEventBus = new Vue()
}
export default install;
if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue)
}
export default install

View File

@ -5,7 +5,7 @@
* @returns {boolean}
*/
export function isExternal(path) {
return /^(https?:|mailto:|tel:)/.test(path);
return /^(https?:|mailto:|tel:)/.test(path)
}
/**
@ -15,7 +15,7 @@ export function isExternal(path) {
* @returns {boolean}
*/
export function isPassword(str) {
return str.length >= 6;
return str.length >= 6
}
/**
@ -25,8 +25,8 @@ export function isPassword(str) {
* @returns {boolean}
*/
export function isNumber(value) {
const reg = /^[0-9]*$/;
return reg.test(value);
const reg = /^[0-9]*$/
return reg.test(value)
}
/**
@ -36,8 +36,8 @@ export function isNumber(value) {
* @returns {boolean}
*/
export function isName(value) {
const reg = /^[\u4e00-\u9fa5a-zA-Z0-9]+$/;
return reg.test(value);
const reg = /^[\u4e00-\u9fa5a-zA-Z0-9]+$/
return reg.test(value)
}
/**
@ -47,8 +47,8 @@ export function isName(value) {
* @returns {boolean}
*/
export function isIP(ip) {
const reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;
return reg.test(ip);
const reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
return reg.test(ip)
}
/**
@ -58,8 +58,8 @@ export function isIP(ip) {
* @returns {boolean}
*/
export function isUrl(url) {
const reg = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/;
return reg.test(url);
const reg = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
return reg.test(url)
}
/**
@ -69,8 +69,8 @@ export function isUrl(url) {
* @returns {boolean}
*/
export function isLowerCase(str) {
const reg = /^[a-z]+$/;
return reg.test(str);
const reg = /^[a-z]+$/
return reg.test(str)
}
/**
@ -80,8 +80,8 @@ export function isLowerCase(str) {
* @returns {boolean}
*/
export function isUpperCase(str) {
const reg = /^[A-Z]+$/;
return reg.test(str);
const reg = /^[A-Z]+$/
return reg.test(str)
}
/**
@ -91,8 +91,8 @@ export function isUpperCase(str) {
* @returns {boolean}
*/
export function isAlphabets(str) {
const reg = /^[A-Za-z]+$/;
return reg.test(str);
const reg = /^[A-Za-z]+$/
return reg.test(str)
}
/**
@ -102,7 +102,7 @@ export function isAlphabets(str) {
* @returns {boolean}
*/
export function isString(str) {
return typeof str === "string" || str instanceof String;
return typeof str === 'string' || str instanceof String
}
/**
@ -112,10 +112,10 @@ export function isString(str) {
* @returns {arg is any[]|boolean}
*/
export function isArray(arg) {
if (typeof Array.isArray === "undefined") {
return Object.prototype.toString.call(arg) === "[object Array]";
if (typeof Array.isArray === 'undefined') {
return Object.prototype.toString.call(arg) === '[object Array]'
}
return Array.isArray(arg);
return Array.isArray(arg)
}
/**
@ -125,8 +125,8 @@ export function isArray(arg) {
* @returns {boolean}
*/
export function isPort(str) {
const reg = /^([0-9]|[1-9]\d|[1-9]\d{2}|[1-9]\d{3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$/;
return reg.test(str);
const reg = /^([0-9]|[1-9]\d|[1-9]\d{2}|[1-9]\d{3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$/
return reg.test(str)
}
/**
@ -136,8 +136,8 @@ export function isPort(str) {
* @returns {boolean}
*/
export function isPhone(str) {
const reg = /^1\d{10}$/;
return reg.test(str);
const reg = /^1\d{10}$/
return reg.test(str)
}
/**
@ -147,8 +147,8 @@ export function isPhone(str) {
* @returns {boolean}
*/
export function isIdCard(str) {
const reg = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
return reg.test(str);
const reg = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
return reg.test(str)
}
/**
@ -158,8 +158,8 @@ export function isIdCard(str) {
* @returns {boolean}
*/
export function isEmail(str) {
const reg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
return reg.test(str);
const reg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
return reg.test(str)
}
/**
@ -169,8 +169,8 @@ export function isEmail(str) {
* @returns {boolean}
*/
export function isChina(str) {
const reg = /^[\u4E00-\u9FA5]{2,4}$/;
return reg.test(str);
const reg = /^[\u4E00-\u9FA5]{2,4}$/
return reg.test(str)
}
/**
@ -183,10 +183,10 @@ export function isBlank(str) {
return (
str == null ||
false ||
str === "" ||
str.trim() === "" ||
str.toLocaleLowerCase().trim() === "null"
);
str === '' ||
str.trim() === '' ||
str.toLocaleLowerCase().trim() === 'null'
)
}
/**
@ -196,8 +196,8 @@ export function isBlank(str) {
* @returns {boolean}
*/
export function isTel(str) {
const reg = /^(400|800)([0-9\\-]{7,10})|(([0-9]{4}|[0-9]{3})(-| )?)?([0-9]{7,8})((-| |转)*([0-9]{1,4}))?$/;
return reg.test(str);
const reg = /^(400|800)([0-9\\-]{7,10})|(([0-9]{4}|[0-9]{3})(-| )?)?([0-9]{7,8})((-| |转)*([0-9]{1,4}))?$/
return reg.test(str)
}
/**
@ -207,8 +207,8 @@ export function isTel(str) {
* @returns {boolean}
*/
export function isNum(str) {
const reg = /^\d+(\.\d{1,2})?$/;
return reg.test(str);
const reg = /^\d+(\.\d{1,2})?$/
return reg.test(str)
}
/**
@ -218,8 +218,8 @@ export function isNum(str) {
* @returns {boolean}
*/
export function isLongitude(str) {
const reg = /^[-|+]?(0?\d{1,2}\.\d{1,5}|1[0-7]?\d{1}\.\d{1,5}|180\.0{1,5})$/;
return reg.test(str);
const reg = /^[-|+]?(0?\d{1,2}\.\d{1,5}|1[0-7]?\d{1}\.\d{1,5}|180\.0{1,5})$/
return reg.test(str)
}
/**
@ -229,8 +229,8 @@ export function isLongitude(str) {
* @returns {boolean}
*/
export function isLatitude(str) {
const reg = /^[-|+]?([0-8]?\d{1}\.\d{1,5}|90\.0{1,5})$/;
return reg.test(str);
const reg = /^[-|+]?([0-8]?\d{1}\.\d{1,5}|90\.0{1,5})$/
return reg.test(str)
}
/**
@ -240,8 +240,8 @@ export function isLatitude(str) {
* @returns {boolean}
*/
export function isRTSP(str) {
const reg = /^rtsp:\/\/([a-z]{0,10}:.{0,10}@)?(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;
const reg1 = /^rtsp:\/\/([a-z]{0,10}:.{0,10}@)?(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5]):[0-9]{1,5}/;
const reg2 = /^rtsp:\/\/([a-z]{0,10}:.{0,10}@)?(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\//;
return reg.test(str) || reg1.test(str) || reg2.test(str);
const reg = /^rtsp:\/\/([a-z]{0,10}:.{0,10}@)?(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
const reg1 = /^rtsp:\/\/([a-z]{0,10}:.{0,10}@)?(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5]):[0-9]{1,5}/
const reg2 = /^rtsp:\/\/([a-z]{0,10}:.{0,10}@)?(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\//
return reg.test(str) || reg1.test(str) || reg2.test(str)
}

Some files were not shown because too many files have changed in this diff Show More