Commit d59c1941 by liimin

优化体积

1 parent 682abdae
......@@ -14507,11 +14507,6 @@
}
}
},
"vue-role-manager": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/vue-role-manager/-/vue-role-manager-1.2.0.tgz",
"integrity": "sha512-MiAbofslwEbwP0TwPnedfiG+yG06qL6CGbLQVZb2i1BHkX2YiiLZFZlxhpqv/cn8ubILHRF2chT3n14jVL5SfQ=="
},
"vue-router": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.1.2.tgz",
......
......@@ -14,7 +14,6 @@
"dependencies": {
"axios": "^0.18.0",
"better-scroll": "^1.15.2",
"core-js": "^2.6.5",
"dayjs": "^1.8.12",
"echarts": "^4.2.1",
"element-ui": "^2.11.1",
......@@ -31,7 +30,6 @@
"ua-parser-js": "^0.7.19",
"vue": "^2.6.10",
"vue-i18n": "^8.14.0",
"vue-role-manager": "^1.2.0",
"vue-router": "^3.0.3",
"vuex": "^3.0.1"
},
......
......@@ -25,7 +25,7 @@ export default {
watch: {
$route: {
handler (to) {
this.path = get(last(to.matched), 'components.default.__source')
this.path = _.get(_.last(to.matched), 'components.default.__source')
},
immediate: true
}
......
......@@ -5,7 +5,7 @@ import { throttle } from 'lodash'
// 生成滚动事件的 handler
function handleMaker (wait) {
return throttle(e => {
return _.throttle(e => {
this.$emit('scroll', {
x: e.target.scrollLeft,
y: e.target.scrollTop
......
......@@ -28,7 +28,6 @@ export default {
</script>
<style lang="scss">
.header-datetime{
font-weight: bold;
transform: translateX(-30px);
}
</style>
......@@ -122,7 +122,7 @@ export default {
// 默认判断父元素和子元素的大小,以确定初始情况是否显示滚动
window.addEventListener('load', this.checkScroll)
// 全局窗口变化监听,判断父元素和子元素的大小,从而控制isScroll的开关
this.throttledCheckScroll = throttle(this.checkScroll, 300)
this.throttledCheckScroll = _.throttle(this.checkScroll, 300)
window.addEventListener('resize', this.throttledCheckScroll)
},
beforeDestroy () {
......
......@@ -13,7 +13,7 @@ cookies.set = function (name = 'default', value = '', cookieSetting = {}) {
expires: 1
}
Object.assign(currentCookieSetting, cookieSetting)
Cookies.set(`d2admin-${process.env.VUE_APP_VERSION}-${name}`, value, currentCookieSetting)
Cookies.set(`tfims-${process.env.VUE_APP_VERSION}-${name}`, value, currentCookieSetting)
}
/**
......@@ -21,7 +21,7 @@ cookies.set = function (name = 'default', value = '', cookieSetting = {}) {
* @param {String} name cookie name
*/
cookies.get = function (name = 'default') {
return Cookies.get(`d2admin-${process.env.VUE_APP_VERSION}-${name}`)
return Cookies.get(`tfims-${process.env.VUE_APP_VERSION}-${name}`)
}
/**
......@@ -36,7 +36,7 @@ cookies.getAll = function () {
* @param {String} name cookie name
*/
cookies.remove = function (name = 'default') {
return Cookies.remove(`d2admin-${process.env.VUE_APP_VERSION}-${name}`)
return Cookies.remove(`tfims-${process.env.VUE_APP_VERSION}-${name}`)
}
export default cookies
......@@ -81,7 +81,7 @@ export function dbGet ({
user = false
}) {
return new Promise(resolve => {
resolve(cloneDeep(db.get(pathInit({
resolve(_.cloneDeep(db.get(pathInit({
dbName,
path,
user,
......
......@@ -2,7 +2,7 @@
* @Author: limin
* @Date: 2019-08-27 19:16:26
* @Last Modified by: limin
* @Last Modified time: 2019-09-09 17:45:36
* @Last Modified time: 2019-09-10 09:20:37
*/
import { cloneDeep } from 'lodash'
const permision = {}
......@@ -169,7 +169,7 @@ permision.flatten = function (arr) {
return arr.reduce((result, item) => {
item.authId = item.authId || item.meta.authId
item.parentId = item.parentId || item.meta.parentId
const cloneItem = cloneDeep(item)
const cloneItem = _.cloneDeep(item)
delete cloneItem.auth
return result.concat(item.auth ? permision.flatten([...item.auth, cloneItem]) : item)
}, [])
......
......@@ -40,28 +40,28 @@ export const home = {
}
export const sys = [
// 系统 前端日志
{
path: '/log',
name: 'log',
meta: {
title: '前端日志',
},
component: _import('system/log')
},
// 刷新页面 必须保留
{
path: '/refresh',
name: 'refresh',
hidden: true,
component: _import('system/function/refresh')
},
// 页面重定向 必须保留
{
path: 'redirect/:route*',
name: 'redirect',
hidden: true,
component: _import('system/function/redirect')
}
// {
// path: '/log',
// name: 'log',
// meta: {
// title: '前端日志',
// },
// component: _import('system/log')
// },
// // 刷新页面 必须保留
// {
// path: '/refresh',
// name: 'refresh',
// hidden: true,
// component: _import('system/function/refresh')
// },
// // 页面重定向 必须保留
// {
// path: 'redirect/:route*',
// name: 'redirect',
// hidden: true,
// component: _import('system/function/redirect')
// }
]
/**
......
......@@ -27,7 +27,7 @@ export default {
const authes = (+data.roleType === +SUPPER_ADMIN)
? util.permision.flatten(Object.values(localRoutes))
.map(obj => ({ authId: obj.authId, parentId: obj.parentId }))
: cloneDeep(data.authes)
: _.cloneDeep(data.authes)
await dispatch('d2admin/auth/set', authes, { root: true })
// // 设置 vuex 用户信息
await dispatch('d2admin/user/set', data, { root: true })
......
......@@ -115,7 +115,7 @@ export default {
path: `$page.${router.app.$route[basis]}.$data`,
user,
validator: () => false,
defaultValue: cloneDeep(instance.$data)
defaultValue: _.cloneDeep(instance.$data)
})
},
/**
......@@ -133,7 +133,7 @@ export default {
return dbGet({
path: `$page.${router.app.$route[basis]}.$data`,
user,
defaultValue: cloneDeep(instance.$data)
defaultValue: _.cloneDeep(instance.$data)
})
},
/**
......
......@@ -50,7 +50,7 @@ export default {
// 当前的 token
token: util.cookies.get('token'),
// 当前地址
url: get(window, 'location.href', ''),
url: _.get(window, 'location.href', ''),
// 用户设置
...meta
}
......
......@@ -10,7 +10,7 @@ import setting from '@/setting.js'
function supplementMenuPath (menu) {
return menu.map(e => ({
...e,
path: e.path || uniqueId('d2-menu-empty-'),
path: e.path || _.uniqueId('d2-menu-empty-'),
...e.children ? {
children: supplementMenuPath(e.children)
} : {}
......
......@@ -4,7 +4,7 @@ import router from '@/router'
import home from '@/router/routes'
// 判定是否需要缓存
const isKeepAlive = data => get(data, 'meta.cache', false)
const isKeepAlive = data => _.get(data, 'meta.cache', false)
export default {
namespaced: true,
......
<template>
<div class="d2-badge">
<p align="center">
<a><img src="https://img.shields.io/github/release/d2-projects/d2-admin.svg"/></a>
<a><img src="https://img.shields.io/github/forks/d2-projects/d2-admin.svg"/></a>
<a><img src="https://img.shields.io/github/stars/d2-projects/d2-admin.svg"/></a>
<a><img src="https://img.shields.io/github/issues/d2-projects/d2-admin.svg"/></a>
<a><img src="https://img.shields.io/github/issues-closed/d2-projects/d2-admin.svg"/></a>
<a><img src="https://img.shields.io/github/issues-pr/d2-projects/d2-admin.svg"/></a>
<a><img src="https://img.shields.io/github/issues-pr-closed/d2-projects/d2-admin.svg"/></a>
</p>
<p align="center">
<a><img src="https://img.shields.io/npm/v/@d2-admin/ice-scaffold.svg"/></a>
<a href="https://www.travis-ci.org/d2-projects/d2-admin"><img src="https://www.travis-ci.org/d2-projects/d2-admin.svg?branch=master"/></a>
<a><img src="https://img.shields.io/github/last-commit/d2-projects/d2-admin.svg"/></a>
<a><img src="https://img.shields.io/badge/code_style-standard-brightgreen.svg"/></a>
<a><img src="https://api.netlify.com/api/v1/badges/a5dd4bbd-da3f-4145-98a9-8012577bdcf5/deploy-status"/></a>
</p>
</div>
</template>
<style lang="scss" scoped>
.d2-badge {
margin-bottom: 20px;
p {
margin: 0px;
margin-bottom: 2px;
&:last-child {
margin-bottom: 0px;
}
a {
display: inline-block;
margin: 0px 2px;
}
}
}
</style>
<template>
<div>
<img
src="./image/d2-help-button@2x.png"
style="width: 138px;"
@click="dialogVisible = true">
<el-dialog
title="帮助"
width="600px"
:visible.sync="dialogVisible"
:append-to-body="true">
<div style="margin-top: -25px; margin-bottom: -25px;">
<el-button-group class="d2-mb">
<el-button @click="$open('https://github.com/d2-projects/d2-admin')">
<d2-icon name="github" class="d2-mr-5"/>
主页
</el-button>
<el-button @click="$open('https://doc.d2admin.fairyever.com/zh/')">
<d2-icon name="book" class="d2-mr-5"/>
中文文档
</el-button>
<el-button @click="$open('https://github.com/d2-projects/d2-admin/issues')">
<d2-icon name="question" class="d2-mr-5"/>
issues
</el-button>
<el-button @click="$open('https://github.com/d2-projects/d2-admin/issues/new/choose')">
<d2-icon name="plus" class="d2-mr-5"/>
New issue
</el-button>
</el-button-group>
<el-row :gutter="20">
<el-col :span="12">
<el-alert :closable="false" type="info" title="QQ群 [ 1500+ / 2000 人 ]" class="d2-mb"/>
<img src="./image/qq.jpg" style="width: 100%;">
</el-col>
<el-col :span="12">
<el-alert :closable="false" type="info" title="与作者成为好友后邀请进微信群" class="d2-mb"/>
<img src="./image/we.jpg" style="width: 100%;">
</el-col>
</el-row>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
data () {
return {
dialogVisible: false
}
}
}
</script>
<template>
<div class="d2-page-cover">
<div class="d2-page-cover__logo">
<slot/>
</div>
<p class="d2-page-cover__title">D2 Admin {{$version}}</p>
<p class="d2-page-cover__sub-title">优雅的中后台集成方案</p>
<p class="d2-page-cover__build-time">FINAL BUILD TIME {{$buildTime}}</p>
<slot name="footer"/>
<a target="blank" href="https://github.com/d2-projects/d2-admin">
<img
style="position: absolute; top: 0; right: 0; border: 0; width: 150px;"
src="./image/darkblue@2x.png"
alt="Fork me on GitHub">
</a>
</div>
</template>
<style lang="scss" scoped>
.d2-page-cover {
@extend %full;
@extend %unable-select;
display: flex;
flex-flow: column nowrap;
justify-content: center;
align-items: center;
.d2-page-cover__logo {
img {
width: 200px;
}
}
.d2-page-cover__title {
margin: 0px;
margin-bottom: 20px;
font-weight: bold;
color: $color-text-main;
}
.d2-page-cover__sub-title {
margin: 0px;
margin-bottom: 5px;
color: $color-text-normal;
}
.d2-page-cover__build-time {
margin: 0px;
margin-bottom: 10px;
font-size: 12px;
color: $color-text-placehoder;
}
}
</style>
import page from './page'
export default page
<template>
<d2-container class="page">
<d2-page-cover>
<d2-icon-svg class="logo" name="d2-admin"/>
<template slot="footer">
<div class="btn-group">
<span class="btn-group__btn" @click="$open('https://github.com/d2-projects')">开源组织</span> |
<span class="btn-group__btn" @click="$open('https://doc.d2admin.fairyever.com/zh/')">文档</span> |
<span class="btn-group__btn" @click="$open('https://github.com/d2-projects/d2-admin-start-kit')">简化版</span> |
<span class="btn-group__btn" @click="$open('https://alibaba.github.io/ice/scaffold?type=vue')">飞冰</span> |
<span class="btn-group__btn" @click="$open('https://juejin.im/user/57a48b632e958a006691b946/posts')">掘金</span> |
<span class="btn-group__btn" @click="$open('https://daily.fairyever.com')">日报</span> |
<el-popover :width="172" trigger="hover">
<p class="d2-mt-0 d2-mb-10">D2Projects</p>
<img src="./image/qr@2x.png" style="width: 172px;">
<span slot="reference" class="btn-group__btn btn-group__btn--link">
<d2-icon name="weixin"/>
微信公众号
</span>
<p style="font-size: 12px; margin-top: 0px; margin-bottom: 0px;">
官方公众号,主要推送前端技术类文章、框架资源、学习教程,以及 D2 系列项目更新信息
</p>
</el-popover>
</div>
<d2-badge/>
<d2-help-btn/>
</template>
</d2-page-cover>
</d2-container>
</template>
<script>
import D2HelpBtn from './components/d2-help-btn'
import D2Badge from './components/d2-badge'
import D2PageCover from './components/d2-page-cover'
export default {
components: {
D2HelpBtn,
D2Badge,
D2PageCover
},
data () {
return {
filename: __filename
}
}
}
</script>
<style lang="scss" scoped>
.page {
.logo {
width: 120px;
}
.btn-group {
color: $color-text-placehoder;
font-size: 12px;
margin-top: 0px;
margin-bottom: 20px;
.btn-group__btn {
color: $color-text-sub;
&:hover {
color: $color-text-main;
}
&.btn-group__btn--link {
color: $color-primary;
}
}
}
}
</style>
......@@ -84,7 +84,7 @@ export default {
])
},
methods: {
get,
get:_.get,
handleShowMore (log) {
// 打印一条日志的所有信息到控制台
this.$notify({
......
......@@ -267,8 +267,8 @@ export default {
async loadBaseData () {
// this.baseData.station = await this.$store.dispatch('d2admin/base/get', BaseData.STATION.KEY)
const { station, subsys } = await this.load()
this.baseData.station = cloneDeep(station)
this.baseData.subsys = cloneDeep(subsys)
this.baseData.station = _.cloneDeep(station)
this.baseData.subsys = _.cloneDeep(subsys)
this.baseData.subsys.unshift({ confCode: '', confValue: '全部' })
// console.log(this.baseData)
},
......
......@@ -25,8 +25,10 @@ const cdn = {
`${CDN_DOMAIN}/axios/0.19.0/axios.min.js`,
`${CDN_DOMAIN}/js-cookie/2.2.0/js.cookie.min.js`,
`${CDN_DOMAIN}/nprogress/0.2.0/nprogress.min.js`,
`${CDN_DOMAIN}/echarts/4.3.0-rc.1/echarts.min.js`
// `${CDN_DOMAIN}/lodash.js/4.17.15/lodash.min.js`
`${CDN_DOMAIN}/echarts/4.3.0-rc.1/echarts.min.js`,
`${CDN_DOMAIN}/lodash.js/4.17.15/lodash.min.js`,
// `${CDN_DOMAIN}/vue-i18n/8.14.0/vue-i18n.esm.js`,
`${CDN_DOMAIN}/UAParser.js/0.7.20/ua-parser.min.js`
]
}
module.exports = {
......@@ -52,8 +54,10 @@ module.exports = {
'axios': 'axios',
'js-cookie': 'Cookies',
'nprogress': 'NProgress',
'echarts': 'echarts'
// 'lodash':'lodash'
'echarts': 'echarts',
'lodash':'_',
// 'vue-i18n':'vue-i18n',
'ua-parser':'UaParser'
}
// 非开发环境
if (process.env.NODE_ENV !== 'development') {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!