From 7ffb617367fb77d1194bb392e212f21535b7edae Mon Sep 17 00:00:00 2001 From: ewall <1054064180@qq.com> Date: Tue, 31 Mar 2020 21:51:01 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9Auser-info?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 + src/icons/svg/copy.svg | 1 + src/icons/svg/good.svg | 2 +- src/icons/svg/save.svg | 1 + src/store/getters.js | 4 +- src/store/modules/user.js | 13 ++-- src/views/detail/index.vue | 7 ++- src/views/user/index.vue | 24 ++++--- src/views/user/modules/Info.vue | 85 +++++++++++++++++++++++++ src/views/user/modules/Order.vue | 104 +++++++++++++++++++++++++++++++ src/views/user/modules/Tools.vue | 25 ++++++++ 11 files changed, 246 insertions(+), 22 deletions(-) create mode 100644 src/icons/svg/copy.svg create mode 100644 src/icons/svg/save.svg create mode 100644 src/views/user/modules/Info.vue create mode 100644 src/views/user/modules/Order.vue create mode 100644 src/views/user/modules/Tools.vue diff --git a/package.json b/package.json index 6508732..e698a16 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "url": "git+https://github.com/Ewall1106/mall" }, "scripts": { + "dev": "vue-cli-service serve", "serve": "vue-cli-service serve", "build": "vue-cli-service build", "lint": "vue-cli-service lint", @@ -27,6 +28,7 @@ "normalize.css": "^8.0.1", "vant": "^2.5.5", "vue": "^2.6.11", + "vue-clipboard2": "^0.3.1", "vue-content-loader": "^0.2.3", "vue-router": "^3.1.5", "vue-scrollto": "^2.17.1", diff --git a/src/icons/svg/copy.svg b/src/icons/svg/copy.svg new file mode 100644 index 0000000..e947913 --- /dev/null +++ b/src/icons/svg/copy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/good.svg b/src/icons/svg/good.svg index ba5c894..596d378 100644 --- a/src/icons/svg/good.svg +++ b/src/icons/svg/good.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/save.svg b/src/icons/svg/save.svg new file mode 100644 index 0000000..d6a619e --- /dev/null +++ b/src/icons/svg/save.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/store/getters.js b/src/store/getters.js index f4344bb..f307e7b 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,8 +1,6 @@ const getters = { // base info - avatar: state => state.user.avatar, - name: state => state.user.name, - token: state => state.user.token, + userInfo: state => state.user.userInfo, // address selectedAddress: state => state.address.selectedAddress } diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 9341f16..c893347 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -3,19 +3,15 @@ import { getToken, setToken, removeToken } from '@/utils/auth' const state = { token: getToken(), - name: '', - avatar: '' + userInfo: {} } const mutations = { SET_TOKEN: (state, token) => { state.token = token }, - SET_NAME: (state, name) => { - state.name = name - }, - SET_AVATAR: (state, avatar) => { - state.avatar = avatar + SET_USER_INFO: (state, info) => { + state.userInfo = info } } @@ -63,8 +59,7 @@ const actions = { if (!data) { reject(new Error('获取基本信息失败,请重新登录')) } - commit('SET_NAME', data.name) - commit('SET_AVATAR', data.avatar) + commit('SET_USER_INFO', data) resolve(data) }) .catch(error => { diff --git a/src/views/detail/index.vue b/src/views/detail/index.vue index 032b865..f1b3abf 100644 --- a/src/views/detail/index.vue +++ b/src/views/detail/index.vue @@ -17,7 +17,12 @@ - + diff --git a/src/views/user/index.vue b/src/views/user/index.vue index ec059cf..683d8b5 100644 --- a/src/views/user/index.vue +++ b/src/views/user/index.vue @@ -1,15 +1,23 @@ - user...... + + + + + - + diff --git a/src/views/user/modules/Info.vue b/src/views/user/modules/Info.vue new file mode 100644 index 0000000..a3b59e0 --- /dev/null +++ b/src/views/user/modules/Info.vue @@ -0,0 +1,85 @@ + + + + + + + {{userInfo.name}} + + + 用户id:{{userInfo.id}} + + + + + + + + + + + diff --git a/src/views/user/modules/Order.vue b/src/views/user/modules/Order.vue new file mode 100644 index 0000000..e2356f9 --- /dev/null +++ b/src/views/user/modules/Order.vue @@ -0,0 +1,104 @@ + + + + 我的订单 + + 全部订单 + + + + + + + {{item.name}} + + + + + + + + diff --git a/src/views/user/modules/Tools.vue b/src/views/user/modules/Tools.vue new file mode 100644 index 0000000..72c7a0b --- /dev/null +++ b/src/views/user/modules/Tools.vue @@ -0,0 +1,25 @@ + + + + + + + + + + + + +
我的订单
+ 全部订单 + +