mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2025-12-18 17:05:54 +08:00
优化管理端商家端冗余以及配置内容。抽出公共主题颜色、站点标题等内容。分离config中api配置,修改商家发布中拖拽以及控制台出错的bug。
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
import axios from 'axios';
|
||||
import { getDictData } from '@/api/index';
|
||||
|
||||
let dictUtil = {
|
||||
|
||||
};
|
||||
|
||||
// 获取常用的数据字典保存至vuex
|
||||
dictUtil.initDictData = function (vm) {
|
||||
// axios.get(getDictData + "sex").then(res => {
|
||||
// if(res.success){
|
||||
// vm.$store.commit("setSex", res.result);
|
||||
// }
|
||||
// });
|
||||
// axios.get(getDictData + "message_type").then(res => {
|
||||
// if(res.success){
|
||||
// vm.$store.commit("setMessageType", res.result);
|
||||
// }
|
||||
// });
|
||||
// axios.get(getDictData + "priority").then(res => {
|
||||
// if(res.success){
|
||||
// vm.$store.commit("setPriority", res.result);
|
||||
// }
|
||||
// });
|
||||
// axios.get(getDictData + "leave_type").then(res => {
|
||||
// if(res.success){
|
||||
// vm.$store.commit("setLeaveType", res.result);
|
||||
// }
|
||||
// });
|
||||
};
|
||||
|
||||
export default dictUtil;
|
||||
@@ -1,14 +0,0 @@
|
||||
const hasPermission = {
|
||||
install (Vue, options) {
|
||||
Vue.directive('has', {
|
||||
inserted (el, binding, vnode) {
|
||||
let permTypes = vnode.context.$route.meta.permTypes;
|
||||
if (permTypes&&!permTypes.includes(binding.value)) {
|
||||
el.parentNode.removeChild(el);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default hasPermission;
|
||||
@@ -1,16 +0,0 @@
|
||||
import { getStore } from './storage';
|
||||
|
||||
const hasRole = {
|
||||
install (Vue, options) {
|
||||
Vue.directive('hasRole', {
|
||||
inserted (el, binding) {
|
||||
let roles = getStore("roles");
|
||||
if (roles&&!roles.includes(binding.value)) {
|
||||
el.parentNode.removeChild(el);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default hasRole;
|
||||
@@ -1,82 +0,0 @@
|
||||
// 导入表格模版数据
|
||||
export const userColumns = [
|
||||
{
|
||||
title: "username",
|
||||
key: "username"
|
||||
},
|
||||
{
|
||||
title: "password",
|
||||
key: "password"
|
||||
},
|
||||
{
|
||||
title: "avatar",
|
||||
key: "avatar"
|
||||
},
|
||||
{
|
||||
title: "departmentId",
|
||||
key: "departmentId"
|
||||
},
|
||||
{
|
||||
title: "mobile",
|
||||
key: "mobile"
|
||||
},
|
||||
{
|
||||
title: "email",
|
||||
key: "email"
|
||||
},
|
||||
{
|
||||
title: "sex",
|
||||
key: "sex"
|
||||
},
|
||||
{
|
||||
title: "address",
|
||||
key: "address"
|
||||
},
|
||||
{
|
||||
title: "type",
|
||||
key: "type"
|
||||
},
|
||||
{
|
||||
title: "status",
|
||||
key: "status"
|
||||
},
|
||||
{
|
||||
title: "delFlag",
|
||||
key: "delFlag"
|
||||
},
|
||||
{
|
||||
title: "defaultRole",
|
||||
key: "defaultRole"
|
||||
}
|
||||
]
|
||||
|
||||
export const userData = [
|
||||
{
|
||||
username: "【记得删除该说明行】唯一用户名不能为空",
|
||||
password: "密码不能为空",
|
||||
avatar: "头像图片链接",
|
||||
departmentId: "部门表主键id",
|
||||
email: "邮箱",
|
||||
mobile: "手机",
|
||||
sex: "性别 0(女) 1(男)",
|
||||
address: "地址数据省市编号 请勿乱填",
|
||||
type: "用户类型 0(普通用户) 1(管理员)",
|
||||
status: "用户状态 0(正常) -1(禁用)",
|
||||
delFlag: "删除标志 0(正常) 1(已删)",
|
||||
defaultRole: "角色 0(不分配默认角色) 1(分配默认注册用户角色)"
|
||||
},
|
||||
{
|
||||
username: "lili",
|
||||
password: "123456",
|
||||
avatar: "https://s1.ax1x.com/2018/05/19/CcdVQP.png",
|
||||
departmentId: "40652338142121984",
|
||||
email: "1012139570@qq.com",
|
||||
sex: 1,
|
||||
address: "[\"510000\",\"510100\",\"510104\"]",
|
||||
mobile: "18782059038",
|
||||
type: 0,
|
||||
status: 0,
|
||||
delFlag: 0,
|
||||
defaultRole: 1
|
||||
}
|
||||
]
|
||||
@@ -1,100 +0,0 @@
|
||||
var idTmr;
|
||||
function getExplorer () {
|
||||
var explorer = window.navigator.userAgent;
|
||||
if (explorer.indexOf('MSIE') >= 0) {
|
||||
// ie
|
||||
return 'ie';
|
||||
} else if (explorer.indexOf('Firefox') >= 0) {
|
||||
// firefox
|
||||
return 'Firefox';
|
||||
} else if (explorer.indexOf('Chrome') >= 0) {
|
||||
// Chrome
|
||||
return 'Chrome';
|
||||
} else if (explorer.indexOf('Opera') >= 0) {
|
||||
// Opera
|
||||
return 'Opera';
|
||||
} else if (explorer.indexOf('Safari') >= 0) {
|
||||
// Safari
|
||||
return 'Safari';
|
||||
};
|
||||
};
|
||||
function tranform (table, aId, name) {
|
||||
let tableHead = table.$children[0].$el;
|
||||
let tableBody = table.$children[1].$el;
|
||||
let tableInnerHTML = '<thead><tr>';
|
||||
if (table.$children.length !== 1) {
|
||||
let len = tableBody.rows.length;
|
||||
let i = -1;
|
||||
while (i < len) {
|
||||
if (i == -1) {
|
||||
Array.from(tableHead.rows[0].children).forEach((td) => {
|
||||
tableInnerHTML = tableInnerHTML + '<th>' + td.children[0].children[0].innerHTML + '</th>';
|
||||
});
|
||||
tableInnerHTML += '</tr><thead><tbody>';
|
||||
} else {
|
||||
tableInnerHTML += '<tr>';
|
||||
Array.from(tableBody.rows[i].children).forEach((td) => {
|
||||
tableInnerHTML = tableInnerHTML + '<td>' + td.children[0].children[0].innerHTML + '</td>';
|
||||
});
|
||||
tableInnerHTML += '</tr>';
|
||||
}
|
||||
i++;
|
||||
}
|
||||
tableInnerHTML += '</tbody>';
|
||||
}
|
||||
|
||||
if (getExplorer() !== 'Safari' && name.substr(-1, 4) !== '.xls') {
|
||||
name += '.xls';
|
||||
}
|
||||
|
||||
if (getExplorer() == 'ie') {
|
||||
var curTbl = table;
|
||||
var oXL = new ActiveXObject('Excel.Application');
|
||||
var oWB = oXL.Workbooks.Add();
|
||||
var xlsheet = oWB.Worksheets(1);
|
||||
var sel = document.body.createTextRange();
|
||||
sel.moveToElementText(curTbl);
|
||||
sel.select();
|
||||
sel.execCommand('Copy');
|
||||
xlsheet.Paste();
|
||||
oXL.Visible = true;
|
||||
|
||||
try {
|
||||
var fname = oXL.Application.GetSaveAsFilename('Excel.xls', 'Excel Spreadsheets (*.xls), *.xls');
|
||||
} catch (e) {
|
||||
print('Nested catch caught ' + e);
|
||||
} finally {
|
||||
oWB.SaveAs(fname);
|
||||
// oWB.Close(savechanges = false);
|
||||
oXL.Quit();
|
||||
oXL = null;
|
||||
idTmr = setInterval(Cleanup(), 1);
|
||||
}
|
||||
} else {
|
||||
tableToExcel(tableInnerHTML, aId, name);
|
||||
}
|
||||
}
|
||||
function Cleanup () {
|
||||
window.clearInterval(idTmr);
|
||||
// CollectGarbage();
|
||||
}
|
||||
let tableToExcel = (function () {
|
||||
let uri = 'data:application/vnd.ms-excel;base64,';
|
||||
let template = '<html><head><meta charset="UTF-8"></head><body><table>{table}</table></body></html>';
|
||||
let base64 = function (s) { return window.btoa(unescape(encodeURIComponent(s))); };
|
||||
let format = function (s, c) {
|
||||
return s.replace(/{(\w+)}/g, function (m, p) { return c[p]; });
|
||||
};
|
||||
return function (table, aId, name) {
|
||||
let ctx = {worksheet: name || 'Worksheet', table: table};
|
||||
document.getElementById(aId).href = uri + base64(format(template, ctx));
|
||||
document.getElementById(aId).download = name;
|
||||
document.getElementById(aId).click();
|
||||
};
|
||||
})();
|
||||
|
||||
const table2excel = {};
|
||||
|
||||
table2excel.transform = tranform;
|
||||
|
||||
export default table2excel;
|
||||
Reference in New Issue
Block a user