diff --git a/web/index.html b/web/index.html index 0ce4628..d1f02b5 100644 --- a/web/index.html +++ b/web/index.html @@ -262,7 +262,7 @@ - + @@ -285,7 +285,7 @@ - + diff --git a/web/main.js b/web/main.js index 5cb2aa7..e289487 100644 --- a/web/main.js +++ b/web/main.js @@ -23,6 +23,7 @@ const app = createApp({ // ==================== 计算属性 ==================== const hasUserId = Vue.computed(() => !!Api.getUserId()); + const hasOnlyUserId = Vue.computed(() => Api.hasOnlyUserId()); const currentUserId = Vue.computed(() => { const userId = Api.getUserId(); return userId ? Number(userId) : null; @@ -1019,6 +1020,7 @@ const app = createApp({ isOrder, exportTitle, hasUserId, + hasOnlyUserId, currentUserId, hasCreators, hasReseller, diff --git a/web/modules/api.js b/web/modules/api.js index e787c24..ea2ff21 100644 --- a/web/modules/api.js +++ b/web/modules/api.js @@ -20,7 +20,7 @@ const getApiBase = () => { const API_BASE = getApiBase(); /** - * 从URL 参数中获取用户 ID + * 从 URL 参数中获取用户 ID * @returns {string} 用户 ID,不存在返回空字符串 */ const getUserId = () => { @@ -29,6 +29,16 @@ const getUserId = () => { return value && String(value).trim() ? String(value).trim() : ''; }; +/** + * 检查 URL 中是否有 userId 参数(不包含 current_user_id) + * @returns {boolean} + */ +const hasOnlyUserId = () => { + const params = new URLSearchParams(window.location.search || ''); + const value = params.get('userId') || params.get('userid') || params.get('user_id'); + return !!(value && String(value).trim()); +}; + /** * 从 URL 参数中获取商户 ID * @returns {string} 商户 ID,不存在返回空字符串 @@ -399,6 +409,7 @@ window.ApiService = { // 基础方法 API_BASE, getUserId, + hasOnlyUserId, getMerchantId, buildUserQueryString, get,