122 lines
4.4 KiB
JavaScript
122 lines
4.4 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const common_assets = require("../../common/assets.js");
|
|
const api_api = require("../../api/api.js");
|
|
const hooks_useNav = require("../../hooks/useNav.js");
|
|
const common_js_user = require("../../common/js/user.js");
|
|
const store_index = require("../../store/index.js");
|
|
if (!Array) {
|
|
const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
|
|
const _easycom_u_button2 = common_vendor.resolveComponent("u-button");
|
|
const _easycom_uni_popup_dialog2 = common_vendor.resolveComponent("uni-popup-dialog");
|
|
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
|
|
(_easycom_up_icon2 + _easycom_u_button2 + _easycom_uni_popup_dialog2 + _easycom_uni_popup2)();
|
|
}
|
|
const _easycom_up_icon = () => "../../uni_modules/uview-plus/components/u-icon/u-icon.js";
|
|
const _easycom_u_button = () => "../../uni_modules/uview-plus/components/u-button/u-button.js";
|
|
const _easycom_uni_popup_dialog = () => "../../uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.js";
|
|
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
|
|
if (!Math) {
|
|
(_easycom_up_icon + _easycom_u_button + _easycom_uni_popup_dialog + _easycom_uni_popup)();
|
|
}
|
|
const _sfc_main = {
|
|
__name: "setting",
|
|
setup(__props) {
|
|
const { nav, navTo } = hooks_useNav.useNav();
|
|
let getInfo = common_vendor.ref();
|
|
common_vendor.ref(false);
|
|
let inputDialog = common_vendor.ref(null);
|
|
common_vendor.onShow(() => {
|
|
getUserInfo();
|
|
});
|
|
let getUserInfo = async () => {
|
|
let _res = await api_api.userInfo();
|
|
getInfo.value = _res;
|
|
};
|
|
let dialogInputConfirm = async (e) => {
|
|
await api_api.updateUserInfo({
|
|
nickName: e
|
|
});
|
|
getUserInfo();
|
|
console.log(e);
|
|
};
|
|
let chooseavatar = async (e) => {
|
|
const { avatarUrl } = e.detail;
|
|
let _url = await common_js_user.uploadFiles(avatarUrl);
|
|
await api_api.updateUserInfo({
|
|
avatar: _url
|
|
});
|
|
getUserInfo();
|
|
};
|
|
let logout = () => {
|
|
common_vendor.index.clearStorageSync();
|
|
store_index.store.commit("setToken", "");
|
|
common_vendor.index.showToast({
|
|
title: "退出登录成功",
|
|
icon: "success"
|
|
});
|
|
common_vendor.index.switchTab({
|
|
url: "/pages/index/index"
|
|
});
|
|
};
|
|
return (_ctx, _cache) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.unref(getInfo).avatar
|
|
}, common_vendor.unref(getInfo).avatar ? {
|
|
b: common_vendor.unref(getInfo).avatar,
|
|
c: common_vendor.o((...args) => _ctx.infoHeader && _ctx.infoHeader(...args))
|
|
} : {
|
|
d: common_assets._imports_0$5
|
|
}, {
|
|
e: common_vendor.o((...args) => common_vendor.unref(chooseavatar) && common_vendor.unref(chooseavatar)(...args)),
|
|
f: common_vendor.t(common_vendor.unref(getInfo).nickName || "默认用户"),
|
|
g: common_vendor.o(($event) => common_vendor.unref(inputDialog).open()),
|
|
h: common_vendor.unref(getInfo).userName
|
|
}, common_vendor.unref(getInfo).userName ? {
|
|
i: common_vendor.t(common_vendor.unref(getInfo).userName)
|
|
} : {}, {
|
|
j: common_vendor.p({
|
|
color: "#999999",
|
|
name: "arrow-right",
|
|
size: "35rpx"
|
|
}),
|
|
k: common_vendor.unref(getInfo).phone
|
|
}, common_vendor.unref(getInfo).phone ? {
|
|
l: common_vendor.t(common_vendor.unref(getInfo).phone)
|
|
} : {}, {
|
|
m: common_vendor.p({
|
|
color: "#999999",
|
|
name: "arrow-right",
|
|
size: "35rpx"
|
|
}),
|
|
n: common_vendor.o(($event) => common_vendor.unref(navTo)("/pages/mine/phone", true)),
|
|
o: common_vendor.o(($event) => common_vendor.unref(logout)()),
|
|
p: common_vendor.p({
|
|
text: "退出登录",
|
|
size: "normal",
|
|
type: "error"
|
|
}),
|
|
q: () => ({
|
|
r: inputClose
|
|
}),
|
|
r: common_vendor.o(common_vendor.unref(dialogInputConfirm)),
|
|
s: common_vendor.p({
|
|
inputType: "text",
|
|
mode: "input",
|
|
title: "请输入昵称",
|
|
placeholder: "请输入昵称"
|
|
}),
|
|
t: () => ({
|
|
r: inputDialog,
|
|
k: "inputDialog"
|
|
}),
|
|
v: common_vendor.p({
|
|
type: "dialog"
|
|
})
|
|
});
|
|
};
|
|
}
|
|
};
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-0bb48146"]]);
|
|
my.createPage(MiniProgramPage);
|