diff --git a/yudao-ui-app/api/auth.js b/yudao-ui-app/api/auth.js index adc31b760..7d97c086b 100644 --- a/yudao-ui-app/api/auth.js +++ b/yudao-ui-app/api/auth.js @@ -9,4 +9,5 @@ export const logout = data => http.post('/member/logout', data) export const sendSmsCode = data => http.post('/member/send-sms-code', data) //使用手机 + 验证码登录 export const smsLogin = data => http.post('/member/sms-login', data) - +//社交登录,使用 (手机号授权)code + 用户信息 +export const socialLogin = data => http.post('/member/social-login', data) diff --git a/yudao-ui-app/pages.json b/yudao-ui-app/pages.json index f7f7ece1e..3ef50a0a9 100644 --- a/yudao-ui-app/pages.json +++ b/yudao-ui-app/pages.json @@ -25,17 +25,17 @@ } }, { - "path": "pages/login/login", + "path": "pages/login/social", "style": { - "navigationBarTitleText": "账号登录" - } - }, - { - "path": "pages/register/register", - "style": { - "navigationBarTitleText": "注册账号" + "navigationBarTitleText": "授权登录" } }, + { + "path": "pages/login/mobile", + "style": { + "navigationBarTitleText": "手机登录" + } + }, { "path": "pages/forgot/forgot", "style": { diff --git a/yudao-ui-app/pages/address/create.vue b/yudao-ui-app/pages/address/create.vue index 66426a052..fccef1bc4 100644 --- a/yudao-ui-app/pages/address/create.vue +++ b/yudao-ui-app/pages/address/create.vue @@ -131,7 +131,7 @@ export default { uni.$u.toast('地址已保存') setTimeout(() => { uni.navigateBack() - }, 1000) + }, 300) }) }) } diff --git a/yudao-ui-app/pages/address/update.vue b/yudao-ui-app/pages/address/update.vue index cfcb00c6c..b8c70d46f 100644 --- a/yudao-ui-app/pages/address/update.vue +++ b/yudao-ui-app/pages/address/update.vue @@ -161,7 +161,7 @@ export default { uni.$u.toast('地址已更新') setTimeout(() => { uni.navigateBack() - }, 1000) + }, 300) }) }) } diff --git a/yudao-ui-app/pages/cart/cart.vue b/yudao-ui-app/pages/cart/cart.vue index 9b8b42b38..07b9f6878 100644 --- a/yudao-ui-app/pages/cart/cart.vue +++ b/yudao-ui-app/pages/cart/cart.vue @@ -6,7 +6,7 @@ - + 查看购物车 diff --git a/yudao-ui-app/pages/login/login.vue b/yudao-ui-app/pages/login/mobile.vue similarity index 83% rename from yudao-ui-app/pages/login/login.vue rename to yudao-ui-app/pages/login/mobile.vue index 0d1f06519..42d1015ef 100644 --- a/yudao-ui-app/pages/login/login.vue +++ b/yudao-ui-app/pages/login/mobile.vue @@ -1,15 +1,15 @@ diff --git a/yudao-ui-app/pages/login/social.vue b/yudao-ui-app/pages/login/social.vue new file mode 100644 index 000000000..502393fa6 --- /dev/null +++ b/yudao-ui-app/pages/login/social.vue @@ -0,0 +1,117 @@ + + + + + diff --git a/yudao-ui-app/pages/register/register.vue b/yudao-ui-app/pages/register/register.vue deleted file mode 100644 index 4e719b9f1..000000000 --- a/yudao-ui-app/pages/register/register.vue +++ /dev/null @@ -1,117 +0,0 @@ - - - - - diff --git a/yudao-ui-app/pages/user/user.vue b/yudao-ui-app/pages/user/user.vue index 8ca6e804e..e3577bead 100644 --- a/yudao-ui-app/pages/user/user.vue +++ b/yudao-ui-app/pages/user/user.vue @@ -79,7 +79,7 @@ export default { methods: { loginOrJump(pageUrl) { if (!this.hasLogin) { - uni.$u.route('/pages/login/login') + uni.$u.route('/pages/login/social') } else { uni.$u.route(pageUrl) } diff --git a/yudao-ui-app/store/index.js b/yudao-ui-app/store/index.js index 245bed75c..5ca02bbd4 100644 --- a/yudao-ui-app/store/index.js +++ b/yudao-ui-app/store/index.js @@ -2,7 +2,7 @@ import Vue from 'vue' import Vuex from 'vuex' import { logout } from '@/api/auth' import { getUserInfo } from '@/api/user' -import { passwordLogin, smsLogin } from '@/api/auth' +import { passwordLogin, smsLogin, socialLogin } from '@/api/auth' const TokenKey = 'App-Token' @@ -56,15 +56,18 @@ const store = new Vuex.Store({ actions: { //账号登录 Login({ state, commit }, { type, data }) { - console.log(type, data) if (type === 0) { return passwordLogin(data).then(res => { commit('SET_TOKEN', res.data) }) - } else { + } else if (type === 1) { return smsLogin(data).then(res => { commit('SET_TOKEN', res.data) }) + } else { + return socialLogin(data).then(res => { + commit('SET_TOKEN', res.data) + }) } }, // 退出登录