settings.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const _sfc_main = {
  4. data() {
  5. return {
  6. statusBarHeight: 20,
  7. myInfo: {
  8. avatarUrl: "https://img.icons8.com/clouds/200/manager.png",
  9. nickName: "张经理",
  10. phoneNum: "138-8888-8888",
  11. orgName: "广东粤铝材实业有限公司"
  12. }
  13. };
  14. },
  15. onLoad() {
  16. const info = common_vendor.index.getSystemInfoSync();
  17. this.statusBarHeight = info.statusBarHeight;
  18. },
  19. methods: {
  20. goBack() {
  21. common_vendor.index.navigateBack();
  22. },
  23. doChooseImage() {
  24. common_vendor.index.chooseImage({
  25. count: 1,
  26. success: (res) => {
  27. this.myInfo.avatarUrl = res.tempFilePaths[0];
  28. common_vendor.index.showToast({ title: "头像已选好", icon: "none" });
  29. }
  30. });
  31. },
  32. doEditName() {
  33. common_vendor.index.showModal({
  34. title: "设置昵称",
  35. content: this.myInfo.nickName,
  36. editable: true,
  37. confirmColor: "#C1001C",
  38. // 重点修复点:弹窗确认按钮强制采用主题红
  39. success: (res) => {
  40. if (res.confirm) {
  41. this.myInfo.nickName = res.content || "未命名";
  42. }
  43. }
  44. });
  45. },
  46. saveProfile() {
  47. common_vendor.index.showLoading({ title: "保存中" });
  48. setTimeout(() => {
  49. common_vendor.index.hideLoading();
  50. common_vendor.index.showToast({ title: "保存成功" });
  51. setTimeout(() => {
  52. common_vendor.index.navigateBack();
  53. }, 1200);
  54. }, 600);
  55. }
  56. }
  57. };
  58. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  59. return {
  60. a: common_vendor.o((...args) => $options.goBack && $options.goBack(...args)),
  61. b: $data.statusBarHeight + "px",
  62. c: $data.myInfo.avatarUrl,
  63. d: common_vendor.o((...args) => $options.doChooseImage && $options.doChooseImage(...args)),
  64. e: common_vendor.t($data.myInfo.nickName),
  65. f: common_vendor.o((...args) => $options.doEditName && $options.doEditName(...args)),
  66. g: common_vendor.t($data.myInfo.phoneNum),
  67. h: common_vendor.t($data.myInfo.orgName),
  68. i: common_vendor.o((...args) => $options.saveProfile && $options.saveProfile(...args))
  69. };
  70. }
  71. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-8e46f4e9"]]);
  72. wx.createPage(MiniProgramPage);
  73. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/mine/settings.js.map