@zfqh/uniapp 0.3.4 → 0.3.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/CHANGELOG.md +16 -0
- package/lib/mixins/webview.js +3 -0
- package/lib/utils/update.d.ts +2 -0
- package/lib/utils/update.js +15 -9
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.3.6](http://10.10.10.16/caoben/front-end/compare/@zfqh/uniapp@0.3.5...@zfqh/uniapp@0.3.6) (2026-07-16)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @zfqh/uniapp
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.3.5](http://10.10.10.16/caoben/front-end/compare/@zfqh/uniapp@0.3.4...@zfqh/uniapp@0.3.5) (2026-07-15)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @zfqh/uniapp
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [0.3.4](http://10.10.10.16/caoben/front-end/compare/@zfqh/uniapp@0.3.3...@zfqh/uniapp@0.3.4) (2026-07-14)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @zfqh/uniapp
|
package/lib/mixins/webview.js
CHANGED
|
@@ -161,6 +161,9 @@ export default {
|
|
|
161
161
|
const params = this.params;
|
|
162
162
|
if (params.url) {
|
|
163
163
|
params.url = decodeURIComponent(params.url);
|
|
164
|
+
if (/^%/.test(params.url)) {
|
|
165
|
+
params.url = decodeURIComponent(params.url);
|
|
166
|
+
}
|
|
164
167
|
}
|
|
165
168
|
const { type, app: _app, url: _url, ...rest } = params;
|
|
166
169
|
let url = _url;
|
package/lib/utils/update.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export interface VersionInfo {
|
|
|
9
9
|
export interface InstallOptions {
|
|
10
10
|
appId: string;
|
|
11
11
|
url: string;
|
|
12
|
+
path?: string;
|
|
12
13
|
progress?: (p: number) => void;
|
|
13
14
|
success?: () => void;
|
|
14
15
|
fail?: (error: {
|
|
@@ -17,6 +18,7 @@ export interface InstallOptions {
|
|
|
17
18
|
}
|
|
18
19
|
export interface CheckVersionOptions {
|
|
19
20
|
appId: string;
|
|
21
|
+
path?: string;
|
|
20
22
|
}
|
|
21
23
|
export declare function checkVersion(options: CheckVersionOptions): Promise<{
|
|
22
24
|
code: number;
|
package/lib/utils/update.js
CHANGED
|
@@ -7,13 +7,13 @@ import { postMessage } from './index';
|
|
|
7
7
|
const { platform, brand } = SYSTEM_INFO;
|
|
8
8
|
let _installMessageHandler = null;
|
|
9
9
|
// #ifdef APP
|
|
10
|
-
function appGetProperty(appId) {
|
|
10
|
+
function appGetProperty(appId, path) {
|
|
11
11
|
return new Promise((resolve) => {
|
|
12
12
|
if (appId === app.appId) {
|
|
13
13
|
plus.runtime.getProperty(String(plus.runtime.appid), (res) => resolve(res));
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
16
|
-
plus.io.resolveLocalFileSystemURL(`_doc/${appId}/manifest.json`, (entry) => {
|
|
16
|
+
plus.io.resolveLocalFileSystemURL(`_doc/${path ? path + '/' : ''}${appId}/manifest.json`, (entry) => {
|
|
17
17
|
entry.file((file) => {
|
|
18
18
|
const reader = new plus.io.FileReader();
|
|
19
19
|
reader.onloadend = (e) => {
|
|
@@ -32,10 +32,10 @@ function appGetProperty(appId) {
|
|
|
32
32
|
}
|
|
33
33
|
// #endif
|
|
34
34
|
// #ifdef H5
|
|
35
|
-
function h5GetProperty(appId) {
|
|
35
|
+
function h5GetProperty(appId, path) {
|
|
36
36
|
return new Promise((resolve) => {
|
|
37
37
|
if (appId !== app.appId && window.electron) {
|
|
38
|
-
window.electron.webUtils.getProperty(appId, (
|
|
38
|
+
window.electron.webUtils.getProperty(appId, path, (res) => resolve(res || {}));
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
41
|
resolve({ version: ver.name, versionCode: ver.code });
|
|
@@ -52,11 +52,11 @@ export async function checkVersion(options) {
|
|
|
52
52
|
try {
|
|
53
53
|
let version = 0;
|
|
54
54
|
// #ifdef APP
|
|
55
|
-
info = await appGetProperty(appId);
|
|
55
|
+
info = await appGetProperty(appId, options.path);
|
|
56
56
|
version = Number(info.versionCode || 0);
|
|
57
57
|
// #endif
|
|
58
58
|
// #ifdef H5
|
|
59
|
-
info = await h5GetProperty(appId);
|
|
59
|
+
info = await h5GetProperty(appId, options.path);
|
|
60
60
|
version = Number(info.versionCode || 0);
|
|
61
61
|
// #endif
|
|
62
62
|
info.versionCode = version;
|
|
@@ -100,7 +100,7 @@ export async function checkVersion(options) {
|
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
// #ifdef APP
|
|
103
|
-
function appInstall({ appId, url, progress, success, fail }) {
|
|
103
|
+
function appInstall({ appId, url, path, progress, success, fail }) {
|
|
104
104
|
const downloadTask = uni.downloadFile({
|
|
105
105
|
url,
|
|
106
106
|
success(res) {
|
|
@@ -112,9 +112,14 @@ function appInstall({ appId, url, progress, success, fail }) {
|
|
|
112
112
|
}
|
|
113
113
|
else {
|
|
114
114
|
plus.io.resolveLocalFileSystemURL('_doc/', (docDir) => {
|
|
115
|
-
|
|
115
|
+
if (path) {
|
|
116
|
+
docDir.getDirectory(path, { create: true }, (subDir) => {
|
|
117
|
+
plus.zip.decompress(res.tempFilePath, subDir.fullPath, success, fail);
|
|
118
|
+
}, (e) => fail?.({ message: e?.message || String(e) }));
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
116
121
|
plus.zip.decompress(res.tempFilePath, docDir.fullPath, success, fail);
|
|
117
|
-
}
|
|
122
|
+
}
|
|
118
123
|
}, (e) => fail?.({ message: e?.message || String(e) }));
|
|
119
124
|
}
|
|
120
125
|
},
|
|
@@ -131,6 +136,7 @@ function h5Install(options) {
|
|
|
131
136
|
payload: {
|
|
132
137
|
appId: options.appId,
|
|
133
138
|
url: options.url,
|
|
139
|
+
path: options.path,
|
|
134
140
|
},
|
|
135
141
|
});
|
|
136
142
|
if (_installMessageHandler) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zfqh/uniapp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "uniapp公共模块",
|
|
5
5
|
"author": "yinjiazeng@163.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"@types/qs": "^6.9.16",
|
|
47
47
|
"@types/url-parse": "^1.4.11"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "08aca69006a003f3041048071bde7ad6bec6f093"
|
|
50
50
|
}
|