diff --git a/.eslintrc.js b/.eslintrc.js index d75cc61..18c69a3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,4 +1,5 @@ -module.exports = { +// 取消 自定义eslintrc验证 +/* module.exports = { root: true, parserOptions: { parser: 'babel-eslint', @@ -11,8 +12,6 @@ module.exports = { }, extends: ['plugin:vue/recommended', 'eslint:recommended'], - // add your custom rules here - //it is base on https://github.com/vuejs/eslint-config-vue rules: { "vue/max-attributes-per-line": [0, { "singleline": 10, @@ -199,3 +198,30 @@ module.exports = { 'array-bracket-spacing': [2, 'never'] } } + */ +module.exports = { + root: true, + env: { + node: true, + }, + extends: ["plugin:vue/essential", "eslint:recommended"], + parserOptions: { + parser: "babel-eslint", + }, + rules: { + "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", + "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", + /* "prettier/prettier": "off" */ + }, + overrides: [ + { + files: [ + "**/__tests__/*.{j,t}s?(x)", + "**/tests/unit/**/*.spec.{j,t}s?(x)", + ], + env: { + jest: true, + }, + }, + ], + }; diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..62ce7bc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM nginx +RUN mkdir /app +COPY dist /app +COPY nginx/nginx.conf /etc/nginx/nginx.conf +EXPOSE 80 \ No newline at end of file diff --git a/README.md b/README.md index da63b4c..2bbef13 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ @@ -15,3 +15,22 @@ `2021年11月30日` FEATURE - 完成 基本项目开发环境搭建 + + +## v1.0.1F +`2021年12月1日` +FEATURE +- 完成 静态页面编写与交互 + + +## v1.0.2F +`2021年12月2日` +FEATURE +- 增加 docker部署文件 +- 修改 docker部署文件 + +## v1.0.3F +`2021年12月3日` +FEATURE +- merge off-limits-type +- 增加 禁入类别 \ No newline at end of file diff --git a/gps_card_admin_run.sh b/gps_card_admin_run.sh new file mode 100644 index 0000000..264ed36 --- /dev/null +++ b/gps_card_admin_run.sh @@ -0,0 +1,36 @@ +#!/bin/bash +### + # @Date: 2021-11-15 09:37:49 + # @LastEditors: JinxuChen + # @LastEditTime: 2021-12-02 15:19:14 + # @FilePath: \GpsCardAdmin\gps_card_admin_run.sh + # @description: 功能 +### +environment=$1 +version=$2 +echo "环境变量为${environment},版本为$version!" +if [[ ${environment} = 'production' ]]; then + echo "开始远程构建容器" + docker stop gps_card_admin_web || true; + docker rm gps_card_admin_web || true; + docker rmi -f $(docker images | grep registry.cn-shanghai.aliyuncs.com/gps_card/gps_card_admin_web | awk '{print $3}') + #docker login --username=telpo_linwl@1111649216405698 --password=telpo#1234 registry.cn-shanghai.aliyuncs.com; + docker login --username=rzl_wangjx@1111649216405698 --password=telpo.123 registry.cn-shanghai.aliyuncs.com + docker pull registry.cn-shanghai.aliyuncs.com/gps_card/gps_card_admin_web:$version + docker run -p 8803:80 -d --restart=always --name gps_card_admin_web registry.cn-shanghai.aliyuncs.com/gps_card/gps_card_admin_web:$version; + #删除产生的None镜像 + docker rmi -f $(docker images | grep none | awk '{print $3}') + docker ps -a + +elif [[ ${environment} == 'test' ]]; then + echo "开始在测试环境远程构建容器" + docker stop gps_card_admin_web || true + docker rm gps_card_admin_web || true + docker rmi -f $(docker images | grep 139.224.254.18:5000/gps_card_admin_web | awk '{print $3}') + docker pull 139.224.254.18:5000/gps_card_admin_web:$version + docker run -p 8803:80 -d --restart=always --name gps_card_admin_web 139.224.254.18:5000/gps_card_admin_web:$version; + #删除产生的None镜像 + docker rmi -f $(docker images | grep none | awk '{print $3}') + docker ps -a + +fi \ No newline at end of file diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..3de107b --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,57 @@ +#user nobody; +worker_processes 1; + +#error_log logs/error.log; +#error_log logs/error.log notice; +error_log /var/log/nginx/error.log warn; + +pid /var/run/nginx.pid; + + +events { + accept_mutex on; #设置网路连接序列化,防止惊群现象发生,默认为on + multi_accept on; #设置一个进程是否同时接受多个网络连接,默认为off + use epoll; #事件驱动模型,select|poll|kqueue|epoll|resig|/dev/poll|eventport + worker_connections 1024; +} + + +http { + include mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + #access_log logs/access.log main; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + #keepalive_timeout 0; + keepalive_timeout 65; + + + server { + listen 80; + server_name localhost; + + #charset koi8-r; + charset utf-8; + + location / { + root /app; # 指向目录 + index index.html; + try_files $uri $uri/ /index.html; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + } + +} \ 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/setup_development.sh b/setup_development.sh new file mode 100644 index 0000000..eba347c --- /dev/null +++ b/setup_development.sh @@ -0,0 +1,30 @@ +### + # @Author: JinxuChen + # @Date: 2021-11-15 + # @LastEditTime: 2021-12-02 15:19:22 + # @LastEditors: JinxuChen + # @Description: In User Settings Edit + # @FilePath: \GpsCardAdmin\setup_development.sh +### +#!/bin/bash +npm -v +npm config set registry https://registry.npm.taobao.org +npm config list +npm install +npm run build-test +image_version=`date +%Y%m%d%H%M`; +docker stop gps_card_admin_web || true; +# 删除gps_parent_web容器 +docker rm gps_card_admin_web || true; +# 删除镜像 +docker rmi -f $(docker images | grep telpo/gps_card_admin_web | awk '{print $3}') +# 构建telpo/gps_card_admin_web:$image_version镜像 +docker build . -t telpo/gps_card_admin_web:$image_version; +#删除产生的None镜像 +docker rmi -f $(docker images | grep none | awk '{print $3}') +# 查看镜像列表 +docker images; +# 启动容器 +docker run -p 8803:80 -d --restart=always --name gps_card_admin_web telpo/gps_card_admin_web:$image_version; +# 查看日志 +docker logs gps_card_admin_web; diff --git a/setup_production.sh b/setup_production.sh new file mode 100644 index 0000000..b0947a5 --- /dev/null +++ b/setup_production.sh @@ -0,0 +1,28 @@ +### + # @Author: JinxuChen + # @Date: 2021-11-15 + # @LastEditTime: 2021-12-02 15:17:27 + # @LastEditors: JinxuChen + # @Description: In User Settings Edit + # @FilePath: \GpsCardAdmin\setup_production.sh +### +#!/bin/bash +npm -v +npm install +npm run build +image_version=$version; +# 删除镜像 + docker rmi -f $(docker images | grep registry.cn-shanghai.aliyuncs.com/gps_card/gps_card_admin_web | awk '{print $3}') + +docker build . -t telpo/gps_card_admin_web:$image_version; +#TODO:推送镜像到阿里仓库 +echo '=================开始推送镜像=======================' +#docker login --username=telpo_linwl@1111649216405698 --password=telpo#1234 registry.cn-shanghai.aliyuncs.com; +docker login --username=rzl_wangjx@1111649216405698 --password=telpo.123 registry.cn-shanghai.aliyuncs.com +docker tag telpo/gps_card_admin_web:$image_version registry.cn-shanghai.aliyuncs.com/gps_card/gps_card_admin_web:$image_version +docker push registry.cn-shanghai.aliyuncs.com/gps_card/gps_card_admin_web:$image_version +echo '=================推送镜像完成=======================' +#删除产生的None镜像 +docker rmi -f $(docker images | grep none | awk '{print $3}') +# 查看镜像列表 +docker images; diff --git a/setup_test.sh b/setup_test.sh new file mode 100644 index 0000000..f15b3e0 --- /dev/null +++ b/setup_test.sh @@ -0,0 +1,31 @@ +### + # @Author: JinxuChen + # @Date: 2021-11-15 + # @LastEditTime: 2021-12-02 15:17:38 + # @LastEditors: JinxuChen + # @Description: In User Settings Edit + # @FilePath: \GpsCardAdmin\setup_test.sh +### +#!/usr/bin/env bash +npm -v +npm config set registry https://registry.npm.taobao.org +npm config list +npm install +npm run build-test + +image_version=$version +# 删除镜像 +docker rmi -f $( + docker images | grep 139.224.254.18:5000/gps_card_admin_web | awk '{print $3}' +) +# 构建gps_card_admin:$image_version镜像 +docker build . -t telpo/gps_card_admin_web:$image_version; +#TODO:推送镜像到私有仓库 +echo '=================开始推送镜像=======================' +docker tag telpo/gps_card_admin_web:$image_version 139.224.254.18:5000/gps_card_admin_web:$image_version +docker push 139.224.254.18:5000/gps_card_admin_web:$image_version +echo '=================推送镜像完成=======================' +#删除产生的None镜像 +docker rmi -f $(docker images | grep none | awk '{print $3}') +# 查看镜像列表 +docker images \ No newline at end of file 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..15a05cd 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-03 15:26:11 * @FilePath: \GpsCardAdmin\src\utils\model.js * @description: 版本号 */ -export const VersionModel = '1.0.0'; \ No newline at end of file +export const VersionModel = '1.0.3'; \ 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..af46511 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,27 +1,332 @@ - - + \ No newline at end of file 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 +