Files
tk-mini-program/unpackage/dist/dev/mp-weixin/pages/Setting/settingmod/changeNickname.js
pengxiaolong 40c3282515 优化代码
2025-08-05 22:05:56 +08:00

91 lines
2.7 KiB
JavaScript

"use strict";
const common_vendor = require("../../../common/vendor.js");
const components_goEasyTool_tool = require("../../../components/goEasyTool/tool.js");
const components_request = require("../../../components/request.js");
const _sfc_main = {
data() {
return {
name: "",
id: ""
};
},
onLoad(options) {
this.name = options.name;
this.id = options.id;
},
methods: {
// 提交修改
onSubmit() {
if (this.name.trim() === "") {
common_vendor.wx$1.showToast({
title: "昵称不能为空",
icon: "none",
duration: 1e3
});
return;
}
common_vendor.index.showLoading({
title: "修改中...",
mask: true
});
components_goEasyTool_tool.goEasylogout(this.$goeasy);
components_request.request({
url: "user/updateUserInfo",
method: "POST",
data: {
id: this.id,
nickName: this.name
},
userInfo: true
}).then((ress) => {
common_vendor.index.__f__("log", "at pages/Setting/settingmod/changeNickname.vue:75", "修改调用返回", ress);
if (ress.code === 200) {
common_vendor.index.showToast({
title: "修改成功",
icon: "success"
});
common_vendor.index.setStorageSync("userinfo", ress.data);
components_goEasyTool_tool.goEasylogin(
this.$goeasy,
String(ress.data.id),
ress.data.headerIcon,
ress.data.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"
});
}
});
},
// 输入昵称
inputName(e) {
this.name = e.detail.value;
},
// 返回上一页
onBack() {
common_vendor.wx$1.navigateBack({
delta: 1
});
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.o((...args) => $options.onBack && $options.onBack(...args)),
b: common_vendor.o((...args) => $options.inputName && $options.inputName(...args)),
c: $data.name,
d: common_vendor.o(($event) => $data.name = $event.detail.value),
e: common_vendor.o((...args) => $options.onSubmit && $options.onSubmit(...args))
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-0dc78cdb"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pages/Setting/settingmod/changeNickname.js.map