diff --git a/.cursor/rules/coding-standards.mdc b/.cursor/rules/coding-standards.mdc new file mode 100644 index 0000000..b93c988 --- /dev/null +++ b/.cursor/rules/coding-standards.mdc @@ -0,0 +1,5 @@ +--- +description: +globs: +alwaysApply: false +--- diff --git a/.cursor/rules/project-guide.mdc b/.cursor/rules/project-guide.mdc new file mode 100644 index 0000000..b93c988 --- /dev/null +++ b/.cursor/rules/project-guide.mdc @@ -0,0 +1,5 @@ +--- +description: +globs: +alwaysApply: false +--- diff --git a/.cursor/rules/social-login-errors.mdc b/.cursor/rules/social-login-errors.mdc new file mode 100644 index 0000000..b93c988 --- /dev/null +++ b/.cursor/rules/social-login-errors.mdc @@ -0,0 +1,5 @@ +--- +description: +globs: +alwaysApply: false +--- diff --git a/.cursor/rules/troubleshooting.mdc b/.cursor/rules/troubleshooting.mdc new file mode 100644 index 0000000..b93c988 --- /dev/null +++ b/.cursor/rules/troubleshooting.mdc @@ -0,0 +1,5 @@ +--- +description: +globs: +alwaysApply: false +--- diff --git a/pages/login.vue b/pages/login.vue index f61e53c..1ad5056 100644 --- a/pages/login.vue +++ b/pages/login.vue @@ -57,6 +57,9 @@ export default { return new Promise((resolve, reject) => { uni.login({ success: res => { + // 注意:这里保存的是微信的授权码 code,不是真正的 openId + // code 是临时的,只能使用一次,有效期约5分钟 + // 后续应该通过后端接口用 code 换取真正的 openId setOpenId(res.code) resolve() }, diff --git a/sub/common/waiting.vue b/sub/common/waiting.vue index 252a226..73aa95b 100644 --- a/sub/common/waiting.vue +++ b/sub/common/waiting.vue @@ -43,7 +43,7 @@ export default { }) qrLogin({ code: this.scene, - openid: getAccessToken() + openid: getOpenId() }).then(res => { setTimeout(() => { uni.hideLoading() diff --git a/utils/auth.js b/utils/auth.js index a823da0..14139ed 100644 --- a/utils/auth.js +++ b/utils/auth.js @@ -30,5 +30,5 @@ export function getOpenId() { } export function removeOpenId() { - uni.removeStorageSync(OpenId) + uni.removeStorageSync(OpenIdKey) } \ No newline at end of file