diff --git a/src/api/tip.js b/src/api/tip.js new file mode 100644 index 0000000000000000000000000000000000000000..8a836006f9bdf682ec69a035bc5bc18907bb8f8f --- /dev/null +++ b/src/api/tip.js @@ -0,0 +1,8 @@ +import request from '@/util/request' + +export function getTodayTip() { + return request({ + url: '/tip/today', + method: 'get' + }) +} \ No newline at end of file diff --git a/src/api/user.js b/src/api/user.js new file mode 100644 index 0000000000000000000000000000000000000000..0aec26031dddbd7ec11b7231d40af90b052b4048 --- /dev/null +++ b/src/api/user.js @@ -0,0 +1,28 @@ +import request from '@/util/request' + +// 用户主页 +export function getInfoByName(username, page, size) { + return request({ + url: '/ums/user/' + username, + method: 'get', + params: { + pageNo: page, + size: size + } + }) +} +// 用户主页 +export function getInfo() { + return request({ + url: '/ums/user/info', + method: 'get' + }) +} +// 更新 +export function update(user) { + return request({ + url: '/ums/user/update', + method: 'post', + data: user + }) +} \ 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 0000000000000000000000000000000000000000..1b31c9f5b7a54acd00e1a8639fe924416e4e3968 --- /dev/null +++ b/src/components/Pagination/index.vue @@ -0,0 +1,101 @@ + + + + + \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index 3ee5ac61ff81272196ab5aa822bafcc7d6bf2891..21300495c4b408c68061b9fbf6423b8bbf4e65b5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -3,13 +3,29 @@ import VueRouter from 'vue-router' Vue.use(VueRouter) -const routes = [{ - path: '/', - name: 'Home', - component: () => +const routes = [ + { + name: 'Home', + path: '/', + component: () => import ('@/view/Home') -}] + }, + //用户主页 + { + name:'user', + path:'/member/home', + component: () => import('@/view/user/Profile'), + meta: {title: '用户主页'} + } , + //用户设置 + { + name: 'user-setting', + path: '/member/Setting', + component: () => import('@/view/user/Setting'), + meta:{ title: '设置'} + } +]; -const router = new VueRouter({ routes }) +const router = new VueRouter({ routes }); -export default router \ No newline at end of file +export default router; \ No newline at end of file diff --git a/src/util/scroll-to.js b/src/util/scroll-to.js new file mode 100644 index 0000000000000000000000000000000000000000..331ef4762e5172acbdd17a4ab56ce83dfa847471 --- /dev/null +++ b/src/util/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() + } \ No newline at end of file diff --git a/src/view/Home.vue b/src/view/Home.vue index c0f7fa2ced5b61b29f47f85fe96ecfb5d386d563..4a402ebc9984792436961ed958523ed991e81ef8 100644 --- a/src/view/Home.vue +++ b/src/view/Home.vue @@ -1,20 +1,31 @@ + + \ No newline at end of file diff --git a/src/view/card/LoginWelcome.vue b/src/view/card/LoginWelcome.vue new file mode 100644 index 0000000000000000000000000000000000000000..499ef2dd5471e2fdf3c68c5d35d6df5a2206d321 --- /dev/null +++ b/src/view/card/LoginWelcome.vue @@ -0,0 +1,30 @@ + + + + + \ No newline at end of file diff --git a/src/view/card/Promotion.vue b/src/view/card/Promotion.vue new file mode 100644 index 0000000000000000000000000000000000000000..6313947a3dd6e0c2dc6bf0ba55fda01d5aaddf43 --- /dev/null +++ b/src/view/card/Promotion.vue @@ -0,0 +1,30 @@ + + + + + \ No newline at end of file diff --git a/src/view/card/Tip.vue b/src/view/card/Tip.vue new file mode 100644 index 0000000000000000000000000000000000000000..ec8c434acc1ec83cd1a0b89968cd0374e2ad57e2 --- /dev/null +++ b/src/view/card/Tip.vue @@ -0,0 +1,41 @@ + + + + + \ No newline at end of file diff --git a/src/view/post/Index.vue b/src/view/post/Index.vue new file mode 100644 index 0000000000000000000000000000000000000000..d5f74a5e30e6c7cd0d88eac35b1b1d6dcf53e9e4 --- /dev/null +++ b/src/view/post/Index.vue @@ -0,0 +1,32 @@ + + + + + \ No newline at end of file diff --git a/src/view/user/Profile.vue b/src/view/user/Profile.vue new file mode 100644 index 0000000000000000000000000000000000000000..f3bc1438943903993e9e0465e64629e90fa99044 --- /dev/null +++ b/src/view/user/Profile.vue @@ -0,0 +1,135 @@ + + + + + + diff --git a/src/view/user/Setting.vue b/src/view/user/Setting.vue new file mode 100644 index 0000000000000000000000000000000000000000..e109e74df4a88ebfe80e8a1bc1dc94f2beafd39f --- /dev/null +++ b/src/view/user/Setting.vue @@ -0,0 +1,118 @@ + + + + + \ No newline at end of file