From 0881d26a75d6c5891a91330a7dba7fd1d71597ea Mon Sep 17 00:00:00 2001 From: 2183691628 <2183691628@qq.com> Date: Wed, 1 Dec 2021 18:19:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E9=9D=99=E6=80=81?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=BC=96=E5=86=99=E4=B8=8E=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 +- package.json | 3 +- src/components/Pagination/index.vue | 102 ++++++ src/components/TTable/TTable.vue | 97 ++++++ src/components/TopMenu/index.vue | 38 +++ src/components/UploadExcel/index.vue | 137 +++++++++ src/directive/waves/index.js | 13 + src/directive/waves/waves.css | 26 ++ src/directive/waves/waves.js | 72 +++++ src/layout/components/Navbar.vue | 230 +++++++------- src/main.js | 11 +- src/router/index.js | 5 +- src/styles/index.scss | 2 +- src/utils/model.js | 4 +- src/utils/scroll-to.js | 58 ++++ .../off-limits-manage/alarm-query/index.vue | 114 ++++++- .../alarm-recognition/index.vue | 291 +++++++++++++++++- .../common-exception/index.vue | 209 ++++++++++++- .../off-limits-main/off-limits-type/index.vue | 4 +- .../user-exception/index.vue | 165 +++++++++- 20 files changed, 1428 insertions(+), 161 deletions(-) create mode 100644 src/components/Pagination/index.vue create mode 100644 src/components/TTable/TTable.vue create mode 100644 src/components/TopMenu/index.vue create mode 100644 src/components/UploadExcel/index.vue create mode 100644 src/directive/waves/index.js create mode 100644 src/directive/waves/waves.css create mode 100644 src/directive/waves/waves.js create mode 100644 src/utils/scroll-to.js diff --git a/README.md b/README.md index da63b4c..a742b1f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ @@ -15,3 +15,9 @@ `2021年11月30日` FEATURE - 完成 基本项目开发环境搭建 + + +## v1.0.1F +`2021年12月1日` +FEATURE +- 完成 静态页面编写与交互 \ No newline at end of file diff --git a/package.json b/package.json index b6877f5..029240d 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,8 @@ "path-to-regexp": "2.4.0", "vue": "2.6.10", "vue-router": "3.0.6", - "vuex": "3.1.0" + "vuex": "3.1.0", + "xlsx": "0.14.1" }, "devDependencies": { "@vue/cli-plugin-babel": "4.4.4", diff --git a/src/components/Pagination/index.vue b/src/components/Pagination/index.vue new file mode 100644 index 0000000..94916f1 --- /dev/null +++ b/src/components/Pagination/index.vue @@ -0,0 +1,102 @@ + + + + + diff --git a/src/components/TTable/TTable.vue b/src/components/TTable/TTable.vue new file mode 100644 index 0000000..606ac92 --- /dev/null +++ b/src/components/TTable/TTable.vue @@ -0,0 +1,97 @@ + + + + + + diff --git a/src/components/TopMenu/index.vue b/src/components/TopMenu/index.vue new file mode 100644 index 0000000..ebaf1e0 --- /dev/null +++ b/src/components/TopMenu/index.vue @@ -0,0 +1,38 @@ + + + + + + diff --git a/src/components/UploadExcel/index.vue b/src/components/UploadExcel/index.vue new file mode 100644 index 0000000..1102e69 --- /dev/null +++ b/src/components/UploadExcel/index.vue @@ -0,0 +1,137 @@ + + + + + diff --git a/src/directive/waves/index.js b/src/directive/waves/index.js new file mode 100644 index 0000000..65f9b30 --- /dev/null +++ b/src/directive/waves/index.js @@ -0,0 +1,13 @@ +import waves from './waves' + +const install = function(Vue) { + Vue.directive('waves', waves) +} + +if (window.Vue) { + window.waves = waves + Vue.use(install); // eslint-disable-line +} + +waves.install = install +export default waves diff --git a/src/directive/waves/waves.css b/src/directive/waves/waves.css new file mode 100644 index 0000000..af7a7ef --- /dev/null +++ b/src/directive/waves/waves.css @@ -0,0 +1,26 @@ +.waves-ripple { + position: absolute; + border-radius: 100%; + background-color: rgba(0, 0, 0, 0.15); + background-clip: padding-box; + pointer-events: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + -webkit-transform: scale(0); + -ms-transform: scale(0); + transform: scale(0); + opacity: 1; +} + +.waves-ripple.z-active { + opacity: 0; + -webkit-transform: scale(2); + -ms-transform: scale(2); + transform: scale(2); + -webkit-transition: opacity 1.2s ease-out, -webkit-transform 0.6s ease-out; + transition: opacity 1.2s ease-out, -webkit-transform 0.6s ease-out; + transition: opacity 1.2s ease-out, transform 0.6s ease-out; + transition: opacity 1.2s ease-out, transform 0.6s ease-out, -webkit-transform 0.6s ease-out; +} \ No newline at end of file diff --git a/src/directive/waves/waves.js b/src/directive/waves/waves.js new file mode 100644 index 0000000..ec2ff43 --- /dev/null +++ b/src/directive/waves/waves.js @@ -0,0 +1,72 @@ +import './waves.css' + +const context = '@@wavesContext' + +function handleClick(el, binding) { + function handle(e) { + const customOpts = Object.assign({}, binding.value) + const opts = Object.assign({ + ele: el, // 波纹作用元素 + type: 'hit', // hit 点击位置扩散 center中心点扩展 + color: 'rgba(0, 0, 0, 0.15)' // 波纹颜色 + }, + customOpts + ) + const target = opts.ele + if (target) { + target.style.position = 'relative' + target.style.overflow = 'hidden' + const rect = target.getBoundingClientRect() + let ripple = target.querySelector('.waves-ripple') + if (!ripple) { + ripple = document.createElement('span') + ripple.className = 'waves-ripple' + ripple.style.height = ripple.style.width = Math.max(rect.width, rect.height) + 'px' + target.appendChild(ripple) + } else { + ripple.className = 'waves-ripple' + } + switch (opts.type) { + case 'center': + ripple.style.top = rect.height / 2 - ripple.offsetHeight / 2 + 'px' + ripple.style.left = rect.width / 2 - ripple.offsetWidth / 2 + 'px' + break + default: + ripple.style.top = + (e.pageY - rect.top - ripple.offsetHeight / 2 - document.documentElement.scrollTop || + document.body.scrollTop) + 'px' + ripple.style.left = + (e.pageX - rect.left - ripple.offsetWidth / 2 - document.documentElement.scrollLeft || + document.body.scrollLeft) + 'px' + } + ripple.style.backgroundColor = opts.color + ripple.className = 'waves-ripple z-active' + return false + } + } + + if (!el[context]) { + el[context] = { + removeHandle: handle + } + } else { + el[context].removeHandle = handle + } + + return handle +} + +export default { + bind(el, binding) { + el.addEventListener('click', handleClick(el, binding), false) + }, + update(el, binding) { + el.removeEventListener('click', el[context].removeHandle, false) + el.addEventListener('click', handleClick(el, binding), false) + }, + unbind(el) { + el.removeEventListener('click', el[context].removeHandle, false) + el[context] = null + delete el[context] + } +} diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index bd3a328..c28b843 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -1,136 +1,150 @@ diff --git a/src/main.js b/src/main.js index 01cba2f..e3c286e 100644 --- a/src/main.js +++ b/src/main.js @@ -1,3 +1,10 @@ +/* + * @Date: 2021-11-30 15:35:16 + * @LastEditors: JinxuChen + * @LastEditTime: 2021-11-30 17:51:56 + * @FilePath: \GpsCardAdmin\src\main.js + * @description: + */ import Vue from 'vue' import 'normalize.css/normalize.css' // A modern alternative to CSS resets @@ -29,9 +36,9 @@ if (process.env.NODE_ENV === 'production') { } // set ElementUI lang to EN -Vue.use(ElementUI, { locale }) +/* Vue.use(ElementUI, { locale }) */ // 如果想要中文版 element-ui,按如下方式声明 -// Vue.use(ElementUI) +Vue.use(ElementUI) Vue.config.productionTip = false diff --git a/src/router/index.js b/src/router/index.js index 14cf0f4..ecbc9d3 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -103,7 +103,8 @@ export const constantRoutes = [{ icon: 'el-icon-user-solid' } }, - { + // todo 一期先不做这个功能 后面原型图确认了再做 + /* { path: 'related-setting', name: 'related-setting', component: () => import('@/views/off-limits-manage/related-setting/index'), @@ -111,7 +112,7 @@ export const constantRoutes = [{ title: '相关设置', icon: 'el-icon-s-tools' } - }, + }, */ { path: 'alarm-query', name: 'alarm-query', diff --git a/src/styles/index.scss b/src/styles/index.scss index 3b4da51..588523d 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -61,5 +61,5 @@ div:focus { // main-container global css .app-container { - padding: 20px; + padding: 20px 10px; } diff --git a/src/utils/model.js b/src/utils/model.js index 33669c0..9aaa3ae 100644 --- a/src/utils/model.js +++ b/src/utils/model.js @@ -1,8 +1,8 @@ /* * @Date: 2021-11-30 15:09:25 * @LastEditors: JinxuChen - * @LastEditTime: 2021-11-30 15:09:49 + * @LastEditTime: 2021-12-01 18:17:55 * @FilePath: \GpsCardAdmin\src\utils\model.js * @description: 版本号 */ -export const VersionModel = '1.0.0'; \ No newline at end of file +export const VersionModel = '1.0.1'; \ No newline at end of file diff --git a/src/utils/scroll-to.js b/src/utils/scroll-to.js new file mode 100644 index 0000000..c5d8e04 --- /dev/null +++ b/src/utils/scroll-to.js @@ -0,0 +1,58 @@ +Math.easeInOutQuad = function(t, b, c, d) { + t /= d / 2 + if (t < 1) { + return c / 2 * t * t + b + } + t-- + return -c / 2 * (t * (t - 2) - 1) + b +} + +// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts +var requestAnimFrame = (function() { + return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60) } +})() + +/** + * Because it's so fucking difficult to detect the scrolling element, just move them all + * @param {number} amount + */ +function move(amount) { + document.documentElement.scrollTop = amount + document.body.parentNode.scrollTop = amount + document.body.scrollTop = amount +} + +function position() { + return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop +} + +/** + * @param {number} to + * @param {number} duration + * @param {Function} callback + */ +export function scrollTo(to, duration, callback) { + const start = position() + const change = to - start + const increment = 20 + let currentTime = 0 + duration = (typeof (duration) === 'undefined') ? 500 : duration + var animateScroll = function() { + // increment the time + currentTime += increment + // find the value with the quadratic in-out easing function + var val = Math.easeInOutQuad(currentTime, start, change, duration) + // move the document.body + move(val) + // do the animation unless its over + if (currentTime < duration) { + requestAnimFrame(animateScroll) + } else { + if (callback && typeof (callback) === 'function') { + // the animation is done so lets callback + callback() + } + } + } + animateScroll() +} diff --git a/src/views/off-limits-manage/alarm-query/index.vue b/src/views/off-limits-manage/alarm-query/index.vue index 7f52e7b..7afad8b 100644 --- a/src/views/off-limits-manage/alarm-query/index.vue +++ b/src/views/off-limits-manage/alarm-query/index.vue @@ -1,27 +1,115 @@ diff --git a/src/views/off-limits-manage/alarm-recognition/index.vue b/src/views/off-limits-manage/alarm-recognition/index.vue index 353fd52..17c67e6 100644 --- a/src/views/off-limits-manage/alarm-recognition/index.vue +++ b/src/views/off-limits-manage/alarm-recognition/index.vue @@ -1,27 +1,298 @@ diff --git a/src/views/off-limits-manage/common-exception/index.vue b/src/views/off-limits-manage/common-exception/index.vue index 9d77fa5..284368e 100644 --- a/src/views/off-limits-manage/common-exception/index.vue +++ b/src/views/off-limits-manage/common-exception/index.vue @@ -1,27 +1,210 @@ diff --git a/src/views/off-limits-manage/off-limits-main/off-limits-type/index.vue b/src/views/off-limits-manage/off-limits-main/off-limits-type/index.vue index babc5cb..bf359fa 100644 --- a/src/views/off-limits-manage/off-limits-main/off-limits-type/index.vue +++ b/src/views/off-limits-manage/off-limits-main/off-limits-type/index.vue @@ -1,7 +1,7 @@ @@ -16,7 +16,7 @@ export default { name:'', data(){ return { - + name: '' } } } diff --git a/src/views/off-limits-manage/user-exception/index.vue b/src/views/off-limits-manage/user-exception/index.vue index d595800..d284e49 100644 --- a/src/views/off-limits-manage/user-exception/index.vue +++ b/src/views/off-limits-manage/user-exception/index.vue @@ -1,24 +1,177 @@ \ No newline at end of file +