first commit
This commit is contained in:
122
unpackage/dist/dev/mp-weixin/pages/mine/sett.js
vendored
Normal file
122
unpackage/dist/dev/mp-weixin/pages/mine/sett.js
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const common_assets = require("../../common/assets.js");
|
||||
const api_index = require("../../api/index.js");
|
||||
const utils_fun = require("../../utils/fun.js");
|
||||
const store_index = require("../../store/index.js");
|
||||
const uni_modules_wotDesignUni_components_wdMessageBox_index = require("../../uni_modules/wot-design-uni/components/wd-message-box/index.js");
|
||||
require("../../uni_modules/wot-design-uni/locale/index.js");
|
||||
require("../../uni_modules/wot-design-uni/dayjs/index.js");
|
||||
if (!Array) {
|
||||
const _easycom_wd_navbar2 = common_vendor.resolveComponent("wd-navbar");
|
||||
const _easycom_wd_message_box2 = common_vendor.resolveComponent("wd-message-box");
|
||||
(_easycom_wd_navbar2 + _easycom_wd_message_box2)();
|
||||
}
|
||||
const _easycom_wd_navbar = () => "../../uni_modules/wot-design-uni/components/wd-navbar/wd-navbar.js";
|
||||
const _easycom_wd_message_box = () => "../../uni_modules/wot-design-uni/components/wd-message-box/wd-message-box.js";
|
||||
if (!Math) {
|
||||
(_easycom_wd_navbar + _easycom_wd_message_box)();
|
||||
}
|
||||
const _sfc_main = {
|
||||
__name: "sett",
|
||||
setup(__props) {
|
||||
const message = uni_modules_wotDesignUni_components_wdMessageBox_index.useMessage();
|
||||
const store = store_index.Store();
|
||||
const back = () => {
|
||||
common_vendor.index.navigateBack();
|
||||
};
|
||||
const userInfo = common_vendor.computed(() => store.userInfo || {});
|
||||
const form = common_vendor.ref({
|
||||
avatar: "",
|
||||
nickname: "",
|
||||
mobile: "",
|
||||
sex: 0
|
||||
});
|
||||
common_vendor.onShow(async () => {
|
||||
await store.usersGetInfo();
|
||||
});
|
||||
common_vendor.onLoad(async () => {
|
||||
const storage = common_vendor.index.getStorageSync("userInfo");
|
||||
if (storage) {
|
||||
const getData = await getUser();
|
||||
common_vendor.index.setStorageSync("userInfo", getData);
|
||||
form.value = { ...getData };
|
||||
}
|
||||
});
|
||||
function prompt() {
|
||||
message.prompt({
|
||||
title: "请输入昵称",
|
||||
inputValue: form.value.nickname
|
||||
}).then(async (res) => {
|
||||
await api_index.api.usersUpdate({ nickname: res.value || "微信用户" });
|
||||
await store.usersGetInfo();
|
||||
}).catch((error) => {
|
||||
common_vendor.index.__f__("log", "at pages/mine/sett.vue:104", error);
|
||||
});
|
||||
}
|
||||
common_vendor.ref("");
|
||||
const chooseAvatar = async (e) => {
|
||||
try {
|
||||
if (e.detail.avatarUrl) {
|
||||
const imgUrl = await utils_fun.uploadFiles(e.detail.avatarUrl);
|
||||
await api_index.api.usersUpdate({ avatar: imgUrl, mobile: userInfo.value.mobile, nickname: userInfo.value.nickname || "微信用户" });
|
||||
await store.usersGetInfo();
|
||||
}
|
||||
} catch (err) {
|
||||
common_vendor.index.__f__("error", "at pages/mine/sett.vue:121", "选择头像失败:", err);
|
||||
}
|
||||
};
|
||||
const logout = async () => {
|
||||
common_vendor.index.showModal({
|
||||
title: "提示",
|
||||
content: `是否确认退出登录?`,
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
store.logoutUser();
|
||||
} else if (res.cancel) {
|
||||
common_vendor.index.__f__("log", "at pages/mine/sett.vue:154", "用户点击取消");
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
const toPhone = () => {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/mine/mobile"
|
||||
});
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.o(back),
|
||||
b: common_vendor.p({
|
||||
bordered: false,
|
||||
["left-arrow"]: true,
|
||||
["custom-style"]: "background-color: transparent !important;",
|
||||
title: "个人信息",
|
||||
safeAreaInsetTop: true
|
||||
}),
|
||||
c: common_assets._imports_0$6,
|
||||
d: userInfo.value.avatar
|
||||
}, userInfo.value.avatar ? {
|
||||
e: userInfo.value.avatar
|
||||
} : {
|
||||
f: common_assets._imports_1$4
|
||||
}, {
|
||||
g: common_vendor.o(chooseAvatar),
|
||||
h: common_vendor.t(userInfo.value.nickname || "微信用户"),
|
||||
i: common_assets._imports_0$1,
|
||||
j: common_vendor.o(prompt),
|
||||
k: common_vendor.t(userInfo.value.mobile),
|
||||
l: common_assets._imports_0$1,
|
||||
m: common_vendor.o(toPhone),
|
||||
n: userInfo.value.userRights
|
||||
}, userInfo.value.userRights ? {
|
||||
o: common_vendor.t(userInfo.value.userRights.rights.rightsName)
|
||||
} : {}, {
|
||||
p: common_vendor.o(logout)
|
||||
});
|
||||
};
|
||||
}
|
||||
};
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-eefb1794"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/mine/sett.js.map
|
||||
Reference in New Issue
Block a user