|
|
@@ -3,13 +3,15 @@ const common_vendor = require("../../common/vendor.js");
|
|
|
const utils_assets = require("../../utils/assets.js");
|
|
|
const api_system_agreement = require("../../api/system/agreement.js");
|
|
|
const api_auth_index = require("../../api/auth/index.js");
|
|
|
+const api_resource_oss = require("../../api/resource/oss.js");
|
|
|
const _sfc_main = {
|
|
|
data() {
|
|
|
return {
|
|
|
assets: utils_assets.assets,
|
|
|
isAgreed: false,
|
|
|
activeModal: "",
|
|
|
- avatarBase64: "",
|
|
|
+ avatarOssId: null,
|
|
|
+ avatarPreviewUrl: "",
|
|
|
userName: "微信用户",
|
|
|
currentProtocol: { title: "", content: "" },
|
|
|
protocols: {
|
|
|
@@ -51,8 +53,8 @@ const _sfc_main = {
|
|
|
}
|
|
|
const res = await api_auth_index.wechatLogin({ loginCode: loginRes.code });
|
|
|
common_vendor.index.hideLoading();
|
|
|
- if (res.data && res.data.accessToken) {
|
|
|
- common_vendor.index.setStorageSync("token", res.data.accessToken);
|
|
|
+ if (res.data && res.data.access_token) {
|
|
|
+ common_vendor.index.setStorageSync("token", res.data.access_token);
|
|
|
common_vendor.index.setStorageSync("isLogin", true);
|
|
|
common_vendor.index.showToast({ title: "登录成功", icon: "success" });
|
|
|
setTimeout(() => {
|
|
|
@@ -67,34 +69,34 @@ const _sfc_main = {
|
|
|
}
|
|
|
} catch (error) {
|
|
|
common_vendor.index.hideLoading();
|
|
|
- common_vendor.index.__f__("error", "at pages/login/index.vue:196", "登录错误:", error);
|
|
|
+ common_vendor.index.__f__("error", "at pages/login/index.vue:190", "登录错误:", error);
|
|
|
common_vendor.index.showToast({ title: "登录失败,请重试", icon: "none" });
|
|
|
}
|
|
|
},
|
|
|
- onChooseAvatar(e) {
|
|
|
+ async onChooseAvatar(e) {
|
|
|
const tempPath = e.detail.avatarUrl;
|
|
|
- common_vendor.index.__f__("log", "at pages/login/index.vue:202", "[微信信息] 头像临时路径:", tempPath);
|
|
|
- const fs = common_vendor.index.getFileSystemManager();
|
|
|
- fs.readFile({
|
|
|
- filePath: tempPath,
|
|
|
- encoding: "base64",
|
|
|
- success: (res) => {
|
|
|
- common_vendor.index.__f__("log", "at pages/login/index.vue:208", "[微信信息] 头像 base64 长度:", res.data.length);
|
|
|
- this.avatarBase64 = "data:image/jpeg;base64," + res.data;
|
|
|
- common_vendor.index.__f__("log", "at pages/login/index.vue:210", "[微信信息] avatarBase64 已赋值,前缀:", this.avatarBase64.substring(0, 30));
|
|
|
- },
|
|
|
- fail: (err) => {
|
|
|
- common_vendor.index.__f__("error", "at pages/login/index.vue:213", "[微信信息] 读取头像 base64 失败:", err);
|
|
|
- }
|
|
|
- });
|
|
|
+ common_vendor.index.__f__("log", "at pages/login/index.vue:196", "[微信信息] 头像临时路径:", tempPath);
|
|
|
+ this.avatarPreviewUrl = tempPath;
|
|
|
+ try {
|
|
|
+ common_vendor.index.showLoading({ title: "上传头像..." });
|
|
|
+ const res = await api_resource_oss.uploadFile(tempPath);
|
|
|
+ common_vendor.index.hideLoading();
|
|
|
+ this.avatarOssId = res.ossId;
|
|
|
+ this.avatarPreviewUrl = res.url;
|
|
|
+ common_vendor.index.__f__("log", "at pages/login/index.vue:204", "[微信信息] 头像OSS上传成功, ossId:", this.avatarOssId);
|
|
|
+ } catch (err) {
|
|
|
+ common_vendor.index.hideLoading();
|
|
|
+ common_vendor.index.__f__("error", "at pages/login/index.vue:207", "[微信信息] 头像上传失败:", err);
|
|
|
+ common_vendor.index.showToast({ title: "头像上传失败", icon: "none" });
|
|
|
+ }
|
|
|
},
|
|
|
onNicknameBlur(e) {
|
|
|
this.userName = e.detail.value;
|
|
|
- common_vendor.index.__f__("log", "at pages/login/index.vue:219", "[微信信息] 昵称(blur):", this.userName);
|
|
|
+ common_vendor.index.__f__("log", "at pages/login/index.vue:213", "[微信信息] 昵称(blur):", this.userName);
|
|
|
},
|
|
|
onNicknameChange(e) {
|
|
|
this.userName = e.detail.value;
|
|
|
- common_vendor.index.__f__("log", "at pages/login/index.vue:223", "[微信信息] 昵称(input):", this.userName);
|
|
|
+ common_vendor.index.__f__("log", "at pages/login/index.vue:217", "[微信信息] 昵称(input):", this.userName);
|
|
|
},
|
|
|
async goToPhoneAuth() {
|
|
|
this.phoneNumber = "";
|
|
|
@@ -119,13 +121,13 @@ const _sfc_main = {
|
|
|
unionId: this.unionId,
|
|
|
phone: this.phoneNumber,
|
|
|
nickname: this.userName,
|
|
|
- avatar: this.avatarBase64
|
|
|
+ avatar: this.avatarOssId
|
|
|
});
|
|
|
common_vendor.index.hideLoading();
|
|
|
this.performLogin();
|
|
|
} catch (error) {
|
|
|
common_vendor.index.hideLoading();
|
|
|
- common_vendor.index.__f__("error", "at pages/login/index.vue:262", "注册错误:", error);
|
|
|
+ common_vendor.index.__f__("error", "at pages/login/index.vue:256", "注册错误:", error);
|
|
|
common_vendor.index.showToast({ title: "注册失败,请重试", icon: "none" });
|
|
|
}
|
|
|
},
|
|
|
@@ -146,7 +148,7 @@ const _sfc_main = {
|
|
|
this.protocols.user = { title: userRes.data.title, content: userRes.data.content };
|
|
|
this.protocols.privacy = { title: privacyRes.data.title, content: privacyRes.data.content };
|
|
|
} catch (e) {
|
|
|
- common_vendor.index.__f__("error", "at pages/login/index.vue:281", "[协议] 加载失败", e);
|
|
|
+ common_vendor.index.__f__("error", "at pages/login/index.vue:275", "[协议] 加载失败", e);
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
@@ -172,26 +174,25 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
}, $data.activeModal === "profile" ? {
|
|
|
n: common_vendor.o(($event) => $data.activeModal = "", "c9"),
|
|
|
o: common_vendor.o(($event) => $data.activeModal = "phone", "14"),
|
|
|
- p: $data.avatarBase64 || "https://img.icons8.com/color/144/user.png",
|
|
|
+ p: $data.avatarPreviewUrl || "https://img.icons8.com/color/144/user.png",
|
|
|
q: common_vendor.o((...args) => $options.onChooseAvatar && $options.onChooseAvatar(...args), "14"),
|
|
|
r: $data.userName,
|
|
|
- s: common_vendor.o((...args) => $options.onNicknameBlur && $options.onNicknameBlur(...args), "60"),
|
|
|
- t: common_vendor.o((...args) => $options.onNicknameChange && $options.onNicknameChange(...args), "df"),
|
|
|
- v: common_vendor.o((...args) => $options.goToPhoneAuth && $options.goToPhoneAuth(...args), "65")
|
|
|
+ s: common_vendor.o((...args) => $options.onNicknameBlur && $options.onNicknameBlur(...args), "64"),
|
|
|
+ t: common_vendor.o((...args) => $options.onNicknameChange && $options.onNicknameChange(...args), "dc"),
|
|
|
+ v: common_vendor.o((...args) => $options.goToPhoneAuth && $options.goToPhoneAuth(...args), "c4")
|
|
|
} : {}, {
|
|
|
w: $data.activeModal === "phone"
|
|
|
}, $data.activeModal === "phone" ? {
|
|
|
x: $data.assets.logo,
|
|
|
- y: common_vendor.t($data.phoneNumber || "获取中..."),
|
|
|
- z: common_vendor.o(($event) => $data.activeModal = "", "8c"),
|
|
|
- A: common_vendor.o((...args) => $options.handleGetPhoneNumber && $options.handleGetPhoneNumber(...args), "f8")
|
|
|
+ y: common_vendor.o(($event) => $data.activeModal = "", "9a"),
|
|
|
+ z: common_vendor.o((...args) => $options.handleGetPhoneNumber && $options.handleGetPhoneNumber(...args), "c5")
|
|
|
} : {}, {
|
|
|
- B: $data.activeModal === "protocol"
|
|
|
+ A: $data.activeModal === "protocol"
|
|
|
}, $data.activeModal === "protocol" ? {
|
|
|
- C: common_vendor.t($data.currentProtocol.title),
|
|
|
- D: common_vendor.o(($event) => $data.activeModal = "", "d4"),
|
|
|
- E: $data.currentProtocol.content,
|
|
|
- F: common_vendor.o(($event) => $data.activeModal = "", "7e")
|
|
|
+ B: common_vendor.t($data.currentProtocol.title),
|
|
|
+ C: common_vendor.o(($event) => $data.activeModal = "", "4d"),
|
|
|
+ D: $data.currentProtocol.content,
|
|
|
+ E: common_vendor.o(($event) => $data.activeModal = "", "4e")
|
|
|
} : {});
|
|
|
}
|
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-d08ef7d4"]]);
|