109 lines
3.8 KiB
JavaScript
109 lines
3.8 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const api_api = require("../../api/api.js");
|
|
const utils_fun = require("../../utils/fun.js");
|
|
if (!Array) {
|
|
const _easycom_up_avatar2 = common_vendor.resolveComponent("up-avatar");
|
|
const _easycom_up_cell2 = common_vendor.resolveComponent("up-cell");
|
|
const _easycom_up_cell_group2 = common_vendor.resolveComponent("up-cell-group");
|
|
const _easycom_up_button2 = common_vendor.resolveComponent("up-button");
|
|
(_easycom_up_avatar2 + _easycom_up_cell2 + _easycom_up_cell_group2 + _easycom_up_button2)();
|
|
}
|
|
const _easycom_up_avatar = () => "../../uni_modules/uview-plus/components/u-avatar/u-avatar.js";
|
|
const _easycom_up_cell = () => "../../uni_modules/uview-plus/components/u-cell/u-cell.js";
|
|
const _easycom_up_cell_group = () => "../../uni_modules/uview-plus/components/u-cell-group/u-cell-group.js";
|
|
const _easycom_up_button = () => "../../uni_modules/uview-plus/components/u-button/u-button.js";
|
|
if (!Math) {
|
|
(_easycom_up_avatar + _easycom_up_cell + _easycom_up_cell_group + _easycom_up_button)();
|
|
}
|
|
const _sfc_main = {
|
|
__name: "sett",
|
|
setup(__props) {
|
|
let info = common_vendor.ref({});
|
|
common_vendor.onShow(async () => {
|
|
getInfo();
|
|
});
|
|
const getInfo = async () => {
|
|
let _res = await api_api.userInfo();
|
|
info.value = _res;
|
|
};
|
|
const chooseAvatar = async (e) => {
|
|
let img = await utils_fun.uploadFiles(e.detail.avatarUrl);
|
|
api_api.updateAvatar({ avatar: img }).then((res) => {
|
|
getInfo();
|
|
});
|
|
common_vendor.index.__f__("log", "at pages/mine/sett.vue:51", img);
|
|
};
|
|
const upNickName = () => {
|
|
common_vendor.index.showModal({
|
|
title: "修改昵称",
|
|
content: info.value.nickName,
|
|
editable: true,
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
api_api.updateNickName({ nickName: res.content }).then((res2) => {
|
|
getInfo();
|
|
});
|
|
common_vendor.index.__f__("log", "at pages/mine/sett.vue:64", res);
|
|
common_vendor.index.__f__("log", "at pages/mine/sett.vue:65", "用户点击确定");
|
|
} else if (res.cancel) {
|
|
common_vendor.index.__f__("log", "at pages/mine/sett.vue:67", "用户点击取消");
|
|
}
|
|
}
|
|
});
|
|
};
|
|
const outLogin = () => {
|
|
common_vendor.index.showModal({
|
|
title: "提示",
|
|
content: "是否确认退出登录?",
|
|
success: (res) => {
|
|
if (res.confirm) {
|
|
common_vendor.index.clearStorageSync();
|
|
common_vendor.index.reLaunch({
|
|
url: "/pages/home/home"
|
|
});
|
|
} else if (res.cancel) {
|
|
common_vendor.index.__f__("log", "at pages/mine/sett.vue:84", "用户点击取消");
|
|
}
|
|
}
|
|
});
|
|
};
|
|
return (_ctx, _cache) => {
|
|
return {
|
|
a: common_vendor.p({
|
|
src: common_vendor.unref(info).avatar
|
|
}),
|
|
b: common_vendor.p({
|
|
title: "头像",
|
|
isLink: true,
|
|
size: "min"
|
|
}),
|
|
c: common_vendor.o(chooseAvatar),
|
|
d: common_vendor.t(common_vendor.unref(info).nickName),
|
|
e: common_vendor.o(upNickName),
|
|
f: common_vendor.p({
|
|
title: "昵称",
|
|
isLink: true,
|
|
size: "min"
|
|
}),
|
|
g: common_vendor.t(common_vendor.unref(info).phone || "-"),
|
|
h: common_vendor.p({
|
|
title: "手机号",
|
|
size: "min",
|
|
border: false
|
|
}),
|
|
i: common_vendor.p({
|
|
border: false
|
|
}),
|
|
j: common_vendor.o(outLogin),
|
|
k: common_vendor.p({
|
|
type: "error",
|
|
text: "退出登录"
|
|
})
|
|
};
|
|
};
|
|
}
|
|
};
|
|
wx.createPage(_sfc_main);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/mine/sett.js.map
|