统一排行榜对齐星雀UI,页面资源后台配置实时刷新
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
40
miniprogram/pages/phone-auth/phone-auth.js
Normal file
40
miniprogram/pages/phone-auth/phone-auth.js
Normal file
@@ -0,0 +1,40 @@
|
||||
import { submit } from '../../utils/phone-auth';
|
||||
|
||||
Page({
|
||||
data: {
|
||||
show: false,
|
||||
avatar: '',
|
||||
avatarFile: null,
|
||||
phoneCode: '',
|
||||
phoneGot: false
|
||||
},
|
||||
onLoad() {
|
||||
setTimeout(() => this.setData({ show: true }), 100);
|
||||
},
|
||||
onAvatar(e) {
|
||||
const p = e.detail.avatarUrl;
|
||||
this.setData({ avatar: p, avatarFile: p });
|
||||
},
|
||||
onPhone(e) {
|
||||
if (e.detail.code) {
|
||||
this.setData({ phoneCode: e.detail.code, phoneGot: true });
|
||||
}
|
||||
},
|
||||
async submit() {
|
||||
const { phoneCode, avatarFile } = this.data;
|
||||
if (!avatarFile || !phoneCode) return;
|
||||
try {
|
||||
wx.showLoading({ title: '认证中...', mask: true });
|
||||
await submit(phoneCode, avatarFile);
|
||||
wx.hideLoading();
|
||||
// 成功,重启小程序,此时check返回false,用户无感进入
|
||||
wx.reLaunch({ url: '/pages/index/index' });
|
||||
} catch (e) {
|
||||
wx.hideLoading();
|
||||
wx.showToast({ title: e.message, icon: 'none' });
|
||||
}
|
||||
},
|
||||
exit() {
|
||||
wx.exitMiniProgram();
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user