diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue
index 0647dcc..9fe15be 100644
--- a/src/pages/login/index.vue
+++ b/src/pages/login/index.vue
@@ -1,57 +1,75 @@
-
-
- 🏠
- 建材销售管家
+
+
+
+
+
+
+
+
+
+
+
+ 🏠
+
+ 建材销售管家
+ 高效 · 便捷 · 专业
-
-
-
-
+
+
+
+
+ 📱
+
+
-
-
-
-
-
-
-
- 其他登录方式
-
-
-
-
- 💬
- 微信登录
-
-
- 💰
- 支付宝登录
-
-
+
+
@@ -68,7 +86,6 @@ export default {
}
},
methods: {
- // 发送验证码
async sendCode() {
if (!this.phone || this.phone.length !== 11) {
uni.showToast({ title: '请输入正确的手机号', icon: 'none' })
@@ -78,8 +95,6 @@ export default {
try {
await authApi.sendCode(this.phone)
uni.showToast({ title: '验证码已发送', icon: 'success' })
-
- // 开始倒计时
this.countdown = 60
const timer = setInterval(() => {
this.countdown--
@@ -92,7 +107,6 @@ export default {
}
},
- // 手机号登录
async phoneLogin() {
if (!this.phone || this.phone.length !== 11) {
uni.showToast({ title: '请输入手机号', icon: 'none' })
@@ -116,178 +130,235 @@ export default {
} catch (e) {
console.error(e)
}
- },
-
- // 微信登录
- async wechatLogin() {
- // #ifdef MP-WEIXIN
- uni.getProvider({
- service: 'oauth',
- success: (res) => {
- if (res.provider.includes('weixin')) {
- uni.login({
- provider: 'weixin',
- success: async (loginRes) => {
- try {
- const data = await authApi.wechatLogin(loginRes.code)
- uni.setStorageSync('token', data.token)
- uni.setStorageSync('refreshToken', data.refreshToken)
- uni.setStorageSync('userId', data.userId)
-
- uni.showToast({ title: '登录成功', icon: 'success' })
- setTimeout(() => {
- uni.reLaunch({ url: '/pages/index/index' })
- }, 1000)
- } catch (e) {
- console.error(e)
- }
- }
- })
- }
- }
- })
- // #endif
- // #ifndef MP-WEIXIN
- uni.showToast({ title: '请在微信小程序中使用', icon: 'none' })
- // #endif
- },
-
- // 支付宝登录
- alipayLogin() {
- // #ifdef MP-ALIPAY
- my.getAuthCode({
- scopes: 'auth_base',
- success: async (res) => {
- try {
- const data = await authApi.alipayLogin(res.authCode)
- uni.setStorageSync('token', data.token)
- uni.setStorageSync('refreshToken', data.refreshToken)
- uni.setStorageSync('userId', data.userId)
-
- uni.showToast({ title: '登录成功', icon: 'success' })
- setTimeout(() => {
- uni.reLaunch({ url: '/pages/index/index' })
- }, 1000)
- } catch (e) {
- console.error(e)
- }
- }
- })
- // #endif
- // #ifndef MP-ALIPAY
- uni.showToast({ title: '请在支付宝小程序中使用', icon: 'none' })
- // #endif
}
}
}