@xtdev/xt-miniprogram-ui 1.2.87 → 1.2.88

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.
@@ -25,11 +25,6 @@ Component({
25
25
  type: Object,
26
26
  value: {},
27
27
  },
28
- // 闪光灯模式:auto/on/off/torch
29
- flash: {
30
- type: String,
31
- value: 'off',
32
- },
33
28
  },
34
29
 
35
30
  data: {
@@ -41,6 +36,8 @@ Component({
41
36
  isLoading: false,
42
37
  systemInfo: null,
43
38
  dpr: 2,
39
+ devicePosition: "back", // 摄像头位置 back: 后置 front: 前置
40
+ flashlight: 'off', // 闪光灯 auto/on/off/torch
44
41
  },
45
42
 
46
43
  lifetimes: {
@@ -66,6 +63,29 @@ Component({
66
63
  }
67
64
  });
68
65
  },
66
+ /**
67
+ * 翻转摄像头
68
+ */
69
+ switchCamera() {
70
+ const { devicePosition } = this.data;
71
+ this.setData({
72
+ devicePosition: devicePosition === 'back' ? 'front' : 'back'
73
+ });
74
+ },
75
+ /**
76
+ * 开关闪光灯
77
+ */
78
+ switchFlashLight() {
79
+ let { flashlight } = this.data;
80
+ flashlight = flashlight === 'off' ? 'on' : 'off';
81
+ this.setData({
82
+ flashlight
83
+ });
84
+ wx.showToast({
85
+ title: flashlight === 'off' ? '闪光灯已关闭' : '闪光灯已开启',
86
+ icon: 'none'
87
+ });
88
+ },
69
89
  /**
70
90
  * 初始化组件
71
91
  */
@@ -118,7 +138,7 @@ Component({
118
138
  * 拍照
119
139
  */
120
140
  takePhoto() {
121
- if (this.data.isLoading) return;
141
+ if (this.data.isLoading) {return;}
122
142
 
123
143
  this.setData({ isLoading: true });
124
144
 
@@ -188,7 +208,8 @@ Component({
188
208
  .exec(res => {
189
209
  if (!res[0] || !res[0].node) {
190
210
  // 使用离屏Canvas
191
- this.createWithOffscreenCanvas(imagePath, imgInfo).then(resolve).catch(reject);
211
+ this.createWithOffscreenCanvas(imagePath, imgInfo).then(resolve)
212
+ .catch(reject);
192
213
  return;
193
214
  }
194
215
 
@@ -515,7 +536,7 @@ Component({
515
536
  */
516
537
  confirmPhoto() {
517
538
  const { previewImage } = this.data;
518
- if (!previewImage) return;
539
+ if (!previewImage) {return;}
519
540
 
520
541
  // 触发事件,将图片路径传递给父组件
521
542
  this.triggerEvent('confirm', {
@@ -1,14 +1,14 @@
1
1
  <view class="watermark-camera-container">
2
2
  <!-- 相机区域 -->
3
3
  <view class="camera-section" wx:if="{{!previewImage}}">
4
- <camera device-position="back" flash="{{flash}}" class="camera" binderror="onCameraError" />
4
+ <camera device-position="{{devicePosition}}" flash="{{flashlight}}" class="camera" binderror="onCameraError" />
5
5
 
6
6
  <!-- 实时水印预览层 -->
7
7
  <view class="watermark-preview-layer">
8
8
  <!-- 左上角标签 -->
9
9
  <view class="tag-container">
10
10
  <view class="tag-label">{{watermarkData.tagText || '拍照记录'}}</view>
11
- <view class="tag-time">{{currentTime}}</view>
11
+ <view class="tag-time">{{currentHours}}<text class="pingfang">:</text>{{currentMinutes}}</view>
12
12
  </view>
13
13
 
14
14
  <!-- 底部信息区 -->
@@ -55,9 +55,11 @@
55
55
 
56
56
  <!-- 拍照按钮 -->
57
57
  <view class="shutter-area">
58
+ <image class="shutter-icon" bind:tap="switchFlashLight" src="{{flashlight == 'on'? 'https://img.tanjiu.cn/home/hXyjajQeyx7nF4dSiFrFM2Ws7Hhbw3fj.png': 'https://img.tanjiu.cn/home/ijXc7GwrFSPi5ttEEJzA7n4Hd3zpGDNE.png'}}" mode="aspectFit" binderror="" bindload=""></image>
58
59
  <view class="shutter-btn" bindtap="takePhoto">
59
60
  <view class="shutter-inner"></view>
60
61
  </view>
62
+ <image class="shutter-icon" bind:tap="switchCamera" src="https://img.tanjiu.cn/home/Jmiyy8h2SiZ8YaMWrNTzcHS3C5XGap3c.png" mode="aspectFit" binderror="" bindload=""></image>
61
63
  </view>
62
64
  </view>
63
65
 
@@ -59,10 +59,14 @@
59
59
  border-radius: 0 8rpx 8rpx 0;
60
60
  }
61
61
 
62
+ .pingfang{
63
+ font-family: PingFang SC-Regular, PingFang SC !important;
64
+ }
65
+
62
66
  .info-container {
63
67
  background: linear-gradient(90deg, #000000 0%, rgba(0, 0, 0, 0) 100%);
64
68
  opacity: 0.5;
65
- padding: 24rpx 20rpx;
69
+ padding: 16rpx;
66
70
  margin-left: 16rpx;
67
71
  margin-bottom: 16rpx;
68
72
  border-radius: 8rpx;
@@ -125,7 +129,7 @@
125
129
  left: 0;
126
130
  right: 0;
127
131
  display: flex;
128
- justify-content: center;
132
+ justify-content: space-evenly;
129
133
  align-items: center;
130
134
  pointer-events: auto;
131
135
  }
@@ -242,3 +246,8 @@
242
246
  font-size: 28rpx;
243
247
  margin-top: 20rpx;
244
248
  }
249
+
250
+ .shutter-icon{
251
+ width: 48rpx;
252
+ height: 48rpx;
253
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xtdev/xt-miniprogram-ui",
3
- "version": "1.2.87",
3
+ "version": "1.2.88",
4
4
  "description": "",
5
5
  "miniprogram": "libs",
6
6
  "publishConfig": {