Commit cfd68fc2 by liimin

登录框修改 部分依赖通过cdn引入 不打包

1 parent 1ccf618b
...@@ -7,7 +7,7 @@ VUE_APP_TITLE=tFIMS ...@@ -7,7 +7,7 @@ VUE_APP_TITLE=tFIMS
VUE_APP_API=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS VUE_APP_API=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
# 仓库地址 # 仓库地址
VUE_APP_REPO= VUE_APP_REPO=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
# 国际化配置 # 国际化配置
VUE_APP_I18N_LOCALE=zh-chs VUE_APP_I18N_LOCALE=zh-chs
......
...@@ -12,9 +12,6 @@ ...@@ -12,9 +12,6 @@
"test:unit": "vue-cli-service test:unit" "test:unit": "vue-cli-service test:unit"
}, },
"dependencies": { "dependencies": {
"@d2-projects/d2-crud": "^2.1.1",
"@d2-projects/vue-table-export": "^1.0.1",
"@d2-projects/vue-table-import": "^1.0.0",
"axios": "^0.18.0", "axios": "^0.18.0",
"better-scroll": "^1.15.2", "better-scroll": "^1.15.2",
"core-js": "^2.6.5", "core-js": "^2.6.5",
...@@ -28,7 +25,6 @@ ...@@ -28,7 +25,6 @@
"js-md5": "^0.7.3", "js-md5": "^0.7.3",
"lodash": "^4.17.11", "lodash": "^4.17.11",
"lowdb": "^1.0.0", "lowdb": "^1.0.0",
"mockjs": "^1.0.1-beta3",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"qs": "^6.7.0", "qs": "^6.7.0",
"screenfull": "^4.2.0", "screenfull": "^4.2.0",
......
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head>
<meta charset="utf-8"> <head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="icon" href="<%= BASE_URL %>icon.ico"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<title><%= VUE_APP_TITLE %></title> <link rel="icon" href="<%= BASE_URL %>icon.ico">
<style> <!-- 使用CDN的CSS文件 -->
html, body, #app { height: 100%; margin: 0px; padding: 0px; width: 100%; } <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>
.d2-home { background-color:#000; height: 100%; display: flex; flex-direction: column; } <link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style" />
.d2-home__main { user-select: none; width: 100%; flex-grow: 1; display: flex; justify-content: center; align-items: center; flex-direction: column; } <link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet" />
.d2-home__footer { width: 100%; flex-grow: 0; text-align: center; padding: 1em 0; } <% } %>
.d2-home__footer > a { font-size: 12px; color: #fff; text-decoration: none; } <!-- 使用CDN的JS文件 预加载 -->
.d2-home__loading { height: 32px; width: 32px; margin-bottom: 20px; } <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
.d2-home__title { color: #FFF; font-size: 20px; margin-bottom: 10px; } <link href="<%= htmlWebpackPlugin.options.cdn.js[i] %>" rel="preload" as="script" />
.d2-home__sub-title { color: #fff; font-size: 14px; } <% } %>
</style> <title><%= VUE_APP_TITLE %></title>
<!-- <script> <style>
html,
body,
#app {
height: 100%;
margin: 0px;
padding: 0px;
width: 100%;
}
.d2-home {
background-color: #000;
height: 100%;
display: flex;
flex-direction: column;
}
.d2-home__main {
user-select: none;
width: 100%;
flex-grow: 1;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.d2-home__footer {
width: 100%;
flex-grow: 0;
text-align: center;
padding: 1em 0;
}
.d2-home__footer>a {
font-size: 12px;
color: #fff;
text-decoration: none;
}
.d2-home__loading {
height: 32px;
width: 32px;
margin-bottom: 20px;
}
.d2-home__title {
color: #FFF;
font-size: 20px;
margin-bottom: 10px;
}
.d2-home__sub-title {
color: #fff;
font-size: 14px;
}
</style>
<!-- <script>
var _hmt = _hmt || []; var _hmt = _hmt || [];
var hmid = "1dfa88d0c8571eef2d383070cb3e5ca1"; var hmid = "1dfa88d0c8571eef2d383070cb3e5ca1";
(function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?" + hmid; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s);})(); (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?" + hmid; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s);})();
</script> --> </script> -->
</head> </head>
<body>
<noscript> <body>
<strong> <noscript>
很抱歉,如果没有 JavaScript 支持,D2Admin 将不能正常工作。请启用浏览器的 JavaScript 然后继续。 <strong>
</strong> 很抱歉,如果没有 JavaScript 支持,D2Admin 将不能正常工作。请启用浏览器的 JavaScript 然后继续。
</noscript> </strong>
<div id="app"> </noscript>
<div class="d2-home"> <div id="app">
<div class="d2-home__main"> <div class="d2-home">
<img <div class="d2-home__main">
class="d2-home__loading" <img class="d2-home__loading" src="./image/loading/loading-spin.svg" alt="loading">
src="./image/loading/loading-spin.svg" <div class="d2-home__title">
alt="loading"> 正在加载资源
<div class="d2-home__title">
正在加载资源
</div>
<div class="d2-home__sub-title">
初次加载资源可能需要较多时间 请耐心等待
</div>
</div> </div>
<div class="d2-home__footer"> <div class="d2-home__sub-title">
<a 初次加载资源可能需要较多时间 请耐心等待
href="https://github.com/d2-projects/d2-admin"
target="_blank">
https://github.com/d2-projects/d2-admin
</a>
</div> </div>
</div> </div>
<div class="d2-home__footer">
<a href="https://github.com/d2-projects/d2-admin" target="_blank">
https://github.com/d2-projects/d2-admin
</a>
</div>
</div> </div>
</body> </div>
</html> <!-- built files will be auto injected -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
<% } %>
</body>
</html>
\ No newline at end of file \ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: limin * @Author: limin
* @Date: 2019-08-26 18:02:41 * @Date: 2019-08-26 18:02:41
* @Last Modified by: limin * @Last Modified by: limin
* @Last Modified time: 2019-08-28 15:04:32 * @Last Modified time: 2019-08-29 03:55:24
*/ */
import axios from '@/plugin/axios' import axios from '@/plugin/axios'
...@@ -13,8 +13,9 @@ const request = (params, method) => { ...@@ -13,8 +13,9 @@ const request = (params, method) => {
params.timestamp = new Date().getTime() params.timestamp = new Date().getTime()
params.v = '1.0.0' params.v = '1.0.0'
params.format = 'json' params.format = 'json'
const url = process.env.NODE_ENV === 'production' ? 'router' : params.method // const url = process.env.NODE_ENV === 'production' ? 'router' : params.method
// return axios.post(url, { 'params': sign(params) }) // return axios.post(url, { 'params': sign(params) })
const url = params.method
return axios({ return axios({
url, url,
method: method || 'get', method: method || 'get',
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
html, body { html, body {
margin: 0px; margin: 0px;
height: 100%; height: 100%;
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif; font-family: "微软雅黑","Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
#app { #app {
@extend %full; @extend %full;
a { a {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</template> </template>
<script> <script>
import {mapGetters} from 'vuex' import { mapGetters } from 'vuex'
export default { export default {
name: 'AuthButton', name: 'AuthButton',
props: { props: {
...@@ -43,20 +43,18 @@ export default { ...@@ -43,20 +43,18 @@ export default {
}, },
data () { data () {
return { return {
isInRole:false isInRole: false
} }
}, },
created () { created () {
// this.$vrm.setRoles(this.btnIdAll) // this.$vrm.setRoles(this.btnIdAll)
const {action,operation} = this.curBtns const { action, operation } = this.curBtns
this.isInRole = [...action,...operation].find(obj=>obj.id===this.id||obj.label===this.label) this.isInRole = [...action, ...operation].find(obj => obj.id === this.id || obj.label === this.label)
}, },
methods: { methods: {
handleClick: function () { handleClick: function () {
this.$emit('e-auth-click', {}) this.$emit('e-auth-click', {})
} }
},
mounted () {
} }
} }
</script> </script>
......
...@@ -122,11 +122,6 @@ export default { ...@@ -122,11 +122,6 @@ export default {
// } // }
// } // }
}, },
watch: {
},
mounted () {
},
methods: { methods: {
// getPersonalType() { // getPersonalType() {
// const params = {} // const params = {}
......
...@@ -122,8 +122,6 @@ export default { ...@@ -122,8 +122,6 @@ export default {
// } // }
// } // }
}, },
mounted () {
},
methods: { methods: {
// getPersonalType() { // getPersonalType() {
// const params = {} // const params = {}
......
...@@ -120,8 +120,6 @@ export default { ...@@ -120,8 +120,6 @@ export default {
openUserMsgDialog: function () { openUserMsgDialog: function () {
console.log('aaaa') console.log('aaaa')
} }
},
mounted () {
} }
} }
</script> </script>
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<!-- 如果你只想在开发环境显示这个按钮请添加 v-if="$env === 'development'" --> <!-- 如果你只想在开发环境显示这个按钮请添加 v-if="$env === 'development'" -->
<d2-header-search @click="handleSearchClick"/> <d2-header-search @click="handleSearchClick"/>
<d2-header-log /> <d2-header-log />
<!-- <d2-header-size /> --> <d2-header-size />
<d2-header-fullscreen/> <d2-header-fullscreen/>
<d2-header-locales /> <d2-header-locales />
<d2-header-theme/> <d2-header-theme/>
......
...@@ -82,28 +82,28 @@ util.deepFind = function (menus, id) { ...@@ -82,28 +82,28 @@ util.deepFind = function (menus, id) {
* @param {*} alpha 透明度 * @param {*} alpha 透明度
*/ */
util.colorToRgb = (sColor, alpha) => { util.colorToRgb = (sColor, alpha) => {
var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/ var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
sColor = sColor.toLowerCase() sColor = sColor.toLowerCase()
if (sColor && reg.test(sColor)) { if (sColor && reg.test(sColor)) {
if (sColor.length === 4) { if (sColor.length === 4) {
var sColorNew = '#' var sColorNew = '#'
for (var i = 1; i < 4; i += 1) { for (var i = 1; i < 4; i += 1) {
sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1)) sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1))
} }
sColor = sColorNew sColor = sColorNew
} }
// 处理六位的颜色值 // 处理六位的颜色值
var sColorChange = [] var sColorChange = []
for (let i = 1; i < 7; i += 2) { for (let i = 1; i < 7; i += 2) {
sColorChange.push(parseInt('0x' + sColor.slice(i, i + 2))) sColorChange.push(parseInt('0x' + sColor.slice(i, i + 2)))
} }
if (alpha || alpha === 0 || alpha === '0') { if (alpha || alpha === 0 || alpha === '0') {
return `rgba(${sColorChange.join(',')} ,${alpha})` return `rgba(${sColorChange.join(',')} ,${alpha})`
} }
return `rgb(${sColorChange.join(',')})` return `rgb(${sColorChange.join(',')})`
} else { } else {
return sColor return sColor
} }
} }
export default util export default util
...@@ -14,23 +14,23 @@ permision.packRoutesBtns = function (resources, idsInPermision) { ...@@ -14,23 +14,23 @@ permision.packRoutesBtns = function (resources, idsInPermision) {
if (!resources || !idsInPermision || !idsInPermision.length) { if (!resources || !idsInPermision || !idsInPermision.length) {
throw new Error('参数错误') throw new Error('参数错误')
} }
let __aRouteInPermision = [], let __aRouteInPermision = []
__oBtnInPermision = {}, let __oBtnInPermision = {}
// __aBtnIdAll=[], // __aBtnIdAll=[],
__objResource = null let __objResource = null
idsInPermision.forEach(obj => { idsInPermision.forEach(obj => {
__objResource = resources[obj.id] __objResource = resources[obj.id]
if(__objResource){//直接能取到的为路由 (也可以在routes 中定标识变量) if (__objResource) { // 直接能取到的为路由 (也可以在routes 中定标识变量)
__aRouteInPermision.push(resources[obj.id])//push 进 路由数组 __aRouteInPermision.push(resources[obj.id])// push 进 路由数组
}else{ //如果取不到 判断是否有父节点 并且父节点是否有auth属性 有 则视为按钮 (同样可以定义标识变量) } else { // 如果取不到 判断是否有父节点 并且父节点是否有auth属性 有 则视为按钮 (同样可以定义标识变量)
__objResource = resources[obj.pid] __objResource = resources[obj.pid]
if(__objResource && __objResource.auth && !__oBtnInPermision[obj.pid]){ if (__objResource && __objResource.auth && !__oBtnInPermision[obj.pid]) {
__oBtnInPermision[obj.pid]=__objResource.auth __oBtnInPermision[obj.pid] = __objResource.auth
// __aBtnIdAll = __aBtnIdAll.concat([...__objResource.auth.action.map(o=>o.id),...__objResource.auth.operation.map(o=>o.id)]) // __aBtnIdAll = __aBtnIdAll.concat([...__objResource.auth.action.map(o=>o.id),...__objResource.auth.operation.map(o=>o.id)])
} }
} }
}) })
return {'route':__aRouteInPermision,'btn':__oBtnInPermision} return { 'route': __aRouteInPermision, 'btn': __oBtnInPermision }
} }
/** /**
...@@ -49,12 +49,12 @@ permision.packAsideMenus = function (resources, idsInPermision) { ...@@ -49,12 +49,12 @@ permision.packAsideMenus = function (resources, idsInPermision) {
*/ */
idsInPermision.forEach(obj => { idsInPermision.forEach(obj => {
const __oMenu = permision.format2Menu(resources[obj.id]) const __oMenu = permision.format2Menu(resources[obj.id])
if(!__oMenu){ //不存在 可能是 按钮 直接继续循环 if (!__oMenu) { // 不存在 可能是 按钮 直接继续循环
return true return true
} }
if (obj.pid === '0') {//取出1级菜单 if (obj.pid === '0') { // 取出1级菜单
__aMenusInPermision.push(__oMenu) __aMenusInPermision.push(__oMenu)
} else {//取出子菜单 } else { // 取出子菜单
__aSub.push(__oMenu) __aSub.push(__oMenu)
} }
}) })
...@@ -77,7 +77,7 @@ permision.packAsideMenus = function (resources, idsInPermision) { ...@@ -77,7 +77,7 @@ permision.packAsideMenus = function (resources, idsInPermision) {
* 格式化菜单 封装成系统所需格式 * 格式化菜单 封装成系统所需格式
*/ */
permision.format2Menu = function (oMenu) { permision.format2Menu = function (oMenu) {
if(!oMenu) return null if (!oMenu) return null
const { icon, path, meta } = oMenu const { icon, path, meta } = oMenu
const { title, id, pid } = meta const { title, id, pid } = meta
return { title, icon, path, id, pid } return { title, icon, path, id, pid }
......
...@@ -7,7 +7,7 @@ import d2Admin from '@/plugin/d2admin' ...@@ -7,7 +7,7 @@ import d2Admin from '@/plugin/d2admin'
// store // store
import store from '@/store/index' import store from '@/store/index'
import D2Crud from '@d2-projects/d2-crud' // import D2Crud from '@d2-projects/d2-crud'
// 菜单和路由设置 // 菜单和路由设置
import router from './router' import router from './router'
// import menuHeader from '@/menu/header' // import menuHeader from '@/menu/header'
...@@ -15,31 +15,31 @@ import router from './router' ...@@ -15,31 +15,31 @@ import router from './router'
// import { frameInRoutes } from '@/router/routes' // import { frameInRoutes } from '@/router/routes'
import echarts from 'echarts' import echarts from 'echarts'
import VRM from 'vue-role-manager' // import VRM from 'vue-role-manager'
Vue.use(VRM, { // Vue.use(VRM, {
router, // router,
redirect: '403', // redirect: '403',
enabled: false // enabled: false
}) // })
// 核心插件 // 核心插件
Vue.use(d2Admin) Vue.use(d2Admin)
Vue.use(D2Crud) // Vue.use(D2Crud)
Vue.prototype.$echarts = echarts Vue.prototype.$echarts = echarts
new Vue({ new Vue({
router, router,
store, store,
i18n, i18n,
render: h => h(App), render: h => h(App),
created () { // created () {
// 处理路由 得到每一级的路由设置 // 处理路由 得到每一级的路由设置
// this.$store.commit('d2admin/page/init', frameInRoutes) // this.$store.commit('d2admin/page/init', frameInRoutes)
// 设置顶栏菜单 (暂时不需要) // 设置顶栏菜单 (暂时不需要)
// this.$store.commit('d2admin/menu/headerSet', menuHeader) // this.$store.commit('d2admin/menu/headerSet', menuHeader)
// 设置侧边栏菜单 (TODO 进行过滤) // 设置侧边栏菜单 (TODO 进行过滤)
// this.$store.commit('d2admin/menu/asideSet', menuAside) // this.$store.commit('d2admin/menu/asideSet', menuAside)
// 初始化菜单搜索功能 // 初始化菜单搜索功能
// this.$store.commit('d2admin/search/init', menuHeader) // this.$store.commit('d2admin/search/init', menuHeader)
}, // },
mounted () { mounted () {
// 展示系统信息 // 展示系统信息
this.$store.commit('d2admin/releases/versionShow') this.$store.commit('d2admin/releases/versionShow')
......
...@@ -14,7 +14,7 @@ import routes from './routes' ...@@ -14,7 +14,7 @@ import routes from './routes'
const originalPush = VueRouter.prototype.push // 解决连续点击路由异常问题 limin const originalPush = VueRouter.prototype.push // 解决连续点击路由异常问题 limin
VueRouter.prototype.push = function push (location) { VueRouter.prototype.push = function push (location) {
return originalPush.call(this, location).catch(err => err) return originalPush.call(this, location) && originalPush.call(this, location).catch(err => err)
} }
Vue.use(VueRouter) Vue.use(VueRouter)
...@@ -39,6 +39,7 @@ router.beforeEach(async (to, from, next) => { ...@@ -39,6 +39,7 @@ router.beforeEach(async (to, from, next) => {
store.commit('d2admin/search/set', false) store.commit('d2admin/search/set', false)
if (from.name === null && to.path !== '/login' && !source) { // 页面刷新 动态路由会失效 初始化路由与左侧菜单栏 if (from.name === null && to.path !== '/login' && !source) { // 页面刷新 动态路由会失效 初始化路由与左侧菜单栏
await store.dispatch('d2admin/auth/init') await store.dispatch('d2admin/auth/init')
await store.dispatch('d2admin/account/load')
next(to.path) next(to.path)
} else if (to.matched.some(r => r.meta.auth)) { // 验证当前路由所有的匹配中是否需要有登录验证的 } else if (to.matched.some(r => r.meta.auth)) { // 验证当前路由所有的匹配中是否需要有登录验证的
// 这里暂时将cookie里是否存有token作为验证是否登录的条件 // 这里暂时将cookie里是否存有token作为验证是否登录的条件
...@@ -55,7 +56,6 @@ router.beforeEach(async (to, from, next) => { ...@@ -55,7 +56,6 @@ router.beforeEach(async (to, from, next) => {
redirect: to.fullPath redirect: to.fullPath
} }
}) })
// https://github.com/d2-projects/d2-admin/issues/138
NProgress.done() NProgress.done()
} }
} else { } else {
......
...@@ -28,7 +28,7 @@ export const home = { ...@@ -28,7 +28,7 @@ export const home = {
}, },
component: _import('systemMonitor') component: _import('systemMonitor')
} }
export const sys =[ export const sys = [
// 系统 前端日志 // 系统 前端日志
{ {
path: 'log', path: 'log',
...@@ -94,11 +94,11 @@ export const resources = { ...@@ -94,11 +94,11 @@ export const resources = {
auth: { auth: {
'operation': [{ // 列表操作 'operation': [{ // 列表操作
id: '1020201', id: '1020201',
pid:'10202', pid: '10202',
label: '查看' label: '查看'
}, { // }, { //
id: '1020202', id: '1020202',
pid:'10202', pid: '10202',
label: '编辑' label: '编辑'
}], }],
'action': [] // 按钮操作 'action': [] // 按钮操作
...@@ -116,11 +116,11 @@ export const resources = { ...@@ -116,11 +116,11 @@ export const resources = {
auth: { auth: {
'operation': [{ // 列表操作 'operation': [{ // 列表操作
id: '1020301', id: '1020301',
pid:'10203', pid: '10203',
label: '查看' label: '查看'
}, { // }, { //
id: '1020302', id: '1020302',
pid:'10203', pid: '10203',
label: '编辑' label: '编辑'
}], }],
'action': [] // 按钮操作 'action': [] // 按钮操作
......
...@@ -32,12 +32,6 @@ export default { ...@@ -32,12 +32,6 @@ export default {
util.cookies.set('uuid', res.uuid) util.cookies.set('uuid', res.uuid)
util.cookies.set('token', res.token) util.cookies.set('token', res.token)
const { user, resources } = res const { user, resources } = res
// const __aRoutesInPermisions= util.permision.packRoutes(sources,resources)
// frameInRoutes[0].children=[dashboard,...__aRoutesInPermisions];
// router.addRoutes(frameInRoutes)
// const __aMenusInPermisions = util.permision.packAsideMenus(sources,resources)
// await commit('d2admin/page/init', frameInRoutes, { root: true })
// await commit('d2admin/menu/asideSet', [dashboard,...__aMenusInPermisions], { root: true })
await dispatch('d2admin/auth/set', resources, { root: true }) await dispatch('d2admin/auth/set', resources, { root: true })
// 设置 vuex 用户信息 // 设置 vuex 用户信息
await dispatch('d2admin/user/set', { await dispatch('d2admin/user/set', {
......
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
*/ */
import util from '@/libs/util.js' import util from '@/libs/util.js'
import router from '@/router' import router from '@/router'
import { resources as sources, home, frameInRoutes,sys } from '@/router/routes' import { resources as sources, home, frameInRoutes, sys } from '@/router/routes'
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
source:null, source: null,
meta:{}, meta: {},
btns:{}, btns: {},
btnIdAll:[] btnIdAll: []
}, },
getters: { getters: {
/** /**
...@@ -39,16 +39,16 @@ export default { ...@@ -39,16 +39,16 @@ export default {
}, },
/** /**
* 返回当前页面的btn * 返回当前页面的btn
* @param {*} state * @param {*} state
*/ */
curBtns(state){ curBtns (state) {
return state.btns[state.meta.id] return state.btns[state.meta.id]
}, },
/** /**
* 返回当前页面的btn * 返回当前页面的btn
* @param {*} state * @param {*} state
*/ */
btnIdAll(state){ btnIdAll (state) {
return state.btnIdAll return state.btnIdAll
} }
}, },
...@@ -118,8 +118,8 @@ export default { ...@@ -118,8 +118,8 @@ export default {
// 获取权限资源点 // 获取权限资源点
const __source = await dispatch('load') const __source = await dispatch('load')
// 过滤资源点 并动态添加到路由 // 过滤资源点 并动态添加到路由
const { route,btn } = util.permision.packRoutesBtns(sources, __source) const { route, btn } = util.permision.packRoutesBtns(sources, __source)
frameInRoutes[0].children = [home, ...route,...sys] frameInRoutes[0].children = [home, ...route, ...sys]
router.addRoutes(frameInRoutes) router.addRoutes(frameInRoutes)
state.btns = btn state.btns = btn
await commit('d2admin/page/init', frameInRoutes, { root: true }) await commit('d2admin/page/init', frameInRoutes, { root: true })
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</d2-container> </d2-container>
</template> </template>
...@@ -57,10 +57,6 @@ export default { ...@@ -57,10 +57,6 @@ export default {
alert(JSON.stringify(row)) alert(JSON.stringify(row))
} }
}, },
components: {
},
mounted () {
},
data () { data () {
return { return {
btn: { btn: {
......
...@@ -115,9 +115,6 @@ export default { ...@@ -115,9 +115,6 @@ export default {
this.$refs.editRuleForm.resetFields() this.$refs.editRuleForm.resetFields()
} }
}, },
mounted: {},
methods: { methods: {
handleClose () { handleClose () {
this.$emit('closeDialog') this.$emit('closeDialog')
......
...@@ -25,9 +25,9 @@ export const getBingImages = options => { ...@@ -25,9 +25,9 @@ export const getBingImages = options => {
// request({ url: 'http://localhost:3000/api/wallpaper' }).then(res => { // request({ url: 'http://localhost:3000/api/wallpaper' }).then(res => {
// console.log(JSON.parse(res.data).base64) // console.log(JSON.parse(res.data).base64)
// if (res.status === 'success') { // if (res.status === 'success') {
resolve(res) resolve(res)
// } else { // } else {
// reject('ERROR.') // reject('ERROR.')
// } // }
}) })
}) })
......
...@@ -11,7 +11,7 @@ export default { ...@@ -11,7 +11,7 @@ export default {
refresh: Boolean, refresh: Boolean,
withAnimation: Boolean withAnimation: Boolean
}, },
data() { data () {
return { return {
oBgStyle: { oBgStyle: {
backgroundImage: '', backgroundImage: '',
...@@ -19,7 +19,7 @@ export default { ...@@ -19,7 +19,7 @@ export default {
} }
} }
}, },
beforeMount() { beforeMount () {
// const oBg = this.$get_session('oBg') // const oBg = this.$get_session('oBg')
// if (oBg && !this.refresh) { // if (oBg && !this.refresh) {
// this.oBgStyle.backgroundImage = oBg.bgi // this.oBgStyle.backgroundImage = oBg.bgi
...@@ -32,8 +32,8 @@ export default { ...@@ -32,8 +32,8 @@ export default {
const oBg = { bgi: this.oBgStyle.backgroundImage, copyright, copyrightlink } const oBg = { bgi: this.oBgStyle.backgroundImage, copyright, copyrightlink }
// this.$set_session('oBg', JSON.stringify(oBg)) // this.$set_session('oBg', JSON.stringify(oBg))
this.$emit('update:oBg', oBg) this.$emit('update:oBg', oBg)
}).catch(err=>{ }).catch(err => {
console.log(err); console.log(err)
}) })
} }
} }
...@@ -57,4 +57,3 @@ export default { ...@@ -57,4 +57,3 @@ export default {
animation: img-action 18s animation: img-action 18s
} }
</style> </style>
...@@ -17,93 +17,74 @@ ...@@ -17,93 +17,74 @@
flex="dir:top main:justify cross:stretch box:justify"> flex="dir:top main:justify cross:stretch box:justify">
<div class="page-login--content-header"> <div class="page-login--content-header">
<p class="page-login--content-header-motto"> <p class="page-login--content-header-motto">
时间是一切财富中最宝贵的财富
</p> </p>
</div> </div>
<div <div
class="page-login--content-main" class="page-login--content-main"
flex="dir:top main:center cross:center"> flex="dir:top main:center cross:center">
<!-- logo -->
<img class="page-login--logo" src="./image/logo@2x.png">
<!-- form --> <!-- form -->
<div class="page-login--form"> <div class="page-login--form">
<el-card shadow="never"> <div class="form-left">
<el-form <el-form
ref="loginForm" ref="loginForm"
label-position="top" label-position="top"
:rules="rules" :rules="rules"
:model="formLogin" :model="formLogin"
size="default"> size="default">
<el-form-item prop="username"> <div class="title-wrap">
<el-input <span class="form-title">tFIMS管理系统</span>
type="text" <span class="form-sub">让服务更智慧、更直接</span>
v-model="formLogin.username" </div>
placeholder="用户名"> <div class="input-wrap">
<i slot="prepend" class="fa fa-user-circle-o"></i> <el-form-item prop="username">
</el-input> <el-input
</el-form-item> type="text"
<el-form-item prop="password"> v-model="formLogin.username"
<el-input placeholder="请输入用户名">
type="password" <i slot="prepend" class="fa fa-user-circle-o"></i>
v-model="formLogin.password" </el-input>
placeholder="密码"> </el-form-item>
<i slot="prepend" class="fa fa-keyboard-o"></i> <el-form-item prop="password">
</el-input> <el-input
</el-form-item> type="password"
<el-form-item prop="code"> v-model="formLogin.password"
<el-input placeholder="请输入密码">
type="text" <i slot="prepend" class="fa fa-keyboard-o"></i>
v-model="formLogin.code" </el-input>
placeholder="验证码"> </el-form-item>
<template slot="append"> <el-form-item class="form-action">
<img class="login-code" src="./image/login-code.png"> <el-button
</template> size="default"
</el-input> @click="submit"
</el-form-item> type="primary"
<el-button class="button-login">
size="default" 登录
@click="submit" </el-button>
type="primary" <el-button
class="button-login"> size="default"
登录 @click="submit"
</el-button> type="primary"
class="button-reg">
注册
</el-button>
</el-form-item>
</div>
</el-form> </el-form>
</el-card> </div>
<p <div class="form-right">
class="page-login--options" <div class="img-top">
flex="main:justify cross:center">
<span><d2-icon name="question-circle"/> 忘记密码</span> </div>
<span>注册用户</span> <div class="img-bg"></div>
</p> </div>
<!-- quick login -->
<!-- <el-button class="page-login--quick" size="default" type="info" @click="dialogVisible = true">
快速选择用户(测试功能)
</el-button> -->
</div> </div>
</div> </div>
<div class="page-login--content-footer"> <div class="page-login--content-footer">
<!-- <p class="page-login--content-footer-locales">
<a
v-for="language in $languages"
:key="language.value"
:command="language.value"
@click="$i18n.locale = language.value">
{{ language.label }}
</a>
</!-->
<p class="page-login--content-footer-copyright"> <p class="page-login--content-footer-copyright">
Copyright 版权所有
<d2-icon name="copyright"/> <d2-icon name="copyright"/>
2018 D2 Projects 开源组织出品 -2019 GLSX粤ICP备12020087号
<a href="https://github.com/FairyEver">
@FairyEver
</a>
</p> </p>
<!-- <p class="page-login--content-footer-options">
<a href="#">帮助</a>
<a href="#">隐私</a>
<a href="#">条款</a>
</p> -->
</div> </div>
</div> </div>
</div> </div>
...@@ -246,7 +227,7 @@ export default { ...@@ -246,7 +227,7 @@ export default {
<style lang="scss"> <style lang="scss">
.page-login { .page-login {
@extend %unable-select; @extend %unable-select;
$backgroundColor: #F0F2F5; $backgroundColor: #2A343D;
// --- // ---
background-color: $backgroundColor; background-color: $backgroundColor;
height: 100%; height: 100%;
...@@ -282,69 +263,91 @@ export default { ...@@ -282,69 +263,91 @@ export default {
font-size: 12px; font-size: 12px;
} }
} }
// main
.page-login--logo {
width: 240px;
margin-bottom: 2em;
margin-top: -2em;
}
// 登录表单 // 登录表单
.page-login--form { .page-login--form {
width: 280px; width: 720px;
// 卡片 height:400px;
.el-card { background: #FFFFFF;
margin-bottom: 15px; box-shadow: 0 8px 20px 0 rgba(0,0,0,0.06);
} border-radius: 16px;
// 登录按钮 padding:40px 0 0 37px;
.button-login { box-sizing: border-box;
width: 100%; display: flex;
} justify-content: space-between;
// 输入框左边的图表区域缩窄 .form-left{
.el-input-group__prepend { width: 300px;
padding: 0px 14px; .title-wrap{
} width: 180px;
.login-code { height: 45px;
height: 40px - 2px; margin-bottom: 62px;
display: block; .form-title{
margin: 0px -20px; font-size: 20px;
border-top-right-radius: 2px; color: #333333;
border-bottom-right-radius: 2px; line-height: 28px;
} }
// 登陆选项 .form-sub{
.page-login--options { font-size: 12px;
margin: 0px; color: #999;
padding: 0px; line-height: 17px;
font-size: 14px; float: left;
color: $color-primary; }
margin-bottom: 15px;
font-weight: bold;
}
.page-login--quick {
width: 100%;
}
}
// 快速选择用户面板
.page-login--quick-user {
@extend %flex-center-col;
padding: 10px 0px;
border-radius: 4px;
&:hover {
background-color: $color-bg;
i {
color: $color-text-normal;
} }
span { .input-warp{
color: $color-text-normal; .el-input{
width: 300px;
height: 35px;
margin-bottom: 24px;
background: #FFFFFF;
border: 1px solid #DDDDDD;
border-radius: 2px;
}
}
.form-action{
.el-button{
width: 145px;
height: 35px;
border-radius: 2px;
letter-spacing: 2px;
font-size: 14px;
line-height: 35px;
display: flex;
justify-content: center;
box-sizing: border-box;
span{
transform: translateY(-12px);
}
}
.button-login{
background-color: #3D6FE4;
color: #FFF;
letter-spacing: 2px;
float: left;
}
.button-reg{
border: 1px solid #DDD;
background-color: #fff;
opacity: 0.9;
color: #333;
float: right;
}
} }
} }
i { .form-right{
font-size: 36px; width: 354px;
color: $color-text-sub; .img-top{
} width: 364px;
span { height: 24px;
font-size: 12px; background: url('./image/bz.png');
margin-top: 10px; margin-bottom: 53px;
color: $color-text-sub; transform: translateX(-20px);
}
.img-bg{
// box-sizing: border-box;
background: url('./image/bg.png');
width: 322px;
height: 276px;
// border:6px solid #F4F9FF;
}
} }
} }
// footer // footer
...@@ -370,7 +373,7 @@ export default { ...@@ -370,7 +373,7 @@ export default {
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
margin-bottom: 10px; margin-bottom: 10px;
font-size: 12px; font-size: 16px;
line-height: 12px; line-height: 12px;
text-align: center; text-align: center;
color: $color-text-normal; color: $color-text-normal;
......
...@@ -173,8 +173,6 @@ export default { ...@@ -173,8 +173,6 @@ export default {
this.getNowFormatDate() this.getNowFormatDate()
}, 1000 / 60) }, 1000 / 60)
}, },
mounted() {
},
beforeDestroy() { beforeDestroy() {
clearInterval(this.timer) clearInterval(this.timer)
this.timer = null this.timer = null
......
...@@ -85,9 +85,6 @@ export default { ...@@ -85,9 +85,6 @@ export default {
this.$refs.editRuleForm.resetFields() this.$refs.editRuleForm.resetFields()
} }
}, },
mounted: {},
methods: { methods: {
handleClose () { handleClose () {
this.$emit('closeDialog') this.$emit('closeDialog')
......
...@@ -11,7 +11,23 @@ process.env.VUE_APP_BUILD_TIME = require('dayjs')().format('YYYY-M-D HH:mm:ss') ...@@ -11,7 +11,23 @@ process.env.VUE_APP_BUILD_TIME = require('dayjs')().format('YYYY-M-D HH:mm:ss')
// 基础路径 注意发布之前要先修改这里 // 基础路径 注意发布之前要先修改这里
let publicPath = '/' let publicPath = '/'
const CDN_DOMAIN = 'https://cdn.bootcss.com'
const cdn = {
css: [
`${CDN_DOMAIN}/element-ui/2.11.1/theme-chalk/index.css`,
`${CDN_DOMAIN}/nprogress/0.2.0/nprogress.min.css`
],
js: [
`${CDN_DOMAIN}/vue/2.6.10/vue.min.js`,
`${CDN_DOMAIN}/vue-router/3.0.6/vue-router.min.js`,
`${CDN_DOMAIN}/element-ui/2.11.1/index.js`,
`${CDN_DOMAIN}/vuex/3.1.1/vuex.min.js`,
`${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}/lodash.js/4.17.15/lodash.min.js`
]
}
module.exports = { module.exports = {
publicPath, // 根据你的实际情况更改这里 publicPath, // 根据你的实际情况更改这里
lintOnSave: true, lintOnSave: true,
...@@ -27,6 +43,16 @@ module.exports = { ...@@ -27,6 +43,16 @@ module.exports = {
} }
}, },
configureWebpack: config => { configureWebpack: config => {
config.externals = {
'vue': 'Vue',
'element-ui': 'ELEMENT',
'vue-router': 'VueRouter',
'vuex': 'Vuex',
'axios': 'axios',
'js-cookie': 'Cookies',
'nprogress': 'NProgress'
// 'lodash':'lodash'
}
// 非开发环境 // 非开发环境
if (process.env.NODE_ENV !== 'development') { if (process.env.NODE_ENV !== 'development') {
config.optimization.minimizer[0].options.terserOptions.compress.warnings = false config.optimization.minimizer[0].options.terserOptions.compress.warnings = false
...@@ -34,6 +60,14 @@ module.exports = { ...@@ -34,6 +60,14 @@ module.exports = {
config.optimization.minimizer[0].options.terserOptions.compress.drop_debugger = true config.optimization.minimizer[0].options.terserOptions.compress.drop_debugger = true
config.optimization.minimizer[0].options.terserOptions.compress.pure_funcs = ['console.log'] config.optimization.minimizer[0].options.terserOptions.compress.pure_funcs = ['console.log']
} }
// const Plugins = [
// new MiniCssExtractPlugin({
// // Options similar to the same options in webpackOptions.output
// // both options are optional
// filename: devMode ? 'css/[name].css' : 'css/[name].[hash].css',
// chunkFilename: devMode ? 'css/[id].css' : 'css/[id].[hash].css',
// })]
// config.plugins = [...config.plugins, ...Plugins]
}, },
// 默认设置: https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-service/lib/config/base.js // 默认设置: https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-service/lib/config/base.js
...@@ -96,6 +130,12 @@ module.exports = { ...@@ -96,6 +130,12 @@ module.exports = {
config.resolve.alias config.resolve.alias
.set('@', resolve('src')) .set('@', resolve('src'))
.set('@api', resolve('src/api')) .set('@api', resolve('src/api'))
config.plugin('html')
.tap(args => {
// args[0].minify.removeComments = false;
args[0].cdn = cdn
return args
})
// 判断环境加入模拟数据 // 判断环境加入模拟数据
// const entry = config.entry('app') // const entry = config.entry('app')
// if (process.env.VUE_APP_BUILD_MODE !== 'nomock') { // if (process.env.VUE_APP_BUILD_MODE !== 'nomock') {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!