From a184ebf5d344d8a24f206d67fa8c79d117e258ec Mon Sep 17 00:00:00 2001 From: lyt <1105290566@qq.com> Date: Fri, 30 Apr 2021 16:15:43 +0800 Subject: [PATCH] =?UTF-8?q?'admin-21.04.30:=E6=96=B0=E5=A2=9E=E6=B3=A2?= =?UTF-8?q?=E6=B5=AA=E6=95=88=E6=9E=9C=E6=8C=87=E4=BB=A4=E5=8F=8A=E6=BC=94?= =?UTF-8?q?=E7=A4=BA=E3=80=81=E7=AA=97=E6=A0=BC=E6=8B=86=E5=88=86=E5=99=A8?= =?UTF-8?q?=E7=AD=89'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + package.json | 3 +- src/i18n/lang/en.ts | 2 + src/i18n/lang/zh-cn.ts | 2 + src/i18n/lang/zh-tw.ts | 2 + src/main.ts | 4 +- src/router/index.ts | 30 ++++++++ src/theme/index.scss | 1 + src/theme/waves.scss | 101 +++++++++++++++++++++++++ src/utils/authDirective.ts | 1 + src/utils/customDirective.ts | 50 +++++++++++++ src/utils/directive.ts | 11 +++ src/utils/setIconfont.ts | 2 +- src/views/fun/splitpanes/index.vue | 52 +++++++++++++ src/views/pages/waterfall/index.vue | 10 +-- src/views/pages/waves/index.vue | 112 ++++++++++++++++++++++++++++ 16 files changed, 372 insertions(+), 12 deletions(-) create mode 100644 src/theme/waves.scss create mode 100644 src/utils/customDirective.ts create mode 100644 src/utils/directive.ts create mode 100644 src/views/fun/splitpanes/index.vue create mode 100644 src/views/pages/waves/index.vue diff --git a/README.md b/README.md index 2d849e08..9e9a6170 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,7 @@ cnpm run build - print-js - vue-web-screen-shot - vue-grid-layout +- splitpanes #### 特别感谢 diff --git a/package.json b/package.json index 640ea695..2a5b30c9 100644 --- a/package.json +++ b/package.json @@ -21,13 +21,14 @@ "qrcodejs2-fixes": "^0.0.2", "screenfull": "^5.1.0", "sortablejs": "^1.13.0", + "splitpanes": "^3.0.4", "vue": "^3.0.5", "vue-grid-layout": "^3.0.0-beta1", "vue-i18n": "^9.1.4", "vue-router": "^4.0.2", "vue-web-screen-shot": "^1.1.9", "vuex": "^4.0.0-rc.2", - "wangeditor": "^4.6.16" + "wangeditor": "^4.6.17" }, "devDependencies": { "@types/axios": "^0.14.0", diff --git a/src/i18n/lang/en.ts b/src/i18n/lang/en.ts index af5bf300..f1494117 100644 --- a/src/i18n/lang/en.ts +++ b/src/i18n/lang/en.ts @@ -33,6 +33,7 @@ export default { funClipboard: 'Copy cut', funScreenShort: 'screenCapture', funGridLayout: 'Drag layout', + funSplitpanes: 'Pane splitter', pagesIndex: 'pages', pagesFiltering: 'Filtering', pagesFilteringDetails: 'FilteringDetails', @@ -46,6 +47,7 @@ export default { pagesWaterfall: 'Waterfall', pagesSteps: 'Steps', pagesPreview: 'Large preview', + pagesWaves: 'Wave effect', chartIndex: 'chartIndex', personal: 'personal', tools: 'tools', diff --git a/src/i18n/lang/zh-cn.ts b/src/i18n/lang/zh-cn.ts index 8ceceeae..c88fc5f0 100644 --- a/src/i18n/lang/zh-cn.ts +++ b/src/i18n/lang/zh-cn.ts @@ -33,6 +33,7 @@ export default { funClipboard: '复制剪切', funScreenShort: 'web端自定义截屏', funGridLayout: '拖拽布局', + funSplitpanes: '窗格拆分器', pagesIndex: '页面', pagesFiltering: '过滤筛选组件', pagesFilteringDetails: '过滤筛选组件详情', @@ -46,6 +47,7 @@ export default { pagesWaterfall: '瀑布屏', pagesSteps: '步骤条', pagesPreview: '大图预览', + pagesWaves: '波浪效果', chartIndex: '大数据图表', personal: '个人中心', tools: '工具类集合', diff --git a/src/i18n/lang/zh-tw.ts b/src/i18n/lang/zh-tw.ts index 16ef697e..4849a74a 100644 --- a/src/i18n/lang/zh-tw.ts +++ b/src/i18n/lang/zh-tw.ts @@ -33,6 +33,7 @@ export default { funClipboard: '複製剪切', funScreenShort: '自定義截圖', funGridLayout: '拖拽佈局', + funSplitpanes: '窗格折開器', pagesIndex: '頁面', pagesFiltering: '過濾篩選組件', pagesFilteringDetails: '過濾篩選組件詳情', @@ -46,6 +47,7 @@ export default { pagesWaterfall: '瀑布屏', pagesSteps: '步驟條', pagesPreview: '大圖預覽', + pagesWaves: '波浪效果', chartIndex: '大資料圖表', personal: '個人中心', tools: '工具類集合', diff --git a/src/main.ts b/src/main.ts index 27cab171..41cbd9ab 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,7 +2,7 @@ import { createApp } from 'vue'; import App from './App.vue'; import router from './router'; import { store, key } from './store'; -import { authDirective } from '/@/utils/authDirective.ts'; +import { directive } from '/@/utils/directive.ts'; import { i18n } from '/@/i18n/index.ts'; import { globalComponentSize } from '/@/utils/componentSize.ts'; @@ -25,4 +25,4 @@ app app.config.globalProperties.mittBus = mitt(); -authDirective(app); +directive(app); diff --git a/src/router/index.ts b/src/router/index.ts index 4869a19f..ee3a70c5 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -514,6 +514,21 @@ export const dynamicRoutes = [ icon: 'iconfont icon-tuodong', }, }, + { + path: '/fun/splitpanes', + name: 'funSplitpanes', + component: () => import('/@/views/fun/splitpanes/index.vue'), + meta: { + title: 'message.router.funSplitpanes', + isLink: '', + isHide: false, + isKeepAlive: true, + isAffix: false, + isIframe: false, + auth: ['admin', 'test'], + icon: 'iconfont icon--chaifenlie', + }, + }, ], }, { @@ -712,6 +727,21 @@ export const dynamicRoutes = [ icon: 'iconfont icon-15tupianyulan', }, }, + { + path: '/pages/waves', + name: 'pagesWaves', + component: () => import('/@/views/pages/waves/index.vue'), + meta: { + title: 'message.router.pagesWaves', + isLink: '', + isHide: false, + isKeepAlive: true, + isAffix: false, + isIframe: false, + auth: ['admin', 'test'], + icon: 'iconfont icon-bolangneng', + }, + }, ], }, { diff --git a/src/theme/index.scss b/src/theme/index.scss index 394edb55..92263947 100644 --- a/src/theme/index.scss +++ b/src/theme/index.scss @@ -4,3 +4,4 @@ @import './element.scss'; @import './iconSelector.scss'; @import './media/media.scss'; +@import './waves.scss'; diff --git a/src/theme/waves.scss b/src/theme/waves.scss new file mode 100644 index 00000000..23add2cb --- /dev/null +++ b/src/theme/waves.scss @@ -0,0 +1,101 @@ +/* Waves v0.6.0 +* http://fian.my.id/Waves +* +* Copyright 2014 Alfiana E. Sibuea and other contributors +* Released under the MIT license +* https://github.com/fians/Waves/blob/master/LICENSE +*/ +.waves-effect { + position: relative; + cursor: pointer; + display: inline-block; + overflow: hidden; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + -webkit-tap-highlight-color: transparent; + vertical-align: middle; + z-index: 1; + will-change: opacity, transform; + transition: all 0.3s ease-out; +} +.waves-effect .waves-ripple { + position: absolute; + border-radius: 50%; + width: 20px; + height: 20px; + margin-top: -10px; + margin-left: -10px; + opacity: 0; + background: rgba(0, 0, 0, 0.2); + transition: all 0.7s ease-out; + transition-property: opacity, -webkit-transform; + transition-property: transform, opacity; + transition-property: transform, opacity, -webkit-transform; + -webkit-transform: scale(0); + transform: scale(0); + pointer-events: none; +} +.waves-effect.waves-light .waves-ripple { + background-color: rgba(255, 255, 255, 0.45); +} +.waves-effect.waves-red .waves-ripple { + background-color: rgba(244, 67, 54, 0.7); +} +.waves-effect.waves-yellow .waves-ripple { + background-color: rgba(255, 235, 59, 0.7); +} +.waves-effect.waves-orange .waves-ripple { + background-color: rgba(255, 152, 0, 0.7); +} +.waves-effect.waves-purple .waves-ripple { + background-color: rgba(156, 39, 176, 0.7); +} +.waves-effect.waves-green .waves-ripple { + background-color: rgba(76, 175, 80, 0.7); +} +.waves-effect.waves-teal .waves-ripple { + background-color: rgba(0, 150, 136, 0.7); +} +.waves-effect input[type='button'], +.waves-effect input[type='reset'], +.waves-effect input[type='submit'] { + border: 0; + font-style: normal; + font-size: inherit; + text-transform: inherit; + background: none; +} +.waves-notransition { + transition: none !important; +} +.waves-circle { + -webkit-transform: translateZ(0); + transform: translateZ(0); + -webkit-mask-image: -webkit-radial-gradient(circle, #fff 100%, #000 100%); +} +.waves-input-wrapper { + border-radius: 0.2em; + vertical-align: bottom; +} +.waves-input-wrapper .waves-button-input { + position: relative; + top: 0; + left: 0; + z-index: 1; +} +.waves-circle { + text-align: center; + width: 2.5em; + height: 2.5em; + line-height: 2.5em; + border-radius: 50%; + -webkit-mask-image: none; +} +.waves-block { + display: block; +} +a.waves-effect .waves-ripple { + z-index: -1; +} diff --git a/src/utils/authDirective.ts b/src/utils/authDirective.ts index cb110972..18eab6e7 100644 --- a/src/utils/authDirective.ts +++ b/src/utils/authDirective.ts @@ -2,6 +2,7 @@ import type { App } from 'vue'; import { store } from '/@/store/index.ts'; import { judementSameArr } from '/@/utils/arrayOperation.ts'; +// 用户权限指令 export function authDirective(app: App) { // 单个权限验证(v-auth="xxx") app.directive('auth', { diff --git a/src/utils/customDirective.ts b/src/utils/customDirective.ts new file mode 100644 index 00000000..53911214 --- /dev/null +++ b/src/utils/customDirective.ts @@ -0,0 +1,50 @@ +import type { App } from 'vue'; + +// 按钮波浪指令 +export function wavesDirective(app: App) { + app.directive('waves', { + mounted(el, binding) { + el.classList.add('waves-effect'); + binding.value && el.classList.add('waves-' + binding.value); + function setConvertStyle(obj: any) { + let style: string = ''; + for (let i in obj) { + if (obj.hasOwnProperty(i)) style += i + ':' + obj[i] + ';'; + } + return style; + } + function onCurrentClick(e: any) { + let elDiv = document.createElement('div'); + elDiv.classList.add('waves-ripple'); + el.appendChild(elDiv); + let styles = { + left: `${e.layerX}px`, + top: `${e.layerY}px`, + opacity: 1, + transform: `scale(${(el.clientWidth / 100) * 10})`, + 'transition-duration': `750ms`, + 'transition-timing-function': `cubic-bezier(0.250, 0.460, 0.450, 0.940)`, + }; + elDiv.setAttribute('style', setConvertStyle(styles)); + setTimeout(() => { + elDiv.setAttribute( + 'style', + setConvertStyle({ + opacity: 0, + transform: styles.transform, + left: styles.left, + top: styles.top, + }) + ); + setTimeout(() => { + elDiv && el.removeChild(elDiv); + }, 750); + }, 450); + } + el.addEventListener('mousedown', onCurrentClick, false); + }, + unmounted(el) { + el.addEventListener('mousedown', () => {}); + }, + }); +} diff --git a/src/utils/directive.ts b/src/utils/directive.ts new file mode 100644 index 00000000..8a6b5b0a --- /dev/null +++ b/src/utils/directive.ts @@ -0,0 +1,11 @@ +import type { App } from 'vue'; +import { authDirective } from '/@/utils/authDirective.ts'; +import { wavesDirective } from '/@/utils/customDirective.ts'; + +// 导出指令方法 +export function directive(app: App) { + // 用户权限指令 + authDirective(app); + // 按钮波浪指令 + wavesDirective(app); +} diff --git a/src/utils/setIconfont.ts b/src/utils/setIconfont.ts index 5832850b..9f805dce 100644 --- a/src/utils/setIconfont.ts +++ b/src/utils/setIconfont.ts @@ -1,6 +1,6 @@ // 字体图标 url const cssCdnUrlList: Array = [ - '//at.alicdn.com/t/font_2298093_omfjza0tsa.css', + '//at.alicdn.com/t/font_2298093_zyqji9hnk.css', '//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css', ]; // 第三方 js url diff --git a/src/views/fun/splitpanes/index.vue b/src/views/fun/splitpanes/index.vue new file mode 100644 index 00000000..9db3d3f0 --- /dev/null +++ b/src/views/fun/splitpanes/index.vue @@ -0,0 +1,52 @@ + + + + + diff --git a/src/views/pages/waterfall/index.vue b/src/views/pages/waterfall/index.vue index 05ce57e4..d0b95abd 100644 --- a/src/views/pages/waterfall/index.vue +++ b/src/views/pages/waterfall/index.vue @@ -2,7 +2,7 @@
-
+
{{ v }}
@@ -11,7 +11,7 @@
-
+
{{ v }}
@@ -62,9 +62,6 @@ export default { transition: all 0.3s ease; cursor: pointer; } - &:active { - opacity: 0.5; - } } } .waterfall-last { @@ -84,9 +81,6 @@ export default { transition: all 0.3s ease; cursor: pointer; } - &:active { - opacity: 0.5; - } } } @media (min-width: 576px) { diff --git a/src/views/pages/waves/index.vue b/src/views/pages/waves/index.vue new file mode 100644 index 00000000..04386141 --- /dev/null +++ b/src/views/pages/waves/index.vue @@ -0,0 +1,112 @@ + + + + +