diff --git a/nezha-fronted/config/index.js b/nezha-fronted/config/index.js index c5eded7f8..f0bc0d882 100644 --- a/nezha-fronted/config/index.js +++ b/nezha-fronted/config/index.js @@ -6,12 +6,18 @@ const path = require('path') module.exports = { dev: { - // Paths assetsSubDirectory: 'static', assetsPublicPath: '/', - proxyTable: {}, - + proxyTable: { + '/api': { + target: 'http://localhost:8088/nz-admin', //设置调用接口域名和端口号别忘了加http + changeOrigin: true, + pathRewrite: { + '^/api': '/' //这里理解成用‘/api’代替target里面的地址,组件中我们调接口时直接用/api代替 + }, + } + }, // Various Dev Server settings host: 'localhost', // can be overwritten by process.env.HOST port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined diff --git a/nezha-fronted/package-lock.json b/nezha-fronted/package-lock.json index 7d2c3621e..330b94fa6 100644 --- a/nezha-fronted/package-lock.json +++ b/nezha-fronted/package-lock.json @@ -289,6 +289,38 @@ "postcss-value-parser": "^3.2.3" } }, + "axios": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz", + "integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==", + "requires": { + "follow-redirects": "1.5.10", + "is-buffer": "^2.0.2" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "requires": { + "debug": "=3.1.0" + } + }, + "is-buffer": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==" + } + } + }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", @@ -6108,8 +6140,7 @@ "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "multicast-dns": { "version": "6.2.3", @@ -11001,6 +11032,16 @@ "integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==", "dev": true }, + "vue-i18n": { + "version": "8.15.1", + "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.15.1.tgz", + "integrity": "sha512-GBbz8qYCu0U2LNu4IcuFLZiuyninG4k26knvhL7GZG5Ncp4RR2VKDEH6g8gQ6I+UUBCvH2MBQVPSdxWe4DBkPw==" + }, + "vue-infinite-scroll": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/vue-infinite-scroll/-/vue-infinite-scroll-2.0.2.tgz", + "integrity": "sha512-n+YghR059YmciANGJh9SsNWRi1YZEBVlODtmnb/12zI+4R72QZSWd+EuZ5mW6auEo/yaJXgxzwsuhvALVnm73A==" + }, "vue-loader": { "version": "13.7.3", "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-13.7.3.tgz", diff --git a/nezha-fronted/src/App.vue b/nezha-fronted/src/App.vue index a2a7be584..e73bf50ea 100644 --- a/nezha-fronted/src/App.vue +++ b/nezha-fronted/src/App.vue @@ -11,12 +11,21 @@ export default { diff --git a/nezha-fronted/src/assets/css/main.css b/nezha-fronted/src/assets/css/main.css index 2ac8421c6..1d1c6a0c5 100644 --- a/nezha-fronted/src/assets/css/main.css +++ b/nezha-fronted/src/assets/css/main.css @@ -11,7 +11,6 @@ body { height: 100%; box-sizing: border-box; } - html { overflow: auto; overflow-y: hidden; @@ -19,6 +18,17 @@ html { height: 100%; box-sizing: border-box; } - - - +/*侧滑文字*/ +.el-form-item .el-form-item__label{ + font-size: 10px; + text-align : left; +} +/*侧滑输入框高度*/ +.el-input .el-input__inner{ + line-height: 26px; + height: 26px; +} +/*侧滑输入框宽度*/ +.el-form-item__content .el-input{ + width: 90%; +} diff --git a/nezha-fronted/src/components/common/Login.vue b/nezha-fronted/src/components/common/Login.vue deleted file mode 100644 index 11a23ae44..000000000 --- a/nezha-fronted/src/components/common/Login.vue +++ /dev/null @@ -1,26 +0,0 @@ - - - - - \ No newline at end of file diff --git a/nezha-fronted/src/components/common/header.vue b/nezha-fronted/src/components/common/header.vue index 2cb1d47bd..2227cec14 100644 --- a/nezha-fronted/src/components/common/header.vue +++ b/nezha-fronted/src/components/common/header.vue @@ -21,6 +21,12 @@ 选项2 选项3 + + + 选项1 + 选项2 + 选项3 +
@@ -91,7 +97,7 @@ export default { \ No newline at end of file diff --git a/nezha-fronted/src/components/common/pagination.vue b/nezha-fronted/src/components/common/pagination.vue new file mode 100644 index 000000000..18e59c76e --- /dev/null +++ b/nezha-fronted/src/components/common/pagination.vue @@ -0,0 +1,64 @@ + + + + + diff --git a/nezha-fronted/src/components/common/SideBar.vue b/nezha-fronted/src/components/common/sideBar.vue similarity index 60% rename from nezha-fronted/src/components/common/SideBar.vue rename to nezha-fronted/src/components/common/sideBar.vue index 8300b4040..324f9c01a 100644 --- a/nezha-fronted/src/components/common/SideBar.vue +++ b/nezha-fronted/src/components/common/sideBar.vue @@ -3,9 +3,9 @@
Project
-
-
-
+ + +
@@ -14,20 +14,20 @@ export default { name: "SiderBar", data(){ return{ - arr:[12,3,4,5,6,7,8,98,54] + // arr:[12,3,4,5,6,7,8,98,54] } }, methods: { - gett: function (index) { - return "sdf" + index - }, - loadMore() { - this.busy = true - setTimeout(() => { - this.page++ - }, 1000) - this.arr.push('1') - } + // gett: function (index) { + // return "sdf" + index + // }, + // loadMore() { + // this.busy = true + // setTimeout(() => { + // this.page++ + // }, 1000) + // this.arr.push('1') + // } } } diff --git a/nezha-fronted/src/components/page/asset/asset.vue b/nezha-fronted/src/components/page/asset/asset.vue index 7bbf806af..f61d396c8 100644 --- a/nezha-fronted/src/components/page/asset/asset.vue +++ b/nezha-fronted/src/components/page/asset/asset.vue @@ -1,15 +1,388 @@ + \ No newline at end of file diff --git a/nezha-fronted/src/main.js b/nezha-fronted/src/main.js index 589dd2b04..bd5fd83b9 100644 --- a/nezha-fronted/src/main.js +++ b/nezha-fronted/src/main.js @@ -8,7 +8,7 @@ import Vue from 'vue' import App from './App' import router from './router' import axios from 'axios'; -import { post, get, patch, put, del } from './components/common/js/http.js' +import { post, get} from './http.js' import Pagination from "./components/common/pagination"; //引入全局分页组件 Vue.component("Pagination", Pagination); @@ -16,13 +16,45 @@ Vue.component("Pagination", Pagination); Vue.prototype.$axios = axios Vue.prototype.$post = post; Vue.prototype.$get = get; -Vue.prototype.$patch = patch; -Vue.prototype.$put = put; -Vue.prototype.$delete = del; Vue.config.productionTip = false Vue.use(ElementUI) + +const clickoutside = { + // 初始化指令 + bind(el, binding, vnode) { + function documentHandler(e) { + // 这里判断点击的元素是否是本身,是本身,则返回 + if (el.contains(e.target)) { + return false; + } + // 判断指令中是否绑定了函数 + if (binding.expression) { + // 如果绑定了函数 则调用那个函数,此处binding.value就是handleClose方法 + if (binding.arg) { + binding.value(e, binding.arg); + } else { + binding.value(e); + } + + } + } + // 给当前元素绑定个私有变量,方便在unbind中可以解除事件监听 + el.__vueClickOutside__ = documentHandler; + document.addEventListener('click', documentHandler); + }, + unbind(el, binding) { + // 解除事件监听 + document.removeEventListener('click', el.__vueClickOutside__); + delete el.__vueClickOutside__; + }, +}; + +Vue.directive('clickoutside', + clickoutside +) + /* eslint-disable no-new */ new Vue({ el: '#app', diff --git a/nezha-fronted/src/router/index.js b/nezha-fronted/src/router/index.js index 13d4964ba..dcdb03c6e 100644 --- a/nezha-fronted/src/router/index.js +++ b/nezha-fronted/src/router/index.js @@ -11,11 +11,11 @@ export default new Router({ }, { path: '/login', - component: resolve => require(['../components/common/Login.vue'], resolve), + component: resolve => require(['../components/common/login.vue'], resolve), }, { path: '/', - component: resolve => require(['../components/common/Home.vue'], resolve), + component: resolve => require(['../components/common/home.vue'], resolve), children: [ { path: '/dashboard', @@ -27,7 +27,11 @@ export default new Router({ }, { path: '/asset', - component: resolve => require(['../components/page/project/project.vue'], resolve), + component: resolve => require(['../components/page/asset/asset.vue'], resolve), + }, + { + path: '/alarm', + component: resolve => require(['../components/page/config/account.vue'], resolve), } ] },