Commit 05842014 authored by 萌萌哒SAKURA酱's avatar 萌萌哒SAKURA酱

Merge branch 'leng_dev' of https://gitee.ltd/pigx/pigx-ui into sakura_dev

parents e8933196 ebdf00cd
# http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
<template> <template>
<div id="app"> <div id="app">
<router-view /> <router-view/>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: 'app', name: 'app',
data () { data() {
return {} return {}
}, },
watch: {}, watch: {},
created () { }, created() {
methods: {}, },
computed: {} methods: {},
} computed: {}
}
</script> </script>
<style lang="scss"> <style lang="scss">
#app { #app {
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
} }
</style> </style>
\ No newline at end of file
...@@ -33,10 +33,10 @@ export function delObj(id) { ...@@ -33,10 +33,10 @@ export function delObj(id) {
} }
export function deploy(id) { export function deploy(id) {
return request({ return request({
url: '/act/model/deploy/' + id, url: '/act/model/deploy/' + id,
method: 'post' method: 'post'
}) })
} }
......
...@@ -41,10 +41,10 @@ export function getObj(id) { ...@@ -41,10 +41,10 @@ export function getObj(id) {
} }
export function submit(id) { export function submit(id) {
return request({ return request({
url: '/act/leave-bill/submit/' + id, url: '/act/leave-bill/submit/' + id,
method: 'get' method: 'get'
}) })
} }
export function delObj(id) { export function delObj(id) {
......
...@@ -32,9 +32,9 @@ export function delObj(id) { ...@@ -32,9 +32,9 @@ export function delObj(id) {
}) })
} }
export function status(id,type) { export function status(id, type) {
return request({ return request({
url: '/act/process/status/' + id + "/" + type, url: '/act/process/status/' + id + "/" + type,
method: 'put' method: 'put'
}) })
} }
...@@ -26,23 +26,23 @@ export function fetchList(query) { ...@@ -26,23 +26,23 @@ export function fetchList(query) {
} }
export function fetchDetail(id) { export function fetchDetail(id) {
return request({ return request({
url: '/act/task/'+id, url: '/act/task/' + id,
method: 'get' method: 'get'
}) })
} }
export function fetchComment(id) { export function fetchComment(id) {
return request({ return request({
url: '/act/task/comment/'+id, url: '/act/task/comment/' + id,
method: 'get' method: 'get'
}) })
} }
export function doTask(obj) { export function doTask(obj) {
return request({ return request({
url: '/act/task', url: '/act/task',
method: 'post', method: 'post',
data: obj data: obj
}) })
} }
...@@ -18,11 +18,11 @@ ...@@ -18,11 +18,11 @@
import request from '@/router/axios' import request from '@/router/axios'
export function fetchDeptTree(query) { export function fetchDeptTree(query) {
return request({ return request({
url: '/admin/dept/user-tree', url: '/admin/dept/user-tree',
method: 'get', method: 'get',
params: query params: query
}) })
} }
export function fetchTree(query) { export function fetchTree(query) {
......
...@@ -16,12 +16,14 @@ ...@@ -16,12 +16,14 @@
*/ */
import request from '@/router/axios' import request from '@/router/axios'
export function GetMenu() { export function GetMenu() {
return request({ return request({
url: '/admin/menu', url: '/admin/menu',
method: 'get' method: 'get'
}) })
} }
export function fetchTree(query) { export function fetchTree(query) {
return request({ return request({
url: '/admin/menu/tree', url: '/admin/menu/tree',
......
...@@ -24,10 +24,11 @@ export function fetchList(query) { ...@@ -24,10 +24,11 @@ export function fetchList(query) {
params: query params: query
}) })
} }
export function putObj(obj) { export function putObj(obj) {
return request({ return request({
url: '/admin/route', url: '/admin/route',
method: 'put', method: 'put',
data: obj data: obj
}) })
} }
...@@ -18,46 +18,46 @@ ...@@ -18,46 +18,46 @@
import request from '@/router/axios' import request from '@/router/axios'
export function fetchList(query) { export function fetchList(query) {
return request({ return request({
url: '/admin/user/page', url: '/admin/user/page',
method: 'get', method: 'get',
params: query params: query
}) })
} }
export function addObj(obj) { export function addObj(obj) {
return request({ return request({
url: '/admin/user', url: '/admin/user',
method: 'post', method: 'post',
data: obj data: obj
}) })
} }
export function getObj(id) { export function getObj(id) {
return request({ return request({
url: '/admin/user/' + id, url: '/admin/user/' + id,
method: 'get' method: 'get'
}) })
} }
export function delObj(id) { export function delObj(id) {
return request({ return request({
url: '/admin/user/' + id, url: '/admin/user/' + id,
method: 'delete' method: 'delete'
}) })
} }
export function putObj(obj) { export function putObj(obj) {
return request({ return request({
url: '/admin/user', url: '/admin/user',
method: 'put', method: 'put',
data: obj data: obj
}) })
} }
export function getDetails(obj) { export function getDetails(obj) {
return request({ return request({
url: '/admin/user/details/' + obj, url: '/admin/user/details/' + obj,
method: 'get' method: 'get'
}) })
} }
...@@ -26,16 +26,22 @@ export function fetchList(query) { ...@@ -26,16 +26,22 @@ export function fetchList(query) {
} }
export function handleDown(table) { export function handleDown(table) {
request({ return request({
url: '/gen/generator/code', url: '/gen/generator/code',
method: 'post', method: 'post',
data: table, data: table,
responseType: 'arraybuffer' responseType: 'arraybuffer'
}).then((response) => { // 处理返回的文件流 }).then((response) => { // 处理返回的文件流
let blob = new Blob([response.data], { type: 'application/zip' } ) let blob = new Blob([response.data], {type: 'application/zip'})
let link = document.createElement('a') let filename = table.tableName + '.zip'
link.href = window.URL.createObjectURL(blob) let link = document.createElement('a');
link.download = table.tableName + '.zip' link.href = URL.createObjectURL(blob);
link.click() link.download = filename;
document.body.appendChild(link);
link.click();
window.setTimeout(function () {
URL.revokeObjectURL(blob);
document.body.removeChild(link);
}, 0);
}) })
} }
...@@ -15,56 +15,57 @@ ...@@ -15,56 +15,57 @@
* Author: lengleng (wangiegie@gmail.com) * Author: lengleng (wangiegie@gmail.com)
*/ */
import request from '@/router/axios' import request from '@/router/axios'
export const loginByUsername = (username, password, code, randomStr) => { export const loginByUsername = (username, password, code, randomStr) => {
var grant_type = 'password' var grant_type = 'password'
var scope = 'server' var scope = 'server'
return request({ return request({
url: '/auth/oauth/token', url: '/auth/oauth/token',
headers: { headers: {
'TENANT_ID': '1', 'TENANT_ID': '1',
'Authorization': 'Basic cGlnOnBpZw==' 'Authorization': 'Basic cGlnOnBpZw=='
}, },
method: 'post', method: 'post',
params: { username, password, randomStr, code, grant_type, scope } params: {username, password, randomStr, code, grant_type, scope}
}) })
} }
export const loginByMobile = (mobile, code) => { export const loginByMobile = (mobile, code) => {
var grant_type = 'mobile' var grant_type = 'mobile'
return request({ return request({
url: '/auth/mobile/token/sms', url: '/auth/mobile/token/sms',
headers: { headers: {
'TENANT_ID': '1', 'TENANT_ID': '1',
'Authorization': 'Basic cGlnOnBpZw==' 'Authorization': 'Basic cGlnOnBpZw=='
}, },
method: 'post', method: 'post',
params: { mobile: 'SMS@' + mobile,code: code, grant_type } params: {mobile: 'SMS@' + mobile, code: code, grant_type}
}) })
} }
export const loginBySocial = (state, code) => { export const loginBySocial = (state, code) => {
var grant_type = 'mobile' var grant_type = 'mobile'
return request({ return request({
url: '/auth/mobile/token/social', url: '/auth/mobile/token/social',
headers: { headers: {
'TENANT_ID': '1', 'TENANT_ID': '1',
'Authorization': 'Basic cGlnOnBpZw==' 'Authorization': 'Basic cGlnOnBpZw=='
}, },
method: 'post', method: 'post',
params: { mobile: state + '@' + code, grant_type } params: {mobile: state + '@' + code, grant_type}
}) })
} }
export const getUserInfo = () => { export const getUserInfo = () => {
return request({ return request({
url: '/admin/user/info', url: '/admin/user/info',
method: 'get' method: 'get'
}) })
} }
export const logout = () => { export const logout = () => {
return request({ return request({
url: '/auth/token/logout', url: '/auth/token/logout',
method: 'delete' method: 'delete'
}) })
} }
...@@ -15,10 +15,10 @@ if (env.NODE_ENV == 'development') { ...@@ -15,10 +15,10 @@ if (env.NODE_ENV == 'development') {
} }
export { export {
baseUrl, baseUrl,
actUrl, actUrl,
iconfontUrl, iconfontUrl,
iconfontVersion, iconfontVersion,
codeUrl, codeUrl,
env env
} }
...@@ -15,59 +15,66 @@ ...@@ -15,59 +15,66 @@
* Author: lengleng (wangiegie@gmail.com) * Author: lengleng (wangiegie@gmail.com)
*/ */
export const tableOption = { export const tableOption = {
border: true, border: true,
index: true, index: true,
indexLabel: '序号', indexLabel: '序号',
stripe: true, stripe: true,
menuAlign: 'center', menuAlign: 'center',
menuWidth: 150, menuWidth: 150,
menuBtn: true, menuBtn: true,
align: 'center', align: 'center',
editBtn: false, editBtn: false,
delBtn: false, delBtn: false,
menuType:'menu', menuType: 'menu',
searchShow: false, searchShow: false,
labelWidth: 120, labelWidth: 120,
column: [{ column: [{
fixed: true, fixed: true,
label: '模型ID', label: '模型ID',
prop: 'id', prop: 'id',
editDisabled: true, editDisabled: true,
addVisdiplay: false addVisdiplay: false
}, {
fixed: true,
label: '模型标识',
prop: 'key',
editDisabled: true
}, {
label: '流程分类',
prop: 'category',
search: true
}, {
label: '模型名称',
prop: 'name'
},
{
label: '描述',
prop: 'desc',
hide: true,
editDisabled: false,
addVisdiplay: true
}, { }, {
fixed: true, label: '版本号',
label: '模型标识', prop: 'version',
prop: 'key', editDisabled: true,
editDisabled: true addVisdiplay: false
}, { }, {
label: '流程分类', width: 150,
prop: 'category', label: '创建时间',
search: true prop: 'createTime',
type: 'datetime',
format: 'yyyy-MM-dd HH:mm',
valueFormat: 'timestamp',
editDisabled: true,
addVisdiplay: false
}, { }, {
label: '模型名称', width: 150,
prop: 'name' label: '最后更新时间',
}, { prop: 'lastUpdateTime',
label: '版本号', type: 'datetime',
prop: 'version', format: 'yyyy-MM-dd HH:mm',
editDisabled: true, valueFormat: 'timestamp',
addVisdiplay: false editDisabled: true,
}, { addVisdiplay: false
width: 150,
label: '创建时间',
prop: 'createTime',
type: 'datetime',
format: 'yyyy-MM-dd HH:mm',
valueFormat: 'timestamp',
editDisabled: true,
addVisdiplay: false
}, {
width: 150,
label: '最后更新时间',
prop: 'lastUpdateTime',
type: 'datetime',
format: 'yyyy-MM-dd HH:mm',
valueFormat: 'timestamp',
editDisabled: true,
addVisdiplay: false
}] }]
} }
...@@ -25,60 +25,60 @@ export const tableOption = { ...@@ -25,60 +25,60 @@ export const tableOption = {
'editBtn': false, 'editBtn': false,
'delBtn': false, 'delBtn': false,
'addBtn': false, 'addBtn': false,
menuType:'menu', menuType: 'menu',
'dicUrl': '/admin/dict/type/leave_status', 'dicUrl': '/admin/dict/type/leave_status',
'column': [ 'column': [
{ {
label: 'ID', label: 'ID',
prop: 'leaveId', prop: 'leaveId',
editDisabled: true, editDisabled: true,
addVisdiplay: false addVisdiplay: false
}, },
{ {
label: '申请人', label: '申请人',
prop: 'username', prop: 'username',
editDisabled: true, editDisabled: true,
addVisdiplay: false addVisdiplay: false
}, },
{ {
label: '天数', label: '天数',
prop: 'days', prop: 'days',
type: 'number' type: 'number'
}, },
{ {
label: '请假时间', label: '请假时间',
prop: 'leaveTime', prop: 'leaveTime',
type: 'datetime', type: 'datetime',
overHidden:true, overHidden: true,
format: 'yyyy-MM-dd HH:mm', format: 'yyyy-MM-dd HH:mm',
valueFormat: "yyyy-MM-dd hh:mm:ss" valueFormat: "yyyy-MM-dd hh:mm:ss"
}, },
{ {
label: '提交时间', label: '提交时间',
prop: 'createTime', prop: 'createTime',
type: 'datetime', type: 'datetime',
overHidden:true, overHidden: true,
format: 'yyyy-MM-dd HH:mm', format: 'yyyy-MM-dd HH:mm',
editDisabled: true, editDisabled: true,
addVisdiplay: false, addVisdiplay: false,
hide: true hide: true
}, },
{ {
label: '状态', label: '状态',
prop: 'state', prop: 'state',
type: 'select', type: 'select',
dicData: 'leave_status', dicData: 'leave_status',
search: true, search: true,
addVisdiplay: false addVisdiplay: false
}, },
{ {
label: '备注', label: '备注',
prop: 'content', prop: 'content',
type:'textarea', type: 'textarea',
overHidden:true, overHidden: true,
minRows:2, minRows: 2,
row:true, row: true,
span:24 span: 24
} }
] ]
} }
...@@ -15,47 +15,47 @@ ...@@ -15,47 +15,47 @@
* Author: lengleng (wangiegie@gmail.com) * Author: lengleng (wangiegie@gmail.com)
*/ */
export const tableOption = { export const tableOption = {
border: true, border: true,
index: true, index: true,
indexLabel: '序号', indexLabel: '序号',
stripe: true, stripe: true,
menuAlign: 'center', menuAlign: 'center',
menuWidth: 150, menuWidth: 150,
menuBtn: true, menuBtn: true,
align: 'center', align: 'center',
addBtn: false, addBtn: false,
editBtn: false, editBtn: false,
delBtn: false, delBtn: false,
menuType:'menu', menuType: 'menu',
searchShow: false, searchShow: false,
column: [{ column: [{
fixed: true, fixed: true,
label: '流程ID', label: '流程ID',
prop: 'processonDefinitionId' prop: 'processonDefinitionId'
}, { }, {
fixed: true, fixed: true,
label: '模型标识', label: '模型标识',
prop: 'key', prop: 'key',
editDisabled: true editDisabled: true
}, { }, {
label: '流程分类', label: '流程分类',
prop: 'category', prop: 'category',
search: true search: true
}, { }, {
label: '模型名称', label: '模型名称',
prop: 'name' prop: 'name'
}, { }, {
label: '版本号', label: '版本号',
prop: 'revision', prop: 'revision',
editDisabled: true, editDisabled: true,
addVisdiplay: false addVisdiplay: false
}, { }, {
label: '部署时间', label: '部署时间',
prop: 'deploymentTime', prop: 'deploymentTime',
type: 'datetime', type: 'datetime',
format: 'yyyy-MM-dd HH:mm', format: 'yyyy-MM-dd HH:mm',
valueFormat: 'timestamp', valueFormat: 'timestamp',
editDisabled: true, editDisabled: true,
addVisdiplay: false addVisdiplay: false
}] }]
} }
...@@ -15,128 +15,128 @@ ...@@ -15,128 +15,128 @@
* Author: lengleng (wangiegie@gmail.com) * Author: lengleng (wangiegie@gmail.com)
*/ */
export const tableOption = { export const tableOption = {
'border': true, 'border': true,
'index': true, 'index': true,
'stripe': true, 'stripe': true,
'menuAlign': "center", 'menuAlign': "center",
'align': "center", 'align': "center",
'menuBtn': true, 'menuBtn': true,
'editBtn': false, 'editBtn': false,
'delBtn': false, 'delBtn': false,
'addBtn': false, 'addBtn': false,
menuType: 'menu', menuType: 'menu',
'dic': [], 'dic': [],
'column': [ 'column': [
{ {
label: 'ID', label: 'ID',
prop: 'taskId', prop: 'taskId',
editDisabled: true, editDisabled: true,
addVisdiplay: false addVisdiplay: false
}, },
{ {
label: '任务名称', label: '任务名称',
prop: 'taskName', prop: 'taskName',
editDisabled: true, editDisabled: true,
addVisdiplay: false addVisdiplay: false
}, },
{ {
label: '提交时间', label: '提交时间',
prop: 'time', prop: 'time',
type: 'datetime', type: 'datetime',
format: 'yyyy-MM-dd HH:mm' format: 'yyyy-MM-dd HH:mm'
} }
] ]
} }
export const formOption = { export const formOption = {
submitBtn: false, submitBtn: false,
emptytBtn: false, emptytBtn: false,
row:true, row: true,
span:12, span: 12,
column: [ column: [
{ {
label: "任务编号", label: "任务编号",
prop: "taskId", prop: "taskId",
disabled: true disabled: true
}, },
{ {
label: "任务名称", label: "任务名称",
prop: "taskName", prop: "taskName",
disabled: true disabled: true
}, },
{ {
label: "申请人", label: "申请人",
prop: "username", prop: "username",
disabled: true disabled: true
}, },
{ {
label: "请假时长", label: "请假时长",
prop: "days", prop: "days",
disabled: true disabled: true
}, },
{ {
label: "请假时间", label: "请假时间",
prop: "createTime", prop: "createTime",
type: 'datetime', type: 'datetime',
format: 'yyyy-MM-dd HH:mm', format: 'yyyy-MM-dd HH:mm',
disabled: true disabled: true
}, },
{ {
label: '提交时间', label: '提交时间',
prop: 'time', prop: 'time',
type: 'datetime', type: 'datetime',
format: 'yyyy-MM-dd HH:mm', format: 'yyyy-MM-dd HH:mm',
disabled: true disabled: true
}, },
{ {
label: '事由', label: '事由',
prop: 'content', prop: 'content',
type:'textarea', type: 'textarea',
minRows:2, minRows: 2,
row:true, row: true,
span:24, span: 24,
disabled: true disabled: true
}, },
{ {
label: '批注', label: '批注',
prop: 'comment', prop: 'comment',
type:'textarea', type: 'textarea',
minRows:2, minRows: 2,
row:true, row: true,
span:24, span: 24,
rules: [{ rules: [{
required: true, required: true,
message: "请输入备注", message: "请输入备注",
trigger: "blur" trigger: "blur"
}] }]
} }
] ]
} }
export const taskOption = { export const taskOption = {
menu:false, menu: false,
page:false, page: false,
addBtn:false, addBtn: false,
align:'center', align: 'center',
menuAlign:'center', menuAlign: 'center',
column:[ column: [
{ {
label:'id', label: 'id',
prop:'id', prop: 'id',
hide: true hide: true
}, },
{ {
label:'用户', label: '用户',
prop:'userId' prop: 'userId'
}, },
{ {
label:'批注', label: '批注',
prop:'fullMessage' prop: 'fullMessage'
},{ }, {
label: "操作时间", label: "操作时间",
prop: "time", prop: "time",
type: "datetime", type: "datetime",
format: "yyyy-MM-dd hh:mm:ss", format: "yyyy-MM-dd hh:mm:ss",
valueFormat: "yyyy-MM-dd hh:mm:ss", valueFormat: "yyyy-MM-dd hh:mm:ss",
} }
] ]
} }
...@@ -25,16 +25,17 @@ const DIC = { ...@@ -25,16 +25,17 @@ const DIC = {
}] }]
} }
export const tableOption = { export const tableOption = {
'border': true, border: true,
'index': true, index: true,
'indexLabel': '序号', indexLabel: '序号',
'stripe': true, stripe: true,
'menuAlign': 'center', menuAlign: 'center',
'align': 'center', align: 'center',
'editBtn': false, editBtn: false,
'delBtn': false, delBtn: false,
'dic': [], viewBtn: true,
'column': [{ dic: [],
column: [{
width: 150, width: 150,
label: '编号', label: '编号',
prop: 'clientId', prop: 'clientId',
...@@ -46,11 +47,12 @@ export const tableOption = { ...@@ -46,11 +47,12 @@ export const tableOption = {
trigger: 'blur' trigger: 'blur'
}] }]
}, { }, {
width: 300,
label: '密钥', label: '密钥',
prop: 'clientSecret', prop: 'clientSecret',
align: 'center', align: 'center',
sortable: true, sortable: true,
overHidden: true,
width: 120,
rules: [{ rules: [{
required: true, required: true,
message: '请输入clientSecret', message: '请输入clientSecret',
...@@ -71,7 +73,7 @@ export const tableOption = { ...@@ -71,7 +73,7 @@ export const tableOption = {
prop: 'authorizedGrantTypes', prop: 'authorizedGrantTypes',
align: 'center', align: 'center',
width: 150, width: 150,
hide: true, overHidden: true,
rules: [{ rules: [{
required: true, required: true,
message: '请输入授权模式', message: '请输入授权模式',
...@@ -90,22 +92,20 @@ export const tableOption = { ...@@ -90,22 +92,20 @@ export const tableOption = {
width: 150, width: 150,
hide: true hide: true
}, { }, {
label: '请求令牌', label: '令牌时效',
prop: 'accessTokenValidity', prop: 'accessTokenValidity',
align: 'center', align: 'center',
width: 150, width: 80
hide: true
}, { }, {
label: '刷新令牌', label: '刷新时效',
prop: 'refreshTokenValidity', prop: 'refreshTokenValidity',
align: 'center', align: 'center',
width: 150, width: 80
hide: true
}, { }, {
label: '扩展信息', label: '扩展信息',
prop: 'additionalInformation', prop: 'additionalInformation',
align: 'center', align: 'center',
width: 150, width: 80,
hide: true hide: true
}, { }, {
label: '自动放行', label: '自动放行',
...@@ -113,7 +113,7 @@ export const tableOption = { ...@@ -113,7 +113,7 @@ export const tableOption = {
align: 'center', align: 'center',
type: 'radio', type: 'radio',
dicData: DIC.vaild, dicData: DIC.vaild,
width: 150, width: 80,
rules: [{ rules: [{
required: true, required: true,
message: '请选择是否放行', message: '请选择是否放行',
...@@ -123,6 +123,7 @@ export const tableOption = { ...@@ -123,6 +123,7 @@ export const tableOption = {
label: '资源ID', label: '资源ID',
prop: 'resourceIds', prop: 'resourceIds',
align: 'center', align: 'center',
hide: true,
width: 150 width: 150
}] }]
} }
...@@ -15,32 +15,33 @@ ...@@ -15,32 +15,33 @@
* Author: lengleng (wangiegie@gmail.com) * Author: lengleng (wangiegie@gmail.com)
*/ */
export const tableOption = { export const tableOption = {
'border': true, border: true,
'index': true, index: true,
'indexLabel': '序号', indexLabel: '序号',
'stripe': true, stripe: true,
'menuAlign': 'center', menuAlign: 'center',
'menuWidth': 150, menuWidth: 150,
'align': 'center', align: 'center',
'refreshBtn': true, refreshBtn: true,
'showClomnuBtn': false, showClomnuBtn: false,
'searchSize': 'mini', searchSize: 'mini',
'addBtn': false, addBtn: false,
'editBtn': false, editBtn: false,
'delBtn': false, delBtn: false,
'dicUrl': '/admin/dict/type/log_type', viewBtn: true,
dicUrl: '/admin/dict/type/log_type',
props: { props: {
label: 'label', label: 'label',
value: 'value' value: 'value'
}, },
'column': [{ column: [{
label: '类型', label: '类型',
prop: 'type', prop: 'type',
type: 'select', type: 'select',
dicData: 'log_type', dicData: 'log_type',
search: true search: true
}, { }, {
label: '请求接口名称', label: '标题',
prop: 'title' prop: 'title'
}, { }, {
label: 'IP地址', label: 'IP地址',
...@@ -52,9 +53,11 @@ export const tableOption = { ...@@ -52,9 +53,11 @@ export const tableOption = {
label: '客户端', label: '客户端',
prop: 'serviceId' prop: 'serviceId'
}, { }, {
width: 80,
label: '请求时间', label: '请求时间',
prop: 'time' prop: 'time'
}, { }, {
width: 150,
label: '创建时间', label: '创建时间',
prop: 'createTime', prop: 'createTime',
type: 'datetime', type: 'datetime',
......
...@@ -15,74 +15,74 @@ ...@@ -15,74 +15,74 @@
* Author: lengleng (wangiegie@gmail.com) * Author: lengleng (wangiegie@gmail.com)
*/ */
export const tableOption = { export const tableOption = {
border: true, border: true,
index: true, index: true,
indexLabel: '序号', indexLabel: '序号',
stripe: true, stripe: true,
menuAlign: 'center', menuAlign: 'center',
editBtn: false, editBtn: false,
delBtn: false, delBtn: false,
align: 'center', align: 'center',
addBtn: false, addBtn: false,
column: [{ column: [{
fixed: true, fixed: true,
label: 'id', label: 'id',
prop: 'roleId', prop: 'roleId',
span: 24, span: 24,
editDisabled: true, editDisabled: true,
addVisdiplay: false, addVisdiplay: false,
}, { }, {
fixed: true, fixed: true,
label: '角色名称', label: '角色名称',
prop: 'roleName', prop: 'roleName',
span: 24, span: 24,
rules: [{ rules: [{
required: true, required: true,
message: '角色名称不能为空', message: '角色名称不能为空',
trigger: 'blur' trigger: 'blur'
}, },
{ {
min: 3, min: 3,
max: 20, max: 20,
message: '长度在 3 到 20 个字符', message: '长度在 3 到 20 个字符',
trigger: 'blur' trigger: 'blur'
} }
] ]
}, { }, {
width: 150, width: 150,
label: '角色标识', label: '角色标识',
prop: 'roleCode', prop: 'roleCode',
span: 24, span: 24,
editDisabled: true, editDisabled: true,
rules: [{ rules: [{
required: true, required: true,
message: '角色标识不能为空', message: '角色标识不能为空',
trigger: 'blur' trigger: 'blur'
}, },
{ {
min: 3, min: 3,
max: 20, max: 20,
message: '长度在 3 到 20 个字符', message: '长度在 3 到 20 个字符',
trigger: 'blur' trigger: 'blur'
} }
] ]
}, { }, {
width: 180, width: 180,
label: '角色描述', label: '角色描述',
prop: 'roleDesc', prop: 'roleDesc',
overHidden: true, overHidden: true,
type: 'textarea', type: 'textarea',
minRows: 6, minRows: 6,
span: 24, span: 24,
}, { }, {
width: 180, width: 180,
label: '创建时间', label: '创建时间',
prop: 'createTime', prop: 'createTime',
type: 'datetime', type: 'datetime',
format: 'yyyy-MM-dd HH:mm', format: 'yyyy-MM-dd HH:mm',
valueFormat: 'yyyy-MM-dd HH:mm:ss', valueFormat: 'yyyy-MM-dd HH:mm:ss',
editDisabled: true, editDisabled: true,
addVisdiplay: false, addVisdiplay: false,
span: 24, span: 24,
}] }]
} }
...@@ -16,73 +16,77 @@ ...@@ -16,73 +16,77 @@
*/ */
export const tableOption = { export const tableOption = {
"border": true, border: true,
"index": true, index: true,
"stripe": true, stripe: true,
"menuAlign": "center", menuAlign: "center",
"align": "center", align: "center",
"editBtn": false, editBtn: false,
"delBtn": false, delBtn: false,
"addBtn": false, addBtn: false,
'dicUrl': '/admin/dict/type/social_type', viewBtn: true,
"column": [{ dicUrl: '/admin/dict/type/social_type',
label: 'ID', column: [{
prop: 'id', label: 'ID',
hide: true, prop: 'id',
addVisdiplay: false, hide: true,
editDisabled: true addVisdiplay: false,
}, editDisabled: true
{ },
label: '类型', {
prop: 'type', label: '类型',
type: 'select', prop: 'type',
dicData: 'social_type', type: 'select',
search: true, dicData: 'social_type',
rules: [{ search: true,
required: true, rules: [{
message: '请选择类型', required: true,
trigger: 'blur' message: '请选择类型',
}] trigger: 'blur'
}, }]
{ },
label: '描述', {
prop: 'remark' label: '描述',
}, prop: 'remark'
{ },
label: 'appId', {
prop: 'appId', label: 'appId',
rules: [{ prop: 'appId',
required: true, overHidden: true,
message: '请输入appId', rules: [{
trigger: 'blur' required: true,
}] message: '请输入appId',
}, trigger: 'blur'
{ }]
label: 'appSecret', },
prop: 'appSecret', {
rules: [{ label: 'appSecret',
required: true, prop: 'appSecret',
message: '请输入appSecret', overHidden: true,
trigger: 'blur' rules: [{
}] required: true,
}, message: '请输入appSecret',
{ trigger: 'blur'
label: '回调地址', }]
prop: 'redirectUrl', },
rules: [{ {
required: true, label: '回调地址',
message: '请输入回调地址', prop: 'redirectUrl',
trigger: 'blur' hide: true,
}] rules: [{
}, required: true,
{ message: '请输入回调地址',
valueFormat: 'timestamp', trigger: 'blur'
format: 'yyyy-MM-dd hh:mm:ss', }]
label: '创建时间', },
prop: 'createTime', {
align: 'center', valueFormat: 'timestamp',
addVisdiplay: false, format: 'yyyy-MM-dd hh:mm:ss',
editDisabled: true label: '创建时间',
} prop: 'createTime',
] align: 'center',
} addVisdiplay: false,
\ No newline at end of file editDisabled: true
}
]
}
...@@ -16,53 +16,54 @@ ...@@ -16,53 +16,54 @@
*/ */
const DIC = { const DIC = {
vaild: [{ vaild: [{
label: '否', label: '否',
value: 'false' value: 'false'
}, { }, {
label: '是', label: '是',
value: 'true' value: 'true'
}] }]
} }
export const tableOption = { export const tableOption = {
'border': true, border: true,
'index': true, index: true,
'indexLabel': '序号', indexLabel: '序号',
'stripe': true, stripe: true,
'menuAlign': 'center', menuAlign: 'center',
'align': 'center', align: 'center',
'addBtn': false, viewBtn: true,
'editBtn': false, addBtn: false,
'delBtn': false, editBtn: false,
'dic': [], delBtn: false,
'column': [{ dic: [],
label: '用户ID', column: [{
prop: 'user_id', label: '用户ID',
align: 'center' prop: 'user_id',
}, { align: 'center'
label: '用户名', }, {
prop: 'user_name', label: '用户名',
align: 'center' prop: 'user_name',
}, { align: 'center'
label: '令牌', }, {
prop: 'token_value', label: '令牌',
align: 'center', prop: 'token_value',
'overHidden': true align: 'center',
}, { 'overHidden': true
label: '类型', }, {
prop: 'token_type', label: '类型',
align: 'center' prop: 'token_type',
}, { align: 'center'
label: '过期时间', }, {
prop: 'expires_in', label: '过期时间',
align: 'center' prop: 'expires_in',
}, { align: 'center'
label: '客户端', }, {
prop: 'client_id', label: '客户端',
align: 'center' prop: 'client_id',
}, { align: 'center'
label: '授权类型', }, {
prop: 'grant_type', label: '授权类型',
align: 'center' prop: 'grant_type',
}] align: 'center'
}]
} }
...@@ -14,132 +14,133 @@ ...@@ -14,132 +14,133 @@
* this software without specific prior written permission. * this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com) * Author: lengleng (wangiegie@gmail.com)
*/ */
import { getDetails } from "@/api/admin/user"; import {getDetails} from "@/api/admin/user";
var validateUsername = (rule, value, callback) => { var validateUsername = (rule, value, callback) => {
getDetails(value).then(response => { getDetails(value).then(response => {
if (window.boxType === 'edit') callback() if (window.boxType === 'edit') callback()
let result = response.data.data let result = response.data.data
if (result !== null) { if (result !== null) {
callback(new Error('用户名已经存在')) callback(new Error('用户名已经存在'))
} else { } else {
callback() callback()
} }
}); });
}; };
export const tableOption = { export const tableOption = {
border: true, border: true,
index: true, index: true,
indexLabel: '序号', indexLabel: '序号',
stripe: true, stripe: true,
menuAlign: 'center', menuAlign: 'center',
editBtn: false, editBtn: false,
delBtn: false, delBtn: false,
align: 'center', align: 'center',
addBtn: false, addBtn: false,
column: [{ column: [{
fixed: true, fixed: true,
label: 'id', label: 'id',
prop: 'userId', prop: 'userId',
span: 24, span: 24,
hide: true, hide: true,
editDisabled: true, editDisabled: true,
addVisdiplay: false, addVisdiplay: false,
}, { }, {
fixed: true, fixed: true,
label: '用户名', label: '用户名',
prop: 'username', prop: 'username',
editDisabled: true, editDisabled: true,
solt: true, solt: true,
search: true, search: true,
span: 24, span: 24,
rules: [{ rules: [{
required: true, required: true,
message: "请输入用户名", message: "请输入用户名",
}, },
{ {
min: 3, min: 3,
max: 20, max: 20,
message: "长度在 3 到 20 个字符", message: "长度在 3 到 20 个字符",
trigger: "blur" trigger: "blur"
}, },
{ validator: validateUsername, trigger: 'blur' } {validator: validateUsername, trigger: 'blur'}
] ]
}, { }, {
label: '密码', label: '密码',
prop: 'password', prop: 'password',
type: 'password', type: 'password',
value: '', value: '',
hide: true, hide: true,
span: 24, span: 24,
rules: [{ rules: [{
min: 6, min: 6,
max: 20, max: 20,
message: "长度在 6 到 20 个字符", message: "长度在 6 到 20 个字符",
trigger: "blur" trigger: "blur"
}] }]
}, { }, {
label: '所属部门', label: '所属部门',
prop: 'deptId', prop: 'deptId',
formsolt: true, formsolt: true,
solt: true, solt: true,
span: 24, span: 24,
hide: true, hide: true,
rules: [{ rules: [{
required: true, required: true,
message: "请选择部门", message: "请选择部门",
trigger: "blur" trigger: "blur"
}] }]
}, { }, {
label: '手机号', label: '手机号',
prop: 'phone', prop: 'phone',
type: 'phone', type: 'phone',
value: '', value: '',
span: 24, span: 24,
rules: [{ rules: [{
min: 6, min: 6,
max: 20, max: 20,
message: "长度在 11 个字符", message: "长度在 11 个字符",
trigger: "blur" trigger: "blur"
}] }]
},{ }, {
label: '角色', label: '角色',
prop: 'role', prop: 'role',
formsolt: true, formsolt: true,
solt: true, solt: true,
overHidden: true, overHidden: true,
span: 24, span: 24,
rules: [{ rules: [{
required: true, required: true,
message: "请选择角色", message: "请选择角色",
trigger: "blur" trigger: "blur"
}], }],
}, { }, {
label: '状态', label: '状态',
prop: "lockFlag", prop: "lockFlag",
type: "select", type: "select",
solt: true, solt: true,
span: 24, span: 24,
rules: [{ rules: [{
required: true, required: true,
message: "请选择状态", message: "请选择状态",
trigger: "blur" trigger: "blur"
}], }],
dicData: [{ dicData: [{
label: '有效', label: '有效',
value: "0" value: "0"
}, {
label: '锁定',
value: "9"
}]
}, { }, {
width: 180, label: '锁定',
label: '创建时间', value: "9"
prop: 'createTime',
type: 'datetime',
format: 'yyyy-MM-dd HH:mm',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
editDisabled: true,
addVisdiplay: false,
span: 24
}] }]
}, {
width: 180,
label: '创建时间',
prop: 'createTime',
type: 'datetime',
format: 'yyyy-MM-dd HH:mm',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
editDisabled: true,
addVisdiplay: false,
span: 24
}]
} }
...@@ -15,84 +15,84 @@ ...@@ -15,84 +15,84 @@
* Author: lengleng (wangiegie@gmail.com) * Author: lengleng (wangiegie@gmail.com)
*/ */
const DIC = { const DIC = {
isSuccess: [{ isSuccess: [{
label: '成功', label: '成功',
value: 1 value: 1
}, },
{ {
label: '失败', label: '失败',
value: 0 value: 0
} }
] ]
} }
export const tableOption = { export const tableOption = {
'border': true, 'border': true,
'index': true, 'index': true,
'indexLabel': '序号', 'indexLabel': '序号',
'stripe': true, 'stripe': true,
'menuAlign': "center", 'menuAlign': "center",
'align': "center", 'align': "center",
'editBtn': false, 'editBtn': false,
'delBtn': false, 'delBtn': false,
'addBtn': false, 'addBtn': false,
'viewBtn':true, 'viewBtn': true,
'dic': [], 'dic': [],
'column': [ 'column': [
{ {
label: 'ID', label: 'ID',
prop: 'id', prop: 'id',
hide: true hide: true
}, },
{ {
label: '任务名称', label: '任务名称',
prop: 'jobName' prop: 'jobName'
}, },
{ {
label: '任务ID', label: '任务ID',
prop: 'taskId', prop: 'taskId',
hide: true, hide: true,
overHidden: true overHidden: true
}, },
{ {
label: '主机名', label: '主机名',
prop: 'hostname', prop: 'hostname',
hide: true hide: true
}, },
{ {
label: 'IP', label: 'IP',
prop: 'ip' prop: 'ip'
}, },
{ {
width: 80, width: 80,
label: '分片项', label: '分片项',
prop: 'shardingItem' prop: 'shardingItem'
}, },
{ {
label: '执行源', label: '执行源',
prop: 'executionSource', prop: 'executionSource',
hide: true hide: true
}, },
{ {
label: '失败原因', label: '失败原因',
prop: 'failureCause', prop: 'failureCause',
hide: true hide: true
}, },
{ {
width: 100, width: 100,
label: '执行结果', label: '执行结果',
prop: 'isSuccess', prop: 'isSuccess',
type: 'select', type: 'select',
dicData: DIC.isSuccess, dicData: DIC.isSuccess,
}, },
{ {
label: '开始时间', label: '开始时间',
prop: 'startTime', prop: 'startTime',
hide: true hide: true
}, },
{ {
label: '完成时间', label: '完成时间',
prop: 'completeTime' prop: 'completeTime'
}, },
] ]
} }
...@@ -16,89 +16,89 @@ ...@@ -16,89 +16,89 @@
*/ */
const DIC = { const DIC = {
state: [{ state: [{
label: '准备中', label: '准备中',
value: 'TASK_STAGING' value: 'TASK_STAGING'
}, },
{ {
label: '执行中', label: '执行中',
value: 'TASK_RUNNING' value: 'TASK_RUNNING'
}, { }, {
label: '已经完成', label: '已经完成',
value: 'TASK_FINISHED' value: 'TASK_FINISHED'
} }
] ]
} }
export const tableOption = { export const tableOption = {
"border": true, "border": true,
"index": true, "index": true,
"stripe": true, "stripe": true,
"menuAlign": "center", "menuAlign": "center",
"align": "center", "align": "center",
"editBtn": false, "editBtn": false,
"delBtn": false, "delBtn": false,
"addBtn": false, "addBtn": false,
"viewBtn": true, "viewBtn": true,
"dic": [], "dic": [],
"column": [{ "column": [{
label: 'ID', label: 'ID',
prop: 'id', prop: 'id',
hide: true hide: true
},
{
label: '作业名称',
prop: 'jobName',
search: true
},
{
label: '原任务',
prop: 'originalTaskId',
hide: true,
width: 100
},
{
label: '任务ID',
prop: 'taskId',
hide: true
},
{
label: '服务器IP',
prop: 'slaveId'
},
{
label: '资源',
prop: 'source',
hide: true
},
{
label: '执行类型',
prop: 'executionType',
hide: true
},
{
width: 100,
label: '分片项',
prop: 'shardingItem'
},
{
width: 100,
label: '状态',
prop: 'state',
type: 'select',
dicData: DIC.state,
search: true
},
{
label: '消息',
prop: 'message',
width: 100,
overHidden: true,
hide: true
}, },
{ {
label: '作业名称', label: '创建时间',
prop: 'jobName', prop: 'creationTime'
search: true }
}, ]
{
label: '原任务',
prop: 'originalTaskId',
hide: true,
width: 100
},
{
label: '任务ID',
prop: 'taskId',
hide: true
},
{
label: '服务器IP',
prop: 'slaveId'
},
{
label: '资源',
prop: 'source',
hide: true
},
{
label: '执行类型',
prop: 'executionType',
hide: true
},
{
width: 100,
label: '分片项',
prop: 'shardingItem'
},
{
width: 100,
label: '状态',
prop: 'state',
type: 'select',
dicData: DIC.state,
search: true
},
{
label: '消息',
prop: 'message',
width: 100,
overHidden: true,
hide: true
},
{
label: '创建时间',
prop: 'creationTime'
}
]
} }
...@@ -16,66 +16,66 @@ ...@@ -16,66 +16,66 @@
*/ */
export const tableOption = { export const tableOption = {
'border': true, 'border': true,
'index': true, 'index': true,
'expand': true, 'expand': true,
'stripe': true, 'stripe': true,
'selection': true, 'selection': true,
'page': false, 'page': false,
'menuAlign': 'center', 'menuAlign': 'center',
'defaultSort': { 'defaultSort': {
prop: 'username', prop: 'username',
order: 'descending' order: 'descending'
}, },
'align': 'center', 'align': 'center',
'dic': [], 'dic': [],
'column': [{ 'column': [{
'label': '用户名', 'label': '用户名',
'prop': 'username', 'prop': 'username',
'span': 24, 'span': 24,
'solt': true, 'solt': true,
'sortable': true, 'sortable': true,
'width': 120, 'width': 120,
'rules': [{ 'rules': [{
'required': true, 'required': true,
'message': '请输入用户名', 'message': '请输入用户名',
'trigger': 'blur' 'trigger': 'blur'
}] }]
}, { }, {
'label': '类型', 'label': '类型',
'prop': 'type', 'prop': 'type',
'width': 80, 'width': 80,
'type': 'select', 'type': 'select',
'sortable': true, 'sortable': true,
'dicData': [{ 'dicData': [{
'label': '后端', 'label': '后端',
'value': '0' 'value': '0'
}, {
'label': '前端',
'value': '1'
}]
}, {
'label': 'stars',
'width': '150',
'prop': 'stars',
'sortable': true,
'solt': true
}, {
'label': '码云',
'solt': true,
'span': 24,
'prop': 'address',
'type': 'textarea',
'overHidden': true
}, { }, {
'label': '项目介绍', 'label': '前端',
'width': '300', 'value': '1'
'prop': 'info',
'editDisabled': true,
'type': 'textarea',
'span': 24,
'maxRow': 4,
'minRow': 4,
'overHidden': true
}] }]
} }, {
\ No newline at end of file 'label': 'stars',
'width': '150',
'prop': 'stars',
'sortable': true,
'solt': true
}, {
'label': '码云',
'solt': true,
'span': 24,
'prop': 'address',
'type': 'textarea',
'overHidden': true
}, {
'label': '项目介绍',
'width': '300',
'prop': 'info',
'editDisabled': true,
'type': 'textarea',
'span': 24,
'maxRow': 4,
'minRow': 4,
'overHidden': true
}]
}
This diff is collapsed.
export default { export default {
'000': '操作太频繁,请勿重复请求', '000': '操作太频繁,请勿重复请求',
'401': '当前操作没有权限', '401': '当前操作没有权限',
'403': '当前操作没有权限', '403': '当前操作没有权限',
'404': '资源不存在', '404': '资源不存在',
'417': '未绑定登录账号,请使用密码登录后绑定', '417': '未绑定登录账号,请使用密码登录后绑定',
'423': '演示环境不能操作,如需了解联系冷冷', '423': '演示环境不能操作,如需了解联系冷冷',
'426': '用户名不存在或密码错误', '426': '用户名不存在或密码错误',
'428': '验证码错误,请重新输入', '428': '验证码错误,请重新输入',
'429': '请求过频繁', '429': '请求过频繁',
'479': '演示环境,没有权限操作', '479': '演示环境,没有权限操作',
'default': '系统未知错误,请反馈给管理员' 'default': '系统未知错误,请反馈给管理员'
} }
\ No newline at end of file
export default { export default {
menu: false, menu: false,
addBtn: false, addBtn: false,
page: false, page: false,
border: true, border: true,
expand: true, expand: true,
refreshBtn: false, refreshBtn: false,
headerAlign: 'center', headerAlign: 'center',
column: [{ column: [{
label: '类型', label: '类型',
prop: 'type', prop: 'type',
width: 80, width: 80,
align: 'center', align: 'center',
solt: true, solt: true,
dicData: [{ dicData: [{
label: 'bug', label: 'bug',
value: 'error' value: 'error'
}]
}, {
label: '地址',
width: 200,
prop: 'url',
overHidden: true,
}, {
label: '内容',
prop: 'message',
overHidden: true,
}, {
label: '错误堆栈',
prop: 'stack',
hide: true
}, {
label: '时间',
align: 'center',
prop: 'time',
width: 200,
}] }]
} }, {
\ No newline at end of file label: '地址',
width: 200,
prop: 'url',
overHidden: true,
}, {
label: '内容',
prop: 'message',
overHidden: true,
}, {
label: '错误堆栈',
prop: 'stack',
hide: true
}, {
label: '时间',
align: 'center',
prop: 'time',
width: 200,
}]
}
const dicData = [{ const dicData = [{
label: '开启', label: '开启',
value: 'true' value: 'true'
}, { }, {
label: '关闭', label: '关闭',
value: 'false' value: 'false'
}] }]
export const list = [{ export const list = [{
key: 'showTag', key: 'showTag',
commit: 'SET_SHOWTAG' commit: 'SET_SHOWTAG'
}, { }, {
key: 'showTheme', key: 'showTheme',
commit: 'SET_SHOWTHEME' commit: 'SET_SHOWTHEME'
}, { }, {
key: 'showColor', key: 'showColor',
commit: 'SET_SHOWCOLOR' commit: 'SET_SHOWCOLOR'
}, { }, {
key: 'showLock', key: 'showLock',
commit: 'SET_SHOWLOCK' commit: 'SET_SHOWLOCK'
}, { }, {
key: 'showDebug', key: 'showDebug',
commit: 'SET_SHOWDEBUG' commit: 'SET_SHOWDEBUG'
}, { }, {
key: 'showFullScren', key: 'showFullScren',
commit: 'SET_SHOWFULLSCREN' commit: 'SET_SHOWFULLSCREN'
}, { }, {
key: 'showCollapse', key: 'showCollapse',
commit: 'SET_SHOWCOLLAPSE' commit: 'SET_SHOWCOLLAPSE'
}, { }, {
key: 'showSearch', key: 'showSearch',
commit: 'SET_SHOWSEARCH' commit: 'SET_SHOWSEARCH'
}, { }, {
key: 'showMenu', key: 'showMenu',
commit: 'SET_SHOWMENU' commit: 'SET_SHOWMENU'
}] }]
export const option = (safe) => { export const option = (safe) => {
const _safe = safe; const _safe = safe;
return { return {
submitBtn: false, submitBtn: false,
column: [{ column: [{
label: '标签', label: '标签',
prop: 'showTag', prop: 'showTag',
type: 'switch', type: 'switch',
span: 24, span: 24,
dicData: dicData, dicData: dicData,
click: ({ column }) => { click: ({column}) => {
_safe.set(column.prop); _safe.set(column.prop);
} }
}, { }, {
label: '日志', label: '日志',
prop: 'showDebug', prop: 'showDebug',
type: 'switch', type: 'switch',
span: 24, span: 24,
dicData: dicData, dicData: dicData,
click: ({ column }) => { click: ({column}) => {
_safe.set(column.prop); _safe.set(column.prop);
} }
}, { }, {
label: '主题', label: '主题',
prop: 'showTheme', prop: 'showTheme',
type: 'switch', type: 'switch',
span: 24, span: 24,
dicData: dicData, dicData: dicData,
click: ({ column }) => { click: ({column}) => {
_safe.set(column.prop); _safe.set(column.prop);
} }
}, { }, {
label: '主题色', label: '主题色',
prop: 'showColor', prop: 'showColor',
type: 'switch', type: 'switch',
span: 24, span: 24,
dicData: dicData, dicData: dicData,
click: ({ column }) => { click: ({column}) => {
_safe.set(column.prop); _safe.set(column.prop);
} }
}, { }, {
label: '全屏', label: '全屏',
prop: 'showFullScren', prop: 'showFullScren',
type: 'switch', type: 'switch',
span: 24, span: 24,
dicData: dicData, dicData: dicData,
click: ({ column }) => { click: ({column}) => {
_safe.set(column.prop); _safe.set(column.prop);
} }
}, { }, {
label: '锁屏', label: '锁屏',
prop: 'showLock', prop: 'showLock',
type: 'switch', type: 'switch',
span: 24, span: 24,
dicData: dicData, dicData: dicData,
click: ({ column }) => { click: ({column}) => {
_safe.set(column.prop); _safe.set(column.prop);
} }
}, { }, {
label: '搜索', label: '搜索',
prop: 'showSearch', prop: 'showSearch',
type: 'switch', type: 'switch',
span: 24, span: 24,
dicData: dicData, dicData: dicData,
click: ({ column }) => { click: ({column}) => {
_safe.set(column.prop); _safe.set(column.prop);
} }
}, { }, {
label: '缩放', label: '缩放',
prop: 'showCollapse', prop: 'showCollapse',
type: 'switch', type: 'switch',
span: 24, span: 24,
dicData: dicData, dicData: dicData,
click: ({ column }) => { click: ({column}) => {
_safe.set(column.prop); _safe.set(column.prop);
} }
}, { }, {
label: '顶部菜单', label: '顶部菜单',
prop: 'showMenu', prop: 'showMenu',
type: 'switch', type: 'switch',
span: 24, span: 24,
dicData: dicData, dicData: dicData,
click: ({ column }) => { click: ({column}) => {
_safe.set(column.prop); _safe.set(column.prop);
} }
}] }]
} }
} }
\ No newline at end of file
export default { export default {
title: "PigX", title: "PigX",
logo: "PigX", logo: "PigX",
indexTitle: 'PigX Pro 快速开发框架', indexTitle: 'PigX Pro 快速开发框架',
whiteList: ["/login", "/404", "/401", "/lock"], //配置无权限可以访问的页面 whiteList: ["/login", "/404", "/401", "/lock"], //配置无权限可以访问的页面
whiteTagList: ["/login", "/404", "/401", "/lock", ], //配置不添加tags页面 ('/advanced-router/mutative-detail/*'——*为通配符) whiteTagList: ["/login", "/404", "/401", "/lock",], //配置不添加tags页面 ('/advanced-router/mutative-detail/*'——*为通配符)
lockPage: '/lock', lockPage: '/lock',
tokenTime: 6000, tokenTime: 6000,
info: { info: {
title: "PigX Pro 快速开发框架", title: "PigX Pro 快速开发框架",
list: [ list: [
'一个基于Spring Cloud、OAuth2.0开发基于Vue前后分离的开发平台。', '一个基于Spring Cloud、OAuth2.0开发基于Vue前后分离的开发平台。',
'一个基于Avue2 开发无需前端知识,即可快速上手的开发平台。', '一个基于Avue2 开发无需前端知识,即可快速上手的开发平台。',
'最大程度上帮助企业节省时间成本和费用开支。', '最大程度上帮助企业节省时间成本和费用开支。',
'QQ群:23754102', 'QQ群:23754102',
'当前版本:v2.0.0', '当前版本:v2.0.0',
] ]
}, },
//http的status默认放行不才用统一处理的, //http的status默认放行不才用统一处理的,
statusWhiteList: [400, 500, 401], statusWhiteList: [400, 500, 401],
//配置首页不可关闭 //配置首页不可关闭
isFirstPage: false, isFirstPage: false,
fistPage: { fistPage: {
label: "首页", label: "首页",
value: "/wel/index", value: "/wel/index",
params: {}, params: {},
query: {}, query: {},
group: [], group: [],
close: false close: false
}, },
//配置菜单的属性 //配置菜单的属性
menu: { menu: {
props: { props: {
label: 'label', label: 'label',
path: 'path', path: 'path',
icon: 'icon', icon: 'icon',
children: 'children' children: 'children'
}
} }
} }
\ No newline at end of file }
import Vue from 'vue'; import Vue from 'vue';
import store from './store' import store from './store'
Vue.config.errorHandler = function(err, vm, info) {
Vue.nextTick(() => { Vue.config.errorHandler = function (err, vm, info) {
store.commit('ADD_LOGS', {
type: 'error', Vue.nextTick(() => {
message: err.message, store.commit('ADD_LOGS', {
stack: err.stack, type: 'error',
info message: err.message,
}) stack: err.stack,
if (process.env.NODE_ENV === 'development') { info
console.group('>>>>>> 错误信息 >>>>>>')
console.log(info)
console.groupEnd();
console.group('>>>>>> Vue 实例 >>>>>>')
console.log(vm)
console.groupEnd();
console.group('>>>>>> Error >>>>>>')
console.log(err)
console.groupEnd();
}
}) })
} if (process.env.NODE_ENV === 'development') {
\ No newline at end of file console.group('>>>>>> 错误信息 >>>>>>')
console.log(info)
console.groupEnd();
console.group('>>>>>> Vue 实例 >>>>>>')
console.log(vm)
console.groupEnd();
console.group('>>>>>> Error >>>>>>')
console.log(err)
console.groupEnd();
}
})
}
function pluralize(time, label) { function pluralize(time, label) {
if (time === 1) { if (time === 1) {
return time + label return time + label
} }
return time + label + 's' return time + label + 's'
} }
/** /**
* 日期格式化 * 日期格式化
*/ */
export function dateFormat(date) { export function dateFormat(date) {
let format = 'yyyy-MM-dd hh:mm:ss'; let format = 'yyyy-MM-dd hh:mm:ss';
if (date != 'Invalid Date') { if (date != 'Invalid Date') {
var o = { var o = {
"M+": date.getMonth() + 1, //month "M+": date.getMonth() + 1, //month
"d+": date.getDate(), //day "d+": date.getDate(), //day
"h+": date.getHours(), //hour "h+": date.getHours(), //hour
"m+": date.getMinutes(), //minute "m+": date.getMinutes(), //minute
"s+": date.getSeconds(), //second "s+": date.getSeconds(), //second
"q+": Math.floor((date.getMonth() + 3) / 3), //quarter "q+": Math.floor((date.getMonth() + 3) / 3), //quarter
"S": date.getMilliseconds() //millisecond "S": date.getMilliseconds() //millisecond
}
if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
(date.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length == 1 ? o[k] :
("00" + o[k]).substr(("" + o[k]).length));
return format;
} }
return ''; if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
(date.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length == 1 ? o[k] :
("00" + o[k]).substr(("" + o[k]).length));
return format;
}
return '';
} }
export function timeAgo(time) { export function timeAgo(time) {
const between = Date.now() / 1000 - Number(time) const between = Date.now() / 1000 - Number(time)
if (between < 3600) { if (between < 3600) {
return pluralize(~~(between / 60), ' minute') return pluralize(~~(between / 60), ' minute')
} else if (between < 86400) { } else if (between < 86400) {
return pluralize(~~(between / 3600), ' hour') return pluralize(~~(between / 3600), ' hour')
} else { } else {
return pluralize(~~(between / 86400), ' day') return pluralize(~~(between / 86400), ' day')
} }
} }
export function parseTime(time, cFormat) { export function parseTime(time, cFormat) {
if (arguments.length === 0) { if (arguments.length === 0) {
return null return null
} }
if ((time + '').length === 10) { if ((time + '').length === 10) {
time = +time * 1000 time = +time * 1000
} }
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}' const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
let date let date
if (typeof time === 'object') { if (typeof time === 'object') {
date = time date = time
} else { } else {
date = new Date(parseInt(time)) date = new Date(parseInt(time))
} }
const formatObj = { const formatObj = {
y: date.getFullYear(), y: date.getFullYear(),
m: date.getMonth() + 1, m: date.getMonth() + 1,
d: date.getDate(), d: date.getDate(),
h: date.getHours(), h: date.getHours(),
i: date.getMinutes(), i: date.getMinutes(),
s: date.getSeconds(), s: date.getSeconds(),
a: date.getDay() 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 - 1]
if (result.length > 0 && value < 10) {
value = '0' + value
} }
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { return value || 0
let value = formatObj[key] })
if (key === 'a') return ['一', '二', '三', '四', '五', '六', '日'][value - 1] return time_str
if (result.length > 0 && value < 10) {
value = '0' + value
}
return value || 0
})
return time_str
} }
export function formatTime(time, option) { export function formatTime(time, option) {
time = +time * 1000 time = +time * 1000
const d = new Date(time) const d = new Date(time)
const now = Date.now() const now = Date.now()
const diff = (now - d) / 1000 const diff = (now - d) / 1000
if (diff < 30) { if (diff < 30) {
return '刚刚' return '刚刚'
} else if (diff < 3600) { // less 1 hour } else if (diff < 3600) { // less 1 hour
return Math.ceil(diff / 60) + '分钟前' return Math.ceil(diff / 60) + '分钟前'
} else if (diff < 3600 * 24) { } else if (diff < 3600 * 24) {
return Math.ceil(diff / 3600) + '小时前' return Math.ceil(diff / 3600) + '小时前'
} else if (diff < 3600 * 24 * 2) { } else if (diff < 3600 * 24 * 2) {
return '1天前' return '1天前'
} }
if (option) { if (option) {
return parseTime(time, option) return parseTime(time, option)
} else { } else {
return d.getMonth() + 1 + '月' + d.getDate() + '日' + d.getHours() + '时' + d.getMinutes() + '分' return d.getMonth() + 1 + '月' + d.getDate() + '日' + d.getHours() + '时' + d.getMinutes() + '分'
} }
} }
/* 数字 格式化*/ /* 数字 格式化*/
export function nFormatter(num, digits) { export function nFormatter(num, digits) {
const si = [ const si = [
{ value: 1E18, symbol: 'E' }, {value: 1E18, symbol: 'E'},
{ value: 1E15, symbol: 'P' }, {value: 1E15, symbol: 'P'},
{ value: 1E12, symbol: 'T' }, {value: 1E12, symbol: 'T'},
{ value: 1E9, symbol: 'G' }, {value: 1E9, symbol: 'G'},
{ value: 1E6, symbol: 'M' }, {value: 1E6, symbol: 'M'},
{ value: 1E3, symbol: 'k' } {value: 1E3, symbol: 'k'}
] ]
for (let i = 0; i < si.length; i++) { for (let i = 0; i < si.length; i++) {
if (num >= si[i].value) { if (num >= si[i].value) {
return (num / si[i].value + 0.1).toFixed(digits).replace(/\.0+$|(\.[0-9]*[1-9])0+$/, '$1') + si[i].symbol return (num / si[i].value + 0.1).toFixed(digits).replace(/\.0+$|(\.[0-9]*[1-9])0+$/, '$1') + si[i].symbol
}
} }
return num.toString() }
return num.toString()
} }
export function html2Text(val) { export function html2Text(val) {
const div = document.createElement('div') const div = document.createElement('div')
div.innerHTML = val div.innerHTML = val
return div.textContent || div.innerText return div.textContent || div.innerText
} }
export function toThousandslsFilter(num) { export function toThousandslsFilter(num) {
return (+num || 0).toString().replace(/^-?\d+/g, m => m.replace(/(?=(?!\b)(\d{3})+$)/g, ',')) return (+num || 0).toString().replace(/^-?\d+/g, m => m.replace(/(?=(?!\b)(\d{3})+$)/g, ','))
} }
\ No newline at end of file
...@@ -10,32 +10,26 @@ import router from './router/router'; ...@@ -10,32 +10,26 @@ import router from './router/router';
import 'avue-plugin-transfer/packages' //引入avue-plugin-transfer插件 import 'avue-plugin-transfer/packages' //引入avue-plugin-transfer插件
// import 'avue-plugin-ueditor/packages' //引入avue-plugin-ueditor插件(如果要兼容ie自行换掉富文本编辑器,此款插件不兼容ie) // import 'avue-plugin-ueditor/packages' //引入avue-plugin-ueditor插件(如果要兼容ie自行换掉富文本编辑器,此款插件不兼容ie)
import store from './store'; import store from './store';
import { import {loadStyle} from './util/util'
loadStyle
} from './util/util'
import * as urls from '@/config/env'; import * as urls from '@/config/env';
import { import {iconfontUrl, iconfontVersion} from '@/config/env';
iconfontUrl,
iconfontVersion
} from '@/config/env';
import * as filters from './filters' // 全局filter import * as filters from './filters' // 全局filter
import './styles/common.scss'; import './styles/common.scss';
// // 引入avue的包 // // 引入avue的包
import Avue from '@smallwei/avue/lib/index.js'; import Avue from '@smallwei/avue/lib/index.js';
// // 引入avue的样式文件 // // 引入avue的样式文件
import '@smallwei/avue/lib/theme-chalk/index.css'; import '@smallwei/avue/lib/theme-chalk/index.css';
// //源文件包
// import '../packages/index.js';
// import '../packages/theme-chalk/src/index.scss';
import basicContainer from './components/basic-container/main' import basicContainer from './components/basic-container/main'
import VueClipboard from 'vue-clipboard2' import VueClipboard from 'vue-clipboard2'
// 插件 json 展示 // 插件 json 展示
import vueJsonTreeView from 'vue-json-tree-view' import vueJsonTreeView from 'vue-json-tree-view'
// //源文件包
// import '../packages/index.js';
// import '../packages/theme-chalk/src/index.scss';
Vue.use(Avue, { menuType : 'text'}); Vue.use(Avue, {menuType: 'text'});
Vue.use(router) Vue.use(router)
...@@ -48,21 +42,21 @@ Vue.use(VueAxios, axios) ...@@ -48,21 +42,21 @@ Vue.use(VueAxios, axios)
Vue.component('basicContainer', basicContainer) Vue.component('basicContainer', basicContainer)
Object.keys(urls).forEach(key => { Object.keys(urls).forEach(key => {
Vue.prototype[key] = urls[key]; Vue.prototype[key] = urls[key];
}) })
Object.keys(filters).forEach(key => { Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key]) Vue.filter(key, filters[key])
}) })
iconfontVersion.forEach(ele => { iconfontVersion.forEach(ele => {
loadStyle(iconfontUrl.replace('$key', ele)); loadStyle(iconfontUrl.replace('$key', ele));
}) })
Vue.config.productionTip = false; Vue.config.productionTip = false;
new Vue({ new Vue({
router, router,
store, store,
render: h => h(App) render: h => h(App)
}).$mount('#app') }).$mount('#app')
...@@ -22,84 +22,90 @@ ...@@ -22,84 +22,90 @@
</div> </div>
</template> </template>
<script> <script>
import { mapGetters, mapState } from "vuex"; import {mapGetters, mapState} from "vuex";
export default {
name: "lock", export default {
data () { name: "lock",
return { data() {
passwd: "", return {
passwdError: false, passwd: "",
pass: false passwdError: false,
}; pass: false
}, };
created () { }, },
mounted () { }, created() {
computed: { },
...mapState({ mounted() {
userInfo: state => state.user.userInfo
}),
...mapGetters(["tag", "lockPasswd"])
},
props: [],
methods: {
handleLogout () {
this.$confirm("是否退出系统, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.$store.dispatch("LogOut").then(() => {
this.$router.push({ path: "/login" });
});
});
}, },
handleLogin () { computed: {
if (this.passwd != this.lockPasswd) { ...mapState({
this.passwd = ""; userInfo: state => state.user.userInfo
this.$message({ }),
message: "解锁密码错误,请重新输入", ...mapGetters(["tag", "lockPasswd"])
type: "error" },
props: [],
methods: {
handleLogout() {
this.$confirm("是否退出系统, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.$store.dispatch("LogOut").then(() => {
this.$router.push({path: "/login"});
});
}); });
this.passwdError = true; },
handleLogin() {
if (this.passwd != this.lockPasswd) {
this.passwd = "";
this.$message({
message: "解锁密码错误,请重新输入",
type: "error"
});
this.passwdError = true;
setTimeout(() => {
this.passwdError = false;
}, 1000);
return;
}
this.pass = true;
setTimeout(() => { setTimeout(() => {
this.passwdError = false; this.$store.commit("CLEAR_LOCK");
this.$router.push({path: this.$router.$avueRouter.getPath({src: this.tag.value})});
}, 1000); }, 1000);
return;
} }
this.pass = true; },
setTimeout(() => { components: {}
this.$store.commit("CLEAR_LOCK"); };
this.$router.push({ path: this.$router.$avueRouter.getPath({ src: this.tag.value }) });
}, 1000);
}
},
components: {}
};
</script> </script>
<style lang="scss"> <style lang="scss">
.lock-container { .lock-container {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
position: relative; position: relative;
.title {
margin-bottom: 8px; .title {
color: #333; margin-bottom: 8px;
color: #333;
}
}
.lock-container::before {
z-index: -999;
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-image: url('/img/login.png');
background-size: cover;
}
.lock-form {
width: 300px;
} }
} </style>
.lock-container::before {
z-index: -999;
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-image: url('/img/login.png');
background-size: cover;
}
.lock-form {
width: 300px;
}
</style>
\ No newline at end of file
...@@ -20,11 +20,10 @@ ...@@ -20,11 +20,10 @@
class="login-select animated fadeIn" class="login-select animated fadeIn"
v-model="active" v-model="active"
@change="handleCommand" @change="handleCommand"
placeholder="请选择租户,不选为默认" placeholder="点击请选择租户"
size="mini" size="mini">
> <el-option label="租户1 用户登录" value="1"></el-option>
<el-option label="租户1" value="1"></el-option> <el-option label="租户2 用户登录" value="2"></el-option>
<el-option label="租户2" value="2"></el-option>
</el-select> </el-select>
</h4> </h4>
<userLogin v-if="activeName==='user'"></userLogin> <userLogin v-if="activeName==='user'"></userLogin>
......
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
</el-row> </el-row>
</el-form-item> </el-form-item>
<el-checkbox v-model="checked">记住账号</el-checkbox>
<el-form-item> <el-form-item>
<el-button type="primary" <el-button type="primary"
size="small" size="small"
......
...@@ -57,78 +57,80 @@ ...@@ -57,78 +57,80 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import {mapGetters} from 'vuex';
export default {
name: 'wel', export default {
data() { name: 'wel',
return { data() {
activeNames: ['1', '2', '3', '4'], return {
DATA: [], activeNames: ['1', '2', '3', '4'],
text: '', DATA: [],
actor: '', text: '',
count: 0, actor: '',
isText: false count: 0,
isText: false
}
},
computed: {
...mapGetters(['website'])
},
methods: {
getData() {
if (this.count < this.DATA.length - 1) {
this.count++
} else {
this.count = 0
}
this.isText = true
this.actor = this.DATA[this.count]
},
setData() {
let num = 0
let count = 0
let active = false
let timeoutstart = 5000
let timeoutend = 1000
let timespeed = 10
setInterval(() => {
if (this.isText) {
if (count == this.actor.length) {
active = true
} else {
active = false
} }
}, if (active) {
computed: { num--
...mapGetters(['website']) this.text = this.actor.substr(0, num)
}, if (num == 0) {
methods: { this.isText = false
getData() { setTimeout(() => {
if (this.count < this.DATA.length - 1) { count = 0
this.count++ this.getData()
} else { }, timeoutend)
this.count = 0 }
} } else {
this.isText = true num++
this.actor = this.DATA[this.count] this.text = this.actor.substr(0, num)
}, if (num == this.actor.length) {
setData() { this.isText = false
let num = 0 setTimeout(() => {
let count = 0 this.isText = true
let active = false count = this.actor.length
let timeoutstart = 5000 }, timeoutstart)
let timeoutend = 1000 }
let timespeed = 10
setInterval(() => {
if (this.isText) {
if (count == this.actor.length) {
active = true
} else {
active = false
}
if (active) {
num--
this.text = this.actor.substr(0, num)
if (num == 0) {
this.isText = false
setTimeout(() => {
count = 0
this.getData()
}, timeoutend)
}
} else {
num++
this.text = this.actor.substr(0, num)
if (num == this.actor.length) {
this.isText = false
setTimeout(() => {
this.isText = true
count = this.actor.length
}, timeoutstart)
}
}
}
}, timespeed)
} }
} }
}, timespeed)
}
} }
}
</script> </script>
<style scoped="scoped" lang="scss"> <style scoped="scoped" lang="scss">
.wel-contailer { .wel-contailer {
position: relative; position: relative;
} }
.banner-text { .banner-text {
position: relative; position: relative;
padding: 0 20px; padding: 0 20px;
...@@ -136,6 +138,7 @@ ...@@ -136,6 +138,7 @@
text-align: center; text-align: center;
color: #333; color: #333;
} }
.banner-img { .banner-img {
position: absolute; position: absolute;
top: 0; top: 0;
...@@ -145,6 +148,7 @@ ...@@ -145,6 +148,7 @@
opacity: 0.8; opacity: 0.8;
display: none; display: none;
} }
.actor { .actor {
height: 250px; height: 250px;
overflow: hidden; overflow: hidden;
......
/** /**
* 全站权限配置 * 全站权限配置
* *
*/ */
import router from './router/router' import router from './router/router'
import store from './store' import store from './store'
import { validatenull } from '@/util/validate' import {validatenull} from '@/util/validate'
import { getToken } from '@/util/auth' import {getToken} from '@/util/auth'
import NProgress from 'nprogress' // progress bar import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style import 'nprogress/nprogress.css' // progress bar style
NProgress.configure({ showSpinner: false }); NProgress.configure({showSpinner: false});
const lockPage = store.getters.website.lockPage; //锁屏页 const lockPage = store.getters.website.lockPage; //锁屏页
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
//缓冲设置 //缓冲设置
if (to.meta.keepAlive === true && store.state.tags.tagList.some(ele => { if (to.meta.keepAlive === true && store.state.tags.tagList.some(ele => {
return ele.value === to.fullPath; return ele.value === to.fullPath;
})) { })) {
to.meta.$keepAlive = true; to.meta.$keepAlive = true;
} else {
NProgress.start()
if (to.meta.keepAlive === true && validatenull(to.meta.$keepAlive)) {
to.meta.$keepAlive = true;
} else { } else {
NProgress.start() to.meta.$keepAlive = false;
if (to.meta.keepAlive === true && validatenull(to.meta.$keepAlive)) {
to.meta.$keepAlive = true;
} else {
to.meta.$keepAlive = false;
}
} }
const meta = to.meta || {}; }
if (getToken()) { const meta = to.meta || {};
if (store.getters.isLock && to.path != lockPage) { if (getToken()) {
next({ path: lockPage }) if (store.getters.isLock && to.path != lockPage) {
} else if (to.path === '/login') { next({path: lockPage})
next({ path: '/' }) } else if (to.path === '/login') {
} else { next({path: '/'})
if (store.getters.roles.length === 0) {
store.dispatch('GetUserInfo').then(() => {
next({...to, replace: true })
}).catch(() => {
store.dispatch('FedLogOut').then(() => {
next({ path: '/login' })
})
})
} else {
const value = to.query.src || to.fullPath;
const label = to.query.name || to.name;
if (meta.isTab !== false && !validatenull(value) && !validatenull(label)) {
store.commit('ADD_TAG', {
label: label,
value: value,
params: to.params,
query: to.query,
group: router.$avueRouter.group || []
});
}
next()
}
}
} else { } else {
if (meta.isAuth === false) { if (store.getters.roles.length === 0) {
next() store.dispatch('GetUserInfo').then(() => {
} else { next({...to, replace: true})
next('/login') }).catch(() => {
store.dispatch('FedLogOut').then(() => {
next({path: '/login'})
})
})
} else {
const value = to.query.src || to.fullPath;
const label = to.query.name || to.name;
if (meta.isTab !== false && !validatenull(value) && !validatenull(label)) {
store.commit('ADD_TAG', {
label: label,
value: value,
params: to.params,
query: to.query,
group: router.$avueRouter.group || []
});
} }
next()
}
}
} else {
if (meta.isAuth === false) {
next()
} else {
next('/login')
} }
}
}) })
router.afterEach(() => { router.afterEach(() => {
NProgress.done(); NProgress.done();
const title = store.getters.tag.label; const title = store.getters.tag.label;
router.$avueRouter.setTitle(title); router.$avueRouter.setTitle(title);
}); });
\ No newline at end of file
const getters = { const getters = {
tag: state => state.tags.tag, tag: state => state.tags.tag,
website: state => state.common.website, website: state => state.common.website,
userInfo: state => state.user.userInfo, userInfo: state => state.user.userInfo,
theme: state => state.common.theme, theme: state => state.common.theme,
themeName: state => state.common.themeName, themeName: state => state.common.themeName,
isShade: state => state.common.isShade, isShade: state => state.common.isShade,
isCollapse: state => state.common.isCollapse, isCollapse: state => state.common.isCollapse,
keyCollapse: (state, getters) => getters.screen > 1 ? getters.isCollapse : false, keyCollapse: (state, getters) => getters.screen > 1 ? getters.isCollapse : false,
screen: state => state.common.screen, screen: state => state.common.screen,
isLock: state => state.common.isLock, isLock: state => state.common.isLock,
isFullScren: state => state.common.isFullScren, isFullScren: state => state.common.isFullScren,
lockPasswd: state => state.common.lockPasswd, lockPasswd: state => state.common.lockPasswd,
tagList: state => state.tags.tagList, tagList: state => state.tags.tagList,
tagWel: state => state.tags.tagWel, tagWel: state => state.tags.tagWel,
access_token: state => state.user.access_token, access_token: state => state.user.access_token,
refresh_token: state => state.user.refresh_token, refresh_token: state => state.user.refresh_token,
roles: state => state.user.roles, roles: state => state.user.roles,
permissions: state => state.user.permissions, permissions: state => state.user.permissions,
menu: state => state.user.menu, menu: state => state.user.menu,
menuAll: state => state.user.menuAll, menuAll: state => state.user.menuAll,
logsList: state => state.logs.logsList, logsList: state => state.logs.logsList,
logsLen: state => state.logs.logsList.length || 0, logsLen: state => state.logs.logsList.length || 0,
logsFlag: (state, getters) => getters.logsLen === 0 logsFlag: (state, getters) => getters.logsLen === 0
} }
export default getters export default getters
\ No newline at end of file
...@@ -8,13 +8,13 @@ import getters from './getters' ...@@ -8,13 +8,13 @@ import getters from './getters'
Vue.use(Vuex) Vue.use(Vuex)
const store = new Vuex.Store({ const store = new Vuex.Store({
modules: { modules: {
user, user,
common, common,
logs, logs,
tags tags
}, },
getters, getters,
}) })
export default store export default store
\ No newline at end of file
import { import {getStore, removeStore, setStore} from '@/util/store'
setStore,
getStore,
removeStore
} from '@/util/store'
import website from '@/const/website' import website from '@/const/website'
const common = {
state: { const common = {
isCollapse: false,
isFullScren: false,
isShade: false,
screen: -1,
isLock: getStore({ name: 'isLock' }) || false,
showTag: getStore({ name: 'showTag' }),
showDebug: getStore({ name: 'showDebug' }),
showCollapse: getStore({ name: 'showCollapse' }),
showSearch: getStore({ name: 'showSearch' }),
showLock: getStore({ name: 'showLock' }),
showFullScren: getStore({ name: 'showFullScren' }),
showTheme: getStore({ name: 'showTheme' }),
showColor: getStore({ name: 'showColor' }),
showMenu: getStore({ name: 'showMenu' }),
theme: getStore({ name: 'theme' }) || '#409EFF',
themeName: getStore({ name: 'themeName' }) || '',
lockPasswd: getStore({ name: 'lockPasswd' }) || '',
website: website,
},
actions: {
state: {
isCollapse: false,
isFullScren: false,
isShade: false,
screen: -1,
isLock: getStore({name: 'isLock'}) || false,
showTag: getStore({name: 'showTag'}),
showDebug: getStore({name: 'showDebug'}),
showCollapse: getStore({name: 'showCollapse'}),
showSearch: getStore({name: 'showSearch'}),
showLock: getStore({name: 'showLock'}),
showFullScren: getStore({name: 'showFullScren'}),
showTheme: getStore({name: 'showTheme'}),
showColor: getStore({name: 'showColor'}),
showMenu: getStore({name: 'showMenu'}),
theme: getStore({name: 'theme'}) || '#409EFF',
themeName: getStore({name: 'themeName'}) || '',
lockPasswd: getStore({name: 'lockPasswd'}) || '',
website: website,
},
actions: {},
mutations: {
SET_SHADE: (state, active) => {
state.isShade = active;
},
SET_COLLAPSE: (state) => {
state.isCollapse = !state.isCollapse;
},
SET_FULLSCREN: (state) => {
state.isFullScren = !state.isFullScren;
},
SET_SHOWCOLLAPSE: (state, active) => {
state.showCollapse = active;
setStore({
name: 'showCollapse',
content: state.showCollapse
})
},
SET_SHOWTAG: (state, active) => {
state.showTag = active;
setStore({
name: 'showTag',
content: state.showTag
})
},
SET_SHOWMENU: (state, active) => {
state.showMenu = active;
setStore({
name: 'showMenu',
content: state.showMenu
})
},
SET_SHOWLOCK: (state, active) => {
state.showLock = active;
setStore({
name: 'showLock',
content: state.showLock
})
},
SET_SHOWSEARCH: (state, active) => {
state.showSearch = active;
setStore({
name: 'showSearch',
content: state.showSearch
})
},
SET_SHOWFULLSCREN: (state, active) => {
state.showFullScren = active;
setStore({
name: 'showFullScren',
content: state.showFullScren
})
},
SET_SHOWDEBUG: (state, active) => {
state.showDebug = active;
setStore({
name: 'showDebug',
content: state.showDebug
})
},
SET_SHOWTHEME: (state, active) => {
state.showTheme = active;
setStore({
name: 'showTheme',
content: state.showTheme
})
},
SET_SHOWCOLOR: (state, active) => {
state.showColor = active;
setStore({
name: 'showColor',
content: state.showColor
})
},
SET_LOCK: (state) => {
state.isLock = true;
setStore({
name: 'isLock',
content: state.isLock,
type: 'session'
})
},
SET_SCREEN: (state, screen) => {
state.screen = screen;
},
SET_THEME: (state, color) => {
state.theme = color;
setStore({
name: 'theme',
content: state.theme,
})
},
SET_THEME_NAME: (state, themeName) => {
state.themeName = themeName;
setStore({
name: 'themeName',
content: state.themeName,
})
},
SET_LOCK_PASSWD: (state, lockPasswd) => {
state.lockPasswd = lockPasswd;
setStore({
name: 'lockPasswd',
content: state.lockPasswd,
type: 'session'
})
},
CLEAR_LOCK: (state) => {
state.isLock = false;
state.lockPasswd = '';
removeStore({
name: 'lockPasswd'
});
removeStore({
name: 'isLock'
});
}, },
mutations: { }
SET_SHADE: (state, active) => {
state.isShade = active;
},
SET_COLLAPSE: (state) => {
state.isCollapse = !state.isCollapse;
},
SET_FULLSCREN: (state) => {
state.isFullScren = !state.isFullScren;
},
SET_SHOWCOLLAPSE: (state, active) => {
state.showCollapse = active;
setStore({
name: 'showCollapse',
content: state.showCollapse
})
},
SET_SHOWTAG: (state, active) => {
state.showTag = active;
setStore({
name: 'showTag',
content: state.showTag
})
},
SET_SHOWMENU: (state, active) => {
state.showMenu = active;
setStore({
name: 'showMenu',
content: state.showMenu
})
},
SET_SHOWLOCK: (state, active) => {
state.showLock = active;
setStore({
name: 'showLock',
content: state.showLock
})
},
SET_SHOWSEARCH: (state, active) => {
state.showSearch = active;
setStore({
name: 'showSearch',
content: state.showSearch
})
},
SET_SHOWFULLSCREN: (state, active) => {
state.showFullScren = active;
setStore({
name: 'showFullScren',
content: state.showFullScren
})
},
SET_SHOWDEBUG: (state, active) => {
state.showDebug = active;
setStore({
name: 'showDebug',
content: state.showDebug
})
},
SET_SHOWTHEME: (state, active) => {
state.showTheme = active;
setStore({
name: 'showTheme',
content: state.showTheme
})
},
SET_SHOWCOLOR: (state, active) => {
state.showColor = active;
setStore({
name: 'showColor',
content: state.showColor
})
},
SET_LOCK: (state) => {
state.isLock = true;
setStore({
name: 'isLock',
content: state.isLock,
type: 'session'
})
},
SET_SCREEN: (state, screen) => {
state.screen = screen;
},
SET_THEME: (state, color) => {
state.theme = color;
setStore({
name: 'theme',
content: state.theme,
})
},
SET_THEME_NAME: (state, themeName) => {
state.themeName = themeName;
setStore({
name: 'themeName',
content: state.themeName,
})
},
SET_LOCK_PASSWD: (state, lockPasswd) => {
state.lockPasswd = lockPasswd;
setStore({
name: 'lockPasswd',
content: state.lockPasswd,
type: 'session'
})
},
CLEAR_LOCK: (state) => {
state.isLock = false;
state.lockPasswd = '';
removeStore({
name: 'lockPasswd'
});
removeStore({
name: 'isLock'
});
},
}
} }
export default common export default common
\ No newline at end of file
import { setStore, getStore } from '@/util/store' import {getStore, setStore} from '@/util/store'
import { dateFormat } from '@/filters/' import {dateFormat} from '@/filters/'
import { sendLogs } from '@/api/admin/log' import {sendLogs} from '@/api/admin/log'
const logs = { const logs = {
state: { state: {
logsList: getStore({ name: 'logsList' }) || [], logsList: getStore({name: 'logsList'}) || [],
},
actions: {
//发送错误日志
SendLogs({state, commit}) {
return new Promise((resolve, reject) => {
sendLogs(state.logsList).then(() => {
commit('CLEAR_LOGS');
resolve();
}).catch(error => {
reject(error)
})
})
}, },
actions: { },
//发送错误日志 mutations: {
SendLogs({ state, commit }) { ADD_LOGS: (state, {type, message, stack, info}) => {
return new Promise((resolve, reject) => { state.logsList.push(Object.assign({
sendLogs(state.logsList).then(() => { url: window.location.href,
commit('CLEAR_LOGS'); time: dateFormat(new Date())
resolve(); }, {
}).catch(error => { type,
reject(error) message,
}) stack,
}) info: info.toString()
}, }))
setStore({name: 'logsList', content: state.logsList})
}, },
mutations: { CLEAR_LOGS: (state) => {
ADD_LOGS: (state, { type, message, stack, info }) => { state.logsList = [];
state.logsList.push(Object.assign({ setStore({name: 'logsList', content: state.logsList})
url: window.location.href,
time: dateFormat(new Date())
}, {
type,
message,
stack,
info: info.toString()
}))
setStore({ name: 'logsList', content: state.logsList })
},
CLEAR_LOGS: (state) => {
state.logsList = [];
setStore({ name: 'logsList', content: state.logsList })
}
} }
}
}; };
......
import { setStore, getStore } from '@/util/store' import {getStore, setStore} from '@/util/store'
import { diff } from '@/util/util' import {diff} from '@/util/util'
import website from '@/const/website' import website from '@/const/website'
const isFirstPage = website.isFirstPage; const isFirstPage = website.isFirstPage;
const tagWel = website.fistPage; const tagWel = website.fistPage;
const tagObj = { const tagObj = {
label: '', //标题名称 label: '', //标题名称
value: '', //标题的路径 value: '', //标题的路径
params: '', //标题的路径参数 params: '', //标题的路径参数
query: '', //标题的参数 query: '', //标题的参数
group: [], //分组 group: [], //分组
} }
//处理首个标签
//处理首个标签
function setFistTag(list) { function setFistTag(list) {
if (list.length == 1) { if (list.length == 1) {
list[0].close = false; list[0].close = false;
} else { } else {
list.forEach(ele => { list.forEach(ele => {
if (ele.value === tagWel.value && isFirstPage === false) { if (ele.value === tagWel.value && isFirstPage === false) {
ele.close = false ele.close = false
} else { } else {
ele.close = true ele.close = true
} }
}) })
} }
} }
const navs = { const navs = {
state: { state: {
tagList: getStore({ name: 'tagList' }) || [], tagList: getStore({name: 'tagList'}) || [],
tag: getStore({ name: 'tag' }) || tagObj, tag: getStore({name: 'tag'}) || tagObj,
tagWel: tagWel tagWel: tagWel
},
actions: {},
mutations: {
ADD_TAG: (state, action) => {
state.tag = action;
setStore({name: 'tag', content: state.tag, type: 'session'})
if (state.tagList.some(ele => diff(ele, action))) return
state.tagList.push(action)
setFistTag(state.tagList);
setStore({name: 'tagList', content: state.tagList, type: 'session'})
}, },
actions: { DEL_TAG: (state, action) => {
state.tagList = state.tagList.filter(item => {
return !diff(item, action);
})
setFistTag(state.tagList);
setStore({name: 'tagList', content: state.tagList, type: 'session'})
},
DEL_ALL_TAG: (state) => {
state.tagList = [state.tagWel];
setStore({name: 'tagList', content: state.tagList, type: 'session'})
},
DEL_TAG_OTHER: (state) => {
state.tagList = state.tagList.filter(item => item.value === state.tag.value)
setFistTag(state.tagList);
setStore({name: 'tagList', content: state.tagList, type: 'session'})
}, },
mutations: { }
ADD_TAG: (state, action) => {
state.tag = action;
setStore({ name: 'tag', content: state.tag, type: 'session' })
if (state.tagList.some(ele => diff(ele, action))) return
state.tagList.push(action)
setFistTag(state.tagList);
setStore({ name: 'tagList', content: state.tagList, type: 'session' })
},
DEL_TAG: (state, action) => {
state.tagList = state.tagList.filter(item => {
return !diff(item, action);
})
setFistTag(state.tagList);
setStore({ name: 'tagList', content: state.tagList, type: 'session' })
},
DEL_ALL_TAG: (state) => {
state.tagList = [state.tagWel];
setStore({ name: 'tagList', content: state.tagList, type: 'session' })
},
DEL_TAG_OTHER: (state) => {
state.tagList = state.tagList.filter(item => item.value === state.tag.value)
setFistTag(state.tagList);
setStore({ name: 'tagList', content: state.tagList, type: 'session' })
},
}
} }
export default navs export default navs
\ No newline at end of file
This diff is collapsed.
export default { export default {
getScreen: function() { getScreen: function () {
var width = document.body.clientWidth; var width = document.body.clientWidth;
if (width >= 1200) { if (width >= 1200) {
return 3; //大屏幕 return 3; //大屏幕
} else if (width >= 992) { } else if (width >= 992) {
return 2; //中屏幕 return 2; //中屏幕
} else if (width >= 768) { } else if (width >= 768) {
return 1; //小屏幕 return 1; //小屏幕
} else { } else {
return 0; //超小屏幕 return 0; //超小屏幕
}
} }
} }
\ No newline at end of file }
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
const TokenKey = 'x-access-token' const TokenKey = 'x-access-token'
export function getToken() { export function getToken() {
return Cookies.get(TokenKey) return Cookies.get(TokenKey)
} }
export function setToken(token) { export function setToken(token) {
return Cookies.set(TokenKey, token) return Cookies.set(TokenKey, token)
} }
export function removeToken() { export function removeToken() {
return Cookies.remove(TokenKey) return Cookies.remove(TokenKey)
} }
\ No newline at end of file
export const calcDate = (date1, date2) => { export const calcDate = (date1, date2) => {
var date3 = date2 - date1; var date3 = date2 - date1;
var days = Math.floor(date3 / (24 * 3600 * 1000)) var days = Math.floor(date3 / (24 * 3600 * 1000))
var leave1 = date3 % (24 * 3600 * 1000) //计算天数后剩余的毫秒数 var leave1 = date3 % (24 * 3600 * 1000) //计算天数后剩余的毫秒数
var hours = Math.floor(leave1 / (3600 * 1000)) var hours = Math.floor(leave1 / (3600 * 1000))
var leave2 = leave1 % (3600 * 1000) //计算小时数后剩余的毫秒数 var leave2 = leave1 % (3600 * 1000) //计算小时数后剩余的毫秒数
var minutes = Math.floor(leave2 / (60 * 1000)) var minutes = Math.floor(leave2 / (60 * 1000))
var leave3 = leave2 % (60 * 1000) //计算分钟数后剩余的毫秒数 var leave3 = leave2 % (60 * 1000) //计算分钟数后剩余的毫秒数
var seconds = Math.round(date3 / 1000) var seconds = Math.round(date3 / 1000)
return { return {
leave1, leave1,
leave2, leave2,
leave3, leave3,
days: days, days: days,
hours: hours, hours: hours,
minutes: minutes, minutes: minutes,
seconds: seconds, seconds: seconds,
} }
} }
\ No newline at end of file
import { import {validatenull} from '@/util/validate';
validatenull
} from '@/util/validate';
/** /**
* 存储localStorage * 存储localStorage
*/ */
export const setStore = (params) => { export const setStore = (params) => {
let { let {
name, name,
content, content,
type, type,
} = params; } = params;
let obj = { let obj = {
dataType: typeof(content), dataType: typeof (content),
content: content, content: content,
type: type, type: type,
datetime: new Date().getTime() datetime: new Date().getTime()
} }
if (type) window.sessionStorage.setItem(name, JSON.stringify(obj)); if (type) window.sessionStorage.setItem(name, JSON.stringify(obj));
else window.localStorage.setItem(name, JSON.stringify(obj)); else window.localStorage.setItem(name, JSON.stringify(obj));
} }
/** /**
* 获取localStorage * 获取localStorage
*/ */
export const getStore = (params) => { export const getStore = (params) => {
let { let {
name, name,
debug debug
} = params; } = params;
let obj = {}, let obj = {},
content; content;
obj = window.sessionStorage.getItem(name); obj = window.sessionStorage.getItem(name);
if (validatenull(obj)) obj = window.localStorage.getItem(name); if (validatenull(obj)) obj = window.localStorage.getItem(name);
if (validatenull(obj)) return; if (validatenull(obj)) return;
obj = JSON.parse(obj); obj = JSON.parse(obj);
if (debug) { if (debug) {
return obj; return obj;
} }
if (obj.dataType == 'string') { if (obj.dataType == 'string') {
content = obj.content; content = obj.content;
} else if (obj.dataType == 'number') { } else if (obj.dataType == 'number') {
content = Number(obj.content); content = Number(obj.content);
} else if (obj.dataType == 'boolean') { } else if (obj.dataType == 'boolean') {
content = eval(obj.content); content = eval(obj.content);
} else if (obj.dataType == 'object') { } else if (obj.dataType == 'object') {
content = obj.content; content = obj.content;
} }
return content; return content;
} }
/** /**
* 删除localStorage * 删除localStorage
*/ */
export const removeStore = params => { export const removeStore = params => {
let { let {
name name
} = params; } = params;
window.localStorage.removeItem(name); window.localStorage.removeItem(name);
window.sessionStorage.removeItem(name); window.sessionStorage.removeItem(name);
} }
/** /**
* 获取全部localStorage * 获取全部localStorage
*/ */
export const getAllStore = (params) => { export const getAllStore = (params) => {
let list = []; let list = [];
let { let {
type type
} = params; } = params;
for (let i = 1; i <= window.sessionStorage.length; i++) { for (let i = 1; i <= window.sessionStorage.length; i++) {
if (type) { if (type) {
list.push({ list.push({
name: window.sessionStorage.key(i), name: window.sessionStorage.key(i),
content: getStore({ content: getStore({
name: window.sessionStorage.key(i), name: window.sessionStorage.key(i),
type: 'session' type: 'session'
}) })
}) })
} else { } else {
list.push(getStore({ list.push(getStore({
name: window.localStorage.key(i), name: window.localStorage.key(i),
content: getStore({ content: getStore({
name: window.localStorage.key(i), name: window.localStorage.key(i),
}) })
})) }))
}
} }
}
return list; return list;
} }
...@@ -94,12 +93,12 @@ export const getAllStore = (params) => { ...@@ -94,12 +93,12 @@ export const getAllStore = (params) => {
* 清空全部localStorage * 清空全部localStorage
*/ */
export const clearStore = (params) => { export const clearStore = (params) => {
let { let {
type type
} = params; } = params;
if (type) { if (type) {
window.sessionStorage.clear(); window.sessionStorage.clear();
return return
} }
window.localStorage.clear() window.localStorage.clear()
} }
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment