caolinxuan 1 周之前
父節點
當前提交
dd38ee6950

+ 71 - 0
pages.json

@@ -53,6 +53,77 @@
 				"navigationBarTitleText": "课程日历"
 			}
 		},
+		{
+			"path": "pages/mine/profile",
+			"style": { "navigationBarTitleText": "个人信息" }
+		},
+		{
+			"path": "pages/mine/recycle",
+			"style": { "navigationBarTitleText": "回收站" }
+		},
+		{
+			"path": "pages/mine/notify",
+			"style": { "navigationBarTitleText": "通知设置" }
+		},
+		{
+			"path": "pages/mine/feedback",
+			"style": { "navigationBarTitleText": "意见反馈" }
+		},
+		{
+			"path": "pages/mine/service",
+			"style": { "navigationBarTitleText": "在线客服" }
+		},
+		{
+			"path": "pages/mine/about",
+			"style": { "navigationBarTitleText": "了解小鹅通" }
+		},
+		{
+			"path": "pages/mine/setting",
+			"style": { "navigationBarTitleText": "设置" }
+		},
+		{
+			"path": "pages/message/selected",
+			"style": { "navigationBarTitleText": "课程精选" }
+		},
+		{
+			"path" : "pages/mine/Merchant",
+			"style" : 
+			{
+				"navigationBarTitleText" : "商家后台管理"
+			}
+		},
+		{
+			"path" : "pages/mine/changePhone",
+			"style" : 
+			{
+				"navigationBarTitleText" : "更换手机号"
+			}
+		},
+		{
+			"path" : "pages/mine/unbindWechat",
+			"style" : 
+			{
+				"navigationBarTitleText" : "解绑微信"
+			}
+		},
+		{
+			"path" : "pages/mine/setPassword",
+			"style" : 
+			{
+				"navigationBarTitleText" : "设置密码"
+			}
+		},
+		{
+			"path" : "pages/mine/cancelAccount",
+			"style" : 
+			{
+				"navigationBarTitleText" : "账号注销"
+			}
+		},
+		{
+			"path": "pages/course/detail",
+			"style": { "navigationBarTitleText": "课程详情" }
+		}
 	],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",

+ 1 - 1
pages/index/index.vue

@@ -4,7 +4,7 @@
 		<view class="top-bar">
 			<view class="title">小鹅通</view>
 			<view class="top-icons">
-				<view class="iconfont icon-search" @click="goToSearch"></view>
+				<view class="iconfont icon-search" @click="goToSearch">搜索</view>
 				<view class="iconfont icon-calendar" @click="goToCalendar">日历</view>
 			</view>
 		</view>

+ 64 - 141
pages/login/index.vue

@@ -54,171 +54,95 @@ export default {
       isAgreed: false,
       showServiceAgreement: false,
       showPrivacyPolicy: false
-    }
+    };
   },
   methods: {
     // 处理协议勾选
     handleAgreementChange(e) {
-      this.isAgreed = e.detail.value.length > 0
+      this.isAgreed = e.detail.value.length > 0;
     },
 
     // 微信登录
-    async handleWechatLogin() {
-      if (!this.isAgreed) {
-        uni.showToast({ title: '请先同意用户协议和隐私政策', icon: 'none' })
-        return
-      }
-      
-      try {
-        // 获取微信登录凭证
-        const loginResult = await new Promise((resolve, reject) => {
-          uni.login({
-            provider: 'weixin',
-            success: (res) => resolve(res),
-            fail: (err) => reject(err)
-          });
-        });
-        
-        if (!loginResult.code) {
-          uni.showToast({ title: '获取登录凭证失败', icon: 'none' });
-          return;
-        }
-
-        // 立即使用code,避免过期
-        console.log('获取到的code:', loginResult.code);
-        
-        // 获取用户信息
-        const userInfoResult = await new Promise((resolve, reject) => {
-          uni.getUserInfo({
-            provider: 'weixin',
-            withCredentials: true,
-            success: (res) => resolve(res),
-            fail: (err) => reject(err)
-          });
-        });
-        
-        if (!userInfoResult.userInfo) {
-          uni.showToast({ title: '获取用户信息失败', icon: 'none' });
-          return;
-        }
-        
-        // 调用后端登录接口
-        const loginRes = await uni.request({
-          url: 'http://localhost:9527/api/wx-login',
-          method: 'POST',
-          data: {
-            code: loginResult.code,
-            nickName: userInfoResult.userInfo.nickName,
-            avatarUrl: userInfoResult.userInfo.avatarUrl,
-            gender: userInfoResult.userInfo.gender.toString(),
-            country: userInfoResult.userInfo.country,
-            province: userInfoResult.userInfo.province,
-            city: userInfoResult.userInfo.city,
-            language: userInfoResult.userInfo.language,
-            rawData: userInfoResult.rawData,
-            signature: userInfoResult.signature,
-            encryptedData: userInfoResult.encryptedData,
-            iv: userInfoResult.iv
-          },
-          header: {
-            'content-type': 'application/json'
-          }
-        });
-
-        // 处理微信登录错误
-        if (loginRes.data.errcode === 40029) {
-          console.error('微信登录code无效,尝试重新获取');
-          // 重新获取code并重试
-          const newLoginResult = await new Promise((resolve, reject) => {
-            uni.login({
-              provider: 'weixin',
-              success: (res) => resolve(res),
-              fail: (err) => reject(err)
-            });
-          });
-
-          if (!newLoginResult.code) {
-            throw new Error('重新获取登录凭证失败');
-          }
-
-          // 使用新的code重试登录
-          const retryRes = await uni.request({
-            url: 'http://localhost:9527/api/wx-login',
-            method: 'POST',
-            data: {
-              code: newLoginResult.code,
-              nickName: userInfoResult.userInfo.nickName,
-              avatarUrl: userInfoResult.userInfo.avatarUrl,
-              gender: userInfoResult.userInfo.gender.toString(),
-              country: userInfoResult.userInfo.country,
-              province: userInfoResult.userInfo.province,
-              city: userInfoResult.userInfo.city,
-              language: userInfoResult.userInfo.language,
-              rawData: userInfoResult.rawData,
-              signature: userInfoResult.signature,
-              encryptedData: userInfoResult.encryptedData,
-              iv: userInfoResult.iv
-            },
-            header: {
-              'content-type': 'application/json'
-            }
-          });
-
-          if (retryRes.statusCode === 200 && !retryRes.data.errcode) {
-            // 登录成功,保存token
-            uni.setStorageSync('token', retryRes.data.data.token);
-            uni.setStorageSync('userInfo', retryRes.data.data.userInfo);
-            
-            // 跳转到发现页
-            uni.switchTab({
-              url: '/pages/discover/index'
-            });
-          } else {
-            throw new Error(retryRes.data.errmsg || '登录失败');
-          }
-        } else if (loginRes.statusCode === 200 && !loginRes.data.errcode) {
-          // 登录成功,保存token
-          uni.setStorageSync('token', loginRes.data.data.token);
-          uni.setStorageSync('userInfo', loginRes.data.data.userInfo);
-          
-          // 跳转到发现页
-          uni.switchTab({
-            url: '/pages/discover/index'
-          });
-        } else {
-          throw new Error(loginRes.data.errmsg || '登录失败');
-        }
-      } catch (error) {
-        console.error('登录过程出错:', error);
-        uni.showToast({ 
-          title: error.message || '登录失败,请重试', 
-          icon: 'none' 
-        });
-      }
-    },
+   handleWechatLogin() {
+     if (!this.isAgreed) {
+       uni.showToast({ title: '请先同意用户协议和隐私政策', icon: 'none' });
+       return;
+     }
+     // 直接在按钮点击回调中调用 wx.getUserProfile(用户主动触发)
+     wx.getUserProfile({
+       desc: '用于登录和完善个人信息', // 清晰的授权用途说明
+       success: async (userRes) => {
+         const { encryptedData, iv } = userRes;
+         console.log(userRes)
+		 
+         // 获取登录凭证(必须在用户授权后调用,保持上下文)
+         const loginResult = await new Promise((resolve, reject) => {
+           wx.login({ success: resolve, fail: reject });
+         });
+         if (!loginResult.code) {
+           uni.showToast({ title: '登录凭证获取失败', icon: 'none' });
+           return;
+         }
+         const code = loginResult.code;
+		 console.log(code)
+		const avatar_url=userRes.userInfo.avatarUrl;
+		const nickname=userRes.userInfo.nickName;
+         // 调用后端接口
+         try {
+           const loginRes = await uni.request({
+             url: 'http://localhost:9527/api/wx-login',
+             method: 'POST',
+             data: { code, encryptedData, iv ,avatar_url ,nickname},
+             header: { 'content-type': 'application/json' }
+           });
+			console.log(loginRes)
+           if (loginRes.statusCode !== 200 || loginRes.data.errcode) {
+             throw new Error(loginRes.data.errmsg || '登录失败');
+           }
+     
+           // 保存用户信息和 token
+		   uni.setStorageSync('uid', loginRes.data.data.id);
+           uni.setStorageSync('token', loginRes.data.data.token);
+           uni.setStorageSync('userInfo', loginRes.data.data.userInfo);
+     
+           // 跳转到 tabBar 页面(确保目标页面在 pages.json 中配置了 tabBar)
+           uni.switchTab({ url: '/pages/discover/index' });
+         } catch (error) {
+           console.error('登录接口调用失败:', error);
+           uni.showToast({ title: '登录失败,请重试', icon: 'none' });
+         }
+       },
+       fail: (err) => {
+         console.error('用户授权失败:', err);
+         if (err.errCode === 10004) { // 用户点击授权弹窗的“拒绝”按钮
+           uni.showToast({ title: '请授权后再登录', icon: 'none' });
+         }
+       }
+     });
+   },
 
     // 跳转到验证码登录页面
     navigateToVerifyCodeLogin() {
       uni.navigateTo({
         url: '/pages/login/verify-code'
-      })
+      });
     },
 
     // 打开服务协议
     openServiceAgreement() {
       uni.navigateTo({
         url: '/pages/agreement/service'
-      })
+      });
     },
 
     // 打开隐私政策
     openPrivacyPolicy() {
       uni.navigateTo({
         url: '/pages/agreement/privacy'
-      })
+      });
     }
   }
-}
+};
 </script>
 
 <style lang="scss">
@@ -430,5 +354,4 @@ export default {
     }
   }
 }
-</style>
- 
+</style>    

+ 25 - 4
pages/login/verify-code.vue

@@ -23,7 +23,7 @@
         <view v-else class="form-area">
           <input class="input" type="text" v-model="account" maxlength="32" placeholder="请输入账号/手机号" />
           <view class="input-group">
-            <input class="input" :type="showPassword ? 'text' : 'password'" v-model="password" maxlength="20" placeholder="请输入密码" />
+            <input class="input" :type="showPassword ? 'text' : 'password'" v-model="password" password maxlength="20" placeholder="请输入密码" />
             <text class="iconfont" :class="showPassword ? 'icon-eye-open' : 'icon-eye-close'" @click="showPassword=!showPassword"></text>
           </view>
         </view>
@@ -158,16 +158,37 @@ export default {
         return
       }
       // TODO: 调用后端登录接口
-      uni.switchTab({
+	  const res = await uni.request({
+	  	url: "http://localhost:9527/api/login",
+		method:'POST',
+		data:{
+			phone: this.phone,
+			password: this.password,
+			code: this.verifyCode
+		},
+		header: {
+            'content-type': 'application/json'
+        }
+	  })
+	  console.log(res.data)
+	  if(res.data.code===200){
+		 // 登录成功,保存token
+		 uni.setStorageSync('token', res.data.data.token);
+		  uni.switchTab({
           url: '/pages/discover/index'  // 替换为实际页面路径
-      });
+		});
+	  }else{
+		  uni.showToast({
+		  	title: '登录失败', icon: 'none'
+		  })
+	  }
     },
     closePopup() {
       this.showServiceAgreement = false
       this.showPrivacyPolicy = false
     },
     goToWechatLogin() {
-      uni.switchTab({
+      uni.navigateTo({
         url: '/pages/login/index'
       })
     }

+ 1 - 1
project.config.json

@@ -29,7 +29,7 @@
     "ignore": [],
     "include": []
   },
-  "appid": "wx3d250e9c83ec74ee",
+  "appid": "wx8246d27305af5834",
   "editorSetting": {},
   "libVersion": "3.8.3"
 }

+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/app.js.map

@@ -1 +1 @@
-{"version":3,"file":"app.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
+{"version":3,"file":"app.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/common/assets.js.map

@@ -1 +1 @@
-{"version":3,"file":"assets.js","sources":["static/login.png","../../../static/illustration_book.png","../../../static/empty_box.png"],"sourcesContent":["export default \"__VITE_ASSET__ec1e9ea5__\"","export default \"/static/illustration_book.png\"","export default \"/static/empty_box.png\""],"names":[],"mappings":";AAAA,MAAe,eAAA;ACAf,MAAe,aAAA;ACAf,MAAe,aAAA;;;;"}
+{"version":3,"file":"assets.js","sources":["static/login.png","../../../static/illustration_book.png","../../../static/empty_box.png","../../../static/wechat.png","static/logo.png","../../../static/shop.png","../../../static/no_shop.png","static/kefu.png","../../../static/empty-box.png"],"sourcesContent":["export default \"__VITE_ASSET__ec1e9ea5__\"","export default \"/static/illustration_book.png\"","export default \"/static/empty_box.png\"","export default \"/static/wechat.png\"","export default \"__VITE_ASSET__46719607__\"","export default \"/static/shop.png\"","export default \"/static/no_shop.png\"","export default \"__VITE_ASSET__11c7b97a__\"","export default \"/static/empty-box.png\""],"names":[],"mappings":";AAAA,MAAe,eAAA;ACAf,MAAe,eAAA;ACAf,MAAe,eAAA;ACAf,MAAe,eAAA;ACAf,MAAe,eAAA;ACAf,MAAe,eAAA;ACAf,MAAe,aAAA;ACAf,MAAe,aAAA;ACAf,MAAe,aAAA;;;;;;;;;;"}

文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/.sourcemap/mp-weixin/common/vendor.js.map


+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/login/index.js.map

@@ -1 +1 @@
-{"version":3,"file":"index.js","sources":["../../../ruanjian/HBuilder X/HBuilderX/plugins/uniapp-cli-vite/uniPage:/cGFnZXMvbG9naW4vaW5kZXgudnVl"],"sourcesContent":["import MiniProgramPage from 'D:/java file/2407_5/small_goose_vue/pages/login/index.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
+{"version":3,"file":"index.js","sources":["../../../ruanjian/HBuilder X/HBuilderX/plugins/uniapp-cli-vite/uniPage:/cGFnZXMvbG9naW4vaW5kZXgudnVl"],"sourcesContent":["import MiniProgramPage from 'D:/java file/2407_5/small_goose_vue/pages/login/index.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}

+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/login/verify-code.js.map

@@ -1 +1 @@
-{"version":3,"file":"verify-code.js","sources":["../../../ruanjian/HBuilder X/HBuilderX/plugins/uniapp-cli-vite/uniPage:/cGFnZXMvbG9naW4vdmVyaWZ5LWNvZGUudnVl"],"sourcesContent":["import MiniProgramPage from 'D:/java file/2407_5/small_goose_vue/pages/login/verify-code.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
+{"version":3,"file":"verify-code.js","sources":["../../../ruanjian/HBuilder X/HBuilderX/plugins/uniapp-cli-vite/uniPage:/cGFnZXMvbG9naW4vdmVyaWZ5LWNvZGUudnVl"],"sourcesContent":["import MiniProgramPage from 'D:/java file/2407_5/small_goose_vue/pages/login/verify-code.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}

+ 14 - 0
unpackage/dist/dev/mp-weixin/app.js

@@ -10,6 +10,20 @@ if (!Math) {
   "./pages/mine/index.js";
   "./pages/search/index.js";
   "./pages/calendar/index.js";
+  "./pages/mine/profile.js";
+  "./pages/mine/recycle.js";
+  "./pages/mine/notify.js";
+  "./pages/mine/feedback.js";
+  "./pages/mine/service.js";
+  "./pages/mine/about.js";
+  "./pages/mine/setting.js";
+  "./pages/message/selected.js";
+  "./pages/mine/Merchant.js";
+  "./pages/mine/changePhone.js";
+  "./pages/mine/unbindWechat.js";
+  "./pages/mine/setPassword.js";
+  "./pages/mine/cancelAccount.js";
+  "./pages/course/detail.js";
 }
 const _sfc_main = {
   onLaunch: function() {

+ 15 - 1
unpackage/dist/dev/mp-weixin/app.json

@@ -7,7 +7,21 @@
     "pages/message/index",
     "pages/mine/index",
     "pages/search/index",
-    "pages/calendar/index"
+    "pages/calendar/index",
+    "pages/mine/profile",
+    "pages/mine/recycle",
+    "pages/mine/notify",
+    "pages/mine/feedback",
+    "pages/mine/service",
+    "pages/mine/about",
+    "pages/mine/setting",
+    "pages/message/selected",
+    "pages/mine/Merchant",
+    "pages/mine/changePhone",
+    "pages/mine/unbindWechat",
+    "pages/mine/setPassword",
+    "pages/mine/cancelAccount",
+    "pages/course/detail"
   ],
   "window": {
     "navigationBarTextStyle": "black",

+ 18 - 6
unpackage/dist/dev/mp-weixin/common/assets.js

@@ -1,8 +1,20 @@
 "use strict";
-const _imports_0$1 = "/static/login.png";
-const _imports_0 = "/static/illustration_book.png";
-const _imports_1 = "/static/empty_box.png";
-exports._imports_0 = _imports_0$1;
-exports._imports_0$1 = _imports_0;
-exports._imports_1 = _imports_1;
+const _imports_0$5 = "/static/login.png";
+const _imports_0$4 = "/static/illustration_book.png";
+const _imports_1$1 = "/static/empty_box.png";
+const _imports_0$3 = "/static/wechat.png";
+const _imports_0$2 = "/static/logo.png";
+const _imports_0$1 = "/static/shop.png";
+const _imports_1 = "/static/no_shop.png";
+const _imports_2 = "/static/kefu.png";
+const _imports_0 = "/static/empty-box.png";
+exports._imports_0 = _imports_0$5;
+exports._imports_0$1 = _imports_0$4;
+exports._imports_0$2 = _imports_0$3;
+exports._imports_0$3 = _imports_0$2;
+exports._imports_0$4 = _imports_0$1;
+exports._imports_0$5 = _imports_0;
+exports._imports_1 = _imports_1$1;
+exports._imports_1$1 = _imports_1;
+exports._imports_2 = _imports_2;
 //# sourceMappingURL=../../.sourcemap/mp-weixin/common/assets.js.map

+ 72 - 13
unpackage/dist/dev/mp-weixin/common/vendor.js

@@ -1303,6 +1303,9 @@ function isReadonly(value) {
 function isShallow(value) {
   return !!(value && value["__v_isShallow"]);
 }
+function isProxy(value) {
+  return isReactive(value) || isReadonly(value);
+}
 function toRaw(observed) {
   const raw = observed && observed["__v_raw"];
   return raw ? toRaw(raw) : observed;
@@ -2094,6 +2097,47 @@ function setCurrentRenderingInstance(instance) {
   instance && instance.type.__scopeId || null;
   return prev;
 }
+const COMPONENTS = "components";
+function resolveComponent(name, maybeSelfReference) {
+  return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
+}
+function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
+  const instance = currentRenderingInstance || currentInstance;
+  if (instance) {
+    const Component2 = instance.type;
+    if (type === COMPONENTS) {
+      const selfName = getComponentName(
+        Component2,
+        false
+      );
+      if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
+        return Component2;
+      }
+    }
+    const res = (
+      // local registration
+      // check instance[type] first which is resolved for options API
+      resolve(instance[type] || Component2[type], name) || // global registration
+      resolve(instance.appContext[type], name)
+    );
+    if (!res && maybeSelfReference) {
+      return Component2;
+    }
+    if (warnMissing && !res) {
+      const extra = type === COMPONENTS ? `
+If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
+      warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
+    }
+    return res;
+  } else {
+    warn$1(
+      `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
+    );
+  }
+}
+function resolve(registry, name) {
+  return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
+}
 const INITIAL_WATCHER_VALUE = {};
 function watch(source, cb, options) {
   if (!isFunction(cb)) {
@@ -3704,6 +3748,12 @@ const Static = Symbol.for("v-stc");
 function isVNode(value) {
   return value ? value.__v_isVNode === true : false;
 }
+const InternalObjectKey = `__vInternal`;
+function guardReactiveProps(props) {
+  if (!props)
+    return null;
+  return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
+}
 const emptyAppContext = createAppContext();
 let uid = 0;
 function createComponentInstance(vnode, parent, suspense) {
@@ -4942,6 +4992,11 @@ function initApp(app) {
   }
 }
 const propsCaches = /* @__PURE__ */ Object.create(null);
+function renderProps(props) {
+  const { uid: uid2, __counter } = getCurrentInstance();
+  const propsId = (propsCaches[uid2] || (propsCaches[uid2] = [])).push(guardReactiveProps(props)) - 1;
+  return uid2 + "," + propsId + "," + __counter;
+}
 function pruneComponentPropsCache(uid2) {
   delete propsCaches[uid2];
 }
@@ -5113,6 +5168,7 @@ const f = (source, renderItem) => vFor(source, renderItem);
 const e = (target, ...sources) => extend(target, ...sources);
 const n = (value) => normalizeClass(value);
 const t = (val) => toDisplayString(val);
+const p = (props) => renderProps(props);
 function createApp$1(rootComponent, rootProps = null) {
   rootComponent && (rootComponent.mpType = "app");
   return createVueApp(rootComponent, rootProps).use(plugin);
@@ -5433,8 +5489,8 @@ function promisify$1(name, fn) {
     if (hasCallback(args)) {
       return wrapperReturnValue(name, invokeApi(name, fn, args, rest));
     }
-    return wrapperReturnValue(name, handlePromise(new Promise((resolve, reject) => {
-      invokeApi(name, fn, extend(args, { success: resolve, fail: reject }), rest);
+    return wrapperReturnValue(name, handlePromise(new Promise((resolve2, reject) => {
+      invokeApi(name, fn, extend(args, { success: resolve2, fail: reject }), rest);
     })));
   };
 }
@@ -5749,7 +5805,7 @@ function invokeGetPushCidCallbacks(cid2, errMsg) {
   getPushCidCallbacks.length = 0;
 }
 const API_GET_PUSH_CLIENT_ID = "getPushClientId";
-const getPushClientId = defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_, { resolve, reject }) => {
+const getPushClientId = defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_, { resolve: resolve2, reject }) => {
   Promise.resolve().then(() => {
     if (typeof enabled === "undefined") {
       enabled = false;
@@ -5758,7 +5814,7 @@ const getPushClientId = defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_, { resolve, re
     }
     getPushCidCallbacks.push((cid2, errMsg) => {
       if (cid2) {
-        resolve({ cid: cid2 });
+        resolve2({ cid: cid2 });
       } else {
         reject(errMsg);
       }
@@ -5827,9 +5883,9 @@ function promisify(name, api) {
     if (isFunction(options.success) || isFunction(options.fail) || isFunction(options.complete)) {
       return wrapperReturnValue(name, invokeApi(name, api, options, rest));
     }
-    return wrapperReturnValue(name, handlePromise(new Promise((resolve, reject) => {
+    return wrapperReturnValue(name, handlePromise(new Promise((resolve2, reject) => {
       invokeApi(name, api, extend({}, options, {
-        success: resolve,
+        success: resolve2,
         fail: reject
       }), rest);
     })));
@@ -6418,13 +6474,13 @@ function initRuntimeSocket(hosts, port, id) {
 }
 const SOCKET_TIMEOUT = 500;
 function tryConnectSocket(host2, port, id) {
-  return new Promise((resolve, reject) => {
+  return new Promise((resolve2, reject) => {
     const socket = index.connectSocket({
       url: `ws://${host2}:${port}/${id}`,
       multiple: true,
       // 支付宝小程序 是否开启多实例
       fail() {
-        resolve(null);
+        resolve2(null);
       }
     });
     const timer = setTimeout(() => {
@@ -6432,19 +6488,19 @@ function tryConnectSocket(host2, port, id) {
         code: 1006,
         reason: "connect timeout"
       });
-      resolve(null);
+      resolve2(null);
     }, SOCKET_TIMEOUT);
     socket.onOpen((e2) => {
       clearTimeout(timer);
-      resolve(socket);
+      resolve2(socket);
     });
     socket.onClose((e2) => {
       clearTimeout(timer);
-      resolve(null);
+      resolve2(null);
     });
     socket.onError((e2) => {
       clearTimeout(timer);
-      resolve(null);
+      resolve2(null);
     });
   });
 }
@@ -6876,7 +6932,7 @@ function initOnError() {
 function initRuntimeSocketService() {
   const hosts = "192.168.225.1,192.168.189.1,192.168.171.80,127.0.0.1";
   const port = "8090";
-  const id = "mp-weixin_DtJ2X4";
+  const id = "mp-weixin_UhCft6";
   const lazy = typeof swan !== "undefined";
   let restoreError = lazy ? () => {
   } : initOnError();
@@ -7822,5 +7878,8 @@ exports.f = f;
 exports.index = index;
 exports.n = n;
 exports.o = o;
+exports.p = p;
+exports.resolveComponent = resolveComponent;
 exports.t = t;
+exports.wx$1 = wx$1;
 //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map

+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/index/index.wxml

@@ -1 +1 @@
-<view class="home-bg"><view class="top-bar"><view class="title">小鹅通</view><view class="top-icons"><view class="iconfont icon-search" bindtap="{{a}}"></view><view class="iconfont icon-calendar" bindtap="{{b}}">日历</view></view></view><view class="waterdrop waterdrop-left"></view><view class="waterdrop waterdrop-right"></view><view class="header-content"><view class="date-motivation"><view class="date">{{c}}</view><view class="motivation">加油梦想是可以实现的</view></view><view class="illustration"><image src="{{d}}" class="book-img" mode="aspectFit"/></view></view><view class="my-course"><view class="module-title">我的课程</view><view class="empty-course"><image src="{{e}}" class="empty-img" mode="aspectFit"/><view class="empty-tip">你还没有学习系列课程\n前往查看你的其他课程</view><button class="more-btn">更多课程</button></view></view><view class="find-course">找不到已购课程?</view></view>
+<view class="home-bg"><view class="top-bar"><view class="title">小鹅通</view><view class="top-icons"><view class="iconfont icon-search" bindtap="{{a}}">搜索</view><view class="iconfont icon-calendar" bindtap="{{b}}">日历</view></view></view><view class="waterdrop waterdrop-left"></view><view class="waterdrop waterdrop-right"></view><view class="header-content"><view class="date-motivation"><view class="date">{{c}}</view><view class="motivation">加油梦想是可以实现的</view></view><view class="illustration"><image src="{{d}}" class="book-img" mode="aspectFit"/></view></view><view class="my-course"><view class="module-title">我的课程</view><view class="empty-course"><image src="{{e}}" class="empty-img" mode="aspectFit"/><view class="empty-tip">你还没有学习系列课程\n前往查看你的其他课程</view><button class="more-btn">更多课程</button></view></view><view class="find-course">找不到已购课程?</view></view>

+ 39 - 99
unpackage/dist/dev/mp-weixin/pages/login/index.js

@@ -15,115 +15,55 @@ const _sfc_main = {
       this.isAgreed = e.detail.value.length > 0;
     },
     // 微信登录
-    async handleWechatLogin() {
+    handleWechatLogin() {
       if (!this.isAgreed) {
         common_vendor.index.showToast({ title: "请先同意用户协议和隐私政策", icon: "none" });
         return;
       }
-      try {
-        const loginResult = await new Promise((resolve, reject) => {
-          common_vendor.index.login({
-            provider: "weixin",
-            success: (res) => resolve(res),
-            fail: (err) => reject(err)
+      common_vendor.wx$1.getUserProfile({
+        desc: "用于登录和完善个人信息",
+        // 清晰的授权用途说明
+        success: async (userRes) => {
+          const { encryptedData, iv } = userRes;
+          common_vendor.index.__f__("log", "at pages/login/index.vue:76", userRes);
+          const loginResult = await new Promise((resolve, reject) => {
+            common_vendor.wx$1.login({ success: resolve, fail: reject });
           });
-        });
-        if (!loginResult.code) {
-          common_vendor.index.showToast({ title: "获取登录凭证失败", icon: "none" });
-          return;
-        }
-        common_vendor.index.__f__("log", "at pages/login/index.vue:88", "获取到的code:", loginResult.code);
-        const userInfoResult = await new Promise((resolve, reject) => {
-          common_vendor.index.getUserInfo({
-            provider: "weixin",
-            withCredentials: true,
-            success: (res) => resolve(res),
-            fail: (err) => reject(err)
-          });
-        });
-        if (!userInfoResult.userInfo) {
-          common_vendor.index.showToast({ title: "获取用户信息失败", icon: "none" });
-          return;
-        }
-        const loginRes = await common_vendor.index.request({
-          url: "http://localhost:9527/api/wx-login",
-          method: "POST",
-          data: {
-            code: loginResult.code,
-            nickName: userInfoResult.userInfo.nickName,
-            avatarUrl: userInfoResult.userInfo.avatarUrl,
-            gender: userInfoResult.userInfo.gender.toString(),
-            country: userInfoResult.userInfo.country,
-            province: userInfoResult.userInfo.province,
-            city: userInfoResult.userInfo.city,
-            language: userInfoResult.userInfo.language,
-            rawData: userInfoResult.rawData,
-            signature: userInfoResult.signature,
-            encryptedData: userInfoResult.encryptedData,
-            iv: userInfoResult.iv
-          },
-          header: {
-            "content-type": "application/json"
+          if (!loginResult.code) {
+            common_vendor.index.showToast({ title: "登录凭证获取失败", icon: "none" });
+            return;
           }
-        });
-        if (loginRes.data.errcode === 40029) {
-          common_vendor.index.__f__("error", "at pages/login/index.vue:130", "微信登录code无效,尝试重新获取");
-          const newLoginResult = await new Promise((resolve, reject) => {
-            common_vendor.index.login({
-              provider: "weixin",
-              success: (res) => resolve(res),
-              fail: (err) => reject(err)
+          const code = loginResult.code;
+          common_vendor.index.__f__("log", "at pages/login/index.vue:87", code);
+          const avatar_url = userRes.userInfo.avatarUrl;
+          const nickname = userRes.userInfo.nickName;
+          try {
+            const loginRes = await common_vendor.index.request({
+              url: "http://localhost:9527/api/wx-login",
+              method: "POST",
+              data: { code, encryptedData, iv, avatar_url, nickname },
+              header: { "content-type": "application/json" }
             });
-          });
-          if (!newLoginResult.code) {
-            throw new Error("重新获取登录凭证失败");
-          }
-          const retryRes = await common_vendor.index.request({
-            url: "http://localhost:9527/api/wx-login",
-            method: "POST",
-            data: {
-              code: newLoginResult.code,
-              nickName: userInfoResult.userInfo.nickName,
-              avatarUrl: userInfoResult.userInfo.avatarUrl,
-              gender: userInfoResult.userInfo.gender.toString(),
-              country: userInfoResult.userInfo.country,
-              province: userInfoResult.userInfo.province,
-              city: userInfoResult.userInfo.city,
-              language: userInfoResult.userInfo.language,
-              rawData: userInfoResult.rawData,
-              signature: userInfoResult.signature,
-              encryptedData: userInfoResult.encryptedData,
-              iv: userInfoResult.iv
-            },
-            header: {
-              "content-type": "application/json"
+            common_vendor.index.__f__("log", "at pages/login/index.vue:98", loginRes);
+            if (loginRes.statusCode !== 200 || loginRes.data.errcode) {
+              throw new Error(loginRes.data.errmsg || "登录失败");
             }
-          });
-          if (retryRes.statusCode === 200 && !retryRes.data.errcode) {
-            common_vendor.index.setStorageSync("token", retryRes.data.data.token);
-            common_vendor.index.setStorageSync("userInfo", retryRes.data.data.userInfo);
-            common_vendor.index.switchTab({
-              url: "/pages/discover/index"
-            });
-          } else {
-            throw new Error(retryRes.data.errmsg || "登录失败");
+            common_vendor.index.setStorageSync("uid", loginRes.data.data.id);
+            common_vendor.index.setStorageSync("token", loginRes.data.data.token);
+            common_vendor.index.setStorageSync("userInfo", loginRes.data.data.userInfo);
+            common_vendor.index.switchTab({ url: "/pages/discover/index" });
+          } catch (error) {
+            common_vendor.index.__f__("error", "at pages/login/index.vue:111", "登录接口调用失败:", error);
+            common_vendor.index.showToast({ title: "登录失败,请重试", icon: "none" });
+          }
+        },
+        fail: (err) => {
+          common_vendor.index.__f__("error", "at pages/login/index.vue:116", "用户授权失败:", err);
+          if (err.errCode === 10004) {
+            common_vendor.index.showToast({ title: "请授权后再登录", icon: "none" });
           }
-        } else if (loginRes.statusCode === 200 && !loginRes.data.errcode) {
-          common_vendor.index.setStorageSync("token", loginRes.data.data.token);
-          common_vendor.index.setStorageSync("userInfo", loginRes.data.data.userInfo);
-          common_vendor.index.switchTab({
-            url: "/pages/discover/index"
-          });
-        } else {
-          throw new Error(loginRes.data.errmsg || "登录失败");
         }
-      } catch (error) {
-        common_vendor.index.__f__("error", "at pages/login/index.vue:192", "登录过程出错:", error);
-        common_vendor.index.showToast({
-          title: error.message || "登录失败,请重试",
-          icon: "none"
-        });
-      }
+      });
     },
     // 跳转到验证码登录页面
     navigateToVerifyCodeLogin() {

+ 25 - 4
unpackage/dist/dev/mp-weixin/pages/login/verify-code.js

@@ -87,17 +87,38 @@ const _sfc_main = {
         common_vendor.index.showToast({ title: "请先同意服务协议和隐私政策", icon: "none" });
         return;
       }
-      common_vendor.index.switchTab({
-        url: "/pages/discover/index"
-        // 替换为实际页面路径
+      const res = await common_vendor.index.request({
+        url: "http://localhost:9527/api/login",
+        method: "POST",
+        data: {
+          phone: this.phone,
+          password: this.password,
+          code: this.verifyCode
+        },
+        header: {
+          "content-type": "application/json"
+        }
       });
+      common_vendor.index.__f__("log", "at pages/login/verify-code.vue:173", res.data);
+      if (res.data.code === 200) {
+        common_vendor.index.setStorageSync("token", res.data.data.token);
+        common_vendor.index.switchTab({
+          url: "/pages/discover/index"
+          // 替换为实际页面路径
+        });
+      } else {
+        common_vendor.index.showToast({
+          title: "登录失败",
+          icon: "none"
+        });
+      }
     },
     closePopup() {
       this.showServiceAgreement = false;
       this.showPrivacyPolicy = false;
     },
     goToWechatLogin() {
-      common_vendor.index.switchTab({
+      common_vendor.index.navigateTo({
         url: "/pages/login/index"
       });
     }

+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/login/verify-code.wxml

@@ -1 +1 @@
-<view class="login-bg"><view class="login-center"><view class="login-card"><view class="login-tabs"><view class="{{['tab', a]}}" bindtap="{{b}}">验证码登录</view><view class="{{['tab', c]}}" bindtap="{{d}}">密码登录</view></view><view wx:if="{{e}}" class="form-area"><input class="input" type="number" maxlength="11" placeholder="请输入手机号" value="{{f}}" bindinput="{{g}}"/><view class="input-group"><input class="input" type="number" maxlength="6" placeholder="请输入验证码" value="{{h}}" bindinput="{{i}}"/><text class="{{['send-code', k && 'disabled']}}" bindtap="{{l}}">{{j}}</text></view></view><view wx:else class="form-area"><input class="input" type="text" maxlength="32" placeholder="请输入账号/手机号" value="{{m}}" bindinput="{{n}}"/><view class="input-group"><block wx:if="{{r0}}"><input class="input" type="{{o}}" maxlength="20" placeholder="请输入密码" value="{{p}}" bindinput="{{q}}"/></block><text class="{{['iconfont', r]}}" bindtap="{{s}}"></text></view></view><view class="back-to-wechat" bindtap="{{t}}"><text class="back-link">返回微信登录</text></view><button class="login-btn" disabled="{{v}}" bindtap="{{w}}"> 登录/注册 </button><view class="agreement"><checkbox-group bindchange="{{A}}"><label class="agreement-label"><checkbox checked="{{x}}" color="#07C160"/><text class="agreement-text"> 我已阅读并同意 <text class="link" catchtap="{{y}}">《用户协议》</text> 和 <text class="link" catchtap="{{z}}">《隐私政策》</text></text></label></checkbox-group></view></view></view></view>
+<view class="login-bg"><view class="login-center"><view class="login-card"><view class="login-tabs"><view class="{{['tab', a]}}" bindtap="{{b}}">验证码登录</view><view class="{{['tab', c]}}" bindtap="{{d}}">密码登录</view></view><view wx:if="{{e}}" class="form-area"><input class="input" type="number" maxlength="11" placeholder="请输入手机号" value="{{f}}" bindinput="{{g}}"/><view class="input-group"><input class="input" type="number" maxlength="6" placeholder="请输入验证码" value="{{h}}" bindinput="{{i}}"/><text class="{{['send-code', k && 'disabled']}}" bindtap="{{l}}">{{j}}</text></view></view><view wx:else class="form-area"><input class="input" type="text" maxlength="32" placeholder="请输入账号/手机号" value="{{m}}" bindinput="{{n}}"/><view class="input-group"><block wx:if="{{r0}}"><input class="input" type="{{o}}" password maxlength="20" placeholder="请输入密码" value="{{p}}" bindinput="{{q}}"/></block><text class="{{['iconfont', r]}}" bindtap="{{s}}"></text></view></view><view class="back-to-wechat" bindtap="{{t}}"><text class="back-link">返回微信登录</text></view><button class="login-btn" disabled="{{v}}" bindtap="{{w}}"> 登录/注册 </button><view class="agreement"><checkbox-group bindchange="{{A}}"><label class="agreement-label"><checkbox checked="{{x}}" color="#07C160"/><text class="agreement-text"> 我已阅读并同意 <text class="link" catchtap="{{y}}">《用户协议》</text> 和 <text class="link" catchtap="{{z}}">《隐私政策》</text></text></label></checkbox-group></view></view></view></view>

+ 1 - 1
unpackage/dist/dev/mp-weixin/project.config.json

@@ -29,7 +29,7 @@
     "ignore": [],
     "include": []
   },
-  "appid": "wx3d250e9c83ec74ee",
+  "appid": "wx8246d27305af5834",
   "editorSetting": {},
   "libVersion": "3.8.3"
 }

+ 20 - 20
unpackage/dist/dev/mp-weixin/project.private.config.json

@@ -1,22 +1,22 @@
 {
-  "libVersion": "3.8.3",
-  "projectname": "small_goose_vue",
-  "setting": {
-    "urlCheck": true,
-    "coverView": true,
-    "lazyloadPlaceholderEnable": false,
-    "skylineRenderEnable": false,
-    "preloadBackgroundData": false,
-    "autoAudits": false,
-    "showShadowRootInWxmlPanel": true,
-    "compileHotReLoad": true,
-    "useApiHook": true,
-    "useApiHostProcess": true,
-    "useStaticServer": false,
-    "useLanDebug": false,
-    "showES6CompileOption": false,
-    "checkInvalidKey": true,
-    "ignoreDevUnusedFiles": true,
-    "bigPackageSizeSupport": false
-  }
+    "libVersion": "2.25.4",
+    "projectname": "small_goose_vue",
+    "setting": {
+        "urlCheck": false,
+        "coverView": true,
+        "lazyloadPlaceholderEnable": false,
+        "skylineRenderEnable": false,
+        "preloadBackgroundData": false,
+        "autoAudits": false,
+        "showShadowRootInWxmlPanel": true,
+        "compileHotReLoad": true,
+        "useApiHook": true,
+        "useApiHostProcess": true,
+        "useStaticServer": false,
+        "useLanDebug": false,
+        "showES6CompileOption": false,
+        "checkInvalidKey": true,
+        "ignoreDevUnusedFiles": true,
+        "bigPackageSizeSupport": false
+    }
 }

部分文件因文件數量過多而無法顯示