stellar-ui-v2 1.40.5 → 1.40.6
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.
- package/components/ste-app-update/README.md +65 -0
- package/components/ste-app-update/config.json +5 -0
- package/components/ste-app-update/method.js +48 -0
- package/components/ste-app-update/ste-app-update.vue +308 -0
- package/components/ste-comment/config.json +4 -4
- package/components/ste-coupon-list/ste-coupon-list.vue +2 -0
- package/components/ste-signature/README.md +2 -1
- package/components/ste-signature/ste-signature.vue +1 -1
- package/package.json +1 -1
- package/static/app_update_img.png +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# AppUpdate App更新
|
|
2
|
+
|
|
3
|
+
此组件用于APP更新功能
|
|
4
|
+
|
|
5
|
+
---$
|
|
6
|
+
|
|
7
|
+
### 基础用法
|
|
8
|
+
|
|
9
|
+
- 属性`clientId`用于设置APP的应用编码
|
|
10
|
+
- 属性`clientSecret`用于设置APP的应用密钥
|
|
11
|
+
- 函数`start`用于开始检查更新
|
|
12
|
+
- 回调事`cancel`取消更新
|
|
13
|
+
- 回调事`complete`取消,成功更新都会执行
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<script>
|
|
17
|
+
export default {
|
|
18
|
+
name: 'AppUpdateDemo',
|
|
19
|
+
data() {
|
|
20
|
+
return {};
|
|
21
|
+
},
|
|
22
|
+
methods: {
|
|
23
|
+
// 监听检查更新结果
|
|
24
|
+
checkForUpdates() {
|
|
25
|
+
if (this.$refs.appUpdate) {
|
|
26
|
+
this.$refs.appUpdate.start((resVersion, version) => {
|
|
27
|
+
const { code, name } = resVersion;
|
|
28
|
+
console.log(`当前版本号:${version}`);
|
|
29
|
+
console.log(`服务器版本号:${code};服务器版本名称${name}`);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
</script>
|
|
36
|
+
<template>
|
|
37
|
+
<ste-app-update ref="appUpdate" clientId="workbench_android" clientSecret="gkS6lEEncqAocYK2qsrvPQZykm3ISeMx"></ste-app-update>
|
|
38
|
+
<button @click="checkForUpdates">检查更新</button>
|
|
39
|
+
</template>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---$
|
|
43
|
+
|
|
44
|
+
### API
|
|
45
|
+
|
|
46
|
+
#### Props
|
|
47
|
+
| 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
48
|
+
| ----- | ----- | --- | ------- | ------ | -------- |
|
|
49
|
+
| `clientId` | 应用编码 | `string` | `` | - | - |
|
|
50
|
+
| `clientSecret` | 应用密钥 | `string` | `` | - | - |
|
|
51
|
+
| `apiUrl` | 更新API地址 | `string` | `https://zboa.whzb.com/inte-cloud-dev/blade-system/api/inte/client/ver/currentDetail` | - | - |
|
|
52
|
+
| `appType` | APP环境,版本号的最后一位为环境标识 | `string` | `` | - | - |
|
|
53
|
+
| `btnText` | 立即体验按钮文本 | `string` | `立即体验` | - | - |
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
#### Events
|
|
57
|
+
| 事件名 | 说明 | 事件参数 | 支持版本 |
|
|
58
|
+
| ----- | ----- | ------- | -------- |
|
|
59
|
+
| `cancel` | 取消更新 | - | - |
|
|
60
|
+
| `update` | 发现新版时本触发 | - | - |
|
|
61
|
+
| `no-update` | 没有新版时本触发 | - | - |
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
---$
|
|
65
|
+
{{xuyajun}}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export function download(data, { success, error, onProgressUpdate, downloadSuccess }) {
|
|
2
|
+
const package_type = data.package_type;
|
|
3
|
+
const downloadTask = uni.downloadFile({
|
|
4
|
+
url: data.updateFile,
|
|
5
|
+
success: (res) => {
|
|
6
|
+
if (res.statusCode === 200) {
|
|
7
|
+
downloadSuccess && downloadSuccess(res.tempFilePath);
|
|
8
|
+
plus.runtime.install(
|
|
9
|
+
res.tempFilePath,
|
|
10
|
+
{ force: true },
|
|
11
|
+
() => {
|
|
12
|
+
// wgt升级
|
|
13
|
+
if (package_type == 1) {
|
|
14
|
+
uni.showModal({
|
|
15
|
+
title: '提示',
|
|
16
|
+
content: '升级成功,请重新启动!',
|
|
17
|
+
confirmText: '确定',
|
|
18
|
+
showCancel: false,
|
|
19
|
+
success: () => {
|
|
20
|
+
success && success();
|
|
21
|
+
plus.runtime.restart();
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
} else {
|
|
25
|
+
// 整包升级
|
|
26
|
+
success && success();
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
(e) => {
|
|
30
|
+
//提示部分wgt包无法安装的问题
|
|
31
|
+
uni.showModal({
|
|
32
|
+
title: '提示',
|
|
33
|
+
content: e.message,
|
|
34
|
+
showCancel: false,
|
|
35
|
+
success: () => {
|
|
36
|
+
error && error(e);
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
// 下载进度
|
|
45
|
+
downloadTask.onProgressUpdate((res) => {
|
|
46
|
+
onProgressUpdate && onProgressUpdate(res);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="update-mask flex-center" v-if="open">
|
|
3
|
+
<view class="update-content">
|
|
4
|
+
<image class="update-image" src="../../static/app_update_img.png"></image>
|
|
5
|
+
|
|
6
|
+
<view class="update-title">发现新版本</view>
|
|
7
|
+
<view class="update-version">v{{ data.name }}</view>
|
|
8
|
+
<scroll-view scroll-y class="update-desc">
|
|
9
|
+
<view class="update-desc-title">更新内容</view>
|
|
10
|
+
<view class="update-desc-message"><rich-text :nodes="data.content"></rich-text></view>
|
|
11
|
+
</scroll-view>
|
|
12
|
+
<view class="update-footer">
|
|
13
|
+
<view class="update-progress-box" v-if="!updateBtn">
|
|
14
|
+
<progress class="update-progress" border-radius="35" :percent="percent" activeColor="#3DA7FF" show-info stroke-width="10" />
|
|
15
|
+
<view>
|
|
16
|
+
<text class="update-down-msg" v-if="tempFilePath">下载完成</text>
|
|
17
|
+
<text class="update-down-msg" v-else>正在下载,请稍后 ({{ downloadedSize }}/{{ packageFileSize }}M)</text>
|
|
18
|
+
</view>
|
|
19
|
+
</view>
|
|
20
|
+
<button class="update-button" plain @click="confirm" v-if="updateBtn">{{ btnText }}</button>
|
|
21
|
+
<button class="update-button" plain @click="install" v-else-if="data.package_type === 0 && tempFilePath">安装</button>
|
|
22
|
+
</view>
|
|
23
|
+
|
|
24
|
+
<view class="update-close" v-if="!data.isForce" @click.stop="close">✖</view>
|
|
25
|
+
</view>
|
|
26
|
+
</view>
|
|
27
|
+
</template>
|
|
28
|
+
<script>
|
|
29
|
+
import { download } from './method';
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
group: '业务组件',
|
|
33
|
+
title: 'AppUpdate APP更新',
|
|
34
|
+
name: 'SteAppUpdate',
|
|
35
|
+
props: {
|
|
36
|
+
/** 应用编码 */
|
|
37
|
+
clientId: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: '',
|
|
40
|
+
},
|
|
41
|
+
/** 应用密钥 */
|
|
42
|
+
clientSecret: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: '',
|
|
45
|
+
},
|
|
46
|
+
/** API地址 */
|
|
47
|
+
apiUrl: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: 'https://zboa.whzb.com/inte-cloud-dev/blade-system/api/inte/client/ver/currentDetail',
|
|
50
|
+
},
|
|
51
|
+
/** APP环境,版本号的最后一位为环境标识 */
|
|
52
|
+
appType: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: '',
|
|
55
|
+
},
|
|
56
|
+
/** 立即体验按钮文本 */
|
|
57
|
+
btnText: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: '立即体验',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
data() {
|
|
63
|
+
return {
|
|
64
|
+
data: {
|
|
65
|
+
content: '',
|
|
66
|
+
updateFile: '', //安装包
|
|
67
|
+
isForce: false, //是否强制更新 0代表否 1代表是
|
|
68
|
+
package_type: 0, //0 是整包升级 1是wgt升级
|
|
69
|
+
name: '1.0.1', // 版本名称
|
|
70
|
+
code: '100', // 版本号
|
|
71
|
+
},
|
|
72
|
+
open: false,
|
|
73
|
+
version: uni.getSystemInfoSync().version,
|
|
74
|
+
percent: 0,
|
|
75
|
+
updateBtn: true,
|
|
76
|
+
downloadedSize: '0',
|
|
77
|
+
packageFileSize: '0',
|
|
78
|
+
tempFilePath: '',
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
methods: {
|
|
82
|
+
getData(callback) {
|
|
83
|
+
uni.request({
|
|
84
|
+
url: this.apiUrl,
|
|
85
|
+
method: 'GET',
|
|
86
|
+
header: {
|
|
87
|
+
Authorization: `Basic ${btoa(this.clientId + ':' + this.clientSecret)}`,
|
|
88
|
+
},
|
|
89
|
+
success: (res) => {
|
|
90
|
+
const _data = res.data;
|
|
91
|
+
if (_data.code == 200) {
|
|
92
|
+
this.data.code = _data.data.code;
|
|
93
|
+
this.data.name = _data.data.name;
|
|
94
|
+
|
|
95
|
+
this.data.content = (_data.data.desc || '').replace(/\n+/g, '<br />');
|
|
96
|
+
|
|
97
|
+
this.data.isForce = _data.data.isForce;
|
|
98
|
+
this.data.updateFile = _data.data.entireFile ? _data.data.entireFile : _data.data.updateFile;
|
|
99
|
+
this.data.package_type = _data.data.entireFile ? 0 : 1;
|
|
100
|
+
callback && callback({ code: _data.data.code, name: _data.data.name, updateFile: this.data.updateFile }, this.version);
|
|
101
|
+
if (this.appType) {
|
|
102
|
+
const nvs = this.data.name.split('.');
|
|
103
|
+
// 版本号的最后一位是环境,比较版本号最后一位版本号是否一致,不一致弹错误窗口提示
|
|
104
|
+
const nevn = nvs[nvs.length - 1];
|
|
105
|
+
if (this.appType !== nevn) {
|
|
106
|
+
uni.showModal({
|
|
107
|
+
title: '提示',
|
|
108
|
+
content: `新版本环境:${nevn}和当前环境${this.appType}不一致`,
|
|
109
|
+
showCancel: false,
|
|
110
|
+
});
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
nvs.splice(nvs.length - 1);
|
|
114
|
+
this.data.name = nvs.join('.');
|
|
115
|
+
}
|
|
116
|
+
if (this.data.updateFile && this.data.code !== this.version) {
|
|
117
|
+
this.open = true;
|
|
118
|
+
this.$emit('update');
|
|
119
|
+
// 如果是强制更新,直接开始下载
|
|
120
|
+
if (this.data.isForce) this.confirm();
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
console.log(_data.msg);
|
|
125
|
+
}
|
|
126
|
+
// 无需升级
|
|
127
|
+
this.$emit('no-update');
|
|
128
|
+
},
|
|
129
|
+
fail: (err) => {
|
|
130
|
+
console.log('err===========', err);
|
|
131
|
+
this.$emit('no-update');
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
start(callback) {
|
|
137
|
+
// #ifdef APP-PLUS
|
|
138
|
+
plus.runtime.getProperty(plus.runtime.appid || '', (inf) => {
|
|
139
|
+
this.version = inf.version || '';
|
|
140
|
+
this.getData(callback);
|
|
141
|
+
});
|
|
142
|
+
// #endif
|
|
143
|
+
// #ifndef APP-PLUS
|
|
144
|
+
this.getData(callback);
|
|
145
|
+
// #endif
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
onProgressUpdate(res) {
|
|
149
|
+
this.percent = res.progress;
|
|
150
|
+
this.downloadedSize = (res.totalBytesWritten / Math.pow(1024, 2)).toFixed(2);
|
|
151
|
+
this.packageFileSize = (res.totalBytesExpectedToWrite / Math.pow(1024, 2)).toFixed(2);
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
confirm() {
|
|
155
|
+
if (this.data.package_type == 0) {
|
|
156
|
+
//apk整包升级 下载地址必须以.apk结尾
|
|
157
|
+
if (this.data.updateFile.includes('.apk')) {
|
|
158
|
+
this.updateBtn = false;
|
|
159
|
+
download(this.data, {
|
|
160
|
+
onProgressUpdate: this.onProgressUpdate,
|
|
161
|
+
downloadSuccess: (path) => (this.tempFilePath = path),
|
|
162
|
+
});
|
|
163
|
+
} else {
|
|
164
|
+
//外部下载 一般是手机应用市场或者其他h5页面
|
|
165
|
+
plus.runtime.openURL(this.data.updateFile);
|
|
166
|
+
uni.navigateBack({
|
|
167
|
+
delta: 1,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
} else {
|
|
171
|
+
this.updateBtn = false;
|
|
172
|
+
//wgt资源包升级 下载地址必须以.wgt结尾
|
|
173
|
+
download(this.data, {
|
|
174
|
+
onProgressUpdate: this.onProgressUpdate,
|
|
175
|
+
downloadSuccess: (path) => (this.tempFilePath = path),
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
close() {
|
|
181
|
+
this.open = false;
|
|
182
|
+
this.$emit('cancel');
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
install() {
|
|
186
|
+
plus.runtime.install(
|
|
187
|
+
this.tempFilePath,
|
|
188
|
+
{ force: true },
|
|
189
|
+
() => {
|
|
190
|
+
// wgt升级
|
|
191
|
+
if (this.data.package_type == 1) {
|
|
192
|
+
uni.showModal({
|
|
193
|
+
title: '提示',
|
|
194
|
+
content: '升级成功,请重新启动!',
|
|
195
|
+
confirmText: '确定',
|
|
196
|
+
showCancel: false,
|
|
197
|
+
success: () => {
|
|
198
|
+
plus.runtime.restart();
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
(e) => {
|
|
204
|
+
//提示部分wgt包无法安装的问题
|
|
205
|
+
uni.showModal({
|
|
206
|
+
title: '提示',
|
|
207
|
+
content: e.message,
|
|
208
|
+
showCancel: false,
|
|
209
|
+
success: () => {},
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
</script>
|
|
217
|
+
|
|
218
|
+
<style lang="scss" scoped>
|
|
219
|
+
.flex-center {
|
|
220
|
+
display: flex;
|
|
221
|
+
justify-content: center;
|
|
222
|
+
align-items: center;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.update-mask {
|
|
226
|
+
position: fixed;
|
|
227
|
+
left: 0;
|
|
228
|
+
top: 0;
|
|
229
|
+
right: 0;
|
|
230
|
+
bottom: 0;
|
|
231
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
232
|
+
z-index: 9999;
|
|
233
|
+
.update-content {
|
|
234
|
+
width: 694rpx;
|
|
235
|
+
background-color: #fff;
|
|
236
|
+
border-radius: 16rpx;
|
|
237
|
+
padding: 72rpx 40rpx 40rpx 40rpx;
|
|
238
|
+
display: flex;
|
|
239
|
+
flex-direction: column;
|
|
240
|
+
align-items: center;
|
|
241
|
+
line-height: 1.5;
|
|
242
|
+
position: relative;
|
|
243
|
+
.update-image {
|
|
244
|
+
width: 201rpx;
|
|
245
|
+
height: 201rpx;
|
|
246
|
+
}
|
|
247
|
+
.update-title {
|
|
248
|
+
margin-top: 28rpx;
|
|
249
|
+
font-weight: 500;
|
|
250
|
+
font-size: 48rpx;
|
|
251
|
+
color: #000000;
|
|
252
|
+
}
|
|
253
|
+
.update-version {
|
|
254
|
+
font-weight: 400;
|
|
255
|
+
font-size: 34rpx;
|
|
256
|
+
color: #a7abb0;
|
|
257
|
+
}
|
|
258
|
+
.update-desc {
|
|
259
|
+
width: 100%;
|
|
260
|
+
max-height: 350rpx;
|
|
261
|
+
margin-top: 24rpx;
|
|
262
|
+
.update-desc-title {
|
|
263
|
+
font-weight: 500;
|
|
264
|
+
font-size: 32rpx;
|
|
265
|
+
color: #000000;
|
|
266
|
+
}
|
|
267
|
+
.update-desc-message {
|
|
268
|
+
font-weight: 400;
|
|
269
|
+
font-size: 28rpx;
|
|
270
|
+
color: #555a61;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.update-footer {
|
|
275
|
+
width: 100%;
|
|
276
|
+
margin-top: 48rpx;
|
|
277
|
+
.update-progress-box {
|
|
278
|
+
text-align: center;
|
|
279
|
+
font-weight: 400;
|
|
280
|
+
font-size: 34rpx;
|
|
281
|
+
color: #a7abb0;
|
|
282
|
+
}
|
|
283
|
+
.update-button {
|
|
284
|
+
width: 100%;
|
|
285
|
+
height: 96rpx;
|
|
286
|
+
line-height: 88rpx;
|
|
287
|
+
background: #1388f7;
|
|
288
|
+
border-radius: 16rpx;
|
|
289
|
+
border: 4rpx solid #1388f7;
|
|
290
|
+
font-weight: 500;
|
|
291
|
+
font-size: 32rpx;
|
|
292
|
+
color: #ffffff;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
.update-close {
|
|
296
|
+
position: absolute;
|
|
297
|
+
top: 0;
|
|
298
|
+
right: 0;
|
|
299
|
+
font-size: 30rpx;
|
|
300
|
+
color: #555a61;
|
|
301
|
+
width: 104rpx;
|
|
302
|
+
height: 96rpx;
|
|
303
|
+
line-height: 96rpx;
|
|
304
|
+
text-align: center;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
2
|
+
"group": "业务组件",
|
|
3
|
+
"title": "Comment 评价",
|
|
4
|
+
"icon": "https://image.whzb.com/chain/StellarUI/组件图标/评价.png"
|
|
5
|
+
}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
<ste-button @click="clear">清除</ste-button>
|
|
17
17
|
<ste-button @click="upstep">上一步</ste-button>
|
|
18
18
|
<ste-button @click="save">保存并预览</ste-button>
|
|
19
|
+
<ste-button background="#f00" @click="output('up')">默认输出不旋转</ste-button>
|
|
19
20
|
<ste-button background="#f00" @click="output('right')">输出旋转90°</ste-button>
|
|
20
21
|
<ste-button background="#f00" @click="output('down')">输出旋转180°</ste-button>
|
|
21
22
|
<ste-button background="#f00" @click="output('left')">输出旋转270°</ste-button>
|
|
@@ -117,7 +118,7 @@ methods: {
|
|
|
117
118
|
|`clear` | 清空画布 |- |- |
|
|
118
119
|
|`back` | 回退 |- |- |
|
|
119
120
|
|`save` | 保存为图片 |(base64)=>void,(err)=>void |- |
|
|
120
|
-
|`output` | 自定义输出
|
|
121
|
+
|`output` | 自定义输出 |{orientation:string;success:(base64)=>void;fail:(err)=>void} |`1.40.4` |
|
|
121
122
|
|
|
122
123
|
|
|
123
124
|
---$
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view v-if="load" class="ste-signature-root" :style="[cmpRootStyle]" :class="customClass" @mousedown="onTouchStart" @mousemove="onTouchMove" @mouseup="onTouchEnd" @mosueleave="onTouchEnd">
|
|
3
3
|
<canvas disable-scroll :id="canvasId" :canvas-id="canvasId" :style="[cmpRootStyle]" @touchstart="onTouchStart" @touchmove="onTouchMove" @touchend="onTouchEnd" />
|
|
4
|
-
<!-- #ifdef APP -->
|
|
4
|
+
<!-- #ifdef APP | APP-PLUS -->
|
|
5
5
|
<canvas style="pointer-events: none; opacity: 0" :style="[cmpRootStyle]" id="ste-signature-app-canvas-output" canvas-id="ste-signature-app-canvas-output" />
|
|
6
6
|
<!-- #endif -->
|
|
7
7
|
</view>
|
package/package.json
CHANGED
|
Binary file
|