diff --git a/src/api/apibook.js b/src/api/apibook.js new file mode 100644 index 0000000..0f3edba --- /dev/null +++ b/src/api/apibook.js @@ -0,0 +1,34 @@ +import request from '@/utils/request' + + +export function getList(data) { + return request({ + url: '/api/book/list', + method: 'get', + params:data + }) +} + +export function saveBook(data) { + return request({ + url: '/api/book/save', + method: 'post', + data:data + }) +} + +export function updateById(data) { + return request({ + url: '/api/book/updateById', + method: 'post', + data:data + }) +} + +export function deleteById(data) { + return request({ + url: '/api/book/delete', + method: 'get', + params:data + }) +} diff --git a/src/components/Pagination/index.vue b/src/components/Pagination/index.vue new file mode 100644 index 0000000..b638af5 --- /dev/null +++ b/src/components/Pagination/index.vue @@ -0,0 +1,101 @@ + + + + + diff --git a/src/main.js b/src/main.js index 01cba2f..c5d6f13 100644 --- a/src/main.js +++ b/src/main.js @@ -4,7 +4,7 @@ import 'normalize.css/normalize.css' // A modern alternative to CSS resets import ElementUI from 'element-ui' import 'element-ui/lib/theme-chalk/index.css' -import locale from 'element-ui/lib/locale/lang/en' // lang i18n +import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n import '@/styles/index.scss' // global css diff --git a/src/router/index.js b/src/router/index.js index 89c3464..88484f1 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -78,13 +78,28 @@ export const constantRoutes = [ meta: { title: 'U8日志', icon: 'el-icon-s-help' }, children: [ { - path: 'errlist', - name: 'errlist', + path: 'u8log', + name: 'u8log', component: () => import('@/views/logpage/index'), meta: { title: 'U8日志', icon: 'table' } } ] }, + { + path: '/book', + component: Layout, + redirect: '/book', + name: 'book', + meta: { title: '帐套配置', icon: 'el-icon-s-help' }, + children: [ + { + path: 'book', + name: 'book', + component: () => import('@/views/apibook/index'), + meta: { title: '帐套配置', icon: 'table' } + } + ] + }, // 404 page must be placed at the end !!! { path: '*', redirect: '/404', hidden: true } diff --git a/src/utils/scroll-to.js b/src/utils/scroll-to.js new file mode 100644 index 0000000..cd101bf --- /dev/null +++ b/src/utils/scroll-to.js @@ -0,0 +1,69 @@ +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/apibook/index.vue b/src/views/apibook/index.vue new file mode 100644 index 0000000..3874cd5 --- /dev/null +++ b/src/views/apibook/index.vue @@ -0,0 +1,267 @@ + + + diff --git a/src/views/logpage/index.vue b/src/views/logpage/index.vue index e5897b7..138cc0c 100644 --- a/src/views/logpage/index.vue +++ b/src/views/logpage/index.vue @@ -1,5 +1,21 @@