WXL
11 小时以前 05c363fdd7ab04e3bd9a753e2c5d5bfff04d681c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
  __name: "profile",
  setup(__props) {
    const userInfo = common_vendor.ref({
      avatar: "/static/avatar/default.jpg",
      nickname: "张三",
      gender: 1,
      birthday: "1990-01-01",
      phone: "13800138000",
      email: "example@email.com",
      verified: true
    });
    const privacy = common_vendor.ref({
      publicProfile: true,
      allowMessage: false
    });
    const formatPhone = (phone) => {
      if (!phone)
        return "未绑定";
      return phone.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
    };
    const changeAvatar = () => {
      common_vendor.index.chooseImage({
        count: 1,
        success: (res) => {
          userInfo.value.avatar = res.tempFilePaths[0];
        }
      });
    };
    const editNickname = () => {
      common_vendor.index.navigateTo({
        url: "/pages/my/edit-nickname"
      });
    };
    const editGender = () => {
      common_vendor.index.showActionSheet({
        itemList: ["男", "女"],
        success: (res) => {
          userInfo.value.gender = res.tapIndex + 1;
        }
      });
    };
    const editBirthday = () => {
      common_vendor.index.showDatePicker({
        current: userInfo.value.birthday,
        success: (res) => {
          userInfo.value.birthday = res.date;
        }
      });
    };
    const editPhone = () => {
      common_vendor.index.navigateTo({
        url: "/pages/my/edit-phone"
      });
    };
    const editEmail = () => {
      common_vendor.index.navigateTo({
        url: "/pages/my/edit-email"
      });
    };
    const goVerify = () => {
      common_vendor.index.navigateTo({
        url: "/pages/my/verify"
      });
    };
    const togglePrivacy = (key, value) => {
      privacy.value[key] = value;
    };
    const changePassword = () => {
      common_vendor.index.navigateTo({
        url: "/pages/my/change-password"
      });
    };
    const bindPhone = () => {
      common_vendor.index.navigateTo({
        url: "/pages/my/bind-phone"
      });
    };
    const logout = () => {
      common_vendor.index.showModal({
        title: "提示",
        content: "确定要退出登录吗?",
        success: (res) => {
          if (res.confirm) {
            common_vendor.index.reLaunch({
              url: "/pages/login/Login"
            });
          }
        }
      });
    };
    return (_ctx, _cache) => {
      return {
        a: userInfo.value.avatar,
        b: common_vendor.o(changeAvatar),
        c: common_vendor.t(userInfo.value.nickname),
        d: common_vendor.o(editNickname),
        e: common_vendor.t(userInfo.value.gender === 1 ? "男" : "女"),
        f: common_vendor.o(editGender),
        g: common_vendor.t(userInfo.value.birthday || "请选择"),
        h: common_vendor.o(editBirthday),
        i: common_vendor.t(formatPhone(userInfo.value.phone)),
        j: common_vendor.o(editPhone),
        k: common_vendor.t(userInfo.value.email || "未绑定"),
        l: common_vendor.o(editEmail),
        m: common_vendor.t(userInfo.value.verified ? "已认证" : "未认证"),
        n: common_vendor.o(goVerify),
        o: privacy.value.publicProfile,
        p: common_vendor.o((e) => togglePrivacy("publicProfile", e.detail.value)),
        q: privacy.value.allowMessage,
        r: common_vendor.o((e) => togglePrivacy("allowMessage", e.detail.value)),
        s: common_vendor.o(changePassword),
        t: common_vendor.t(formatPhone(userInfo.value.phone)),
        v: common_vendor.o(bindPhone),
        w: common_vendor.o(logout),
        x: common_vendor.gei(_ctx, "")
      };
    };
  }
};
wx.createPage(_sfc_main);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/my/profile.js.map