diff --git a/稻城亚丁小程序/uniapp/src/pages.json b/稻城亚丁小程序/uniapp/src/pages.json
index f3425a6..848e7d5 100644
--- a/稻城亚丁小程序/uniapp/src/pages.json
+++ b/稻城亚丁小程序/uniapp/src/pages.json
@@ -54,6 +54,14 @@
}
},
{
+ "path": "pages/profile-setup/profile-setup",
+ "style": {
+ "navigationBarTitleText": "完善资料",
+ "navigationBarBackgroundColor": "#ffffff",
+ "navigationBarTextStyle": "black"
+ }
+ },
+ {
"path": "pages/photo-detail/photo-detail",
"style": {
"navigationBarTitleText": "作品详情",
diff --git a/稻城亚丁小程序/uniapp/src/pages/login/login.vue b/稻城亚丁小程序/uniapp/src/pages/login/login.vue
index 423a098..7b92a0a 100644
--- a/稻城亚丁小程序/uniapp/src/pages/login/login.vue
+++ b/稻城亚丁小程序/uniapp/src/pages/login/login.vue
@@ -83,6 +83,7 @@ import {
} from "@/config/api";
import { getMpToken } from "@/utils/api/http";
import { getMpLoginChannel, loginAsGuest, loginWithPhone, loginWithWeixin } from "@/utils/api/mpSession";
+import { needsProfileSetup } from "@/utils/nicknameCheck";
import { staticAsset } from "@/utils/staticAsset";
const statusBarHeight = ref(20);
const headerBg = staticAsset("login-header.png");
@@ -190,17 +191,26 @@ function normalizeAuditSafeMessage(msg: string): string {
return m;
}
-async function onWeixinLogin() {
+async function onWeixinLogin(_e?: any) {
errMsg.value = "";
loading.value = true;
try {
// #ifdef MP-WEIXIN
- await loginWithWeixin();
+ const user = await loginWithWeixin();
// #endif
// #ifndef MP-WEIXIN
await loginAsGuest();
+ const user = null;
// #endif
uni.showToast({ title: "登录成功", icon: "success" });
+ // #ifdef MP-WEIXIN
+ if (needsProfileSetup()) {
+ setTimeout(() => {
+ uni.navigateTo({ url: "/pages/profile-setup/profile-setup" });
+ }, 500);
+ return;
+ }
+ // #endif
afterLoginNavigate();
} catch (e: unknown) {
const raw = appendLoopbackConnectHint(pickErr(e, "登录失败"));
diff --git a/稻城亚丁小程序/uniapp/src/pages/profile-setup/profile-setup.vue b/稻城亚丁小程序/uniapp/src/pages/profile-setup/profile-setup.vue
new file mode 100644
index 0000000..e5bfefc
--- /dev/null
+++ b/稻城亚丁小程序/uniapp/src/pages/profile-setup/profile-setup.vue
@@ -0,0 +1,353 @@
+
+
+
+
+
+
+
+
+
+
+
+ 昵称
+
+
+
+
+
+
+
+ 手机号
+
+
+
+
+
+
+
+ 跳过,以后再设
+
+
+
+
+
+
+
diff --git a/稻城亚丁小程序/uniapp/src/pages/upload/upload.vue b/稻城亚丁小程序/uniapp/src/pages/upload/upload.vue
index e7d9e48..8d76387 100644
--- a/稻城亚丁小程序/uniapp/src/pages/upload/upload.vue
+++ b/稻城亚丁小程序/uniapp/src/pages/upload/upload.vue
@@ -167,7 +167,7 @@ import {
uploadImage,
} from "@/utils/api/http";
import { ensureMpSession, getMpLoginChannel } from "@/utils/api/mpSession";
-import { reLaunchLoginIfNoBoundPhone } from "@/utils/guestTabGuard";
+import { reLaunchLoginIfNoBoundPhone, redirectToProfileSetupIfNeeded } from "@/utils/guestTabGuard";
import { consumeUploadFormClearFlag } from "@/utils/uploadTabClear";
import { resolveMediaUrl } from "@/utils/mediaUrl";
import { consumeUploadResubmitWorkId } from "@/utils/uploadResubmit";
@@ -277,6 +277,9 @@ onShow(() => {
if (reLaunchLoginIfNoBoundPhone()) {
return;
}
+ if (redirectToProfileSetupIfNeeded()) {
+ return;
+ }
const rid = consumeUploadResubmitWorkId();
if (apiOn.value && rid > 0) {
void loadWorkForEdit(rid);
diff --git a/稻城亚丁小程序/uniapp/src/pages/user/user.vue b/稻城亚丁小程序/uniapp/src/pages/user/user.vue
index 06e916e..50c37a9 100644
--- a/稻城亚丁小程序/uniapp/src/pages/user/user.vue
+++ b/稻城亚丁小程序/uniapp/src/pages/user/user.vue
@@ -287,7 +287,7 @@ import {
isMpSessionExpiredError,
} from "@/utils/api/http";
import { ensureMpSession, getMpLoginChannel } from "@/utils/api/mpSession";
-import { reLaunchLoginIfNoBoundPhone } from "@/utils/guestTabGuard";
+import { reLaunchLoginIfNoBoundPhone, redirectToProfileSetupIfNeeded } from "@/utils/guestTabGuard";
import { resolveMediaUrl } from "@/utils/mediaUrl";
const statusBarHeight = ref(20);
@@ -511,6 +511,9 @@ onShow(() => {
if (reLaunchLoginIfNoBoundPhone()) {
return;
}
+ if (redirectToProfileSetupIfNeeded()) {
+ return;
+ }
profile.value = loadUserProfile();
void loadUserFromApi();
});
diff --git a/稻城亚丁小程序/uniapp/src/utils/guestTabGuard.ts b/稻城亚丁小程序/uniapp/src/utils/guestTabGuard.ts
index 9ec646a..aa42965 100644
--- a/稻城亚丁小程序/uniapp/src/utils/guestTabGuard.ts
+++ b/稻城亚丁小程序/uniapp/src/utils/guestTabGuard.ts
@@ -1,3 +1,5 @@
+import { needsProfileSetup } from "./nicknameCheck";
+
/**
* 先浏览后登录;不再强制绑定手机号后才可使用上传/我的。
* 保留函数签名,避免各处 import 大面积改动;始终视为「未处于仅差手机号」状态。
@@ -10,3 +12,15 @@ export function isLoggedInWithoutBoundPhone(): boolean {
export function reLaunchLoginIfNoBoundPhone(): boolean {
return false;
}
+
+/**
+ * 检查当前用户是否缺少必要资料(昵称为占位名 或 未绑定手机号),
+ * 若是则跳转到资料完善页。返回 true 表示已触发跳转。
+ */
+export function redirectToProfileSetupIfNeeded(): boolean {
+ if (needsProfileSetup()) {
+ uni.navigateTo({ url: "/pages/profile-setup/profile-setup" });
+ return true;
+ }
+ return false;
+}
diff --git a/稻城亚丁小程序/uniapp/src/utils/nicknameCheck.ts b/稻城亚丁小程序/uniapp/src/utils/nicknameCheck.ts
new file mode 100644
index 0000000..7447691
--- /dev/null
+++ b/稻城亚丁小程序/uniapp/src/utils/nicknameCheck.ts
@@ -0,0 +1,21 @@
+import { loadUserProfile } from "./userProfileStorage";
+
+/**
+ * 检查当前用户昵称是否为通用占位名
+ * (微信用户 / 游客 / 空 表示用户尚未完善个人资料)
+ */
+export function isGenericNickname(): boolean {
+ const profile = loadUserProfile();
+ const name = String(profile.nickname || "").trim();
+ return name === "" || name === "微信用户" || name === "游客";
+}
+
+/**
+ * 检查用户是否缺少必要资料(昵称为占位名 或 手机号为空)
+ */
+export function needsProfileSetup(): boolean {
+ const profile = loadUserProfile();
+ const name = String(profile.nickname || "").trim();
+ const phone = String(profile.phone || "").trim();
+ return name === "" || name === "微信用户" || name === "游客" || phone === "";
+}