|
@@ -7,23 +7,33 @@ App({
|
|
|
// 检查登录状态并弹出提示框
|
|
|
checkLoginStatus() {
|
|
|
const isLoggedIn = wx.getStorageSync('userInfo') || false;
|
|
|
+
|
|
|
if (!isLoggedIn) {
|
|
|
wx.showModal({
|
|
|
- title: '绑定手机号',
|
|
|
- content: '防止账号丢失以及方便找回,建议您绑定手机号码',
|
|
|
- confirmText: '立即绑定',
|
|
|
- cancelText: '取消',
|
|
|
+ title: '登录身份选择',
|
|
|
+ content: '请选择您的身份以完成登录',
|
|
|
+ confirmText: '我是老师',
|
|
|
+ cancelText: '我是家长',
|
|
|
success: (res) => {
|
|
|
if (res.confirm) {
|
|
|
- // 跳转到绑定手机号页面
|
|
|
+ // 家长:跳转本小程序登录页
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/logins/logins',
|
|
|
});
|
|
|
+ } else if (res.cancel) {
|
|
|
+ // 老师:跳转到老师端小程序
|
|
|
+ wx.navigateToMiniProgram({
|
|
|
+ appId: 'wx06f2b1b09ac5684f', // ⚠️ 替换成实际 appId
|
|
|
+ path: 'pages/logins/logins',
|
|
|
+ });
|
|
|
}
|
|
|
- },
|
|
|
+ }
|
|
|
});
|
|
|
+
|
|
|
+ return false;
|
|
|
}
|
|
|
- return isLoggedIn;
|
|
|
+
|
|
|
+ return true;
|
|
|
},
|
|
|
onLaunch() {
|
|
|
// wx.cloud.init({
|