"use strict"; const common_vendor = require("../../common/vendor.js"); const components_request = require("../../components/request.js"); const components_postFile = require("../../components/postFile.js"); const components_generateFileName = require("../../components/generateFileName.js"); const components_goEasyTool_tool = require("../../components/goEasyTool/tool.js"); const _sfc_main = { inject: ["$global"], data() { return { userinfo: "", name: "", id: "", info: {}, useravatar: "", email: null, havaPassword: false }; }, onLoad(option) { common_vendor.index.getStorage({ key: "userinfo", success: (res) => { this.id = res.data.id; this.name = res.data.nickName; this.userinfo = this.useravatar = res.data.headerIcon; this.email = res.data.email; this.havaPassword = res.data.havaPassword; } }); }, onShow() { common_vendor.index.getStorage({ key: "userinfo", success: (res) => { this.id = res.data.id; this.name = res.data.nickName; this.userinfo = this.useravatar = res.data.headerIcon; this.email = res.data.email; this.havaPassword = res.data.havaPassword; } }); }, methods: { //修改密码 modifyPassword() { common_vendor.index.navigateTo({ url: "/pages/Setting/settingmod/changePassword?id=" + this.id }); }, // 修改邮箱 modifyEmailAddress() { common_vendor.index.navigateTo({ url: "/pages/Setting/settingmod/changeEmail?email=" + this.email + "&id=" + this.id }); }, // 修改昵称 inputNickname() { common_vendor.index.navigateTo({ url: "/pages/Setting/settingmod/changeNickname?name=" + this.name + "&id=" + this.id }); }, // 扫码登录web端 scanCode() { common_vendor.index.scanCode({ success: (res) => { const data = JSON.parse(res.result); if (data.type === "qrcdoe") { components_request.request({ url: "user/scan", method: "POST", data: { uuid: data.uuid, userId: this.id }, userInfo: true }).then((res2) => { if (res2.code === 200) { common_vendor.index.showToast({ title: "登录成功", icon: "success" }); } else { common_vendor.index.showToast({ title: res2, icon: "none" }); } }).catch((err) => { common_vendor.index.showToast({ title: "登录失败", icon: "none" }); }); } } }); }, onBack() { common_vendor.index.navigateBack({ delta: 1 }); }, // 选择头像 async Userinfo(e) { const { avatarUrl } = e.detail; this.userinfo = avatarUrl; this.changeHeaderIcon(); }, // 修改头像 changeHeaderIcon() { components_goEasyTool_tool.goEasylogout(this.$goeasy); common_vendor.index.showLoading({ title: "修改中...", mask: true }); components_postFile.uploadFile({ path: this.userinfo, name: components_generateFileName.generateFileName() }).then((res) => { components_request.request({ url: "user/updateUserInfo", method: "POST", data: { id: this.id, headerIcon: res.split("/").pop(), nickName: this.name }, userInfo: true }).then((ress) => { common_vendor.index.__f__("log", "at pages/Setting/Setting.vue:226", "修改调用返回", ress); if (ress.code === 200) { common_vendor.index.showToast({ title: "修改成功", icon: "success" }); common_vendor.index.setStorageSync("userinfo", ress.data.info); components_goEasyTool_tool.goEasylogin( this.$goeasy, String(ress.data.info.id), ress.data.info.headerIcon, ress.data.info.nickName ); common_vendor.index.hideLoading(); common_vendor.index.navigateBack({ delta: 1 }); } else { common_vendor.index.hideLoading(); common_vendor.index.showToast({ title: ress.msg, icon: "none" }); } }); }).catch((err) => { common_vendor.index.hideLoading(); common_vendor.index.showToast({ title: "上传失败", icon: "none" }); }); } } }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return { a: common_vendor.o((...args) => $options.onBack && $options.onBack(...args)), b: $data.userinfo, c: common_vendor.o((...args) => $options.Userinfo && $options.Userinfo(...args)), d: common_vendor.t($data.name), e: common_vendor.o((...args) => $options.inputNickname && $options.inputNickname(...args)), f: common_vendor.t($data.email == "" || $data.email == null ? "未绑定" : $data.email), g: common_vendor.o((...args) => $options.modifyEmailAddress && $options.modifyEmailAddress(...args)), h: common_vendor.t($data.havaPassword ? "" : "未设置"), i: common_vendor.o((...args) => $options.modifyPassword && $options.modifyPassword(...args)), j: common_vendor.o((...args) => $options.scanCode && $options.scanCode(...args)) }; } const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-3c55a289"]]); wx.createPage(MiniProgramPage); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/Setting/Setting.js.map