jmash-core-mp 0.1.34 → 0.1.36

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.
@@ -12,6 +12,7 @@ class RegionApiImpl {
12
12
  url: "/v1/region/dict_region/list/" + config.tenant,
13
13
  method: "GET",
14
14
  data: query,
15
+ header: { Authorization: false },
15
16
  });
16
17
  }
17
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmash-core-mp",
3
- "version": "0.1.34",
3
+ "version": "0.1.36",
4
4
  "private": false,
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -15,6 +15,7 @@ class RegionApiImpl {
15
15
  url: "/v1/region/dict_region/list/" + config.tenant,
16
16
  method: "GET",
17
17
  data: query,
18
+ header: { Authorization: false },
18
19
  });
19
20
  }
20
21
  }
@@ -43,18 +43,18 @@
43
43
  <view class="phone-number">{{ userInfo.mobilePhone }}</view>
44
44
  <!-- 微信 -->
45
45
  <button open-type="getPhoneNumber" class="phone-right-btn" bindgetphonenumber="getPhoneNumberWechat"
46
- wx:if="{{ isChangePhone && __mpx_mode__ === 'wx' }}">更换手机号</button>
46
+ wx:if="{{ isChangePhone && __mpx_mode__ === 'wx' }}" style="{{ phoneBtnStyle }}">更换手机号</button>
47
47
  <!-- 支付宝 -->
48
48
  <button open-type="getAuthorize" scope="phoneNumber" class="phone-right-btn"
49
49
  wx:if="{{ isChangePhone && __mpx_mode__ === 'ali' }}" onGetAuthorize="getPhoneNumberAli"
50
- onError="onPhoneAuthFail">更换手机号</button>
50
+ onError="onPhoneAuthFail" style="{{ phoneBtnStyle }}">更换手机号</button>
51
51
  </view>
52
52
  </view>
53
53
  </view>
54
54
 
55
55
  <!-- 保存按钮 -->
56
56
  <view class="main-btn">
57
- <button class="main-btn-item" bindtap="handleUpdateUser">保存</button>
57
+ <button class="main-btn-item" bindtap="handleUpdateUser" style="{{ saveBtnStyle }}">保存</button>
58
58
  </view>
59
59
  </view>
60
60
  </template>
@@ -100,6 +100,9 @@ createComponent({
100
100
  imageUrl: getApp().globalData.config.baseUrl + "/v1/file/path/",
101
101
  userInfo: {} as UserInfo,
102
102
  userStore: {} as any,
103
+ themeColor: (getApp().globalData.config.themeColor || "#2563EB"),
104
+ phoneBtnStyle: "color: " + (getApp().globalData.config.themeColor || "#2563EB"),
105
+ saveBtnStyle: "background-color: " + (getApp().globalData.config.themeColor || "#2563EB") + ";color: #fff",
103
106
  },
104
107
  ready() {
105
108
  this.userStore = useUserStore();
@@ -363,17 +366,14 @@ $bg-card: #ffffff;
363
366
  font-size: 32rpx;
364
367
  font-weight: 600;
365
368
  letter-spacing: 2rpx;
366
- background-color: $primary;
367
- color: #fff;
368
369
  border: none;
369
370
  display: flex;
370
371
  align-items: center;
371
372
  justify-content: center;
372
- transition: background-color 0.2s;
373
- box-shadow: 0 4rpx 12rpx rgba(7, 193, 96, 0.3);
373
+ transition: opacity 0.2s;
374
374
 
375
375
  &:active {
376
- background-color: $primary-dark;
376
+ opacity: 0.8;
377
377
  }
378
378
  }
379
379
  }
@@ -13,7 +13,8 @@
13
13
  <!-- 用户信息 -->
14
14
  <view class="auth-user-r">
15
15
  <view class="user-edit">
16
- <text class="user-name" style="color: {{ userNameColor }}">{{ userInfo.realName || '微信用户' }}</text>
16
+ <text class="user-name" style="color: {{ userNameColor }}">{{ userInfo.realName || userInfo.nickName ||
17
+ '微信用户' }}</text>
17
18
  <view class="edit-icon-bg">
18
19
  <text class="edit-icon">✎</text>
19
20
  </view>
@@ -91,6 +92,7 @@ createComponent({
91
92
  }
92
93
  };
93
94
  onShow(refreshFunc);
95
+ // TODO: 讨论是否改为 checkLogin(),避免 token 过期时"伪登录"导致显示"微信用户"
94
96
  const isLogin = computed(() => userStore.accessToken !== '');
95
97
  return { resourceUrl, baseUrl, userInfo, userStore, refreshFunc, isLogin };
96
98
  },
@@ -1,38 +1,41 @@
1
1
  <template>
2
- <slot name="before"></slot>
3
- <view class="login_box">
4
- <!-- 头像区域 -->
5
- <view class="avatar-section">
6
- <button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
7
- <image class="avatar-img" src="{{ avatarUrl || avatar }}" mode="aspectFill" />
8
- <view class="avatar-badge">
9
- <text class="badge-icon">✎</text>
10
- </view>
11
- </button>
12
- <text class="avatar-tip">点击更换头像</text>
13
- </view>
2
+ <!-- <slot name="before"></slot> -->
3
+ <view class="login-page">
4
+ <view class="login_box">
5
+ <text class="app-name">{{ config.xcxName }}</text>
6
+ <!-- 头像区域 -->
7
+ <view class="avatar-section">
8
+ <button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
9
+ <image class="avatar-img" src="{{ avatarUrl || avatar }}" mode="aspectFill" />
10
+ <view class="avatar-badge">
11
+ <text class="badge-icon">✎</text>
12
+ </view>
13
+ </button>
14
+ <text class="avatar-tip">点击更换头像</text>
15
+ </view>
14
16
 
15
- <!-- 姓名输入 -->
16
- <view class="name-section">
17
- <view class="name-field">
18
- <text class="field-icon">👤</text>
19
- <input name="nickname" type="nickname" class="weui-input name-input" placeholder="请输入您的姓名" bindinput="validate"
20
- wx:model="{{ nameValue }}" />
17
+ <!-- 姓名输入 -->
18
+ <view class="name-section">
19
+ <view class="name-field">
20
+ <cube-icon class="field-icon" type="user" size="36rpx" color="#999" />
21
+ <input name="nickname" type="nickname" class="weui-input name-input" placeholder="请输入您的姓名"
22
+ bindinput="validate" wx:model="{{ nameValue }}" />
23
+ </view>
21
24
  </view>
22
- </view>
23
25
 
24
- <button open-type="getPhoneNumber" style="{{ loginStyle }}" bind:getphonenumber="wxPhoneLogin"
25
- wx:if="{{ agreeStatus && isValidate }}">手机号授权登录</button>
26
- <button bind:tap="onLogin" style="{{ loginStyle }}" wx:else>授权登录</button>
27
- <checkbox-group bindchange="agreeChange" class="protocol_agree" wx:if="{{ showPrivacyPolicy }}">
28
- <label>
29
- <checkbox value="{{ agreeStatus+'' }}" checked="{{ agreeStatus }}" color="{{ checkedColor }}" />
30
- 已阅读
31
- <text id="user" style="{{ agreementStyle }}" catch:tap="goPolicyInfo">《用户使用协议》</text>
32
- <text id="privacy" style="{{ agreementStyle }}" catch:tap="goPolicyInfo">《隐私权政策》</text>
33
- </label>
34
- </checkbox-group>
35
- <slot name="after"></slot>
26
+ <button open-type="getPhoneNumber" style="{{ loginStyle }}" bind:getphonenumber="wxPhoneLogin"
27
+ wx:if="{{ agreeStatus && isValidate }}">手机号授权登录</button>
28
+ <button bind:tap="onLogin" style="{{ loginStyle }}" wx:else>授权登录</button>
29
+ <checkbox-group bindchange="agreeChange" class="protocol_agree" wx:if="{{ showPrivacyPolicy }}">
30
+ <label>
31
+ <checkbox value="{{ agreeStatus+'' }}" checked="{{ agreeStatus }}" color="{{ checkedColor }}" />
32
+ 已阅读
33
+ <text id="user" style="{{ agreementStyle }}" catch:tap="goPolicyInfo">《用户使用协议》</text>
34
+ <text id="privacy" style="{{ agreementStyle }}" catch:tap="goPolicyInfo">《隐私权政策》</text>
35
+ </label>
36
+ </checkbox-group>
37
+ <slot name="after"></slot>
38
+ </view>
36
39
  </view>
37
40
  </template>
38
41
 
@@ -45,23 +48,6 @@ createComponent({
45
48
  multipleSlots: true,
46
49
  },
47
50
  properties: {
48
- // 登录按钮样式
49
- loginStyle: {
50
- type: String,
51
- value:
52
- "width: 100%;background-color: #2563EB;color: #fff;font-size: 15px;",
53
- },
54
- // 单选框选中的颜色
55
- checkedColor: {
56
- type: String,
57
- value: "#0551ff",
58
- },
59
-
60
- // 协议样式
61
- agreementStyle: {
62
- type: String,
63
- value: "color: #0551ff",
64
- },
65
51
  // 登录后跳转页面
66
52
  backurl: {
67
53
  type: String,
@@ -84,21 +70,29 @@ createComponent({
84
70
  }
85
71
  },
86
72
  setup(props) {
87
- let config = getApp().globalData.config || { resourceUrl: '', name: '应用' };
73
+ mpx.setNavigationBarTitle({ title: "登录" });
74
+ let config = getApp().globalData.config || { resourceUrl: '', xcxName: '应用' };
75
+ let themeColor = config.themeColor || "#2563EB";
88
76
  let agreeStatus = ref(false);
89
77
  let nameValue = ref('');
90
78
  let avatarUrl = ref('');
91
79
  let isValidate = ref(false);
92
80
  let userStore = useUserStore();
93
81
  let avatar = ref(config.resourceUrl + "/images/components/gray_head2x.png");
94
- console.log(avatar);
82
+ let loginStyle = "width: 100%;background-color: " + themeColor + ";color: #fff;font-size: 15px;padding:11rpx 0";
83
+ let checkedColor = themeColor;
84
+ let agreementStyle = "color: " + themeColor;
95
85
  return {
96
86
  agreeStatus,
97
87
  nameValue,
98
88
  avatarUrl,
99
89
  isValidate,
100
90
  avatar,
101
- userStore
91
+ userStore,
92
+ config,
93
+ loginStyle,
94
+ checkedColor,
95
+ agreementStyle
102
96
  };
103
97
  },
104
98
  methods: {
@@ -175,7 +169,7 @@ createComponent({
175
169
  }
176
170
  if (event.detail.errMsg === "getPhoneNumber:ok") {
177
171
  console.log(event.detail.code);
178
- this.userStore.mpRegister(event.detail.code, this.nameValue).then((resp) => {
172
+ this.userStore.mpRegister(event.detail.code, this.nameValue, this.avatarUrl || this.avatar).then((resp) => {
179
173
  if (resp.status === false) {
180
174
  mpx.showToast({
181
175
  title: resp.message ? resp.message : "登录失败联系管理员",
@@ -219,12 +213,43 @@ $border: #d0d0d0;
219
213
  $bg-page: #f2f2f2;
220
214
  $bg-card: #ffffff;
221
215
 
216
+ .login-page {
217
+ position: relative;
218
+ min-height: 100vh;
219
+ }
220
+
221
+ .back-bar {
222
+ position: fixed;
223
+ top: 88rpx;
224
+ left: 16rpx;
225
+ z-index: 10;
226
+ display: flex;
227
+ align-items: center;
228
+ justify-content: center;
229
+ width: 60rpx;
230
+ height: 60rpx;
231
+
232
+ .back-arrow {
233
+ font-size: 48rpx;
234
+ color: #333;
235
+ line-height: 1;
236
+ }
237
+ }
238
+
222
239
  .login_box {
223
- padding: 13% 3% 4%;
240
+ padding: 5% 3% 4%;
224
241
  display: flex;
225
242
  flex-direction: column;
226
243
  align-items: center;
227
244
 
245
+ .app-name {
246
+ font-size: 50rpx;
247
+ color: $text-1;
248
+ margin-bottom: 302rpx;
249
+ margin-top: 78rpx;
250
+ letter-spacing: 3rpx;
251
+ }
252
+
228
253
  .login_btn {
229
254
  background-color: $blue-color;
230
255
  color: $white-color;
@@ -257,6 +282,10 @@ $bg-card: #ffffff;
257
282
  border: none;
258
283
  line-height: 1;
259
284
 
285
+ &::after {
286
+ border: none;
287
+ }
288
+
260
289
  .avatar-img {
261
290
  width: 120rpx;
262
291
  height: 120rpx;
@@ -342,6 +371,8 @@ $bg-card: #ffffff;
342
371
  <script type="application/json">
343
372
  {
344
373
  "component": true,
345
- "usingComponents": {}
374
+ "usingComponents": {
375
+ "cube-icon": "@mpxjs/mpx-cube-ui/lib/components/icon/index"
376
+ }
346
377
  }
347
- </script>
378
+ </script>
@@ -53,6 +53,7 @@ createPage({
53
53
 
54
54
  <script type="application/json">
55
55
  {
56
+ "navigationBarTitleText": "登录",
56
57
  "usingComponents": {
57
58
  "jmash-login": "../../../components/core/jmash-login.mpx"
58
59
  }