xyvcard-wechat-auth 0.0.9 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -50,6 +50,8 @@ export interface UpdateUserReq {
50
50
  nickName?: string;
51
51
  avatar?: string;
52
52
  realName?: string;
53
+ gender?: string;
54
+ birthDate?: string;
53
55
  }
54
56
  export interface UserInfoReq {
55
57
  tenant?: string;
@@ -0,0 +1,105 @@
1
+ import { authApi } from "../../../api/auth/index.js";
2
+ import { fileApi } from "../../../api/files/index.js";
3
+ import { config } from "../../../utils/config.js";
4
+ import { db } from "../../../utils/db.js";
5
+ Component({
6
+ /**
7
+ * 组件的属性列表
8
+ */
9
+ properties: {
10
+ // 定义一个对象类型的属性
11
+ userInfoShow: {
12
+ type: Object,
13
+ value: {
14
+ avatar: true,
15
+ // 头像
16
+ nickName: true,
17
+ // 昵称
18
+ realName: true,
19
+ // 姓名
20
+ mobilePhone: true
21
+ // 默认值
22
+ }
23
+ }
24
+ },
25
+ /**
26
+ * 组件的初始数据
27
+ */
28
+ data: {
29
+ userInfo: {
30
+ // 获取缓存中的用户信息
31
+ ...wx.getStorageSync("userInfo"),
32
+ updateMask: "nickName,avatar,realName"
33
+ }
34
+ },
35
+ lifetimes: {
36
+ ready() {
37
+ this.setData({
38
+ userInfo: {
39
+ ...this.data.userInfo,
40
+ // 获取缓存中的用户信息
41
+ ...wx.getStorageSync("userInfo"),
42
+ requestId: Math.random() * 10 + ""
43
+ }
44
+ });
45
+ }
46
+ },
47
+ /**
48
+ * 组件的方法列表
49
+ */
50
+ methods: {
51
+ // 获取微信昵称
52
+ getNicknameValue(e) {
53
+ this.setData({
54
+ "userInfo.nickName": e.detail.value
55
+ });
56
+ },
57
+ // 设置姓名
58
+ setrealNameValue(e) {
59
+ this.setData({
60
+ "userInfo.realName": e.detail.value
61
+ });
62
+ },
63
+ // 获取微信头像
64
+ onChooseAvatar(e) {
65
+ const { avatarUrl } = e.detail;
66
+ fileApi.uploadFile(avatarUrl).then((res) => {
67
+ this.setData({
68
+ "userInfo.avatar": res.data.fileSrc
69
+ });
70
+ });
71
+ },
72
+ // 更换手机号
73
+ getPhoneNumber(e) {
74
+ if (e.detail.errMsg === "getPhoneNumber:ok") {
75
+ authApi.replaceBindphone({
76
+ appId: config.appId,
77
+ phoneCode: e.detail.code,
78
+ componentAppid: config.componentAppid
79
+ }).then((res) => {
80
+ if (res.data) {
81
+ authApi.findUserInfo({}).then((res2) => {
82
+ if (res2.code == 200) {
83
+ db.userInfoStorage(res2.data);
84
+ this.setData({
85
+ userInfo: {
86
+ ...this.data.userInfo,
87
+ ...wx.getStorageSync("userInfo")
88
+ }
89
+ });
90
+ }
91
+ });
92
+ }
93
+ });
94
+ }
95
+ },
96
+ // 更新用户信息
97
+ updateUserInfo() {
98
+ authApi.updateUserInfo(this.data.userInfo).then((res) => {
99
+ if (res.code == 200) {
100
+ db.userInfoStorage(res.data);
101
+ }
102
+ });
103
+ }
104
+ }
105
+ });
@@ -0,0 +1,4 @@
1
+ {
2
+ "component": true,
3
+ "usingComponents": {}
4
+ }
@@ -0,0 +1,35 @@
1
+ <!-- 我的页面 中个人信息编辑页面 -->
2
+ <view class="my-information">
3
+ <view class="main">
4
+ <view class="main-profile" wx:if="{{ userInfoShow.avatar }}">
5
+ <view class="profile-left">头像</view>
6
+ <view class="profile-right">
7
+ <button class="image-box-bgc" open-type="chooseAvatar" plain="true" bind:chooseavatar="onChooseAvatar">
8
+ <image class="profile-image" src="{{ resourceUrl + '/components/gray_head2x.png' }}" mode="" wx:if="{{ !userInfo.avatar }}" />
9
+ <image class="profile-image" src="{{ imageUrl + userInfo.avatar }}" mode="" wx:else />
10
+ </button>
11
+ </view>
12
+ </view>
13
+ <view class="main-nickname" wx:if="{{ userInfoShow.nickName }}">
14
+ <view class="nickname-left">昵称</view>
15
+ <view class="nickname-right">
16
+ <input value="{{ userInfo.nickName }}" type="nickname" bindinput="getNicknameValue" class="nickname-input" />
17
+ </view>
18
+ </view>
19
+ <view class="main-nickname" wx:if="{{ userInfoShow.realName }}">
20
+ <view class="nickname-left">姓名</view>
21
+ <view class="nickname-right">
22
+ <input value="{{ userInfo.realName }}" type="realName" bindinput="setrealNameValue" class="nickname-input" />
23
+ </view>
24
+ </view>
25
+
26
+ <view class="main-phone" wx:if="{{ userInfoShow.mobilePhone }}">
27
+ <view class="phone-left">手机号</view>
28
+ <view class="phone-right">
29
+ <view>{{ userInfo.mobilePhone }}</view>
30
+ <button open-type="getPhoneNumber" class="phone-right-btn" bindgetphonenumber="getPhoneNumber" plain="true">更换手机号</button>
31
+ </view>
32
+ </view>
33
+ </view>
34
+
35
+ </view>
@@ -0,0 +1 @@
1
+ .my-information{background-color:#f6f6f6;width:100%;height:100vh;position:relative}.my-information .main{background-color:#fff;padding:0 15px}.my-information .main .main-profile,.my-information .main .main-nickname,.my-information .main .main-phone{display:flex;justify-content:space-between;align-items:center;height:55px;border-bottom:1px solid #f5f5f5}.my-information .main .main-profile .profile-left,.my-information .main .main-profile .nickname-left,.my-information .main .main-profile .nickname-right,.my-information .main .main-profile .phone-left,.my-information .main .main-nickname .profile-left,.my-information .main .main-nickname .nickname-left,.my-information .main .main-nickname .nickname-right,.my-information .main .main-nickname .phone-left,.my-information .main .main-phone .profile-left,.my-information .main .main-phone .nickname-left,.my-information .main .main-phone .nickname-right,.my-information .main .main-phone .phone-left{font-size:15px;color:#333}.my-information .main .main-profile .profile-right .profile-image,.my-information .main .main-nickname .profile-right .profile-image,.my-information .main .main-phone .profile-right .profile-image{width:35px;height:35px}.my-information .main .main-profile .phone-right,.my-information .main .main-nickname .phone-right,.my-information .main .main-phone .phone-right{display:flex;justify-content:space-between;align-items:center;font-size:15px;color:#333}.my-information .main .main-profile .phone-right .phone-right-btn,.my-information .main .main-nickname .phone-right .phone-right-btn,.my-information .main .main-phone .phone-right .phone-right-btn{background-color:#e6edff;border-radius:12px;margin-left:10px;border:none;font-size:12px;color:#0551ff}.my-information .main .image-box-bgc{background-color:rgba(0,0,0,0);border-radius:0;line-height:0;border:0;padding:0}.my-information .main .nickname-input{text-align:right}.my-information .main .main-phone{border:none}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,27 @@
1
+ import { config } from "../../../utils/config.js";
2
+ Component({
3
+ /**
4
+ * 组件的属性列表
5
+ */
6
+ properties: {},
7
+ /**
8
+ * 组件的初始数据
9
+ */
10
+ data: {
11
+ BASE_URL: config.baseUrl + "/v1/file/image/clip/200/200/",
12
+ resourceUrl: config.resourceUrl + "/images/mall",
13
+ token: wx.getStorageSync("token"),
14
+ userInfo: wx.getStorageSync("userInfo")
15
+ },
16
+ /**
17
+ * 组件的方法列表
18
+ */
19
+ methods: {
20
+ handleLogin() {
21
+ this.triggerEvent("login");
22
+ },
23
+ handleUpdateUser() {
24
+ this.triggerEvent("updateUser");
25
+ }
26
+ }
27
+ });
@@ -0,0 +1,4 @@
1
+ {
2
+ "component": true,
3
+ "usingComponents": {}
4
+ }
@@ -0,0 +1,19 @@
1
+ <view class="auth-user-box">
2
+ <block wx:if="{{ token }}">
3
+ <view class="auth-user-l">
4
+ <image src="{{ BASE_URL + userInfo.avatar }}" class="avatar-img" wx:if="{{ userInfo.avatar }}"></image>
5
+ <image src="{{ resourceUrl }}/tswk.png" class="avatar-img" wx:else></image>
6
+ <view class="auth-user-r">
7
+ <view class="user-edit">{{ userInfo.realName }}
8
+ <image src="{{ resourceUrl }}/book/user_edit_icon.png" class="edit_icon" bind:tap="handleUpdateUser"></image>
9
+ </view>
10
+ <text class="user-mobile">{{ userInfo.mobilePhoneIns }}</text>
11
+ </view>
12
+ </view>
13
+ </block>
14
+ <view class="auth-user-l" wx:else>
15
+ <image src="{{ resourceUrl }}/tswk.png" class="avatar-img"></image>
16
+ <text bind:tap="handleLogin">登录</text>
17
+ </view>
18
+
19
+ </view>
@@ -0,0 +1 @@
1
+ .auth-user-box{display:flex;align-items:center;padding:15px 0 15px 3%}.auth-user-box .auth-user-l{display:flex;align-items:center;font-size:15px;font-weight:bold}.auth-user-box .auth-user-l .avatar-img{width:60px;height:60px;border-radius:25px;margin-right:10px}.auth-user-box .auth-user-r .user-edit{display:flex;align-items:center}.auth-user-box .auth-user-r .user-edit .edit_icon{width:30px;height:30px;margin-left:10px}.auth-user-box .auth-user-r .user-mobile{font-size:14px;color:#666;font-weight:500}
@@ -25,12 +25,17 @@ Component({
25
25
  // 背景色
26
26
  backColor: {
27
27
  type: String,
28
- value: ""
28
+ value: "#fff"
29
29
  },
30
30
  // 是否有阴影
31
- isBoxShadow: {
31
+ searchStyle: {
32
+ type: String,
33
+ value: ""
34
+ },
35
+ // 是否聚焦
36
+ focus: {
32
37
  type: Boolean,
33
- value: true
38
+ value: false
34
39
  }
35
40
  },
36
41
  /**
@@ -1,6 +1,6 @@
1
- <view class="auth-search-box" style="box-shadow: {{ isBoxShadow ? '0px 3px 3px 0px rgba(40, 65, 91, 0.1);' : '0px' }}">
1
+ <view class="auth-search-box" style="{{ searchStyle }}">
2
2
  <image src="{{ resourceUrl + '/icon_image/icon_search.png' }}" class="search-icon"></image>
3
- <input class="search-input" style="background-color: {{ backColor }}; width: {{ isSearchBtn ? '60%' : '100%' }}; {{ isSearchBtn ? '' : 'padding-right: 20px' }}" placeholder="{{ placeholder }}" disabled="{{ disabled }}" value="{{ likeName }}" bindinput="handleInput" bind:tap="handleTap" />
3
+ <input class="search-input" style="background-color: {{ backColor }}; width: {{ isSearchBtn ? '60%' : '100%' }}; {{ isSearchBtn ? '' : 'padding-right: 20px' }}" focus="{{ focus }}" placeholder="{{ placeholder }}" disabled="{{ disabled }}" value="{{ likeName }}" bindinput="handleInput" bind:tap="handleTap" />
4
4
  <view class="search-btn" wx:if="{{ isSearchBtn }}">
5
5
  <slot></slot>
6
6
  </view>
@@ -24,9 +24,4 @@ $border-line: #EBEBEB;
24
24
  // 背景色
25
25
  $background-color: #f6f6f6;
26
26
  // 白色背景
27
- $background-white-color: #fff;
28
- // 灰色字体
29
- $grey-color: #999;
30
- $grey-dark-color: #666;
31
- // 字体大小
32
- $font-mini-size: 12px;
27
+ $background-white-color: #fff;
@@ -3,7 +3,7 @@ const host = "gh.sooyie.cn";
3
3
  const agentUrl = "/v1/file/path/wxapp";
4
4
  const config = {
5
5
  dev: true,
6
- testNewUser: true,
6
+ testNewUser: false,
7
7
  name: "Jmash框架",
8
8
  baseUrl: https + host,
9
9
  // 接口域名
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xyvcard-wechat-auth",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",