From e77ce462ee26f9b0eee7afbbe3d49599dd0a7184 Mon Sep 17 00:00:00 2001 From: Junling Bu Date: Tue, 30 Apr 2019 22:54:41 +0800 Subject: [PATCH] =?UTF-8?q?chore[litemall-vue]:=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8F=8D=E9=A6=88=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- litemall-vue/src/api/api.js | 42 ++- litemall-vue/src/api/goods.js | 40 --- litemall-vue/src/api/order.js | 7 - litemall-vue/src/api/promotion.js | 1 - litemall-vue/src/api/shop.js | 17 -- litemall-vue/src/api/user.js | 44 ---- litemall-vue/src/router/user.js | 6 + litemall-vue/src/store/modules/user.js | 62 +---- litemall-vue/src/views/items/tabbar-class.vue | 6 +- .../src/views/user/module-address/index.vue | 11 +- .../src/views/user/module-feedback/index.vue | 94 +++++++ .../src/views/user/module-help/index.vue | 7 +- .../src/views/user/module-server/index.vue | 2 +- .../src/views/user/refund-list/index.vue | 2 +- .../views/user/user-information-set/index.vue | 8 +- .../user-information-set/set-mobile/index.vue | 242 +++++++++--------- .../set-nickname/index.vue | 116 ++++----- .../set-password/index.vue | 19 +- 18 files changed, 352 insertions(+), 374 deletions(-) delete mode 100755 litemall-vue/src/api/goods.js delete mode 100755 litemall-vue/src/api/order.js delete mode 100755 litemall-vue/src/api/promotion.js delete mode 100755 litemall-vue/src/api/shop.js delete mode 100755 litemall-vue/src/api/user.js create mode 100644 litemall-vue/src/views/user/module-feedback/index.vue diff --git a/litemall-vue/src/api/api.js b/litemall-vue/src/api/api.js index b0fb64cc..64775505 100644 --- a/litemall-vue/src/api/api.js +++ b/litemall-vue/src/api/api.js @@ -43,10 +43,38 @@ export function authLogout() { method: 'post' }) } - +const AuthInfo='wx/auth/info'; //用户信息 +export function authInfo() { + return request({ + url: AuthInfo, + method: 'get' + }) +} +const AuthProfile='wx/auth/profile'; //验证码 +export function authProfile(data) { + return request({ + url: AuthProfile, + method: 'post', + data + }) +} const AuthRegister='wx/auth/register'; //账号注册 const AuthReset='wx/auth/reset'; //账号密码重置 +export function authReset(data) { + return request({ + url: AuthReset, + method: 'post', + data + }) +} const AuthRegisterCaptcha='wx/auth/regCaptcha'; //验证码 +export function authRegisterCaptcha(data) { + return request({ + url: AuthRegisterCaptcha, + method: 'post', + data + }) +} const AuthBindPhone='wx/auth/bindPhone'; //绑定微信手机号 const GoodsCount='wx/goods/count'; //统计商品总数 @@ -282,6 +310,14 @@ const OrderGoods='wx/order/goods'; // 代评价商品信息 const OrderComment='wx/order/comment'; // 评价订单商品信息 const FeedbackAdd='wx/feedback/submit'; //添加反馈 +export function feedbackAdd(data) { + return request({ + url: FeedbackAdd, + method: 'post', + data + }) +} + const FootprintList='wx/footprint/list'; //足迹列表 const FootprintDelete='wx/footprint/delete'; //删除足迹 @@ -350,4 +386,6 @@ export function getList(api, query) { method: 'get', params: query }) -} \ No newline at end of file +} + +export const REFUND_LIST = ''; \ No newline at end of file diff --git a/litemall-vue/src/api/goods.js b/litemall-vue/src/api/goods.js deleted file mode 100755 index a2b25faa..00000000 --- a/litemall-vue/src/api/goods.js +++ /dev/null @@ -1,40 +0,0 @@ -import request from '@/utils/request' - -// export const GOODS_CATEGORY = '/category'; -export const GOODS_CATEGORY = '/wx/catalog/index'; -export const GOODS_CHANNGE_CATEGORY = '/wx/catalog/current?id='; -export const GOODS_SEARCH = '/moreGoods'; -export const GOODS_DETAIL = '/details'; - -export function goodsCategory(query) { - return request({ - url: '/wx/catalog/index', - method: 'get', - params: query - }) -} - -export function goodsChannelCategory(query) { - return request({ - url: '/wx/catalog/index', - method: 'get', - params: query - }) -} - -export function goodsSearch(query) { - return request({ - url: '/wx/catalog/current?id=', - method: 'get', - params: query - }) -} - -export function goodsDetail(query) { - return request({ - url: '/wx/catalog/index', - method: 'get', - params: query - }) -} - \ No newline at end of file diff --git a/litemall-vue/src/api/order.js b/litemall-vue/src/api/order.js deleted file mode 100755 index 885a6e93..00000000 --- a/litemall-vue/src/api/order.js +++ /dev/null @@ -1,7 +0,0 @@ -import request from '@/utils/request' - -export const ORDER_LIST = '/order-list'; - -export const ELE_COUPON_LIST = '/electronic-list'; - -export const REFUND_LIST = '/refund-list'; diff --git a/litemall-vue/src/api/promotion.js b/litemall-vue/src/api/promotion.js deleted file mode 100755 index 543ea86b..00000000 --- a/litemall-vue/src/api/promotion.js +++ /dev/null @@ -1 +0,0 @@ -import request from '@/utils/request' diff --git a/litemall-vue/src/api/shop.js b/litemall-vue/src/api/shop.js deleted file mode 100755 index 2e193590..00000000 --- a/litemall-vue/src/api/shop.js +++ /dev/null @@ -1,17 +0,0 @@ -import request from '@/utils/request' - -export const HOME_module = '/home'; -export const ALL_GOODS = '/moreGoods'; - -export const SHOPINFO = '/shop-info'; - -// 运费模板 -export const POST_FEE = ''; - -export function getHome(query) { - return request({ - url: '/wx/home/index', - method: 'get', - params: query - }) -} diff --git a/litemall-vue/src/api/user.js b/litemall-vue/src/api/user.js deleted file mode 100755 index e4602fce..00000000 --- a/litemall-vue/src/api/user.js +++ /dev/null @@ -1,44 +0,0 @@ -import request from '@/utils/request' - -// 登录 -export const USER_LOGIN = '/wx/auth/login'; -export const USER_LOGOUT = ''; - -// 用户信息 -export const USER_PROFILE = '/user-profile'; -export const USER_MODIFY_PASSWORD = ''; -export const USER_CHANGE_MOBILE = ''; - -// 验证码 -export const USER_SENDCODE = ''; - -// 地址 -export const ADDRESS = '/address'; -export const ADDRESS_DEFAULT = '/address-default'; - -// 收藏 -export const GOODS_COLLECT_LIST = '/moreGoods'; - -export function loginByUsername(data) { - return request({ - url: '/wx/auth/login', - method: 'post', - data - }) -} - - -export function logout() { - return request({ - url: '/auth/logout', - method: 'post' - }) -} - -export function getUserInfo(token) { - return request({ - url: '/auth/info', - method: 'get', - params: { token } - }) -} \ No newline at end of file diff --git a/litemall-vue/src/router/user.js b/litemall-vue/src/router/user.js index 4dee465d..a7d09065 100644 --- a/litemall-vue/src/router/user.js +++ b/litemall-vue/src/router/user.js @@ -4,6 +4,7 @@ const UserAddress = () => import('@/views/user/module-address'); const UserAddressEdit = () => import('@/views/user/module-address-edit'); const UserServer = () => import('@/views/user/module-server'); const UserHelp = () => import('@/views/user/module-help'); +const UserFeedback = () => import('@/views/user/module-feedback'); const UserInformation = () => import('@/views/user/user-information-set'); const UserInfo_SetBg = () => import('@/views/user/user-information-set/set-bg'); @@ -61,6 +62,11 @@ export default [ name: 'user-help', component: UserHelp }, + { + path: '/user/feedback', + name: 'user-feedback', + component: UserFeedback + }, { path: '/user/information', name: 'user-information', diff --git a/litemall-vue/src/store/modules/user.js b/litemall-vue/src/store/modules/user.js index 6d5bf63c..6b344ee6 100644 --- a/litemall-vue/src/store/modules/user.js +++ b/litemall-vue/src/store/modules/user.js @@ -1,4 +1,4 @@ -import { loginByUsername, logout, getUserInfo } from '@/api/user' +import { authLoginByAccount, authLogout, authInfo } from '@/api/api' import { getToken, setToken, removeToken } from '@/utils/auth' const user = { @@ -52,7 +52,7 @@ const user = { LoginByUsername({ commit }, userInfo) { const username = userInfo.username.trim() return new Promise((resolve, reject) => { - loginByUsername(username, userInfo.password).then(response => { + authLoginByAccount(username, userInfo.password).then(response => { const token = response.data.data commit('SET_TOKEN', token) setToken(token) @@ -69,12 +69,6 @@ const user = { getUserInfo(state.token).then(response => { const data = response.data.data - if (data.perms && data.perms.length > 0) { // 验证返回的perms是否是一个非空数组 - commit('SET_PERMS', data.perms) - } else { - reject('getInfo: perms must be a non-null array !') - } - commit('SET_ROLES', data.roles) commit('SET_NAME', data.name) commit('SET_AVATAR', data.avatar) @@ -86,60 +80,22 @@ const user = { }) }, - // 第三方验证登录 - // LoginByThirdparty({ commit, state }, code) { - // return new Promise((resolve, reject) => { - // commit('SET_CODE', code) - // loginByThirdparty(state.status, state.email, state.code).then(response => { - // commit('SET_TOKEN', response.data.token) - // setToken(response.data.token) - // resolve() - // }).catch(error => { - // reject(error) - // }) - // }) - // }, - + // 登出 LogOut({ commit, state }) { return new Promise((resolve, reject) => { - logout(state.token).then(() => { - commit('SET_TOKEN', '') - commit('SET_ROLES', []) - commit('SET_PERMS', []) + authLogout(state.token).then(() => { + commit('Authorization', '') + commit('avatar', '') + commit('background_image', []) + commit('nickName', []) + removeToken() resolve() }).catch(error => { reject(error) }) }) - }, - - // 前端 登出 - FedLogOut({ commit }) { - return new Promise(resolve => { - commit('SET_TOKEN', '') - removeToken() - resolve() - }) - }, - - // 动态修改权限 - ChangeRoles({ commit, dispatch }, role) { - return new Promise(resolve => { - commit('SET_TOKEN', role) - setToken(role) - getUserInfo(role).then(response => { - const data = response.data - commit('SET_ROLES', data.roles) - commit('SET_PERMS', data.perms) - commit('SET_NAME', data.name) - commit('SET_AVATAR', data.avatar) - commit('SET_INTRODUCTION', data.introduction) - dispatch('GenerateRoutes', data) // 动态修改权限后 重绘侧边菜单 - resolve() - }) - }) } } } diff --git a/litemall-vue/src/views/items/tabbar-class.vue b/litemall-vue/src/views/items/tabbar-class.vue index 94631ec3..28eb17ab 100755 --- a/litemall-vue/src/views/items/tabbar-class.vue +++ b/litemall-vue/src/views/items/tabbar-class.vue @@ -18,7 +18,7 @@ + + + diff --git a/litemall-vue/src/views/user/module-help/index.vue b/litemall-vue/src/views/user/module-help/index.vue index 716a006f..bcab93d0 100644 --- a/litemall-vue/src/views/user/module-help/index.vue +++ b/litemall-vue/src/views/user/module-help/index.vue @@ -1,6 +1,6 @@ - - + + + + + + diff --git a/litemall-vue/src/views/user/user-information-set/set-nickname/index.vue b/litemall-vue/src/views/user/user-information-set/set-nickname/index.vue index 1482835d..be5017df 100755 --- a/litemall-vue/src/views/user/user-information-set/set-nickname/index.vue +++ b/litemall-vue/src/views/user/user-information-set/set-nickname/index.vue @@ -1,58 +1,58 @@ - - - - - - - + + + + + + + diff --git a/litemall-vue/src/views/user/user-information-set/set-password/index.vue b/litemall-vue/src/views/user/user-information-set/set-password/index.vue index 0cda89a6..81a7a716 100755 --- a/litemall-vue/src/views/user/user-information-set/set-password/index.vue +++ b/litemall-vue/src/views/user/user-information-set/set-password/index.vue @@ -34,7 +34,7 @@