1 line
4.8 KiB
Plaintext
1 line
4.8 KiB
Plaintext
{"version":3,"sources":["pages/user/change-password.uvue","pages/user/terms.uvue","uni_modules/ak-req/ak-req.uts"],"sourcesContent":["<template>\r\n <view class=\"page-container\">\r\n <view class=\"form-group\">\r\n <view class=\"input-item\">\r\n <text class=\"label\">旧密码</text>\r\n <input class=\"input\" type=\"password\" placeholder=\"请输入旧密码\" v-model=\"oldPassword\" />\r\n </view>\r\n <view class=\"input-item\">\r\n <text class=\"label\">新密码</text>\r\n <input class=\"input\" type=\"password\" placeholder=\"请输入新密码\" v-model=\"newPassword\" />\r\n </view>\r\n <view class=\"input-item\">\r\n <text class=\"label\">确认密码</text>\r\n <input class=\"input\" type=\"password\" placeholder=\"请再次输入新密码\" v-model=\"confirmPassword\" />\r\n </view>\r\n </view>\r\n \r\n <button class=\"submit-btn\" @click=\"handleSubmit\">确认修改</button>\r\n </view>\r\n</template>\r\n\r\n<script setup lang=\"uts\">\r\nimport { ref } from 'vue'\r\nimport supa from '@/components/supadb/aksupainstance.uts'\r\n\r\nconst oldPassword = ref('')\r\nconst newPassword = ref('')\r\nconst confirmPassword = ref('')\r\n\r\nconst handleSubmit = async () => {\r\n if (!oldPassword.value || !newPassword.value || !confirmPassword.value) {\r\n uni.showToast({\r\n title: '请填写完整信息',\r\n icon: 'none'\r\n })\r\n return\r\n }\r\n \r\n if (newPassword.value !== confirmPassword.value) {\r\n uni.showToast({\r\n title: '两次输入的密码不一致',\r\n icon: 'none'\r\n })\r\n return\r\n }\r\n \r\n uni.showLoading({ title: '提交中...' })\r\n \r\n try {\r\n // 注意:Supabase Auth updatePassword 不需要由于已经是登录状态不需要验证旧密码\r\n // 如果严谨流程,应该先用旧密码尝试登录一次(Verified)\r\n // 这里简化流程直接修改\r\n const { error } = await supa.auth.updateUser({\r\n password: newPassword.value\r\n })\r\n \r\n uni.hideLoading()\r\n \r\n if (error !== null) {\r\n console.error(error)\r\n uni.showToast({\r\n title: '修改失败: ' + error.message,\r\n icon: 'none'\r\n })\r\n return\r\n }\r\n \r\n uni.showToast({\r\n title: '修改成功',\r\n icon: 'success'\r\n })\r\n setTimeout(() => {\r\n uni.navigateBack()\r\n }, 1500)\r\n } catch (e) {\r\n uni.hideLoading()\r\n console.error(e)\r\n uni.showToast({\r\n title: '请求异常',\r\n icon: 'none'\r\n })\r\n }\r\n}\r\n</script>\r\n\r\n<style>\r\n.page-container {\r\n padding: 20px;\r\n background-color: #f5f5f5;\r\n flex: 1;\r\n background-color: #fff;\r\n border-radius: 8px;\r\n padding: 0 15px;\r\n margin-bottom: 30px;\r\n}\r\n\r\n.input-item {\r\n display: flex;\r\n align-items: center;\r\n height: 50px;\r\n border-bottom: 1px solid #eee;\r\n}\r\n\r\n.input-item:last-child {\r\n border-bottom: none;\r\n}\r\n\r\n.label {\r\n width: 80px;\r\n font-size: 14px;\r\n color: #333;\r\n}\r\n\r\n.input {\r\n flex: 1;\r\n font-size: 14px;\r\n}\r\n\r\n.submit-btn {\r\n background-color: #007aff;\r\n color: #fff;\r\n border-radius: 25px;\r\n font-size: 16px;\r\n}\r\n</style>",null,null],"names":[],"mappings":";;;;;;;;;;;;;;+BAwDU,eAAA;;+BAVJ,eAAA;;;;;;;;;;YArBN,IAAM,cAAc,IAAI;YACxB,IAAM,cAAc,IAAI;YACxB,IAAM,kBAAkB,IAAI;YAE5B,IAAM,eAAe,OAAK,WAAA,IAAA,EAAM;gBAAA,OAAA,eAAA;wBAC9B,IAAI,CAAC,YAAY,KAAK,CAAA,EAAA,CAAI,CAAC,YAAY,KAAK,CAAA,EAAA,CAAI,CAAC,gBAAgB,KAAK,EAAE;2DAEpE,QAAO,WACP,OAAM;4BAER;;wBAGF,IAAI,YAAY,KAAK,CAAA,GAAA,CAAK,gBAAgB,KAAK,EAAE;2DAE7C,QAAO,cACP,OAAM;4BAER;;wBAGE,mCAAc,QAAO;wBAEzB,IAAI;4BAIA,IAAM,AAAE,QAAU,CAAA,MAAM,aAAK,IAAI,CAAC,UAAU,CA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