stellar-ui-plus 1.21.5 → 1.21.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/method.ts +107 -0
- package/components/ste-app-update/props.ts +8 -5
- package/components/ste-app-update/ste-app-update.vue +250 -57
- package/components/ste-date-user/ste-date-user.vue +1 -1
- package/components/ste-login-info/ste-login-info.vue +1 -1
- package/package.json +1 -1
- package/components/ste-app-update/rt-uni-update.vue +0 -307
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
export interface ResponseData {
|
|
2
|
+
id: number;
|
|
3
|
+
createUser: number;
|
|
4
|
+
createDept: number;
|
|
5
|
+
createTime: string;
|
|
6
|
+
updateUser: number;
|
|
7
|
+
updateTime: string;
|
|
8
|
+
status: number;
|
|
9
|
+
isDeleted: number;
|
|
10
|
+
tenantId: string;
|
|
11
|
+
/** 应用id(关联inte_client表id字段) */
|
|
12
|
+
inteClientId: number;
|
|
13
|
+
/** 版本号 */
|
|
14
|
+
code: string;
|
|
15
|
+
/** 版本名称 */
|
|
16
|
+
name: string;
|
|
17
|
+
/** 版本说明 */
|
|
18
|
+
desc: string;
|
|
19
|
+
/** 版本更新内容 */
|
|
20
|
+
content: string;
|
|
21
|
+
/** 版本更新文件地址 */
|
|
22
|
+
updateFile: string;
|
|
23
|
+
/** 版本完整文件地址 */
|
|
24
|
+
entireFile: string;
|
|
25
|
+
/** 是否当前版本 */
|
|
26
|
+
isCurrent: true;
|
|
27
|
+
/** 是否强制更新 */
|
|
28
|
+
isForce: true;
|
|
29
|
+
/** 发布状态 TO_RELEASE待发布、RELEASED已发布 */
|
|
30
|
+
publishStatus: 'TO_RELEASE' | 'RELEASED';
|
|
31
|
+
createUserName: string;
|
|
32
|
+
updateUserName: string;
|
|
33
|
+
createDeptName: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ClientData {
|
|
37
|
+
/** 版本更新内容 */
|
|
38
|
+
content: string;
|
|
39
|
+
/** 版本更新文件地址 */
|
|
40
|
+
updateFile: string;
|
|
41
|
+
/** 版本完整文件地址 */
|
|
42
|
+
entireFile: string;
|
|
43
|
+
/** 是否强制更新 */
|
|
44
|
+
isForce: boolean;
|
|
45
|
+
/** 0 是整包升级 1是wgt升级 */
|
|
46
|
+
package_type: number;
|
|
47
|
+
/** 版本名称 */
|
|
48
|
+
name: string;
|
|
49
|
+
/** 版本号 */
|
|
50
|
+
code: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function download(
|
|
54
|
+
data: ClientData,
|
|
55
|
+
{ success, error, onProgressUpdate }: { success?: () => void; error?: (e: any) => void; onProgressUpdate?: (res: UniApp.OnProgressDownloadResult) => void }
|
|
56
|
+
) {
|
|
57
|
+
const package_type = data.package_type;
|
|
58
|
+
const downloadTask = uni.downloadFile({
|
|
59
|
+
url: data.updateFile,
|
|
60
|
+
success: res => {
|
|
61
|
+
if (res.statusCode === 200) {
|
|
62
|
+
plus.runtime.install(
|
|
63
|
+
res.tempFilePath,
|
|
64
|
+
//true表示强制安装,不进行版本号的校验;false则需要版本号校验,
|
|
65
|
+
{ force: true },
|
|
66
|
+
() => {
|
|
67
|
+
// wgt升级
|
|
68
|
+
if (package_type == 1) {
|
|
69
|
+
uni.showModal({
|
|
70
|
+
title: '提示',
|
|
71
|
+
content: '升级成功,请重新启动!',
|
|
72
|
+
confirmText: '确定',
|
|
73
|
+
showCancel: false,
|
|
74
|
+
success: () => {
|
|
75
|
+
success && success();
|
|
76
|
+
plus.runtime.restart();
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
e => {
|
|
82
|
+
//提示部分wgt包无法安装的问题
|
|
83
|
+
data.isForce = false;
|
|
84
|
+
uni.showModal({
|
|
85
|
+
title: '提示',
|
|
86
|
+
content: e.message,
|
|
87
|
+
showCancel: false,
|
|
88
|
+
success: () => {
|
|
89
|
+
error && error(e);
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
// 整包升级
|
|
95
|
+
if (package_type == 0) {
|
|
96
|
+
// 解决安装app点击取消,更新还在的问题
|
|
97
|
+
data.isForce = false;
|
|
98
|
+
success && success();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
// 下载进度
|
|
104
|
+
downloadTask.onProgressUpdate(res => {
|
|
105
|
+
onProgressUpdate && onProgressUpdate(res);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import type { PropType } from 'vue';
|
|
2
1
|
export default {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
/** 应用编码 */
|
|
3
|
+
clientId: {
|
|
5
4
|
type: String,
|
|
6
|
-
default: () =>
|
|
7
|
-
|
|
5
|
+
default: () => 'workbench_android',
|
|
6
|
+
},
|
|
7
|
+
/** 应用密钥 */
|
|
8
|
+
clientSecret: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: () => 'gkS6lEEncqAocYK2qsrvPQZykm3ISeMx',
|
|
8
11
|
},
|
|
9
12
|
};
|
|
@@ -1,74 +1,267 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { onMounted, ref, reactive } from 'vue';
|
|
3
3
|
import propsData from './props';
|
|
4
|
-
import
|
|
4
|
+
import { type ClientData, type ResponseData, download } from './method';
|
|
5
5
|
|
|
6
6
|
const props = defineProps(propsData);
|
|
7
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
|
-
|
|
8
|
+
const data = reactive<ClientData>({
|
|
9
|
+
content: '1. 修复已知问题<br>2. 优化用户体验',
|
|
10
|
+
updateFile: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-6bef1fe3-e3e3-4909-9f0c-6ed9bd11c93b/aae2360a-6628-4c93-b873-ce1600b9a852.apk', //安装包下载地址或者通用应用市场地址
|
|
11
|
+
entireFile: '',
|
|
12
|
+
isForce: false, //是否强制更新 0代表否 1代表是
|
|
13
|
+
package_type: 0, //0 是整包升级 1是wgt升级
|
|
14
|
+
name: '1.0.1', // 版本名称
|
|
15
|
+
code: '100', // 版本号
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const open = ref(true);
|
|
19
|
+
const version = ref(uni.getSystemInfoSync().version);
|
|
20
|
+
const percent = ref(0);
|
|
21
|
+
const updateBtn = ref(true);
|
|
22
|
+
const downloadedSize = ref('0');
|
|
23
|
+
const packageFileSize = ref('0');
|
|
24
|
+
const getData = () => {
|
|
25
|
+
uni.request({
|
|
26
|
+
url: 'http://172.16.118.216:30000/blade-system/api/inte/client/ver/currentDetail',
|
|
27
|
+
method: 'GET',
|
|
28
|
+
header: {
|
|
29
|
+
Authorization: `Basic ${btoa(props.clientId + ':' + props.clientSecret)}`,
|
|
30
|
+
},
|
|
31
|
+
success: (res: any) => {
|
|
32
|
+
const _data: {
|
|
33
|
+
code: number;
|
|
34
|
+
success: boolean;
|
|
35
|
+
msg: string;
|
|
36
|
+
data: ResponseData;
|
|
37
|
+
} = res.data;
|
|
38
|
+
if (_data.code == 200) {
|
|
39
|
+
data.code = _data.data.code;
|
|
40
|
+
data.name = _data.data.name;
|
|
41
|
+
data.content = _data.data.content;
|
|
42
|
+
data.updateFile = _data.data.updateFile;
|
|
43
|
+
data.entireFile = _data.data.entireFile;
|
|
44
|
+
data.isForce = _data.data.isForce;
|
|
45
|
+
data.package_type = _data.data.entireFile ? 0 : 1;
|
|
46
|
+
console.log(_data.data);
|
|
47
|
+
} else {
|
|
48
|
+
console.log(_data.msg);
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
onMounted(() => {
|
|
55
|
+
getData();
|
|
56
|
+
plus.runtime.getProperty(plus.runtime.appid || '', inf => {
|
|
57
|
+
version.value = inf.version || '';
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const onProgressUpdate = (res: UniApp.OnProgressDownloadResult) => {
|
|
62
|
+
percent.value = res.progress;
|
|
63
|
+
downloadedSize.value = (res.totalBytesWritten / Math.pow(1024, 2)).toFixed(2);
|
|
64
|
+
packageFileSize.value = (res.totalBytesExpectedToWrite / Math.pow(1024, 2)).toFixed(2);
|
|
65
|
+
};
|
|
66
|
+
const confirm = () => {
|
|
67
|
+
if (data.package_type == 0) {
|
|
68
|
+
//apk整包升级 下载地址必须以.apk结尾
|
|
69
|
+
if (data.updateFile.includes('.apk')) {
|
|
70
|
+
updateBtn.value = false;
|
|
71
|
+
download(data, { onProgressUpdate });
|
|
59
72
|
} else {
|
|
60
|
-
|
|
73
|
+
//外部下载 一般是手机应用市场或者其他h5页面
|
|
74
|
+
data.isForce = false; // 解决跳转外部链接后,更新提示还在的问题
|
|
75
|
+
plus.runtime.openURL(data.updateFile);
|
|
76
|
+
uni.navigateBack({
|
|
77
|
+
delta: 1,
|
|
78
|
+
});
|
|
61
79
|
}
|
|
80
|
+
} else {
|
|
81
|
+
updateBtn.value = false;
|
|
82
|
+
//wgt资源包升级 下载地址必须以.wgt结尾
|
|
83
|
+
download(data, { onProgressUpdate });
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
defineExpose({
|
|
88
|
+
onHide() {
|
|
89
|
+
data.isForce = false;
|
|
62
90
|
},
|
|
63
91
|
});
|
|
64
92
|
</script>
|
|
65
93
|
<template>
|
|
66
|
-
<view class="
|
|
67
|
-
<
|
|
94
|
+
<view class="update-mask flex-center" v-if="open">
|
|
95
|
+
<view class="content botton-radius">
|
|
96
|
+
<view class="content-top">
|
|
97
|
+
<view class="content-top-text">
|
|
98
|
+
<text class="">发现新版本 v{{ data.code }}</text>
|
|
99
|
+
<text class="version">当前版本:{{ version }}</text>
|
|
100
|
+
</view>
|
|
101
|
+
<image class="content-top" style="top: 0" width="100%" height="100%" src="../../static/bg_top.png"></image>
|
|
102
|
+
</view>
|
|
103
|
+
<view class="content-header"></view>
|
|
104
|
+
<view class="content-body">
|
|
105
|
+
<view class="title"><text>更新内容</text></view>
|
|
106
|
+
<view class="body">
|
|
107
|
+
<scroll-view class="box-des-scroll" scroll-y><rich-text :nodes="data.content"></rich-text></scroll-view>
|
|
108
|
+
</view>
|
|
109
|
+
<view class="footer flex-center">
|
|
110
|
+
<view class="progress-box flex-column" v-if="!updateBtn">
|
|
111
|
+
<progress class="progress" border-radius="35" :percent="percent" activeColor="#3DA7FF" show-info stroke-width="10" />
|
|
112
|
+
<!-- <u-line-progress :striped="true" :percent="percent" :striped-active="true"></u-line-progress> -->
|
|
113
|
+
<view>
|
|
114
|
+
<text class="fs24">正在下载,请稍后 ({{ downloadedSize }}/{{ packageFileSize }}M)</text>
|
|
115
|
+
</view>
|
|
116
|
+
</view>
|
|
117
|
+
|
|
118
|
+
<button class="content-button" style="border: none; color: #fff" plain @click="confirm" v-if="updateBtn">立即升级</button>
|
|
119
|
+
</view>
|
|
120
|
+
</view>
|
|
121
|
+
|
|
122
|
+
<image v-if="!data.isForce" class="close-img" src="../../static/app_update_close.png" @click.stop="open = false"></image>
|
|
123
|
+
</view>
|
|
68
124
|
</view>
|
|
69
125
|
</template>
|
|
70
126
|
|
|
71
127
|
<style lang="scss" scoped>
|
|
72
|
-
.
|
|
128
|
+
.flex-center {
|
|
129
|
+
/* #ifndef APP-NVUE */
|
|
130
|
+
display: flex;
|
|
131
|
+
/* #endif */
|
|
132
|
+
justify-content: center;
|
|
133
|
+
align-items: center;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.update-mask {
|
|
137
|
+
position: fixed;
|
|
138
|
+
left: 0;
|
|
139
|
+
top: 0;
|
|
140
|
+
right: 0;
|
|
141
|
+
bottom: 0;
|
|
142
|
+
background-color: rgba(0, 0, 0, 0.65);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.botton-radius {
|
|
146
|
+
border-bottom-left-radius: 30rpx;
|
|
147
|
+
border-bottom-right-radius: 30rpx;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.content {
|
|
151
|
+
position: relative;
|
|
152
|
+
top: 0;
|
|
153
|
+
width: 600rpx;
|
|
154
|
+
background-color: #fff;
|
|
155
|
+
box-sizing: border-box;
|
|
156
|
+
padding: 0 50rpx;
|
|
157
|
+
font-family: Source Han Sans CN;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.text {
|
|
161
|
+
/* #ifndef APP-NVUE */
|
|
162
|
+
display: block;
|
|
163
|
+
/* #endif */
|
|
164
|
+
line-height: 200px;
|
|
165
|
+
text-align: center;
|
|
166
|
+
color: #ffffff;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.content-top {
|
|
170
|
+
position: absolute;
|
|
171
|
+
top: -195rpx;
|
|
172
|
+
left: 0;
|
|
173
|
+
width: 600rpx;
|
|
174
|
+
height: 270rpx;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.content-top-text {
|
|
178
|
+
font-size: 40rpx;
|
|
179
|
+
font-weight: bold;
|
|
180
|
+
color: #f8f8fa;
|
|
181
|
+
position: absolute;
|
|
182
|
+
top: 120rpx;
|
|
183
|
+
left: 50rpx;
|
|
184
|
+
z-index: 1;
|
|
185
|
+
display: flex;
|
|
186
|
+
flex-direction: column;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.content-header {
|
|
190
|
+
height: 70rpx;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.title {
|
|
194
|
+
font-size: 33rpx;
|
|
195
|
+
font-weight: bold;
|
|
196
|
+
color: #3da7ff;
|
|
197
|
+
line-height: 38px;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.footer {
|
|
201
|
+
height: 150rpx;
|
|
202
|
+
display: flex;
|
|
203
|
+
align-items: center;
|
|
204
|
+
justify-content: space-around;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.box-des-scroll {
|
|
208
|
+
box-sizing: border-box;
|
|
209
|
+
padding: 0 40rpx;
|
|
210
|
+
text-align: left;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.box-des {
|
|
214
|
+
font-size: 26rpx;
|
|
215
|
+
color: #000000;
|
|
216
|
+
line-height: 50rpx;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.progress-box {
|
|
220
|
+
width: 100%;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.progress {
|
|
224
|
+
width: 83%;
|
|
225
|
+
height: 40rpx;
|
|
226
|
+
border-radius: 35px;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.close-img {
|
|
230
|
+
width: 70rpx;
|
|
231
|
+
height: 70rpx;
|
|
232
|
+
z-index: 1000;
|
|
233
|
+
position: absolute;
|
|
234
|
+
bottom: -120rpx;
|
|
235
|
+
left: calc(50% - 70rpx / 2);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.content-button {
|
|
239
|
+
text-align: center;
|
|
240
|
+
flex: 1;
|
|
241
|
+
font-size: 30rpx;
|
|
242
|
+
font-weight: 400;
|
|
243
|
+
color: #ffffff;
|
|
244
|
+
border-radius: 40rpx;
|
|
245
|
+
margin: 0 18rpx;
|
|
246
|
+
|
|
247
|
+
height: 80rpx;
|
|
248
|
+
line-height: 80rpx;
|
|
249
|
+
|
|
250
|
+
background: linear-gradient(to right, #1785ff, #3da7ff);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.flex-column {
|
|
254
|
+
display: flex;
|
|
255
|
+
flex-direction: column;
|
|
256
|
+
align-items: center;
|
|
257
|
+
}
|
|
258
|
+
.fs24 {
|
|
259
|
+
font-size: 24rpx;
|
|
260
|
+
}
|
|
261
|
+
.version {
|
|
262
|
+
font-size: 24rpx;
|
|
263
|
+
margin-top: 10rpx;
|
|
264
|
+
color: #eeeeee;
|
|
265
|
+
text-decoration: underline;
|
|
73
266
|
}
|
|
74
267
|
</style>
|
|
@@ -35,7 +35,7 @@ const emits = defineEmits(loginInfoEmits);
|
|
|
35
35
|
const { getColor } = useColorStore();
|
|
36
36
|
|
|
37
37
|
const compMainColor = computed(() => {
|
|
38
|
-
return
|
|
38
|
+
return getColor().steThemeColor;
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
const compRootStyle = computed(() => {
|
package/package.json
CHANGED
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="update-mask flex-center">
|
|
3
|
-
<view class="content botton-radius">
|
|
4
|
-
<view class="content-top">
|
|
5
|
-
<view class="content-top-text">
|
|
6
|
-
<text class="">发现新版本 v{{ data.edition_name }}</text>
|
|
7
|
-
<text class="version">当前版本:{{ version }}</text>
|
|
8
|
-
</view>
|
|
9
|
-
<image class="content-top" style="top: 0" width="100%" height="100%" src="../../static/bg_top.png"></image>
|
|
10
|
-
</view>
|
|
11
|
-
<view class="content-header"></view>
|
|
12
|
-
<view class="content-body">
|
|
13
|
-
<view class="title"><text>更新内容</text></view>
|
|
14
|
-
<view class="body">
|
|
15
|
-
<scroll-view class="box-des-scroll" scroll-y="true"><rich-text :nodes="data.describe"></rich-text></scroll-view>
|
|
16
|
-
</view>
|
|
17
|
-
<view class="footer flex-center">
|
|
18
|
-
<view class="progress-box flex-column" v-if="!updateBtn">
|
|
19
|
-
<progress class="progress" border-radius="35" :percent="percent" activeColor="#3DA7FF" show-info stroke-width="10" />
|
|
20
|
-
<!-- <u-line-progress :striped="true" :percent="percent" :striped-active="true"></u-line-progress> -->
|
|
21
|
-
<view>
|
|
22
|
-
<text class="fs24">正在下载,请稍后 ({{ downloadedSize }}/{{ packageFileSize }}M)</text>
|
|
23
|
-
</view>
|
|
24
|
-
</view>
|
|
25
|
-
|
|
26
|
-
<button class="content-button" style="border: none; color: #fff" plain @click="confirm" v-if="updateBtn">立即升级</button>
|
|
27
|
-
</view>
|
|
28
|
-
</view>
|
|
29
|
-
|
|
30
|
-
<image v-if="cancleBtn" class="close-img" src="../../static/app_update_close.png" @click.stop="cancel"></image>
|
|
31
|
-
</view>
|
|
32
|
-
</view>
|
|
33
|
-
</template>
|
|
34
|
-
|
|
35
|
-
<script>
|
|
36
|
-
export default {
|
|
37
|
-
props: {
|
|
38
|
-
data: {
|
|
39
|
-
type: Object,
|
|
40
|
-
default: () => ({
|
|
41
|
-
describe: '1. 修复已知问题<br>2. 优化用户体验',
|
|
42
|
-
edition_url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-6bef1fe3-e3e3-4909-9f0c-6ed9bd11c93b/aae2360a-6628-4c93-b873-ce1600b9a852.apk', //安装包下载地址或者通用应用市场地址
|
|
43
|
-
edition_force: 1, //是否强制更新 0代表否 1代表是
|
|
44
|
-
package_type: 0, //0是整包升级 1是wgt升级
|
|
45
|
-
edition_name: '1.0.1', //后端返回的版本名称
|
|
46
|
-
}),
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
data() {
|
|
50
|
-
return {
|
|
51
|
-
version: '1.0.0', //当前运行版本(打包时manifest里的版本名称)
|
|
52
|
-
percent: 0, //进度条百分比
|
|
53
|
-
updateBtn: true, //是否显示立即更新
|
|
54
|
-
cancleBtn: false, //是否显示取消按钮
|
|
55
|
-
downloadedSize: 0, //当前已下载大小
|
|
56
|
-
packageFileSize: 0, //安装包大小
|
|
57
|
-
};
|
|
58
|
-
},
|
|
59
|
-
onHide() {
|
|
60
|
-
//解决应用切换到后台再次打开更新弹窗叠加多个的问题
|
|
61
|
-
// console.log('切换到后台');
|
|
62
|
-
this.data.edition_force = 0;
|
|
63
|
-
uni.navigateBack({
|
|
64
|
-
delta: 1,
|
|
65
|
-
});
|
|
66
|
-
},
|
|
67
|
-
onLoad({ obj }) {
|
|
68
|
-
this.data = JSON.parse(obj);
|
|
69
|
-
if (this.data.edition_force == 0) {
|
|
70
|
-
this.cancleBtn = true;
|
|
71
|
-
}
|
|
72
|
-
plus.runtime.getProperty(plus.runtime.appid, inf => {
|
|
73
|
-
this.version = inf.version;
|
|
74
|
-
});
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
onBackPress() {
|
|
78
|
-
// 强制更新不允许返回
|
|
79
|
-
if (this.data.edition_force == 1) {
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
methods: {
|
|
85
|
-
cancel() {
|
|
86
|
-
//取消升级 返回上一页
|
|
87
|
-
uni.navigateBack({
|
|
88
|
-
delta: 1,
|
|
89
|
-
});
|
|
90
|
-
},
|
|
91
|
-
confirm() {
|
|
92
|
-
if (this.data.package_type == 0) {
|
|
93
|
-
//apk整包升级 下载地址必须以.apk结尾
|
|
94
|
-
if (this.data.edition_url.includes('.apk')) {
|
|
95
|
-
this.updateBtn = false;
|
|
96
|
-
this.cancleBtn = false;
|
|
97
|
-
this.download();
|
|
98
|
-
} else {
|
|
99
|
-
//外部下载 一般是手机应用市场或者其他h5页面
|
|
100
|
-
this.data.edition_force = 0; // 解决跳转外部链接后,更新提示还在的问题
|
|
101
|
-
plus.runtime.openURL(this.data.edition_url);
|
|
102
|
-
uni.navigateBack({
|
|
103
|
-
delta: 1,
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
} else {
|
|
107
|
-
this.updateBtn = false;
|
|
108
|
-
this.cancleBtn = false;
|
|
109
|
-
//wgt资源包升级 下载地址必须以.wgt结尾
|
|
110
|
-
this.download();
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
download() {
|
|
114
|
-
let package_type = this.data.package_type;
|
|
115
|
-
let that = this;
|
|
116
|
-
const downloadTask = uni.downloadFile({
|
|
117
|
-
url: this.data.edition_url,
|
|
118
|
-
success: res => {
|
|
119
|
-
if (res.statusCode === 200) {
|
|
120
|
-
plus.runtime.install(
|
|
121
|
-
res.tempFilePath,
|
|
122
|
-
{
|
|
123
|
-
force: true, //true表示强制安装,不进行版本号的校验;false则需要版本号校验,
|
|
124
|
-
},
|
|
125
|
-
function () {
|
|
126
|
-
// console.log('success', success);
|
|
127
|
-
if (package_type == 1) {
|
|
128
|
-
plus.runtime.restart();
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
function (e) {
|
|
132
|
-
//提示部分wgt包无法安装的问题
|
|
133
|
-
that.data.edition_force = 0;
|
|
134
|
-
uni.showToast({
|
|
135
|
-
title: e.message,
|
|
136
|
-
icon: 'none',
|
|
137
|
-
duration: 2500,
|
|
138
|
-
});
|
|
139
|
-
setTimeout(() => {
|
|
140
|
-
uni.navigateBack();
|
|
141
|
-
}, 2000);
|
|
142
|
-
}
|
|
143
|
-
);
|
|
144
|
-
if (package_type == 0) {
|
|
145
|
-
// 解决安装app点击取消,更新还在的问题
|
|
146
|
-
this.data.edition_force = 0;
|
|
147
|
-
uni.navigateBack();
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
});
|
|
152
|
-
// 进度条
|
|
153
|
-
downloadTask.onProgressUpdate(res => {
|
|
154
|
-
this.percent = res.progress;
|
|
155
|
-
this.downloadedSize = (res.totalBytesWritten / Math.pow(1024, 2)).toFixed(2);
|
|
156
|
-
this.packageFileSize = (res.totalBytesExpectedToWrite / Math.pow(1024, 2)).toFixed(2);
|
|
157
|
-
});
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
};
|
|
161
|
-
</script>
|
|
162
|
-
|
|
163
|
-
<style>
|
|
164
|
-
page {
|
|
165
|
-
background: transparent;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.flex-center {
|
|
169
|
-
/* #ifndef APP-NVUE */
|
|
170
|
-
display: flex;
|
|
171
|
-
/* #endif */
|
|
172
|
-
justify-content: center;
|
|
173
|
-
align-items: center;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
.update-mask {
|
|
177
|
-
position: fixed;
|
|
178
|
-
left: 0;
|
|
179
|
-
top: 0;
|
|
180
|
-
right: 0;
|
|
181
|
-
bottom: 0;
|
|
182
|
-
background-color: rgba(0, 0, 0, 0.65);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.botton-radius {
|
|
186
|
-
border-bottom-left-radius: 30rpx;
|
|
187
|
-
border-bottom-right-radius: 30rpx;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.content {
|
|
191
|
-
position: relative;
|
|
192
|
-
top: 0;
|
|
193
|
-
width: 600rpx;
|
|
194
|
-
background-color: #fff;
|
|
195
|
-
box-sizing: border-box;
|
|
196
|
-
padding: 0 50rpx;
|
|
197
|
-
font-family: Source Han Sans CN;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.text {
|
|
201
|
-
/* #ifndef APP-NVUE */
|
|
202
|
-
display: block;
|
|
203
|
-
/* #endif */
|
|
204
|
-
line-height: 200px;
|
|
205
|
-
text-align: center;
|
|
206
|
-
color: #ffffff;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
.content-top {
|
|
210
|
-
position: absolute;
|
|
211
|
-
top: -195rpx;
|
|
212
|
-
left: 0;
|
|
213
|
-
width: 600rpx;
|
|
214
|
-
height: 270rpx;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.content-top-text {
|
|
218
|
-
font-size: 40rpx;
|
|
219
|
-
font-weight: bold;
|
|
220
|
-
color: #f8f8fa;
|
|
221
|
-
position: absolute;
|
|
222
|
-
top: 120rpx;
|
|
223
|
-
left: 50rpx;
|
|
224
|
-
z-index: 1;
|
|
225
|
-
display: flex;
|
|
226
|
-
flex-direction: column;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
.content-header {
|
|
230
|
-
height: 70rpx;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
.title {
|
|
234
|
-
font-size: 33rpx;
|
|
235
|
-
font-weight: bold;
|
|
236
|
-
color: #3da7ff;
|
|
237
|
-
line-height: 38px;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
.footer {
|
|
241
|
-
height: 150rpx;
|
|
242
|
-
display: flex;
|
|
243
|
-
align-items: center;
|
|
244
|
-
justify-content: space-around;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
.box-des-scroll {
|
|
248
|
-
box-sizing: border-box;
|
|
249
|
-
padding: 0 40rpx;
|
|
250
|
-
text-align: left;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.box-des {
|
|
254
|
-
font-size: 26rpx;
|
|
255
|
-
color: #000000;
|
|
256
|
-
line-height: 50rpx;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
.progress-box {
|
|
260
|
-
width: 100%;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
.progress {
|
|
264
|
-
width: 83%;
|
|
265
|
-
height: 40rpx;
|
|
266
|
-
border-radius: 35px;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
.close-img {
|
|
270
|
-
width: 70rpx;
|
|
271
|
-
height: 70rpx;
|
|
272
|
-
z-index: 1000;
|
|
273
|
-
position: absolute;
|
|
274
|
-
bottom: -120rpx;
|
|
275
|
-
left: calc(50% - 70rpx / 2);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
.content-button {
|
|
279
|
-
text-align: center;
|
|
280
|
-
flex: 1;
|
|
281
|
-
font-size: 30rpx;
|
|
282
|
-
font-weight: 400;
|
|
283
|
-
color: #ffffff;
|
|
284
|
-
border-radius: 40rpx;
|
|
285
|
-
margin: 0 18rpx;
|
|
286
|
-
|
|
287
|
-
height: 80rpx;
|
|
288
|
-
line-height: 80rpx;
|
|
289
|
-
|
|
290
|
-
background: linear-gradient(to right, #1785ff, #3da7ff);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
.flex-column {
|
|
294
|
-
display: flex;
|
|
295
|
-
flex-direction: column;
|
|
296
|
-
align-items: center;
|
|
297
|
-
}
|
|
298
|
-
.fs24 {
|
|
299
|
-
font-size: 24rpx;
|
|
300
|
-
}
|
|
301
|
-
.version {
|
|
302
|
-
font-size: 24rpx;
|
|
303
|
-
margin-top: 10rpx;
|
|
304
|
-
color: #eeeeee;
|
|
305
|
-
text-decoration: underline;
|
|
306
|
-
}
|
|
307
|
-
</style>
|