@wp1001/ui 2.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +6 -0
- package/@vant-D4fmGxs6.js +3891 -0
- package/index.js +8419 -0
- package/package.json +59 -0
- package/packages/assets/devtools-detector.js +2 -0
- package/packages/components/xarray/index.js +64 -0
- package/packages/components/xarray/xarray.vue +57 -0
- package/packages/components/xautorows/index.js +35 -0
- package/packages/components/xautorows/xautorows.vue +29 -0
- package/packages/components/xbutton/mobile.js +3 -0
- package/packages/components/xbutton/mobile.vue +9 -0
- package/packages/components/xbutton/pc.js +3 -0
- package/packages/components/xbutton/pc.vue +9 -0
- package/packages/components/xbuttons/mobile.js +51 -0
- package/packages/components/xbuttons/mobile.vue +12 -0
- package/packages/components/xbuttons/pc.js +51 -0
- package/packages/components/xbuttons/pc.vue +16 -0
- package/packages/components/xchart/constants.js +58 -0
- package/packages/components/xchart/index.js +263 -0
- package/packages/components/xchart/utils.js +121 -0
- package/packages/components/xchart/xchart.vue +173 -0
- package/packages/components/xcheckboxs/mobile.js +58 -0
- package/packages/components/xcheckboxs/mobile.vue +38 -0
- package/packages/components/xcheckboxs/pc.js +49 -0
- package/packages/components/xcheckboxs/pc.vue +42 -0
- package/packages/components/xcol/mobile.js +10 -0
- package/packages/components/xcol/mobile.vue +9 -0
- package/packages/components/xcol/pc.js +10 -0
- package/packages/components/xcol/pc.vue +9 -0
- package/packages/components/xdatepicker/mobile.js +71 -0
- package/packages/components/xdatepicker/mobile.vue +44 -0
- package/packages/components/xdatepicker/pc.js +9 -0
- package/packages/components/xdatepicker/pc.vue +12 -0
- package/packages/components/xdialog/mobile.js +60 -0
- package/packages/components/xdialog/mobile.vue +43 -0
- package/packages/components/xdialog/pc.js +64 -0
- package/packages/components/xdialog/pc.vue +51 -0
- package/packages/components/xdict/index.js +47 -0
- package/packages/components/xdict/xdict.vue +9 -0
- package/packages/components/xdistrictselect/mobile.js +79 -0
- package/packages/components/xdistrictselect/mobile.vue +28 -0
- package/packages/components/xdistrictselect/pc.js +127 -0
- package/packages/components/xdistrictselect/pc.vue +32 -0
- package/packages/components/xform/mobile.js +29 -0
- package/packages/components/xform/mobile.vue +43 -0
- package/packages/components/xform/pc.js +42 -0
- package/packages/components/xform/pc.vue +76 -0
- package/packages/components/xform/utils.js +95 -0
- package/packages/components/xformitem/mobile.js +56 -0
- package/packages/components/xformitem/mobile.vue +3 -0
- package/packages/components/xformitem/pc.js +72 -0
- package/packages/components/xformitem/pc.vue +10 -0
- package/packages/components/xformitem/utils.jsx +181 -0
- package/packages/components/xicon/mobile.js +35 -0
- package/packages/components/xicon/mobile.vue +9 -0
- package/packages/components/xicon/pc.js +35 -0
- package/packages/components/xicon/pc.vue +11 -0
- package/packages/components/xinfo/index.js +100 -0
- package/packages/components/xinfo/xinfo.vue +140 -0
- package/packages/components/xlooper/index.js +7 -0
- package/packages/components/xlooper/xlooper.vue +20 -0
- package/packages/components/xpagination/mobile.js +21 -0
- package/packages/components/xpagination/mobile.vue +31 -0
- package/packages/components/xpagination/pc.js +21 -0
- package/packages/components/xpagination/pc.vue +16 -0
- package/packages/components/xpicker/index.js +38 -0
- package/packages/components/xpicker/xpicker.vue +29 -0
- package/packages/components/xradios/mobile.js +40 -0
- package/packages/components/xradios/mobile.vue +22 -0
- package/packages/components/xradios/pc.js +53 -0
- package/packages/components/xradios/pc.vue +43 -0
- package/packages/components/xrow/mobile.js +9 -0
- package/packages/components/xrow/mobile.vue +23 -0
- package/packages/components/xrow/pc.js +9 -0
- package/packages/components/xrow/pc.vue +22 -0
- package/packages/components/xscan/mobile.js +24 -0
- package/packages/components/xscan/mobile.vue +21 -0
- package/packages/components/xscan/pc.js +20 -0
- package/packages/components/xscan/pc.vue +18 -0
- package/packages/components/xsearcher/index.js +198 -0
- package/packages/components/xsearcher/xsearcher.vue +170 -0
- package/packages/components/xselect/mobile.js +86 -0
- package/packages/components/xselect/mobile.vue +24 -0
- package/packages/components/xselect/pc.js +114 -0
- package/packages/components/xselect/pc.vue +55 -0
- package/packages/components/xselect/util.js +66 -0
- package/packages/components/xselectv2/index.js +91 -0
- package/packages/components/xselectv2/xselectv2.vue +46 -0
- package/packages/components/xtable/mobile.js +108 -0
- package/packages/components/xtable/mobile.vue +246 -0
- package/packages/components/xtable/pc.js +143 -0
- package/packages/components/xtable/pc.vue +421 -0
- package/packages/components/xtable/searcher.js +477 -0
- package/packages/components/xtable/searcher.jsx +330 -0
- package/packages/components/xtable/searcher.vue +133 -0
- package/packages/components/xtable/settings.js +80 -0
- package/packages/components/xtable/settings.vue +77 -0
- package/packages/components/xtable/utils.js +692 -0
- package/packages/components/xtabletools/mobile.js +25 -0
- package/packages/components/xtabletools/mobile.vue +126 -0
- package/packages/components/xtabletools/pc.js +18 -0
- package/packages/components/xtabletools/pc.vue +135 -0
- package/packages/components/xtablev2/index.js +53 -0
- package/packages/components/xtablev2/utils.jsx +214 -0
- package/packages/components/xtablev2/xtablev2.vue +147 -0
- package/packages/components/xtags/mobile.js +17 -0
- package/packages/components/xtags/mobile.vue +21 -0
- package/packages/components/xtags/pc.js +17 -0
- package/packages/components/xtags/pc.vue +22 -0
- package/packages/components/xtinymce/index.js +71 -0
- package/packages/components/xtinymce/xtinymce.vue +9 -0
- package/packages/components/xuploader/xfileuploader.js +48 -0
- package/packages/components/xuploader/xfileuploader.vue +54 -0
- package/packages/components/xuploader/ximageuploader.js +53 -0
- package/packages/components/xuploader/ximageuploader.vue +52 -0
- package/packages/comps.js +108 -0
- package/packages/controllers/BaseController.js +125 -0
- package/packages/controllers/CrudController.js +907 -0
- package/packages/controllers/TempCrudController.js +32 -0
- package/packages/controllers/index.js +15 -0
- package/packages/directives/el-table-infinite-scroll.js +55 -0
- package/packages/directives/index.js +5 -0
- package/packages/index.js +81 -0
- package/packages/index.scss +4 -0
- package/packages/layout/breadcrumb/breadcrumb.vue +31 -0
- package/packages/layout/breadcrumb/index.js +41 -0
- package/packages/layout/header/header.vue +281 -0
- package/packages/layout/header/inner.js +11 -0
- package/packages/layout/header/inner.vue +3 -0
- package/packages/layout/mobile-menu.vue +83 -0
- package/packages/layout/mobile-tabs.vue +54 -0
- package/packages/layout/pc.vue +85 -0
- package/packages/layout/screenlock/index.js +129 -0
- package/packages/layout/screenlock/screenlock.vue +85 -0
- package/packages/layout/sidebar/item.js +16 -0
- package/packages/layout/sidebar/item.vue +16 -0
- package/packages/layout/sidebar/menu.js +72 -0
- package/packages/layout/sidebar/menu.vue +106 -0
- package/packages/layout/sidebar/sidebar.vue +147 -0
- package/packages/layout/tagsview/ScrollPane.js +65 -0
- package/packages/layout/tagsview/ScrollPane.vue +24 -0
- package/packages/layout/tagsview/index.js +169 -0
- package/packages/layout/tagsview/index.vue +124 -0
- package/packages/plop/actions/make-fill-admin-partials-action.js +95 -0
- package/packages/plop/generators/make-admin-page.js +39 -0
- package/packages/plop/generators/make-database-admin-pages.js +84 -0
- package/packages/plop/generators/make-page-generator.js +52 -0
- package/packages/plop/generators/make-simple-page.js +20 -0
- package/packages/plop/plopfile.js +24 -0
- package/packages/plop/templates/admin_page/controller.js +3 -0
- package/packages/plop/templates/admin_page/model.js +24 -0
- package/packages/plop/templates/admin_page/{{snakeCase pagename}}-scoped.scss +3 -0
- package/packages/plop/templates/admin_page/{{snakeCase pagename}}.vue +11 -0
- package/packages/plop/templates/simple_page/controller.js +3 -0
- package/packages/plop/templates/simple_page/model.js +6 -0
- package/packages/plop/templates/simple_page/{{snakeCase pagename}}-scoped.scss +3 -0
- package/packages/plop/templates/simple_page/{{snakeCase pagename}}.vue +7 -0
- package/packages/plop/utils/index.js +168 -0
- package/packages/plop/utils/plop-utils.js +86 -0
- package/packages/styles/common.scss +137 -0
- package/packages/styles/element-ui.scss +142 -0
- package/packages/styles/vant.scss +133 -0
- package/packages/styles/variables.scss +23 -0
- package/packages/utils/crypt.js +24 -0
- package/packages/utils/decorators.js +67 -0
- package/packages/utils/disallowDevtools.js +53 -0
- package/packages/utils/effects.js +173 -0
- package/packages/utils/funcs.js +78 -0
- package/packages/utils/index.js +95 -0
- package/packages/utils/message.js +110 -0
- package/packages/utils/middlewares.js +86 -0
- package/packages/utils/model.js +71 -0
- package/packages/utils/modelUtils.js +203 -0
- package/packages/utils/request.js +57 -0
- package/packages/utils/site.js +33 -0
- package/packages/vite-plugins.js +141 -0
- package/publish.sh +12 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { reactive, watch } from 'vue'
|
|
3
|
+
import { useRoute } from 'vue-router'
|
|
4
|
+
|
|
5
|
+
const route = useRoute()
|
|
6
|
+
|
|
7
|
+
const tabs = [
|
|
8
|
+
{
|
|
9
|
+
text: '首页',
|
|
10
|
+
icon: 'home-o'
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
text: '设置',
|
|
14
|
+
icon: 'setting-o'
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<div class="mobile-tabs-layout">
|
|
21
|
+
<van-nav-bar
|
|
22
|
+
v-show="!route.meta.hideNavBar"
|
|
23
|
+
:left-text="!route.meta.hideLeftArrow ? '返回' : ''"
|
|
24
|
+
:left-arrow="!route.meta.hideLeftArrow"
|
|
25
|
+
:title="route.meta.title"
|
|
26
|
+
@click-left="$router.go(-1)"
|
|
27
|
+
/>
|
|
28
|
+
<main>
|
|
29
|
+
<router-view />
|
|
30
|
+
</main>
|
|
31
|
+
<van-tabbar v-show="!route.meta.hideTabBar">
|
|
32
|
+
<van-tabbar-item
|
|
33
|
+
v-for="(item, index) in tabs"
|
|
34
|
+
:key="index"
|
|
35
|
+
v-bind="item"
|
|
36
|
+
>
|
|
37
|
+
{{ item.text }}
|
|
38
|
+
</van-tabbar-item>
|
|
39
|
+
</van-tabbar>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<style lang="scss" scoped>
|
|
44
|
+
svg {
|
|
45
|
+
transform: rotate(180deg);
|
|
46
|
+
&.active {
|
|
47
|
+
transform: rotate(0);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
main {
|
|
51
|
+
height: calc(100vh - var(--van-nav-bar-height));
|
|
52
|
+
overflow-y: auto;
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import store from '@/store'
|
|
4
|
+
import { utils } from '@stardust_js/ui'
|
|
5
|
+
|
|
6
|
+
import Header from './header/header.vue'
|
|
7
|
+
import Sidebar from './sidebar/sidebar.vue'
|
|
8
|
+
import TagsView from './tagsview/index.vue'
|
|
9
|
+
import ScreenLock from './screenlock/screenlock.vue'
|
|
10
|
+
|
|
11
|
+
const { app } = store
|
|
12
|
+
const watermarkUrl = computed(() => utils.effects.createWatermark(app.watermark).toDataURL())
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<el-container
|
|
17
|
+
class="pc-layout"
|
|
18
|
+
:class="{ mobile: app.isMobile, 'has-tagsview': app.tagsviewVisible }"
|
|
19
|
+
>
|
|
20
|
+
<Sidebar />
|
|
21
|
+
|
|
22
|
+
<el-container>
|
|
23
|
+
<el-header>
|
|
24
|
+
<Header class="header" />
|
|
25
|
+
<TagsView v-if="app.tagsviewVisible" />
|
|
26
|
+
</el-header>
|
|
27
|
+
|
|
28
|
+
<el-main>
|
|
29
|
+
<router-view />
|
|
30
|
+
</el-main>
|
|
31
|
+
</el-container>
|
|
32
|
+
|
|
33
|
+
<ScreenLock />
|
|
34
|
+
|
|
35
|
+
<div
|
|
36
|
+
class="watermark"
|
|
37
|
+
:style="{ 'background-image': app.watermark.visible ? `url(${watermarkUrl})` : '' }"
|
|
38
|
+
/>
|
|
39
|
+
</el-container>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<style lang="scss" scoped>
|
|
43
|
+
.pc-layout {
|
|
44
|
+
.el-header {
|
|
45
|
+
height: var(--x-head-height);
|
|
46
|
+
padding: 0;
|
|
47
|
+
color: #606666;
|
|
48
|
+
}
|
|
49
|
+
.header {
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
background-color: var(--x-header-bg-color);
|
|
53
|
+
height: var(--x-header-height);
|
|
54
|
+
}
|
|
55
|
+
.el-main {
|
|
56
|
+
background-color: var(--x-bg-color);
|
|
57
|
+
padding: 10px;
|
|
58
|
+
height: calc(100% - #{var(--x-head-height)});
|
|
59
|
+
overflow-y: auto;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&.mobile {
|
|
63
|
+
zoom: 0.8;
|
|
64
|
+
}
|
|
65
|
+
&.has-tagsview {
|
|
66
|
+
.el-header {
|
|
67
|
+
height: calc(var(--x-head-height) + var(--x-tagsview-height));
|
|
68
|
+
}
|
|
69
|
+
.el-main {
|
|
70
|
+
height: calc(100% - #{var(--x-head-height)} - #{var(--x-tagsview-height)});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.watermark {
|
|
76
|
+
position: fixed;
|
|
77
|
+
left: 0;
|
|
78
|
+
top: 0;
|
|
79
|
+
width: 100%;
|
|
80
|
+
height: 100%;
|
|
81
|
+
pointer-events: none;
|
|
82
|
+
transform: rotate(-10deg);
|
|
83
|
+
z-index: 9999;
|
|
84
|
+
}
|
|
85
|
+
</style>
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { utils } from '@stardust_js/ui'
|
|
2
|
+
import { service } from '@/stardust'
|
|
3
|
+
const { funcs } = StardustJs
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
data () {
|
|
7
|
+
return {
|
|
8
|
+
lastTime: Date.now(),
|
|
9
|
+
isVerifing: false,
|
|
10
|
+
pin: new Array(6).fill(''),
|
|
11
|
+
inputs: [],
|
|
12
|
+
stoper: null
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
computed: {
|
|
16
|
+
screenLock () {
|
|
17
|
+
return this.$store.app.screenLock
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
mounted () {
|
|
21
|
+
if (!this.screenLock.enabled) {
|
|
22
|
+
return
|
|
23
|
+
}
|
|
24
|
+
this.detectInteractive(this.onInteractive)
|
|
25
|
+
setInterval(this.checkInteractive, 200)
|
|
26
|
+
this.checkInteractive()
|
|
27
|
+
},
|
|
28
|
+
methods: {
|
|
29
|
+
handleCustomPin () {
|
|
30
|
+
const pin = window.prompt('请输入自定义PIN码(6位字母或数字)')
|
|
31
|
+
if (pin === null) return
|
|
32
|
+
if (!pin || pin.length !== 6 || !/\w{6}/.test(pin)) {
|
|
33
|
+
return utils.Message('PIN码格式错误')
|
|
34
|
+
}
|
|
35
|
+
service.restful.update('users', this.$store.user.info.id, { pin })
|
|
36
|
+
this.$store.user.info.pin = pin
|
|
37
|
+
},
|
|
38
|
+
async checkInteractive () {
|
|
39
|
+
this.checkMask()
|
|
40
|
+
if (
|
|
41
|
+
this.screenLock.isLocked && !this.stoper ||
|
|
42
|
+
!this.screenLock.isLocked && Date.now() - this.lastTime > this.screenLock.time * 1000
|
|
43
|
+
) {
|
|
44
|
+
await this.toggleScreenLock(true)
|
|
45
|
+
this.effect()
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
effect () {
|
|
49
|
+
this.stoper = utils.effects.pop(this.$refs.canvas)
|
|
50
|
+
},
|
|
51
|
+
detectInteractive (callback) {
|
|
52
|
+
const eventTypes = ['click', 'keydown', 'mousemove', 'mousewheel']
|
|
53
|
+
eventTypes.forEach(type => {
|
|
54
|
+
document.addEventListener(type, () => callback(type), true)
|
|
55
|
+
})
|
|
56
|
+
},
|
|
57
|
+
onInteractive (type) {
|
|
58
|
+
if (this.screenLock.isLocked) {
|
|
59
|
+
if (type === 'click') {
|
|
60
|
+
this.isVerifing = true
|
|
61
|
+
this.$nextTick(() => {
|
|
62
|
+
const index = this.pin.findIndex(c => !c)
|
|
63
|
+
this.$refs.inputs[index].input.focus()
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
this.lastTime = Date.now()
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
async checkMask () {
|
|
71
|
+
if (!this.screenLock.isLocked) {
|
|
72
|
+
return
|
|
73
|
+
}
|
|
74
|
+
const mask = document.querySelector('.screen-lock .fullscreen')
|
|
75
|
+
let exists = !!mask
|
|
76
|
+
if (exists) {
|
|
77
|
+
const rect = mask.getBoundingClientRect()
|
|
78
|
+
const zoom = document.documentElement.style.zoom * 1 || 1
|
|
79
|
+
exists = rect.left === 0 &&
|
|
80
|
+
rect.top === 0 &&
|
|
81
|
+
Math.round(rect.width - window.innerWidth / zoom) < 1 &&
|
|
82
|
+
Math.round(rect.height - window.innerHeight / zoom) < 1
|
|
83
|
+
}
|
|
84
|
+
if (!exists) {
|
|
85
|
+
window.location.reload()
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
async handlePinInput (index, event) {
|
|
89
|
+
const char = event.key
|
|
90
|
+
if (/[0-9]/.test(char)) {
|
|
91
|
+
this.pin[index] = char
|
|
92
|
+
} else {
|
|
93
|
+
if (char.toLowerCase() === 'backspace' && index > 0) {
|
|
94
|
+
this.pin[index - 1] = ''
|
|
95
|
+
this.$refs.inputs[index - 1].input.focus()
|
|
96
|
+
}
|
|
97
|
+
return
|
|
98
|
+
}
|
|
99
|
+
if (index < this.pin.length - 1) {
|
|
100
|
+
await funcs.sleep(20)
|
|
101
|
+
this.$refs.inputs[index + 1].input.focus()
|
|
102
|
+
} else {
|
|
103
|
+
if (this.pin.join('') !== this.$store.getters.user.pin) {
|
|
104
|
+
this.$message({
|
|
105
|
+
type: 'warning',
|
|
106
|
+
message: '锁屏密码错误',
|
|
107
|
+
})
|
|
108
|
+
this.$refs.inputs[0].input.focus()
|
|
109
|
+
} else {
|
|
110
|
+
this.isVerifing = false
|
|
111
|
+
this.stoper()
|
|
112
|
+
this.stoper = null
|
|
113
|
+
this.lastTime = Date.now()
|
|
114
|
+
this.toggleScreenLock(false)
|
|
115
|
+
}
|
|
116
|
+
this.pin = new Array(6).fill('')
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
async handleCompositionstart (index, event) {
|
|
120
|
+
event.target.blur()
|
|
121
|
+
await StardustJs.funcs.sleep(10)
|
|
122
|
+
event.target.focus()
|
|
123
|
+
},
|
|
124
|
+
async toggleScreenLock (isLocked) {
|
|
125
|
+
this.$store.app.screenLock.isLocked = isLocked
|
|
126
|
+
await this.$nextTick()
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export { default } from './index.js'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<div
|
|
7
|
+
v-if="screenLock.enabled && screenLock.isLocked"
|
|
8
|
+
class="screen-lock fullscreen flex-center"
|
|
9
|
+
>
|
|
10
|
+
<canvas
|
|
11
|
+
ref="canvas"
|
|
12
|
+
class="fullscreen"
|
|
13
|
+
/>
|
|
14
|
+
|
|
15
|
+
<div v-if="isVerifing" class="verify abs-center">
|
|
16
|
+
<div class="pin">
|
|
17
|
+
<el-input
|
|
18
|
+
v-for="(c, index) in pin"
|
|
19
|
+
:key="index"
|
|
20
|
+
v-model="pin[index]"
|
|
21
|
+
type="tel"
|
|
22
|
+
ref="inputs"
|
|
23
|
+
:readonly="!!c"
|
|
24
|
+
spellcheck="false"
|
|
25
|
+
autocomplete="off"
|
|
26
|
+
autocorrect="off"
|
|
27
|
+
autocapitalize="off"
|
|
28
|
+
@compositionstart.stop.prevent="handleCompositionstart(index, $event)"
|
|
29
|
+
@keydown.stop.prevent="handlePinInput(index, $event)"
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
<el-button
|
|
33
|
+
type="primary"
|
|
34
|
+
class="custom-pin"
|
|
35
|
+
@click="handleCustomPin"
|
|
36
|
+
>
|
|
37
|
+
自定义锁屏PIN码
|
|
38
|
+
</el-button>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<style lang="scss" scoped>
|
|
44
|
+
.screen-lock {
|
|
45
|
+
z-index: 9998;
|
|
46
|
+
.pin {
|
|
47
|
+
.el-input {
|
|
48
|
+
width: 50px;
|
|
49
|
+
height: 50px;
|
|
50
|
+
margin: 5px;
|
|
51
|
+
font-size: 40px;
|
|
52
|
+
}
|
|
53
|
+
:deep(input) {
|
|
54
|
+
color: #409eff;
|
|
55
|
+
text-align: center;
|
|
56
|
+
padding-bottom: 3px;
|
|
57
|
+
-moz-appearance: textfield;
|
|
58
|
+
&::-webkit-outer-spin-button,
|
|
59
|
+
&::-webkit-inner-spin-button {
|
|
60
|
+
-webkit-appearance: none !important;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
.verify {
|
|
65
|
+
z-index: 9999;
|
|
66
|
+
text-align: center;
|
|
67
|
+
.custom-pin {
|
|
68
|
+
margin-top: 20px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
canvas {
|
|
72
|
+
animation-name: fade-in;
|
|
73
|
+
animation-duration: 1s;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@keyframes fade-in {
|
|
77
|
+
0% {
|
|
78
|
+
opacity: 0;
|
|
79
|
+
}
|
|
80
|
+
100% {
|
|
81
|
+
opacity: 1;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export { default } from './item.js'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<span
|
|
7
|
+
class="menu-item flex-center"
|
|
8
|
+
:class="{ branch: isBranch }"
|
|
9
|
+
>
|
|
10
|
+
<x-icon v-if="data.meta.icon" :name="data.meta.icon" class="icon" />
|
|
11
|
+
<span v-show="hover || !collapse">
|
|
12
|
+
<span>{{ data.meta.title }}</span>
|
|
13
|
+
<x-icon v-if="isBranch" :name="`arrow-${node?.expanded ? 'up' : 'down'}`" class="arrow-toggle" />
|
|
14
|
+
</span>
|
|
15
|
+
</span>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import Item from './item.vue'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
name: 'Menu',
|
|
5
|
+
components: { Item },
|
|
6
|
+
props: {
|
|
7
|
+
menu: Array,
|
|
8
|
+
hover: Boolean
|
|
9
|
+
},
|
|
10
|
+
data () {
|
|
11
|
+
return {
|
|
12
|
+
defaultProps: { label: 'name' }
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
computed: {
|
|
16
|
+
collapse () {
|
|
17
|
+
return this.$store.getters.collapse
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
watch: {
|
|
21
|
+
collapse: {
|
|
22
|
+
handler () {
|
|
23
|
+
this.filter()
|
|
24
|
+
this.updateCurrent()
|
|
25
|
+
},
|
|
26
|
+
immediate: true
|
|
27
|
+
},
|
|
28
|
+
$route: {
|
|
29
|
+
handler: 'updateCurrent',
|
|
30
|
+
immediate: true
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
mounted () {
|
|
34
|
+
this.filter()
|
|
35
|
+
this.updateCurrent()
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
filter () {
|
|
39
|
+
this.$refs.tree?.filter()
|
|
40
|
+
},
|
|
41
|
+
updateCurrent () {
|
|
42
|
+
(this.hover || !this.collapse) && this.$refs.tree?.setCurrentKey(this.$route.name)
|
|
43
|
+
},
|
|
44
|
+
filterMenu (_, data) {
|
|
45
|
+
if (!this.hover && this.collapse && data.path[0] !== '/') {
|
|
46
|
+
return false
|
|
47
|
+
}
|
|
48
|
+
return !data.meta?.hidden
|
|
49
|
+
},
|
|
50
|
+
checkIsRoot (data) {
|
|
51
|
+
return this.checkIsBranch(data) && data.path.split('/').length === 2
|
|
52
|
+
},
|
|
53
|
+
checkIsBranch (data) {
|
|
54
|
+
return data.children?.length > 0
|
|
55
|
+
},
|
|
56
|
+
handleNodeClick (data, node, _, e) {
|
|
57
|
+
if (!this.checkIsBranch(data)) {
|
|
58
|
+
this.$router.push({ name: data.name })
|
|
59
|
+
return
|
|
60
|
+
}
|
|
61
|
+
if (this.collapse && this.checkIsRoot(data)) {
|
|
62
|
+
this.$store.app.$patch({ sidebarCollapse: false })
|
|
63
|
+
this.$refs.tree.setCurrentKey(this.$route.name)
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
handleKeydown ($event, node, data) {
|
|
67
|
+
if ($event.key === 'Enter') {
|
|
68
|
+
this.$router.push({ name: data.name })
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export { default } from './menu.js'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<el-tree
|
|
7
|
+
ref="tree"
|
|
8
|
+
:data="menu"
|
|
9
|
+
:props="defaultProps"
|
|
10
|
+
:filter-node-method="filterMenu"
|
|
11
|
+
node-key="name"
|
|
12
|
+
class="side-menu"
|
|
13
|
+
@node-click="handleNodeClick"
|
|
14
|
+
>
|
|
15
|
+
<template #default="{ node, data }">
|
|
16
|
+
<div :tabindex="data.tabindex" @keydown="handleKeydown($event, node, data)">
|
|
17
|
+
<slot v-if="collapse && checkIsRoot(data)" name="root-menu" :node="node" :data="data" />
|
|
18
|
+
<Item v-else :node="node" :data="data" :hover="hover" />
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
</el-tree>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<style lang="scss">
|
|
25
|
+
.side-menu {
|
|
26
|
+
min-width: 100%;
|
|
27
|
+
max-height: 100vh;
|
|
28
|
+
overflow-y: auto;
|
|
29
|
+
display: inline-block !important;
|
|
30
|
+
background-color: var(--x-sidebar-bg-color);
|
|
31
|
+
color: #a0aaaa;
|
|
32
|
+
.el-tree-node__expand-icon {
|
|
33
|
+
display: none;
|
|
34
|
+
}
|
|
35
|
+
.el-tree-node__content {
|
|
36
|
+
height: 50px;
|
|
37
|
+
line-height: 50px;
|
|
38
|
+
position: relative;
|
|
39
|
+
}
|
|
40
|
+
.el-tree-node__chilren,
|
|
41
|
+
.el-tree-node__content {
|
|
42
|
+
background-color: transparent !important;
|
|
43
|
+
}
|
|
44
|
+
.el-tree-node {
|
|
45
|
+
&.is-current {
|
|
46
|
+
background-color: var(--x-sidebar-current-bg-color);
|
|
47
|
+
.menu-item {
|
|
48
|
+
color: var(--x-sidebar-current-text-color);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
&.is-expanded .el-tree-node__content:hover, &:not(.is-expanded):hover {
|
|
52
|
+
background-color: var(--x-sidebar-hover-bg-color) !important;
|
|
53
|
+
.menu-item {
|
|
54
|
+
color: var(--x-sidebar-current-text-color);
|
|
55
|
+
animation-name: tick;
|
|
56
|
+
animation-duration: 0.3s;
|
|
57
|
+
@keyframes tick {
|
|
58
|
+
0% {
|
|
59
|
+
left: 0;
|
|
60
|
+
}
|
|
61
|
+
50% {
|
|
62
|
+
left: 10px;
|
|
63
|
+
}
|
|
64
|
+
100% {
|
|
65
|
+
left: 0;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.menu-item {
|
|
73
|
+
width: 100%;
|
|
74
|
+
justify-content: start;
|
|
75
|
+
padding: 0 10px 0 22px;
|
|
76
|
+
color: var(--x-sidebar-text-color);
|
|
77
|
+
&.branch {
|
|
78
|
+
padding-left: 22px;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
.icon {
|
|
82
|
+
font-size: 20px;
|
|
83
|
+
margin-right: 10px;
|
|
84
|
+
}
|
|
85
|
+
.arrow-toggle {
|
|
86
|
+
position: absolute;
|
|
87
|
+
top: 15px;
|
|
88
|
+
right: 15px;
|
|
89
|
+
color: #e0eeee;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
.mobile {
|
|
93
|
+
.side-menu {
|
|
94
|
+
.menu-item {
|
|
95
|
+
padding-left: 0;
|
|
96
|
+
&.branch {
|
|
97
|
+
padding-left: 0;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
.arrow-toggle {
|
|
101
|
+
top: 0.48rem;
|
|
102
|
+
right: 0;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
</style>
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed } from 'vue'
|
|
3
|
+
import { useRoute } from 'vue-router'
|
|
4
|
+
|
|
5
|
+
import store from '@/store'
|
|
6
|
+
import Menu from './menu.vue'
|
|
7
|
+
import Item from './item.vue'
|
|
8
|
+
|
|
9
|
+
const props = defineProps({ menu: Array })
|
|
10
|
+
const route = useRoute()
|
|
11
|
+
const hoverMenu = ref(null)
|
|
12
|
+
|
|
13
|
+
const { app, routes } = store
|
|
14
|
+
|
|
15
|
+
const collapse = computed(() => app.sidebarCollapse)
|
|
16
|
+
const toggled = computed(() => app.sidebarToggled)
|
|
17
|
+
const toggleDuration = computed(() => app.toggleDuration + 's')
|
|
18
|
+
|
|
19
|
+
const _menu = computed(() => {
|
|
20
|
+
const filtered = routes.enabledRoutes.filter(route => {
|
|
21
|
+
return !route.meta.hidden && route.path.split('/').length === 2
|
|
22
|
+
})
|
|
23
|
+
setTabIndex(filtered)
|
|
24
|
+
return filtered
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const setTabIndex = (menu, start = 1) => {
|
|
28
|
+
menu.forEach(ele => {
|
|
29
|
+
ele.tabindex = start ++
|
|
30
|
+
if (ele.children?.length) {
|
|
31
|
+
start = setTabIndex(ele.children, start)
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
return start
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const menu = computed(() => props.menu || _menu.value)
|
|
38
|
+
|
|
39
|
+
const sidebarClasses = computed(() => ({
|
|
40
|
+
collapse: collapse.value,
|
|
41
|
+
expand: !collapse.value,
|
|
42
|
+
collapsing: toggled.value && collapse.value,
|
|
43
|
+
expanding: toggled.value && !collapse.value,
|
|
44
|
+
mobile: app.isMobile
|
|
45
|
+
}))
|
|
46
|
+
|
|
47
|
+
const onPopoverShow = () => hoverMenu.value.updateCurrent()
|
|
48
|
+
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<template>
|
|
52
|
+
<el-aside class="sidebar" :class="sidebarClasses">
|
|
53
|
+
<router-link :to="{ path: '/' }" class="logo-name flex-center">
|
|
54
|
+
<img src="/logo.png" alt="logo" class="logo" />
|
|
55
|
+
<span v-show="!collapse" class="site-name">{{ app.sitename }}</span>
|
|
56
|
+
</router-link>
|
|
57
|
+
<el-scrollbar>
|
|
58
|
+
<Menu :menu="menu">
|
|
59
|
+
<template #root-menu="{ node, data }">
|
|
60
|
+
<el-popover
|
|
61
|
+
placement="right"
|
|
62
|
+
:width="200"
|
|
63
|
+
trigger="hover"
|
|
64
|
+
popper-class="menu-popover"
|
|
65
|
+
@show="onPopoverShow"
|
|
66
|
+
>
|
|
67
|
+
<template #reference>
|
|
68
|
+
<Item :data="data" />
|
|
69
|
+
</template>
|
|
70
|
+
<Menu ref="hoverMenu" :menu="data.children" :hover="true" />
|
|
71
|
+
</el-popover>
|
|
72
|
+
</template>
|
|
73
|
+
</Menu>
|
|
74
|
+
</el-scrollbar>
|
|
75
|
+
</el-aside>
|
|
76
|
+
</template>
|
|
77
|
+
|
|
78
|
+
<style lang="scss" scoped>
|
|
79
|
+
.sidebar {
|
|
80
|
+
position: relative;
|
|
81
|
+
background-color: var(--x-sidebar-bg-color);
|
|
82
|
+
color: white;
|
|
83
|
+
overflow-x: hidden;
|
|
84
|
+
animation-duration: v-bind('toggleDuration');
|
|
85
|
+
font-size: 15px;
|
|
86
|
+
&.expand {
|
|
87
|
+
width: var(--x-sidebar-width);
|
|
88
|
+
}
|
|
89
|
+
&.collapse {
|
|
90
|
+
width: var(--x-sidebar-collapse-width);
|
|
91
|
+
}
|
|
92
|
+
&.expanding {
|
|
93
|
+
animation-name: expanding;
|
|
94
|
+
}
|
|
95
|
+
&.collapsing {
|
|
96
|
+
animation-name: collapsing;
|
|
97
|
+
}
|
|
98
|
+
.logo-name {
|
|
99
|
+
position: absolute;
|
|
100
|
+
left: 0;
|
|
101
|
+
top: 0;
|
|
102
|
+
background-color: var(--x-sidebar-bg-color);
|
|
103
|
+
width: var(--x-sidebar-width);
|
|
104
|
+
height: var(--x-header-height);
|
|
105
|
+
line-height: var(--x-header-height);
|
|
106
|
+
z-index: 100;
|
|
107
|
+
font-weight: 600;
|
|
108
|
+
font-style: italic;
|
|
109
|
+
font-size: 18px;
|
|
110
|
+
color: white;
|
|
111
|
+
justify-content: start;
|
|
112
|
+
border-bottom: 1px solid #409eff;
|
|
113
|
+
.logo {
|
|
114
|
+
height: 80%;
|
|
115
|
+
margin: 10% 10px;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
.el-scrollbar {
|
|
119
|
+
width: 100%;
|
|
120
|
+
padding-top: var(--x-header-height);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@keyframes expanding {
|
|
125
|
+
0% {
|
|
126
|
+
width: var(--x-sidebar-collapse-width);
|
|
127
|
+
}
|
|
128
|
+
100% {
|
|
129
|
+
width: var(--x-sidebar-width);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@keyframes collapsing {
|
|
134
|
+
0% {
|
|
135
|
+
width: var(--x-sidebar-width);
|
|
136
|
+
}
|
|
137
|
+
100% {
|
|
138
|
+
width: var(--x-sidebar-collapse-width);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
</style>
|
|
142
|
+
|
|
143
|
+
<style lang="scss">
|
|
144
|
+
.menu-popover {
|
|
145
|
+
padding: 0 !important;
|
|
146
|
+
}
|
|
147
|
+
</style>
|