Commit f7d384e55de7b5c965665a75a2c9c95fc56b63c8
1 parent
083daa65
api按模块单独配置文件
Showing
9 changed files
with
42 additions
and
27 deletions
yudao-ui-app/api/address.js
0 → 100644
| 1 | +//请求工具参考https://ext.dcloud.net.cn/plugin?id=392 | |
| 2 | +const { http } = uni.$u | |
| 3 | + | |
| 4 | +//获得用户收件地址列表 | |
| 5 | +export const getAddressList = params => http.get('/app-api/member/address/list', params) | |
| 6 | +//创建用户收件地址 | |
| 7 | +export const createAddress = data => http.post('/app-api/member/address/create', data) | |
| 8 | +//通过ID获得用户收件地址 | |
| 9 | +export const getAddressById = params => http.get('/app-api/member/address/get', { params }) | |
| 10 | +//获得默认的用户收件地址 | |
| 11 | +export const getDefaultUserAddress = params => http.get('/app-api/member/address/get-default', { params }) | |
| 12 | +//更新用户收件地址 | |
| 13 | +export const updateAddress = params => http.put('/app-api/member/address/update', params) | |
| 14 | +//删除用户收件地址 | |
| 15 | +export const deleteAddress = params => http.delete('/app-api/member/address/delete', {}, { params }) | ... | ... |
yudao-ui-app/api/auth.js
0 → 100644
| 1 | +//请求工具参考https://ext.dcloud.net.cn/plugin?id=392 | |
| 2 | +const { http } = uni.$u | |
| 3 | + | |
| 4 | +//使用手机 + 密码登录 | |
| 5 | +export const passwordLogin = data => http.post('/app-api/member/login', data) | |
| 6 | +//退出登录 | |
| 7 | +export const logout = data => http.post('/app-api/member/logout', data) | |
| 8 | +//发送手机验证码 | |
| 9 | +export const sendSmsCode = data => http.post('/app-api/member/send-sms-code', data) | |
| 10 | +//使用手机 + 验证码登录 | |
| 11 | +export const smsLogin = data => http.post('/app-api/member/sms-login', data) | |
| 12 | + | ... | ... |
yudao-ui-app/api/index.js
0 → 100644
yudao-ui-app/common/api.js renamed to yudao-ui-app/api/user.js
| 1 | 1 | //请求工具参考https://ext.dcloud.net.cn/plugin?id=392 |
| 2 | 2 | const { http } = uni.$u |
| 3 | 3 | |
| 4 | -/* login */ | |
| 5 | -//使用手机 + 密码登录 | |
| 6 | -export const passwordLogin = params => http.post('/app-api/member/login', params) | |
| 7 | -//退出登录 | |
| 8 | -export const logout = params => http.post('/app-api/member/logout', params) | |
| 9 | -//发送手机验证码 | |
| 10 | -export const sendSmsCode = params => http.post('/app-api/member/send-sms-code', params) | |
| 11 | -//使用手机 + 验证码登录 | |
| 12 | -export const smsLogin = params => http.post('/app-api/member/sms-login', params) | |
| 13 | - | |
| 14 | 4 | //获取用户信息 |
| 15 | 5 | export const getUserInfo = params => http.get('/app-api/member/user/get', params) |
| 16 | 6 | //修改用户头像 |
| ... | ... | @@ -21,13 +11,4 @@ export const updateAvatar = filePath => |
| 21 | 11 | filePath: filePath |
| 22 | 12 | }) |
| 23 | 13 | //修改用户昵称 |
| 24 | -export const updateNickname = params => | |
| 25 | - http.put('/app-api/member/user/update-nickname', {}, { | |
| 26 | - params | |
| 27 | - }) | |
| 28 | - | |
| 29 | -/* index */ | |
| 30 | -// 获取滚动图数据 | |
| 31 | -export const getBannerData = params => http.get('/app-api/index', params) | |
| 32 | -// 获取滚动通知数据 | |
| 33 | -export const getNoticeData = params => http.get('/app-api/notice', params) | |
| 14 | +export const updateNickname = params => http.put('/app-api/member/user/update-nickname', {}, { params }) | ... | ... |
yudao-ui-app/pages/index/index.vue
yudao-ui-app/pages/login/login.vue
yudao-ui-app/pages/profile/profile.vue
yudao-ui-app/pages/user/user.vue
| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | <view class="user-header"> |
| 4 | 4 | <view class="user-info" @click="loginOrJump('/pages/profile/profile')"> |
| 5 | 5 | <u-avatar size="80" :src="userInfo.avatar"></u-avatar> |
| 6 | - <text class="nick-name">{{ hasLogin ? userInfo.nickname || '游客' : '点击登录' }}</text> | |
| 6 | + <text class="nick-name">{{ hasLogin ? userInfo.nickname || '游客' : '登录/注册' }}</text> | |
| 7 | 7 | </view> |
| 8 | 8 | </view> |
| 9 | 9 | |
| ... | ... | @@ -90,10 +90,9 @@ export default { |
| 90 | 90 | content: '您确定要退出登录吗', |
| 91 | 91 | success: res => { |
| 92 | 92 | if (res.confirm) { |
| 93 | - console.log('用户点击确定') | |
| 94 | 93 | this.$store.dispatch('logout') |
| 95 | 94 | } else if (res.cancel) { |
| 96 | - console.log('用户点击取消') | |
| 95 | + //console.log('用户点击取消') | |
| 97 | 96 | } |
| 98 | 97 | } |
| 99 | 98 | }) | ... | ... |