mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-30 22:40:48 +00:00
improve: 文件整理
This commit is contained in:
parent
8307a7cf3a
commit
5f7da37549
@ -1,37 +0,0 @@
|
||||
import Vue from 'vue';
|
||||
import VueI18n from 'vue-i18n';
|
||||
import { localRead } from '@/libs/util';
|
||||
import customZhCn from './lang/zh-CN';
|
||||
import customZhTw from './lang/zh-TW';
|
||||
import customEnUs from './lang/en-US';
|
||||
import zhCnLocale from 'iview/src/locale/lang/zh-CN';
|
||||
import enUsLocale from 'iview/src/locale/lang/en-US';
|
||||
import zhTwLocale from 'iview/src/locale/lang/zh-TW';
|
||||
|
||||
Vue.use(VueI18n);
|
||||
|
||||
// 自动根据浏览器系统语言设置语言
|
||||
const navLang = navigator.language;
|
||||
const localLang = navLang === 'zh-CN' || navLang === 'en-US' ? navLang : false;
|
||||
let lang = localLang || localRead('local') || 'zh-CN';
|
||||
|
||||
Vue.config.lang = lang;
|
||||
|
||||
// vue-i18n 6.x+写法
|
||||
Vue.locale = () => {};
|
||||
const messages = {
|
||||
'zh-CN': Object.assign(zhCnLocale, customZhCn),
|
||||
'zh-TW': Object.assign(zhTwLocale, customZhTw),
|
||||
'en-US': Object.assign(enUsLocale, customEnUs),
|
||||
};
|
||||
const i18n = new VueI18n({
|
||||
locale: lang,
|
||||
messages,
|
||||
});
|
||||
|
||||
export default i18n;
|
||||
|
||||
// vue-i18n 5.x写法
|
||||
// Vue.locale('zh-CN', Object.assign(zhCnLocale, customZhCn))
|
||||
// Vue.locale('en-US', Object.assign(zhTwLocale, customZhTw))
|
||||
// Vue.locale('zh-TW', Object.assign(enUsLocale, customEnUs))
|
||||
@ -1,47 +0,0 @@
|
||||
export default {
|
||||
home: 'Home',
|
||||
login: 'Login',
|
||||
components: 'Components',
|
||||
count_to_page: 'Count-to',
|
||||
tables_page: 'Table',
|
||||
split_pane_page: 'Split-pane',
|
||||
markdown_page: 'Markdown-editor',
|
||||
editor_page: 'Rich-Text-Editor',
|
||||
icons_page: 'Custom-icon',
|
||||
img_cropper_page: 'Image-editor',
|
||||
update: 'Update',
|
||||
doc: 'Document',
|
||||
join_page: 'QQ Group',
|
||||
update_table_page: 'Update .CSV',
|
||||
update_paste_page: 'Paste Table Data',
|
||||
multilevel: 'multilevel',
|
||||
directive_page: 'Directive',
|
||||
level_1: 'Level-1',
|
||||
level_2: 'Level-2',
|
||||
level_2_1: 'Level-2-1',
|
||||
level_2_3: 'Level-2-3',
|
||||
level_2_2: 'Level-2-2',
|
||||
level_2_2_1: 'Level-2-2-1',
|
||||
level_2_2_2: 'Level-2-2-2',
|
||||
excel: 'Excel',
|
||||
'upload-excel': 'Upload Excel',
|
||||
'export-excel': 'Export Excel',
|
||||
tools_methods_page: 'Tools Methods',
|
||||
drag_list_page: 'Drag-list',
|
||||
i18n_page: 'Internationalization',
|
||||
modalTitle: 'Modal Title',
|
||||
content: 'This is the modal box content.',
|
||||
buttonText: 'Show Modal',
|
||||
'i18n-tip':
|
||||
'Note: Only this page is multi-language, other pages do not add language content to the multi-language package.',
|
||||
error_store_page: 'Error Collection',
|
||||
error_logger_page: 'Error Logger',
|
||||
query: 'Query',
|
||||
params: 'Params',
|
||||
cropper_page: 'Cropper',
|
||||
message_page: 'Message Center',
|
||||
tree_table_page: 'Tree Table',
|
||||
org_tree_page: 'Org Tree',
|
||||
drag_drawer_page: 'Draggable Drawer',
|
||||
tree_select_page: 'Tree Selector',
|
||||
};
|
||||
@ -1,46 +0,0 @@
|
||||
export default {
|
||||
home: '首页问问',
|
||||
login: '登录',
|
||||
components: '组件',
|
||||
count_to_page: '数字渐变',
|
||||
tables_page: '多功能表格',
|
||||
split_pane_page: '分割窗口',
|
||||
markdown_page: 'Markdown编辑器',
|
||||
editor_page: '富文本编辑器',
|
||||
icons_page: '自定义图标',
|
||||
img_cropper_page: '图片编辑器',
|
||||
update: '上传数据',
|
||||
join_page: 'QQ群问问',
|
||||
doc: '文档',
|
||||
update_table_page: '上传CSV文件',
|
||||
update_paste_page: '粘贴表格数据',
|
||||
multilevel: '多级菜单',
|
||||
directive_page: '指令',
|
||||
level_1: 'Level-1',
|
||||
level_2: 'Level-2',
|
||||
level_2_1: 'Level-2-1',
|
||||
level_2_3: 'Level-2-3',
|
||||
level_2_2: 'Level-2-2',
|
||||
level_2_2_1: 'Level-2-2-1',
|
||||
level_2_2_2: 'Level-2-2-2',
|
||||
excel: 'Excel',
|
||||
'upload-excel': '上传excel',
|
||||
'export-excel': '导出excel',
|
||||
tools_methods_page: '工具函数',
|
||||
drag_list_page: '拖拽列表',
|
||||
i18n_page: '多语言',
|
||||
modalTitle: '模态框题目',
|
||||
content: '这是模态框内容',
|
||||
buttonText: '显示模态框',
|
||||
'i18n-tip': '注:仅此页做了多语言,其他页面没有在多语言包中添加语言内容',
|
||||
error_store_page: '错误收集',
|
||||
error_logger_page: '错误日志',
|
||||
query: '带参路由',
|
||||
params: '动态路由',
|
||||
cropper_page: '图片裁剪',
|
||||
message_page: '消息中心',
|
||||
tree_table_page: '树状表格',
|
||||
org_tree_page: '组织结构树',
|
||||
drag_drawer_page: '可拖动抽屉',
|
||||
tree_select_page: '树状下拉选择器2',
|
||||
};
|
||||
@ -1,46 +0,0 @@
|
||||
export default {
|
||||
home: '首頁',
|
||||
login: '登錄',
|
||||
components: '组件',
|
||||
count_to_page: '数字渐变',
|
||||
tables_page: '多功能表格',
|
||||
split_pane_page: '分割窗口',
|
||||
markdown_page: 'Markdown編輯器',
|
||||
editor_page: '富文本編輯器',
|
||||
icons_page: '自定義圖標',
|
||||
img_cropper_page: '圖片編輯器',
|
||||
update: '上傳數據',
|
||||
join_page: 'QQ群',
|
||||
doc: '文檔',
|
||||
update_table_page: '上傳CSV文件',
|
||||
update_paste_page: '粘貼表格數據',
|
||||
multilevel: '多级菜单',
|
||||
directive_page: '指令',
|
||||
level_1: 'Level-1',
|
||||
level_2: 'Level-2',
|
||||
level_2_1: 'Level-2-1',
|
||||
level_2_3: 'Level-2-3',
|
||||
level_2_2: 'Level-2-2',
|
||||
level_2_2_1: 'Level-2-2-1',
|
||||
level_2_2_2: 'Level-2-2-2',
|
||||
excel: 'Excel',
|
||||
'upload-excel': '上傳excel',
|
||||
'export-excel': '導出excel',
|
||||
tools_methods_page: '工具函數',
|
||||
drag_list_page: '拖拽列表',
|
||||
i18n_page: '多語言',
|
||||
modalTitle: '模態框題目',
|
||||
content: '這是模態框內容',
|
||||
buttonText: '顯示模態框',
|
||||
'i18n-tip': '注:僅此頁做了多語言,其他頁面沒有在多語言包中添加語言內容',
|
||||
error_store_page: '錯誤收集',
|
||||
error_logger_page: '錯誤日誌',
|
||||
query: '帶參路由',
|
||||
params: '動態路由',
|
||||
cropper_page: '圖片裁剪',
|
||||
message_page: '消息中心',
|
||||
tree_table_page: '樹狀表格',
|
||||
org_tree_page: '組織結構樹',
|
||||
drag_drawer_page: '可拖動抽屜',
|
||||
tree_select_page: '樹狀下拉選擇器',
|
||||
};
|
||||
@ -1,44 +0,0 @@
|
||||
import Mock from 'mockjs';
|
||||
import { doCustomTimes } from '@/libs/util';
|
||||
import orgData from './data/org-data';
|
||||
import { treeData } from './data/tree-select';
|
||||
const Random = Mock.Random;
|
||||
|
||||
export const getTableData = (req) => {
|
||||
let tableData = [];
|
||||
doCustomTimes(5, () => {
|
||||
tableData.push(
|
||||
Mock.mock({
|
||||
name: '@name',
|
||||
email: '@email',
|
||||
createTime: '@date',
|
||||
}),
|
||||
);
|
||||
});
|
||||
return tableData;
|
||||
};
|
||||
|
||||
export const getDragList = (req) => {
|
||||
let dragList = [];
|
||||
doCustomTimes(5, () => {
|
||||
dragList.push(
|
||||
Mock.mock({
|
||||
name: Random.csentence(10, 13),
|
||||
id: Random.increment(10),
|
||||
}),
|
||||
);
|
||||
});
|
||||
return dragList;
|
||||
};
|
||||
|
||||
export const uploadImage = (req) => {
|
||||
return Promise.resolve();
|
||||
};
|
||||
|
||||
export const getOrgData = (req) => {
|
||||
return orgData;
|
||||
};
|
||||
|
||||
export const getTreeSelectData = (req) => {
|
||||
return treeData;
|
||||
};
|
||||
@ -1,50 +0,0 @@
|
||||
export default {
|
||||
id: 0,
|
||||
label: 'XXX科技有限公司',
|
||||
children: [
|
||||
{
|
||||
id: 2,
|
||||
label: '产品研发部',
|
||||
children: [
|
||||
{
|
||||
id: 5,
|
||||
label: '研发-前端',
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
label: '研发-后端',
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
label: 'UI设计',
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
label: '产品经理',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
label: '销售部',
|
||||
children: [
|
||||
{
|
||||
id: 7,
|
||||
label: '销售一部',
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
label: '销售二部',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
label: '财务部',
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
label: 'HR人事',
|
||||
},
|
||||
],
|
||||
};
|
||||
@ -1,82 +0,0 @@
|
||||
export const treeData = [
|
||||
{
|
||||
id: 1,
|
||||
title: '1',
|
||||
children: [
|
||||
{
|
||||
id: 11,
|
||||
title: '1-1',
|
||||
loading: false,
|
||||
children: [
|
||||
// {
|
||||
// id: 111,
|
||||
// title: '1-1-1'
|
||||
// },
|
||||
// {
|
||||
// id: 112,
|
||||
// title: '1-1-2'
|
||||
// },
|
||||
// {
|
||||
// id: 113,
|
||||
// title: '1-1-3'
|
||||
// },
|
||||
// {
|
||||
// id: 114,
|
||||
// title: '1-1-4'
|
||||
// }
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
title: '1-2',
|
||||
children: [
|
||||
{
|
||||
id: 121,
|
||||
title: '1-2-1',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export const newTreeData = [
|
||||
{
|
||||
id: 'a',
|
||||
title: 'a',
|
||||
children: [
|
||||
{
|
||||
id: 'a1',
|
||||
title: 'a-1',
|
||||
children: [
|
||||
{
|
||||
id: 112,
|
||||
title: '1-1-2',
|
||||
},
|
||||
{
|
||||
id: 'a12',
|
||||
title: 'a-1-2',
|
||||
},
|
||||
{
|
||||
id: 'a13',
|
||||
title: 'a-1-3',
|
||||
},
|
||||
{
|
||||
id: 'a14',
|
||||
title: 'a-1-4',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'a2',
|
||||
title: 'a-2',
|
||||
children: [
|
||||
{
|
||||
id: 'a21',
|
||||
title: 'b-2-1',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@ -1,28 +0,0 @@
|
||||
import Mock from 'mockjs';
|
||||
// import { login, logout, getUserInfo } from './login'
|
||||
import { getTableData, getDragList, uploadImage, getOrgData, getTreeSelectData } from './data';
|
||||
import { getMessageInit, getContentByMsgId, hasRead, removeReaded, restoreTrash, messageCount } from './user';
|
||||
|
||||
// 配置Ajax请求延时,可用来测试网络延迟大时项目中一些效果
|
||||
// Mock.setup({
|
||||
// timeout: 1000
|
||||
// });
|
||||
//
|
||||
// // 登录相关和获取用户信息
|
||||
// Mock.mock(/\/login/, login);
|
||||
// Mock.mock(/\/get_info/, getUserInfo);
|
||||
// Mock.mock(/\/logout/, logout);
|
||||
// Mock.mock(/\/get_table_data/, getTableData);
|
||||
// Mock.mock(/\/get_drag_list/, getDragList);
|
||||
// Mock.mock(/\/save_error_logger/, 'success');
|
||||
// Mock.mock(/\/image\/upload/, uploadImage);
|
||||
// Mock.mock(/\/message\/init/, getMessageInit);
|
||||
// Mock.mock(/\/message\/content/, getContentByMsgId);
|
||||
// Mock.mock(/\/message\/has_read/, hasRead);
|
||||
// Mock.mock(/\/message\/remove_readed/, removeReaded);
|
||||
// Mock.mock(/\/message\/restore/, restoreTrash);
|
||||
// Mock.mock(/\/message\/count/, messageCount);
|
||||
// Mock.mock(/\/get_org_data/, getOrgData);
|
||||
// Mock.mock(/\/get_tree_select_data/, getTreeSelectData);
|
||||
//
|
||||
// export default Mock
|
||||
@ -1,31 +0,0 @@
|
||||
// import { getParams } from '@/libs/util'
|
||||
// const USER_MAP = {
|
||||
// super_admin: {
|
||||
// name: 'super_admin',
|
||||
// user_id: '1',
|
||||
// access: ['super_admin', 'admin'],
|
||||
// token: 'super_admin',
|
||||
// avatar: 'https://file.iviewui.com/dist/a0e88e83800f138b94d2414621bd9704.png'
|
||||
// },
|
||||
// admin: {
|
||||
// name: 'admin',
|
||||
// user_id: '2',
|
||||
// access: ['admin'],
|
||||
// token: 'admin',
|
||||
// avatar: 'https://avatars0.githubusercontent.com/u/20942571?s=460&v=4'
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// export const login = req => {
|
||||
// req = JSON.parse(req.body)
|
||||
// return { token: USER_MAP[req.userName].token }
|
||||
// }
|
||||
//
|
||||
// export const getUserInfo = req => {
|
||||
// const params = getParams(req.url)
|
||||
// return USER_MAP[params.token]
|
||||
// }
|
||||
//
|
||||
// export const logout = req => {
|
||||
// return null
|
||||
// }
|
||||
@ -1,64 +0,0 @@
|
||||
import Mock from 'mockjs';
|
||||
import { doCustomTimes } from '@/libs/util';
|
||||
const Random = Mock.Random;
|
||||
|
||||
export const getMessageInit = () => {
|
||||
let unreadList = [];
|
||||
doCustomTimes(3, () => {
|
||||
unreadList.push(
|
||||
Mock.mock({
|
||||
title: Random.cword(10, 15),
|
||||
create_time: '@date',
|
||||
msg_id: Random.increment(100),
|
||||
}),
|
||||
);
|
||||
});
|
||||
let readedList = [];
|
||||
doCustomTimes(4, () => {
|
||||
readedList.push(
|
||||
Mock.mock({
|
||||
title: Random.cword(10, 15),
|
||||
create_time: '@date',
|
||||
msg_id: Random.increment(100),
|
||||
}),
|
||||
);
|
||||
});
|
||||
let trashList = [];
|
||||
doCustomTimes(2, () => {
|
||||
trashList.push(
|
||||
Mock.mock({
|
||||
title: Random.cword(10, 15),
|
||||
create_time: '@date',
|
||||
msg_id: Random.increment(100),
|
||||
}),
|
||||
);
|
||||
});
|
||||
return {
|
||||
unread: unreadList,
|
||||
readed: readedList,
|
||||
trash: trashList,
|
||||
};
|
||||
};
|
||||
|
||||
export const getContentByMsgId = () => {
|
||||
return `<divcourier new',="" monospace;font-weight:="" normal;font-size:="" 12px;line-height:="" 18px;white-space:="" pre;"=""><div> <span style="font-size: medium;">这是消息内容,这个内容是使用<span style="color: rgb(255, 255, 255); background-color: rgb(28, 72, 127);">富文本编辑器</span>编辑的,所以你可以看到一些<span style="text-decoration-line: underline; font-style: italic; color: rgb(194, 79, 74);">格式</span></span></div><ol><li>你可以查看Mock返回的数据格式,和api请求的接口,来确定你的后端接口的开发</li><li>使用你的真实接口后,前端页面基本不需要修改即可满足基本需求</li><li>快来试试吧</li></ol><p>${Random.csentence(
|
||||
100,
|
||||
200,
|
||||
)}</p></divcourier>`;
|
||||
};
|
||||
|
||||
export const hasRead = () => {
|
||||
return true;
|
||||
};
|
||||
|
||||
export const removeReaded = () => {
|
||||
return true;
|
||||
};
|
||||
|
||||
export const restoreTrash = () => {
|
||||
return true;
|
||||
};
|
||||
|
||||
export const messageCount = () => {
|
||||
return 3;
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user