@dcloudio/uni-app-plus 2.0.0 → 2.0.1-33420211227001
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/dist/automator.view.js +1 -1
- package/dist/index.js +543 -138
- package/dist/index.v3.js +1540 -460
- package/dist/view.css +1 -1
- package/dist/view.umd.js +21028 -11114
- package/dist/view.umd.min.js +2 -2
- package/lib/uni.automator.js +1 -1
- package/package.json +2 -2
- package/template/common/__uniappchooselocation.js +1 -1
- package/template/common/__uniapperror.png +0 -0
- package/template/v3/__uniappquill.js +1 -1
- package/template/v3/__uniappquillimageresize.js +1 -1
package/dist/index.v3.js
CHANGED
|
@@ -13,7 +13,8 @@ var serviceContext = (function () {
|
|
|
13
13
|
'base64ToArrayBuffer',
|
|
14
14
|
'arrayBufferToBase64',
|
|
15
15
|
'addInterceptor',
|
|
16
|
-
'removeInterceptor'
|
|
16
|
+
'removeInterceptor',
|
|
17
|
+
'interceptors'
|
|
17
18
|
];
|
|
18
19
|
|
|
19
20
|
const network = [
|
|
@@ -27,7 +28,8 @@ var serviceContext = (function () {
|
|
|
27
28
|
'onSocketMessage',
|
|
28
29
|
'closeSocket',
|
|
29
30
|
'onSocketClose',
|
|
30
|
-
'getUpdateManager'
|
|
31
|
+
'getUpdateManager',
|
|
32
|
+
'configMTLS'
|
|
31
33
|
];
|
|
32
34
|
|
|
33
35
|
const route = [
|
|
@@ -62,6 +64,7 @@ var serviceContext = (function () {
|
|
|
62
64
|
'chooseImage',
|
|
63
65
|
'chooseFile',
|
|
64
66
|
'previewImage',
|
|
67
|
+
'closePreviewImage',
|
|
65
68
|
'getImageInfo',
|
|
66
69
|
'getVideoInfo',
|
|
67
70
|
'saveImageToPhotosAlbum',
|
|
@@ -192,7 +195,10 @@ var serviceContext = (function () {
|
|
|
192
195
|
'getRightWindowStyle',
|
|
193
196
|
'setTopWindowStyle',
|
|
194
197
|
'setLeftWindowStyle',
|
|
195
|
-
'setRightWindowStyle'
|
|
198
|
+
'setRightWindowStyle',
|
|
199
|
+
'getLocale',
|
|
200
|
+
'setLocale',
|
|
201
|
+
'onLocaleChange'
|
|
196
202
|
];
|
|
197
203
|
|
|
198
204
|
const event = [
|
|
@@ -225,8 +231,11 @@ var serviceContext = (function () {
|
|
|
225
231
|
'login',
|
|
226
232
|
'checkSession',
|
|
227
233
|
'getUserInfo',
|
|
234
|
+
'getUserProfile',
|
|
228
235
|
'preLogin',
|
|
229
236
|
'closeAuthView',
|
|
237
|
+
'getCheckBoxState',
|
|
238
|
+
'getUniverifyManager',
|
|
230
239
|
'share',
|
|
231
240
|
'shareWithSystem',
|
|
232
241
|
'showShareMenu',
|
|
@@ -246,12 +255,16 @@ var serviceContext = (function () {
|
|
|
246
255
|
'sendNativeEvent',
|
|
247
256
|
'preloadPage',
|
|
248
257
|
'unPreloadPage',
|
|
249
|
-
'loadSubPackage'
|
|
258
|
+
'loadSubPackage',
|
|
259
|
+
'sendHostEvent',
|
|
260
|
+
'navigateToMiniProgram'
|
|
250
261
|
];
|
|
251
262
|
|
|
252
263
|
const ad = [
|
|
253
264
|
'createRewardedVideoAd',
|
|
254
|
-
'createFullScreenVideoAd'
|
|
265
|
+
'createFullScreenVideoAd',
|
|
266
|
+
'createInterstitialAd',
|
|
267
|
+
'createInteractiveAd'
|
|
255
268
|
];
|
|
256
269
|
|
|
257
270
|
const apis = [
|
|
@@ -285,6 +298,84 @@ var serviceContext = (function () {
|
|
|
285
298
|
window.addEventListener('test-passive', null, opts);
|
|
286
299
|
} catch (e) {}
|
|
287
300
|
|
|
301
|
+
let realAtob;
|
|
302
|
+
|
|
303
|
+
const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
304
|
+
const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
|
|
305
|
+
|
|
306
|
+
if (typeof atob !== 'function') {
|
|
307
|
+
realAtob = function (str) {
|
|
308
|
+
str = String(str).replace(/[\t\n\f\r ]+/g, '');
|
|
309
|
+
if (!b64re.test(str)) { throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.") }
|
|
310
|
+
|
|
311
|
+
// Adding the padding if missing, for semplicity
|
|
312
|
+
str += '=='.slice(2 - (str.length & 3));
|
|
313
|
+
var bitmap; var result = ''; var r1; var r2; var i = 0;
|
|
314
|
+
for (; i < str.length;) {
|
|
315
|
+
bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 |
|
|
316
|
+
(r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++)));
|
|
317
|
+
|
|
318
|
+
result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255)
|
|
319
|
+
: r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255)
|
|
320
|
+
: String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255);
|
|
321
|
+
}
|
|
322
|
+
return result
|
|
323
|
+
};
|
|
324
|
+
} else {
|
|
325
|
+
// 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
|
|
326
|
+
realAtob = atob;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function b64DecodeUnicode (str) {
|
|
330
|
+
return decodeURIComponent(realAtob(str).split('').map(function (c) {
|
|
331
|
+
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)
|
|
332
|
+
}).join(''))
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function getCurrentUserInfo () {
|
|
336
|
+
const token = ( uni ).getStorageSync('uni_id_token') || '';
|
|
337
|
+
const tokenArr = token.split('.');
|
|
338
|
+
if (!token || tokenArr.length !== 3) {
|
|
339
|
+
return {
|
|
340
|
+
uid: null,
|
|
341
|
+
role: [],
|
|
342
|
+
permission: [],
|
|
343
|
+
tokenExpired: 0
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
let userInfo;
|
|
347
|
+
try {
|
|
348
|
+
userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
|
|
349
|
+
} catch (error) {
|
|
350
|
+
throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message)
|
|
351
|
+
}
|
|
352
|
+
userInfo.tokenExpired = userInfo.exp * 1000;
|
|
353
|
+
delete userInfo.exp;
|
|
354
|
+
delete userInfo.iat;
|
|
355
|
+
return userInfo
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
function uniIdMixin (Vue) {
|
|
359
|
+
Vue.prototype.uniIDHasRole = function (roleId) {
|
|
360
|
+
const {
|
|
361
|
+
role
|
|
362
|
+
} = getCurrentUserInfo();
|
|
363
|
+
return role.indexOf(roleId) > -1
|
|
364
|
+
};
|
|
365
|
+
Vue.prototype.uniIDHasPermission = function (permissionId) {
|
|
366
|
+
const {
|
|
367
|
+
permission
|
|
368
|
+
} = getCurrentUserInfo();
|
|
369
|
+
return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1
|
|
370
|
+
};
|
|
371
|
+
Vue.prototype.uniIDTokenValid = function () {
|
|
372
|
+
const {
|
|
373
|
+
tokenExpired
|
|
374
|
+
} = getCurrentUserInfo();
|
|
375
|
+
return tokenExpired > Date.now()
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
|
|
288
379
|
const _toString = Object.prototype.toString;
|
|
289
380
|
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
290
381
|
|
|
@@ -292,6 +383,10 @@ var serviceContext = (function () {
|
|
|
292
383
|
return typeof fn === 'function'
|
|
293
384
|
}
|
|
294
385
|
|
|
386
|
+
function isStr (str) {
|
|
387
|
+
return typeof str === 'string'
|
|
388
|
+
}
|
|
389
|
+
|
|
295
390
|
function isObject (obj) {
|
|
296
391
|
return obj !== null && typeof obj === 'object'
|
|
297
392
|
}
|
|
@@ -640,7 +735,7 @@ var serviceContext = (function () {
|
|
|
640
735
|
}
|
|
641
736
|
if (res === false) {
|
|
642
737
|
return {
|
|
643
|
-
then () {}
|
|
738
|
+
then () { }
|
|
644
739
|
}
|
|
645
740
|
}
|
|
646
741
|
}
|
|
@@ -688,15 +783,15 @@ var serviceContext = (function () {
|
|
|
688
783
|
if (hook !== 'returnValue') {
|
|
689
784
|
interceptor[hook] = globalInterceptors[hook].slice();
|
|
690
785
|
}
|
|
691
|
-
});
|
|
692
|
-
const scopedInterceptor = scopedInterceptors[method];
|
|
693
|
-
if (scopedInterceptor) {
|
|
694
|
-
Object.keys(scopedInterceptor).forEach(hook => {
|
|
695
|
-
if (hook !== 'returnValue') {
|
|
696
|
-
interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
|
|
697
|
-
}
|
|
698
|
-
});
|
|
699
|
-
}
|
|
786
|
+
});
|
|
787
|
+
const scopedInterceptor = scopedInterceptors[method];
|
|
788
|
+
if (scopedInterceptor) {
|
|
789
|
+
Object.keys(scopedInterceptor).forEach(hook => {
|
|
790
|
+
if (hook !== 'returnValue') {
|
|
791
|
+
interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
|
|
792
|
+
}
|
|
793
|
+
});
|
|
794
|
+
}
|
|
700
795
|
return interceptor
|
|
701
796
|
}
|
|
702
797
|
|
|
@@ -720,16 +815,20 @@ var serviceContext = (function () {
|
|
|
720
815
|
if (!isPromise(res)) {
|
|
721
816
|
return res
|
|
722
817
|
}
|
|
723
|
-
return
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
818
|
+
return new Promise((resolve, reject) => {
|
|
819
|
+
res.then(res => {
|
|
820
|
+
if (res[0]) {
|
|
821
|
+
reject(res[0]);
|
|
822
|
+
} else {
|
|
823
|
+
resolve(res[1]);
|
|
824
|
+
}
|
|
825
|
+
});
|
|
727
826
|
})
|
|
728
827
|
}
|
|
729
828
|
};
|
|
730
829
|
|
|
731
830
|
const SYNC_API_RE =
|
|
732
|
-
/^\$|Window$|WindowStyle$|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
|
|
831
|
+
/^\$|Window$|WindowStyle$|sendHostEvent|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale/;
|
|
733
832
|
|
|
734
833
|
const CONTEXT_API_RE = /^create|Manager$/;
|
|
735
834
|
|
|
@@ -1093,18 +1192,20 @@ var serviceContext = (function () {
|
|
|
1093
1192
|
scanCode: scanCode
|
|
1094
1193
|
});
|
|
1095
1194
|
|
|
1195
|
+
const isArray = Array.isArray;
|
|
1096
1196
|
const isObject$1 = (val) => val !== null && typeof val === 'object';
|
|
1197
|
+
const defaultDelimiters = ['{', '}'];
|
|
1097
1198
|
class BaseFormatter {
|
|
1098
1199
|
constructor() {
|
|
1099
1200
|
this._caches = Object.create(null);
|
|
1100
1201
|
}
|
|
1101
|
-
interpolate(message, values) {
|
|
1202
|
+
interpolate(message, values, delimiters = defaultDelimiters) {
|
|
1102
1203
|
if (!values) {
|
|
1103
1204
|
return [message];
|
|
1104
1205
|
}
|
|
1105
1206
|
let tokens = this._caches[message];
|
|
1106
1207
|
if (!tokens) {
|
|
1107
|
-
tokens = parse(message);
|
|
1208
|
+
tokens = parse(message, delimiters);
|
|
1108
1209
|
this._caches[message] = tokens;
|
|
1109
1210
|
}
|
|
1110
1211
|
return compile(tokens, values);
|
|
@@ -1112,24 +1213,24 @@ var serviceContext = (function () {
|
|
|
1112
1213
|
}
|
|
1113
1214
|
const RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
|
|
1114
1215
|
const RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
|
|
1115
|
-
function parse(format) {
|
|
1216
|
+
function parse(format, [startDelimiter, endDelimiter]) {
|
|
1116
1217
|
const tokens = [];
|
|
1117
1218
|
let position = 0;
|
|
1118
1219
|
let text = '';
|
|
1119
1220
|
while (position < format.length) {
|
|
1120
1221
|
let char = format[position++];
|
|
1121
|
-
if (char ===
|
|
1222
|
+
if (char === startDelimiter) {
|
|
1122
1223
|
if (text) {
|
|
1123
1224
|
tokens.push({ type: 'text', value: text });
|
|
1124
1225
|
}
|
|
1125
1226
|
text = '';
|
|
1126
1227
|
let sub = '';
|
|
1127
1228
|
char = format[position++];
|
|
1128
|
-
while (char !== undefined && char !==
|
|
1229
|
+
while (char !== undefined && char !== endDelimiter) {
|
|
1129
1230
|
sub += char;
|
|
1130
1231
|
char = format[position++];
|
|
1131
1232
|
}
|
|
1132
|
-
const isClosed = char ===
|
|
1233
|
+
const isClosed = char === endDelimiter;
|
|
1133
1234
|
const type = RE_TOKEN_LIST_VALUE.test(sub)
|
|
1134
1235
|
? 'list'
|
|
1135
1236
|
: isClosed && RE_TOKEN_NAMED_VALUE.test(sub)
|
|
@@ -1137,12 +1238,12 @@ var serviceContext = (function () {
|
|
|
1137
1238
|
: 'unknown';
|
|
1138
1239
|
tokens.push({ value: sub, type });
|
|
1139
1240
|
}
|
|
1140
|
-
else if (char === '%') {
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
}
|
|
1241
|
+
// else if (char === '%') {
|
|
1242
|
+
// // when found rails i18n syntax, skip text capture
|
|
1243
|
+
// if (format[position] !== '{') {
|
|
1244
|
+
// text += char
|
|
1245
|
+
// }
|
|
1246
|
+
// }
|
|
1146
1247
|
else {
|
|
1147
1248
|
text += char;
|
|
1148
1249
|
}
|
|
@@ -1153,7 +1254,7 @@ var serviceContext = (function () {
|
|
|
1153
1254
|
function compile(tokens, values) {
|
|
1154
1255
|
const compiled = [];
|
|
1155
1256
|
let index = 0;
|
|
1156
|
-
const mode =
|
|
1257
|
+
const mode = isArray(values)
|
|
1157
1258
|
? 'list'
|
|
1158
1259
|
: isObject$1(values)
|
|
1159
1260
|
? 'named'
|
|
@@ -1191,6 +1292,11 @@ var serviceContext = (function () {
|
|
|
1191
1292
|
return compiled;
|
|
1192
1293
|
}
|
|
1193
1294
|
|
|
1295
|
+
const LOCALE_ZH_HANS = 'zh-Hans';
|
|
1296
|
+
const LOCALE_ZH_HANT = 'zh-Hant';
|
|
1297
|
+
const LOCALE_EN = 'en';
|
|
1298
|
+
const LOCALE_FR = 'fr';
|
|
1299
|
+
const LOCALE_ES = 'es';
|
|
1194
1300
|
const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
1195
1301
|
const hasOwn$1 = (val, key) => hasOwnProperty$1.call(val, key);
|
|
1196
1302
|
const defaultFormatter = new BaseFormatter();
|
|
@@ -1205,31 +1311,31 @@ var serviceContext = (function () {
|
|
|
1205
1311
|
return;
|
|
1206
1312
|
}
|
|
1207
1313
|
locale = locale.trim().replace(/_/g, '-');
|
|
1208
|
-
if (messages[locale]) {
|
|
1314
|
+
if (messages && messages[locale]) {
|
|
1209
1315
|
return locale;
|
|
1210
1316
|
}
|
|
1211
1317
|
locale = locale.toLowerCase();
|
|
1212
1318
|
if (locale.indexOf('zh') === 0) {
|
|
1213
|
-
if (locale.indexOf('-hans')
|
|
1214
|
-
return
|
|
1319
|
+
if (locale.indexOf('-hans') > -1) {
|
|
1320
|
+
return LOCALE_ZH_HANS;
|
|
1215
1321
|
}
|
|
1216
|
-
if (locale.indexOf('-hant')
|
|
1217
|
-
return
|
|
1322
|
+
if (locale.indexOf('-hant') > -1) {
|
|
1323
|
+
return LOCALE_ZH_HANT;
|
|
1218
1324
|
}
|
|
1219
1325
|
if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
|
|
1220
|
-
return
|
|
1326
|
+
return LOCALE_ZH_HANT;
|
|
1221
1327
|
}
|
|
1222
|
-
return
|
|
1328
|
+
return LOCALE_ZH_HANS;
|
|
1223
1329
|
}
|
|
1224
|
-
const lang = startsWith(locale, [
|
|
1330
|
+
const lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
|
|
1225
1331
|
if (lang) {
|
|
1226
1332
|
return lang;
|
|
1227
1333
|
}
|
|
1228
1334
|
}
|
|
1229
1335
|
class I18n {
|
|
1230
1336
|
constructor({ locale, fallbackLocale, messages, watcher, formater, }) {
|
|
1231
|
-
this.locale =
|
|
1232
|
-
this.fallbackLocale =
|
|
1337
|
+
this.locale = LOCALE_EN;
|
|
1338
|
+
this.fallbackLocale = LOCALE_EN;
|
|
1233
1339
|
this.message = {};
|
|
1234
1340
|
this.messages = {};
|
|
1235
1341
|
this.watchers = [];
|
|
@@ -1237,8 +1343,8 @@ var serviceContext = (function () {
|
|
|
1237
1343
|
this.fallbackLocale = fallbackLocale;
|
|
1238
1344
|
}
|
|
1239
1345
|
this.formater = formater || defaultFormatter;
|
|
1240
|
-
this.messages = messages;
|
|
1241
|
-
this.setLocale(locale);
|
|
1346
|
+
this.messages = messages || {};
|
|
1347
|
+
this.setLocale(locale || LOCALE_EN);
|
|
1242
1348
|
if (watcher) {
|
|
1243
1349
|
this.watchLocale(watcher);
|
|
1244
1350
|
}
|
|
@@ -1246,10 +1352,17 @@ var serviceContext = (function () {
|
|
|
1246
1352
|
setLocale(locale) {
|
|
1247
1353
|
const oldLocale = this.locale;
|
|
1248
1354
|
this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
|
|
1355
|
+
if (!this.messages[this.locale]) {
|
|
1356
|
+
// 可能初始化时不存在
|
|
1357
|
+
this.messages[this.locale] = {};
|
|
1358
|
+
}
|
|
1249
1359
|
this.message = this.messages[this.locale];
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1360
|
+
// 仅发生变化时,通知
|
|
1361
|
+
if (oldLocale !== this.locale) {
|
|
1362
|
+
this.watchers.forEach((watcher) => {
|
|
1363
|
+
watcher(this.locale, oldLocale);
|
|
1364
|
+
});
|
|
1365
|
+
}
|
|
1253
1366
|
}
|
|
1254
1367
|
getLocale() {
|
|
1255
1368
|
return this.locale;
|
|
@@ -1260,14 +1373,27 @@ var serviceContext = (function () {
|
|
|
1260
1373
|
this.watchers.splice(index, 1);
|
|
1261
1374
|
};
|
|
1262
1375
|
}
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1376
|
+
add(locale, message, override = true) {
|
|
1377
|
+
const curMessages = this.messages[locale];
|
|
1378
|
+
if (curMessages) {
|
|
1379
|
+
if (override) {
|
|
1380
|
+
Object.assign(curMessages, message);
|
|
1381
|
+
}
|
|
1382
|
+
else {
|
|
1383
|
+
Object.keys(message).forEach((key) => {
|
|
1384
|
+
if (!hasOwn$1(curMessages, key)) {
|
|
1385
|
+
curMessages[key] = message[key];
|
|
1386
|
+
}
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1266
1389
|
}
|
|
1267
1390
|
else {
|
|
1268
1391
|
this.messages[locale] = message;
|
|
1269
1392
|
}
|
|
1270
1393
|
}
|
|
1394
|
+
f(message, values, delimiters) {
|
|
1395
|
+
return this.formater.interpolate(message, values, delimiters).join('');
|
|
1396
|
+
}
|
|
1271
1397
|
t(key, locale, values) {
|
|
1272
1398
|
let message = this.message;
|
|
1273
1399
|
if (typeof locale === 'string') {
|
|
@@ -1285,94 +1411,118 @@ var serviceContext = (function () {
|
|
|
1285
1411
|
}
|
|
1286
1412
|
}
|
|
1287
1413
|
|
|
1288
|
-
function
|
|
1289
|
-
|
|
1290
|
-
|
|
1414
|
+
function watchAppLocale(appVm, i18n) {
|
|
1415
|
+
// 需要保证 watch 的触发在组件渲染之前
|
|
1416
|
+
if (appVm.$watchLocale) {
|
|
1417
|
+
// vue2
|
|
1418
|
+
appVm.$watchLocale((newLocale) => {
|
|
1419
|
+
i18n.setLocale(newLocale);
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
else {
|
|
1423
|
+
appVm.$watch(() => appVm.$locale, (newLocale) => {
|
|
1291
1424
|
i18n.setLocale(newLocale);
|
|
1292
|
-
}, {
|
|
1293
|
-
immediate: true,
|
|
1294
1425
|
});
|
|
1426
|
+
}
|
|
1295
1427
|
}
|
|
1296
1428
|
function getDefaultLocale() {
|
|
1297
|
-
if (typeof
|
|
1298
|
-
return
|
|
1429
|
+
if (typeof uni !== 'undefined' && uni.getLocale) {
|
|
1430
|
+
return uni.getLocale();
|
|
1299
1431
|
}
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
return
|
|
1432
|
+
// 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在 global 上挂了 getLocale
|
|
1433
|
+
if (typeof global !== 'undefined' && global.getLocale) {
|
|
1434
|
+
return global.getLocale();
|
|
1303
1435
|
}
|
|
1304
|
-
return
|
|
1436
|
+
return LOCALE_EN;
|
|
1305
1437
|
}
|
|
1306
|
-
function initVueI18n(
|
|
1438
|
+
function initVueI18n(locale, messages = {}, fallbackLocale, watcher) {
|
|
1439
|
+
// 兼容旧版本入参
|
|
1440
|
+
if (typeof locale !== 'string') {
|
|
1441
|
+
[locale, messages] = [
|
|
1442
|
+
messages,
|
|
1443
|
+
locale,
|
|
1444
|
+
];
|
|
1445
|
+
}
|
|
1446
|
+
if (typeof locale !== 'string') {
|
|
1447
|
+
// 因为小程序平台,uni-i18n 和 uni 互相引用,导致此时访问 uni 时,为 undefined
|
|
1448
|
+
locale = getDefaultLocale();
|
|
1449
|
+
}
|
|
1450
|
+
if (typeof fallbackLocale !== 'string') {
|
|
1451
|
+
fallbackLocale =
|
|
1452
|
+
(typeof __uniConfig !== 'undefined' && __uniConfig.fallbackLocale) ||
|
|
1453
|
+
LOCALE_EN;
|
|
1454
|
+
}
|
|
1307
1455
|
const i18n = new I18n({
|
|
1308
|
-
locale
|
|
1456
|
+
locale,
|
|
1309
1457
|
fallbackLocale,
|
|
1310
1458
|
messages,
|
|
1459
|
+
watcher,
|
|
1311
1460
|
});
|
|
1312
1461
|
let t = (key, values) => {
|
|
1313
1462
|
if (typeof getApp !== 'function') {
|
|
1314
|
-
// app
|
|
1463
|
+
// app view
|
|
1315
1464
|
/* eslint-disable no-func-assign */
|
|
1316
1465
|
t = function (key, values) {
|
|
1317
1466
|
return i18n.t(key, values);
|
|
1318
1467
|
};
|
|
1319
1468
|
}
|
|
1320
1469
|
else {
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
if (
|
|
1341
|
-
|
|
1470
|
+
let isWatchedAppLocale = false;
|
|
1471
|
+
t = function (key, values) {
|
|
1472
|
+
const appVm = getApp().$vm;
|
|
1473
|
+
// 可能$vm还不存在,比如在支付宝小程序中,组件定义较早,在props的default里使用了t()函数(如uni-goods-nav),此时app还未初始化
|
|
1474
|
+
// options: {
|
|
1475
|
+
// type: Array,
|
|
1476
|
+
// default () {
|
|
1477
|
+
// return [{
|
|
1478
|
+
// icon: 'shop',
|
|
1479
|
+
// text: t("uni-goods-nav.options.shop"),
|
|
1480
|
+
// }, {
|
|
1481
|
+
// icon: 'cart',
|
|
1482
|
+
// text: t("uni-goods-nav.options.cart")
|
|
1483
|
+
// }]
|
|
1484
|
+
// }
|
|
1485
|
+
// },
|
|
1486
|
+
if (appVm) {
|
|
1487
|
+
// 触发响应式
|
|
1488
|
+
appVm.$locale;
|
|
1489
|
+
if (!isWatchedAppLocale) {
|
|
1490
|
+
isWatchedAppLocale = true;
|
|
1491
|
+
watchAppLocale(appVm, i18n);
|
|
1342
1492
|
}
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
}
|
|
1493
|
+
}
|
|
1494
|
+
return i18n.t(key, values);
|
|
1495
|
+
};
|
|
1346
1496
|
}
|
|
1347
1497
|
return t(key, values);
|
|
1348
1498
|
};
|
|
1349
1499
|
return {
|
|
1500
|
+
i18n,
|
|
1501
|
+
f(message, values, delimiters) {
|
|
1502
|
+
return i18n.f(message, values, delimiters);
|
|
1503
|
+
},
|
|
1350
1504
|
t(key, values) {
|
|
1351
1505
|
return t(key, values);
|
|
1352
1506
|
},
|
|
1507
|
+
add(locale, message, override = true) {
|
|
1508
|
+
return i18n.add(locale, message, override);
|
|
1509
|
+
},
|
|
1510
|
+
watch(fn) {
|
|
1511
|
+
return i18n.watchLocale(fn);
|
|
1512
|
+
},
|
|
1353
1513
|
getLocale() {
|
|
1354
1514
|
return i18n.getLocale();
|
|
1355
1515
|
},
|
|
1356
1516
|
setLocale(newLocale) {
|
|
1357
1517
|
return i18n.setLocale(newLocale);
|
|
1358
1518
|
},
|
|
1359
|
-
mixin: {
|
|
1360
|
-
beforeCreate() {
|
|
1361
|
-
const unwatch = i18n.watchLocale(() => {
|
|
1362
|
-
this.$forceUpdate();
|
|
1363
|
-
});
|
|
1364
|
-
this.$once('hook:beforeDestroy', function () {
|
|
1365
|
-
unwatch();
|
|
1366
|
-
});
|
|
1367
|
-
},
|
|
1368
|
-
methods: {
|
|
1369
|
-
$$t(key, values) {
|
|
1370
|
-
return t(key, values);
|
|
1371
|
-
},
|
|
1372
|
-
},
|
|
1373
|
-
},
|
|
1374
1519
|
};
|
|
1375
1520
|
}
|
|
1521
|
+
function isI18nStr(value, delimiters) {
|
|
1522
|
+
return value.indexOf(delimiters[0]) > -1;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
const NAVBAR_HEIGHT = 44;
|
|
1376
1526
|
|
|
1377
1527
|
var en = {
|
|
1378
1528
|
"uni.app.quit": "Press back button again to exit",
|
|
@@ -1388,6 +1538,7 @@ var serviceContext = (function () {
|
|
|
1388
1538
|
"uni.chooseVideo.cancel": "Cancel",
|
|
1389
1539
|
"uni.chooseVideo.sourceType.album": "Album",
|
|
1390
1540
|
"uni.chooseVideo.sourceType.camera": "Camera",
|
|
1541
|
+
"uni.chooseFile.notUserActivation": "File chooser dialog can only be shown with a user activation",
|
|
1391
1542
|
"uni.previewImage.cancel": "Cancel",
|
|
1392
1543
|
"uni.previewImage.button.save": "Save Image",
|
|
1393
1544
|
"uni.previewImage.save.success": "Saved successfully",
|
|
@@ -1404,7 +1555,9 @@ var serviceContext = (function () {
|
|
|
1404
1555
|
"uni.video.danmu": "Danmu",
|
|
1405
1556
|
"uni.video.volume": "Volume",
|
|
1406
1557
|
"uni.button.feedback.title": "feedback",
|
|
1407
|
-
"uni.button.feedback.send": "send"
|
|
1558
|
+
"uni.button.feedback.send": "send",
|
|
1559
|
+
"uni.chooseLocation.search": "Find Place",
|
|
1560
|
+
"uni.chooseLocation.cancel": "Cancel"
|
|
1408
1561
|
};
|
|
1409
1562
|
|
|
1410
1563
|
var es = {
|
|
@@ -1421,6 +1574,7 @@ var serviceContext = (function () {
|
|
|
1421
1574
|
"uni.chooseVideo.cancel": "Cancelar",
|
|
1422
1575
|
"uni.chooseVideo.sourceType.album": "Álbum",
|
|
1423
1576
|
"uni.chooseVideo.sourceType.camera": "Cámara",
|
|
1577
|
+
"uni.chooseFile.notUserActivation": "El cuadro de diálogo del selector de archivos solo se puede mostrar con la activación del usuario",
|
|
1424
1578
|
"uni.previewImage.cancel": "Cancelar",
|
|
1425
1579
|
"uni.previewImage.button.save": "Guardar imagen",
|
|
1426
1580
|
"uni.previewImage.save.success": "Guardado exitosamente",
|
|
@@ -1437,7 +1591,9 @@ var serviceContext = (function () {
|
|
|
1437
1591
|
"uni.video.danmu": "Danmu",
|
|
1438
1592
|
"uni.video.volume": "Volumen",
|
|
1439
1593
|
"uni.button.feedback.title": "realimentación",
|
|
1440
|
-
"uni.button.feedback.send": "enviar"
|
|
1594
|
+
"uni.button.feedback.send": "enviar",
|
|
1595
|
+
"uni.chooseLocation.search": "Encontrar",
|
|
1596
|
+
"uni.chooseLocation.cancel": "Cancelar"
|
|
1441
1597
|
};
|
|
1442
1598
|
|
|
1443
1599
|
var fr = {
|
|
@@ -1454,6 +1610,7 @@ var serviceContext = (function () {
|
|
|
1454
1610
|
"uni.chooseVideo.cancel": "Annuler",
|
|
1455
1611
|
"uni.chooseVideo.sourceType.album": "Album",
|
|
1456
1612
|
"uni.chooseVideo.sourceType.camera": "Caméra",
|
|
1613
|
+
"uni.chooseFile.notUserActivation": "La boîte de dialogue du sélecteur de fichier ne peut être affichée qu'avec une activation par l'utilisateur",
|
|
1457
1614
|
"uni.previewImage.cancel": "Annuler",
|
|
1458
1615
|
"uni.previewImage.button.save": "Guardar imagen",
|
|
1459
1616
|
"uni.previewImage.save.success": "Enregistré avec succès",
|
|
@@ -1470,7 +1627,9 @@ var serviceContext = (function () {
|
|
|
1470
1627
|
"uni.video.danmu": "Danmu",
|
|
1471
1628
|
"uni.video.volume": "Le Volume",
|
|
1472
1629
|
"uni.button.feedback.title": "retour d'information",
|
|
1473
|
-
"uni.button.feedback.send": "envoyer"
|
|
1630
|
+
"uni.button.feedback.send": "envoyer",
|
|
1631
|
+
"uni.chooseLocation.search": "Trouve",
|
|
1632
|
+
"uni.chooseLocation.cancel": "Annuler"
|
|
1474
1633
|
};
|
|
1475
1634
|
|
|
1476
1635
|
var zhHans = {
|
|
@@ -1487,6 +1646,7 @@ var serviceContext = (function () {
|
|
|
1487
1646
|
"uni.chooseVideo.cancel": "取消",
|
|
1488
1647
|
"uni.chooseVideo.sourceType.album": "从相册选择",
|
|
1489
1648
|
"uni.chooseVideo.sourceType.camera": "拍摄",
|
|
1649
|
+
"uni.chooseFile.notUserActivation": "文件选择器对话框只能在由用户激活时显示",
|
|
1490
1650
|
"uni.previewImage.cancel": "取消",
|
|
1491
1651
|
"uni.previewImage.button.save": "保存图像",
|
|
1492
1652
|
"uni.previewImage.save.success": "保存图像到相册成功",
|
|
@@ -1503,7 +1663,9 @@ var serviceContext = (function () {
|
|
|
1503
1663
|
"uni.video.danmu": "弹幕",
|
|
1504
1664
|
"uni.video.volume": "音量",
|
|
1505
1665
|
"uni.button.feedback.title": "问题反馈",
|
|
1506
|
-
"uni.button.feedback.send": "发送"
|
|
1666
|
+
"uni.button.feedback.send": "发送",
|
|
1667
|
+
"uni.chooseLocation.search": "搜索地点",
|
|
1668
|
+
"uni.chooseLocation.cancel": "取消"
|
|
1507
1669
|
};
|
|
1508
1670
|
|
|
1509
1671
|
var zhHant = {
|
|
@@ -1520,6 +1682,7 @@ var serviceContext = (function () {
|
|
|
1520
1682
|
"uni.chooseVideo.cancel": "取消",
|
|
1521
1683
|
"uni.chooseVideo.sourceType.album": "從相冊選擇",
|
|
1522
1684
|
"uni.chooseVideo.sourceType.camera": "拍攝",
|
|
1685
|
+
"uni.chooseFile.notUserActivation": "文件選擇器對話框只能在由用戶激活時顯示",
|
|
1523
1686
|
"uni.previewImage.cancel": "取消",
|
|
1524
1687
|
"uni.previewImage.button.save": "保存圖像",
|
|
1525
1688
|
"uni.previewImage.save.success": "保存圖像到相冊成功",
|
|
@@ -1536,29 +1699,184 @@ var serviceContext = (function () {
|
|
|
1536
1699
|
"uni.video.danmu": "彈幕",
|
|
1537
1700
|
"uni.video.volume": "音量",
|
|
1538
1701
|
"uni.button.feedback.title": "問題反饋",
|
|
1539
|
-
"uni.button.feedback.send": "發送"
|
|
1702
|
+
"uni.button.feedback.send": "發送",
|
|
1703
|
+
"uni.chooseLocation.search": "搜索地點",
|
|
1704
|
+
"uni.chooseLocation.cancel": "取消"
|
|
1540
1705
|
};
|
|
1541
1706
|
|
|
1542
|
-
const messages = {
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1707
|
+
const messages = {};
|
|
1708
|
+
|
|
1709
|
+
{
|
|
1710
|
+
Object.assign(messages, {
|
|
1711
|
+
en,
|
|
1712
|
+
es,
|
|
1713
|
+
fr,
|
|
1714
|
+
'zh-Hans': zhHans,
|
|
1715
|
+
'zh-Hant': zhHant
|
|
1716
|
+
});
|
|
1717
|
+
}
|
|
1549
1718
|
|
|
1550
|
-
|
|
1719
|
+
let locale;
|
|
1551
1720
|
|
|
1552
|
-
|
|
1721
|
+
{
|
|
1722
|
+
if (typeof weex === 'object') {
|
|
1723
|
+
locale = weex.requireModule('plus').getLanguage();
|
|
1724
|
+
} else {
|
|
1725
|
+
locale = '';
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
function initI18nMessages () {
|
|
1730
|
+
if (!isEnableLocale()) {
|
|
1731
|
+
return
|
|
1732
|
+
}
|
|
1733
|
+
const localeKeys = Object.keys(__uniConfig.locales);
|
|
1734
|
+
if (localeKeys.length) {
|
|
1735
|
+
localeKeys.forEach((locale) => {
|
|
1736
|
+
const curMessages = messages[locale];
|
|
1737
|
+
const userMessages = __uniConfig.locales[locale];
|
|
1738
|
+
if (curMessages) {
|
|
1739
|
+
Object.assign(curMessages, userMessages);
|
|
1740
|
+
} else {
|
|
1741
|
+
messages[locale] = userMessages;
|
|
1742
|
+
}
|
|
1743
|
+
});
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
initI18nMessages();
|
|
1748
|
+
|
|
1749
|
+
const i18n = initVueI18n(
|
|
1750
|
+
locale,
|
|
1751
|
+
messages
|
|
1752
|
+
);
|
|
1553
1753
|
const t = i18n.t;
|
|
1554
|
-
const
|
|
1754
|
+
const i18nMixin = (i18n.mixin = {
|
|
1755
|
+
beforeCreate () {
|
|
1756
|
+
const unwatch = i18n.i18n.watchLocale(() => {
|
|
1757
|
+
this.$forceUpdate();
|
|
1758
|
+
});
|
|
1759
|
+
this.$once('hook:beforeDestroy', function () {
|
|
1760
|
+
unwatch();
|
|
1761
|
+
});
|
|
1762
|
+
},
|
|
1763
|
+
methods: {
|
|
1764
|
+
$$t (key, values) {
|
|
1765
|
+
return t(key, values)
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
});
|
|
1769
|
+
const getLocale = i18n.getLocale;
|
|
1770
|
+
|
|
1771
|
+
function initAppLocale (Vue, appVm, locale) {
|
|
1772
|
+
const state = Vue.observable({
|
|
1773
|
+
locale: locale || i18n.getLocale()
|
|
1774
|
+
});
|
|
1775
|
+
const localeWatchers = [];
|
|
1776
|
+
appVm.$watchLocale = fn => {
|
|
1777
|
+
localeWatchers.push(fn);
|
|
1778
|
+
};
|
|
1779
|
+
Object.defineProperty(appVm, '$locale', {
|
|
1780
|
+
get () {
|
|
1781
|
+
return state.locale
|
|
1782
|
+
},
|
|
1783
|
+
set (v) {
|
|
1784
|
+
state.locale = v;
|
|
1785
|
+
localeWatchers.forEach(watch => watch(v));
|
|
1786
|
+
}
|
|
1787
|
+
});
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
const I18N_JSON_DELIMITERS = ['%', '%'];
|
|
1791
|
+
|
|
1792
|
+
function getLocaleMessage () {
|
|
1793
|
+
const locale = uni.getLocale();
|
|
1794
|
+
const locales = __uniConfig.locales;
|
|
1795
|
+
return (
|
|
1796
|
+
locales[locale] || locales[__uniConfig.fallbackLocale] || locales.en || {}
|
|
1797
|
+
)
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
function formatI18n (message) {
|
|
1801
|
+
if (isI18nStr(message, I18N_JSON_DELIMITERS)) {
|
|
1802
|
+
return i18n.f(message, getLocaleMessage(), I18N_JSON_DELIMITERS)
|
|
1803
|
+
}
|
|
1804
|
+
return message
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
function resolveJsonObj (jsonObj, names) {
|
|
1808
|
+
if (names.length === 1) {
|
|
1809
|
+
if (jsonObj) {
|
|
1810
|
+
const value = jsonObj[names[0]];
|
|
1811
|
+
if (isStr(value) && isI18nStr(value, I18N_JSON_DELIMITERS)) {
|
|
1812
|
+
return jsonObj
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
return
|
|
1816
|
+
}
|
|
1817
|
+
const name = names.shift();
|
|
1818
|
+
return resolveJsonObj(jsonObj && jsonObj[name], names)
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
function defineI18nProperties (obj, names) {
|
|
1822
|
+
return names.map(name => defineI18nProperty(obj, name))
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
function defineI18nProperty (obj, names) {
|
|
1826
|
+
const jsonObj = resolveJsonObj(obj, names);
|
|
1827
|
+
if (!jsonObj) {
|
|
1828
|
+
return false
|
|
1829
|
+
}
|
|
1830
|
+
const prop = names[names.length - 1];
|
|
1831
|
+
let value = jsonObj[prop];
|
|
1832
|
+
Object.defineProperty(jsonObj, prop, {
|
|
1833
|
+
get () {
|
|
1834
|
+
return formatI18n(value)
|
|
1835
|
+
},
|
|
1836
|
+
set (v) {
|
|
1837
|
+
value = v;
|
|
1838
|
+
}
|
|
1839
|
+
});
|
|
1840
|
+
return true
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
function isEnableLocale () {
|
|
1844
|
+
return typeof __uniConfig !== 'undefined' && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
function initNavigationBarI18n (navigationBar) {
|
|
1848
|
+
if (isEnableLocale()) {
|
|
1849
|
+
return defineI18nProperties(navigationBar, [
|
|
1850
|
+
['titleText'],
|
|
1851
|
+
['searchInput', 'placeholder']
|
|
1852
|
+
])
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
// export function initI18n() {
|
|
1857
|
+
// const localeKeys = Object.keys(__uniConfig.locales || {})
|
|
1858
|
+
// if (localeKeys.length) {
|
|
1859
|
+
// localeKeys.forEach((locale) =>
|
|
1860
|
+
// i18n.add(locale, __uniConfig.locales[locale])
|
|
1861
|
+
// )
|
|
1862
|
+
// }
|
|
1863
|
+
// }
|
|
1555
1864
|
|
|
1556
1865
|
const setClipboardData = {
|
|
1557
|
-
|
|
1866
|
+
data: {
|
|
1867
|
+
type: String,
|
|
1868
|
+
required: true
|
|
1869
|
+
},
|
|
1870
|
+
showToast: {
|
|
1871
|
+
type: Boolean,
|
|
1872
|
+
default: true
|
|
1873
|
+
},
|
|
1874
|
+
beforeSuccess (res, params) {
|
|
1875
|
+
if (!params.showToast) return
|
|
1558
1876
|
const title = t('uni.setClipboardData.success');
|
|
1559
1877
|
if (title) {
|
|
1560
1878
|
uni.showToast({
|
|
1561
|
-
title
|
|
1879
|
+
title,
|
|
1562
1880
|
icon: 'success',
|
|
1563
1881
|
mask: false,
|
|
1564
1882
|
style: {
|
|
@@ -1629,10 +1947,13 @@ var serviceContext = (function () {
|
|
|
1629
1947
|
function getRealPath (filePath) {
|
|
1630
1948
|
if (filePath.indexOf('/') === 0) {
|
|
1631
1949
|
if (filePath.indexOf('//') === 0) {
|
|
1632
|
-
|
|
1633
|
-
} else {
|
|
1634
|
-
return addBase(filePath.substr(1))
|
|
1950
|
+
return 'https:' + filePath
|
|
1635
1951
|
}
|
|
1952
|
+
// 平台绝对路径 安卓、iOS
|
|
1953
|
+
if (filePath.startsWith('/storage/') || filePath.startsWith('/sdcard/') || filePath.includes('/Containers/Data/Application/')) {
|
|
1954
|
+
return 'file://' + filePath
|
|
1955
|
+
}
|
|
1956
|
+
return addBase(filePath.substr(1))
|
|
1636
1957
|
}
|
|
1637
1958
|
// 网络资源或base64
|
|
1638
1959
|
if (SCHEME_RE.test(filePath) || DATA_RE.test(filePath) || filePath.indexOf('blob:') === 0) {
|
|
@@ -1735,18 +2056,15 @@ var serviceContext = (function () {
|
|
|
1735
2056
|
chooseLocation: chooseLocation
|
|
1736
2057
|
});
|
|
1737
2058
|
|
|
1738
|
-
const
|
|
1739
|
-
|
|
1740
|
-
GCJ02: 'GCJ02'
|
|
1741
|
-
};
|
|
2059
|
+
const coordTypes = ['wgs84', 'gcj02'];
|
|
2060
|
+
|
|
1742
2061
|
const getLocation = {
|
|
1743
2062
|
type: {
|
|
1744
2063
|
type: String,
|
|
1745
2064
|
validator (value, params) {
|
|
1746
|
-
value = (value || '').
|
|
1747
|
-
params.type =
|
|
1748
|
-
}
|
|
1749
|
-
default: type.WGS84
|
|
2065
|
+
value = (value || '').toLowerCase();
|
|
2066
|
+
params.type = coordTypes.indexOf(value) < 0 ? coordTypes[0] : value;
|
|
2067
|
+
}
|
|
1750
2068
|
},
|
|
1751
2069
|
altitude: {
|
|
1752
2070
|
type: Boolean,
|
|
@@ -2069,7 +2387,8 @@ var serviceContext = (function () {
|
|
|
2069
2387
|
PUT: 'PUT',
|
|
2070
2388
|
DELETE: 'DELETE',
|
|
2071
2389
|
TRACE: 'TRACE',
|
|
2072
|
-
CONNECT: 'CONNECT'
|
|
2390
|
+
CONNECT: 'CONNECT',
|
|
2391
|
+
PATCH: 'PATCH'
|
|
2073
2392
|
};
|
|
2074
2393
|
const dataType = {
|
|
2075
2394
|
JSON: 'json'
|
|
@@ -2165,11 +2484,24 @@ var serviceContext = (function () {
|
|
|
2165
2484
|
timeout: {
|
|
2166
2485
|
type: Number
|
|
2167
2486
|
}
|
|
2487
|
+
};
|
|
2488
|
+
|
|
2489
|
+
const configMTLS = {
|
|
2490
|
+
certificates: {
|
|
2491
|
+
type: Array,
|
|
2492
|
+
required: true,
|
|
2493
|
+
validator (value) {
|
|
2494
|
+
if (value.some(item => toRawType(item.host) !== 'String')) {
|
|
2495
|
+
return '参数配置错误,请确认后重试'
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2168
2499
|
};
|
|
2169
2500
|
|
|
2170
2501
|
var require_context_module_0_25 = /*#__PURE__*/Object.freeze({
|
|
2171
2502
|
__proto__: null,
|
|
2172
|
-
request: request
|
|
2503
|
+
request: request,
|
|
2504
|
+
configMTLS: configMTLS
|
|
2173
2505
|
});
|
|
2174
2506
|
|
|
2175
2507
|
const method$1 = {
|
|
@@ -2246,7 +2578,7 @@ var serviceContext = (function () {
|
|
|
2246
2578
|
type: String,
|
|
2247
2579
|
validator (value, params) {
|
|
2248
2580
|
if (value) {
|
|
2249
|
-
params.
|
|
2581
|
+
params.filePath = getRealPath(value);
|
|
2250
2582
|
}
|
|
2251
2583
|
}
|
|
2252
2584
|
},
|
|
@@ -2734,7 +3066,7 @@ var serviceContext = (function () {
|
|
|
2734
3066
|
icon: {
|
|
2735
3067
|
default: 'success',
|
|
2736
3068
|
validator (icon, params) {
|
|
2737
|
-
if (['success', 'loading', 'none'].indexOf(icon) === -1) {
|
|
3069
|
+
if (['success', 'loading', 'error', 'none'].indexOf(icon) === -1) {
|
|
2738
3070
|
params.icon = 'success';
|
|
2739
3071
|
}
|
|
2740
3072
|
}
|
|
@@ -3312,7 +3644,7 @@ var serviceContext = (function () {
|
|
|
3312
3644
|
const errMsg = res.errMsg;
|
|
3313
3645
|
|
|
3314
3646
|
if (errMsg.indexOf(apiName + ':ok') === 0) {
|
|
3315
|
-
isFn(beforeSuccess) && beforeSuccess(res);
|
|
3647
|
+
isFn(beforeSuccess) && beforeSuccess(res, params);
|
|
3316
3648
|
|
|
3317
3649
|
hasSuccess && success(res);
|
|
3318
3650
|
|
|
@@ -3850,7 +4182,7 @@ var serviceContext = (function () {
|
|
|
3850
4182
|
|
|
3851
4183
|
// 无协议的情况补全 https
|
|
3852
4184
|
if (filePath.indexOf('//') === 0) {
|
|
3853
|
-
|
|
4185
|
+
return 'https:' + filePath
|
|
3854
4186
|
}
|
|
3855
4187
|
|
|
3856
4188
|
// 网络资源或base64
|
|
@@ -3865,6 +4197,10 @@ var serviceContext = (function () {
|
|
|
3865
4197
|
const wwwPath = 'file://' + _handleLocalPath('_www');
|
|
3866
4198
|
// 绝对路径转换为本地文件系统路径
|
|
3867
4199
|
if (filePath.indexOf('/') === 0) {
|
|
4200
|
+
// 平台绝对路径 安卓、iOS
|
|
4201
|
+
if (filePath.startsWith('/storage/') || filePath.startsWith('/sdcard/') || filePath.includes('/Containers/Data/Application/')) {
|
|
4202
|
+
return 'file://' + filePath
|
|
4203
|
+
}
|
|
3868
4204
|
return wwwPath + filePath
|
|
3869
4205
|
}
|
|
3870
4206
|
// 相对资源
|
|
@@ -4029,13 +4365,15 @@ var serviceContext = (function () {
|
|
|
4029
4365
|
return array.length > 1 ? '.' + array[array.length - 1] : ''
|
|
4030
4366
|
}
|
|
4031
4367
|
|
|
4368
|
+
const AUDIO_DEFAULT_CATEGORY = 'ambient';
|
|
4369
|
+
|
|
4032
4370
|
const audios = {};
|
|
4033
4371
|
|
|
4034
4372
|
const evts = ['play', 'canplay', 'ended', 'stop', 'waiting', 'seeking', 'seeked', 'pause'];
|
|
4035
4373
|
|
|
4036
4374
|
const publishAudioStateChange = (state, res = {}) => publish('onAudioStateChange', Object.assign({
|
|
4037
4375
|
state
|
|
4038
|
-
}, res));
|
|
4376
|
+
}, res));
|
|
4039
4377
|
|
|
4040
4378
|
const initStateChage = audioId => {
|
|
4041
4379
|
const audio = audios[audioId];
|
|
@@ -4074,7 +4412,8 @@ var serviceContext = (function () {
|
|
|
4074
4412
|
const audio = audios[audioId] = plus.audio.createPlayer('');
|
|
4075
4413
|
audio.src = '';
|
|
4076
4414
|
audio.volume = 1;
|
|
4077
|
-
audio.startTime = 0;
|
|
4415
|
+
audio.startTime = 0;
|
|
4416
|
+
audio.setSessionCategory(AUDIO_DEFAULT_CATEGORY);
|
|
4078
4417
|
return {
|
|
4079
4418
|
errMsg: 'createAudioInstance:ok',
|
|
4080
4419
|
audioId
|
|
@@ -4101,7 +4440,8 @@ var serviceContext = (function () {
|
|
|
4101
4440
|
autoplay = false,
|
|
4102
4441
|
loop = false,
|
|
4103
4442
|
obeyMuteSwitch,
|
|
4104
|
-
volume
|
|
4443
|
+
volume,
|
|
4444
|
+
category = AUDIO_DEFAULT_CATEGORY
|
|
4105
4445
|
}) {
|
|
4106
4446
|
const audio = audios[audioId];
|
|
4107
4447
|
if (audio) {
|
|
@@ -4118,7 +4458,10 @@ var serviceContext = (function () {
|
|
|
4118
4458
|
if (typeof volume === 'number') {
|
|
4119
4459
|
audio.volume = style.volume = volume;
|
|
4120
4460
|
}
|
|
4121
|
-
audio.setStyles(style);
|
|
4461
|
+
audio.setStyles(style);
|
|
4462
|
+
if (category) {
|
|
4463
|
+
audio.setSessionCategory(category);
|
|
4464
|
+
}
|
|
4122
4465
|
initStateChage(audioId);
|
|
4123
4466
|
}
|
|
4124
4467
|
return {
|
|
@@ -4537,6 +4880,9 @@ var serviceContext = (function () {
|
|
|
4537
4880
|
},
|
|
4538
4881
|
openMapApp (ctx, args) {
|
|
4539
4882
|
return invokeVmMethod(ctx, 'openMapApp', args)
|
|
4883
|
+
},
|
|
4884
|
+
on (ctx, args) {
|
|
4885
|
+
return ctx.on(args.name, args.callback)
|
|
4540
4886
|
}
|
|
4541
4887
|
};
|
|
4542
4888
|
|
|
@@ -5459,7 +5805,7 @@ var serviceContext = (function () {
|
|
|
5459
5805
|
animationDuration: 200,
|
|
5460
5806
|
uniNView: {
|
|
5461
5807
|
path: `${(typeof process === 'object' && process.env && process.env.VUE_APP_TEMPLATE_PATH) || ''}/${url}.js`,
|
|
5462
|
-
defaultFontSize:
|
|
5808
|
+
defaultFontSize: 16,
|
|
5463
5809
|
viewport: plus_.screen.resolutionWidth
|
|
5464
5810
|
}
|
|
5465
5811
|
};
|
|
@@ -5800,8 +6146,6 @@ var serviceContext = (function () {
|
|
|
5800
6146
|
}
|
|
5801
6147
|
}
|
|
5802
6148
|
|
|
5803
|
-
const NAVBAR_HEIGHT = 44;
|
|
5804
|
-
|
|
5805
6149
|
const TABBAR_HEIGHT = 50;
|
|
5806
6150
|
const isIOS$1 = plus.os.name === 'iOS';
|
|
5807
6151
|
let config;
|
|
@@ -5844,7 +6188,7 @@ var serviceContext = (function () {
|
|
|
5844
6188
|
/**
|
|
5845
6189
|
* 动态设置 tabBar 某一项的内容
|
|
5846
6190
|
*/
|
|
5847
|
-
function setTabBarItem$1 (index, text, iconPath, selectedIconPath) {
|
|
6191
|
+
function setTabBarItem$1 (index, text, iconPath, selectedIconPath, visible) {
|
|
5848
6192
|
const item = {
|
|
5849
6193
|
index
|
|
5850
6194
|
};
|
|
@@ -5857,7 +6201,17 @@ var serviceContext = (function () {
|
|
|
5857
6201
|
if (selectedIconPath) {
|
|
5858
6202
|
item.selectedIconPath = getRealPath$1(selectedIconPath);
|
|
5859
6203
|
}
|
|
5860
|
-
|
|
6204
|
+
if (visible !== undefined) {
|
|
6205
|
+
item.visible = config.list[index].visible = visible;
|
|
6206
|
+
delete item.index;
|
|
6207
|
+
|
|
6208
|
+
const tabbarItems = config.list.map(item => ({ visible: item.visible }));
|
|
6209
|
+
tabbarItems[index] = item;
|
|
6210
|
+
|
|
6211
|
+
tabBar && tabBar.setTabBarItems({ list: tabbarItems });
|
|
6212
|
+
} else {
|
|
6213
|
+
tabBar && tabBar.setTabBarItem(item);
|
|
6214
|
+
}
|
|
5861
6215
|
}
|
|
5862
6216
|
/**
|
|
5863
6217
|
* 动态设置 tabBar 的整体样式
|
|
@@ -5986,7 +6340,7 @@ var serviceContext = (function () {
|
|
|
5986
6340
|
let deviceId;
|
|
5987
6341
|
|
|
5988
6342
|
function deviceId$1 () {
|
|
5989
|
-
deviceId = deviceId || plus.
|
|
6343
|
+
deviceId = deviceId || plus.device.uuid;
|
|
5990
6344
|
return deviceId
|
|
5991
6345
|
}
|
|
5992
6346
|
|
|
@@ -5997,6 +6351,7 @@ var serviceContext = (function () {
|
|
|
5997
6351
|
function getSystemInfo () {
|
|
5998
6352
|
const platform = plus.os.name.toLowerCase();
|
|
5999
6353
|
const ios = platform === 'ios';
|
|
6354
|
+
const isAndroid = platform === 'android';
|
|
6000
6355
|
const {
|
|
6001
6356
|
screenWidth,
|
|
6002
6357
|
screenHeight
|
|
@@ -6063,7 +6418,7 @@ var serviceContext = (function () {
|
|
|
6063
6418
|
windowHeight,
|
|
6064
6419
|
statusBarHeight,
|
|
6065
6420
|
language: plus.os.language,
|
|
6066
|
-
system: plus.os.version
|
|
6421
|
+
system: `${ios ? 'iOS' : isAndroid ? 'Android' : ''} ${plus.os.version}`,
|
|
6067
6422
|
version: plus.runtime.innerVersion,
|
|
6068
6423
|
fontSizeSetting: '',
|
|
6069
6424
|
platform,
|
|
@@ -6196,16 +6551,10 @@ var serviceContext = (function () {
|
|
|
6196
6551
|
filePath,
|
|
6197
6552
|
fileType
|
|
6198
6553
|
} = {}, callbackId) {
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
});
|
|
6204
|
-
}, err => {
|
|
6205
|
-
invoke$1(callbackId, {
|
|
6206
|
-
errMsg: 'openDocument:fail ' + err.message
|
|
6207
|
-
});
|
|
6208
|
-
});
|
|
6554
|
+
const successCallback = warpPlusSuccessCallback(callbackId, 'saveFile');
|
|
6555
|
+
const errorCallback = warpPlusErrorCallback(callbackId, 'saveFile');
|
|
6556
|
+
|
|
6557
|
+
plus.runtime.openDocument(getRealPath$1(filePath), undefined, successCallback, errorCallback);
|
|
6209
6558
|
}
|
|
6210
6559
|
|
|
6211
6560
|
const CHOOSE_LOCATION_PATH = '_www/__uniappchooselocation.html';
|
|
@@ -6408,8 +6757,10 @@ var serviceContext = (function () {
|
|
|
6408
6757
|
function getLocation$1 ({
|
|
6409
6758
|
type = 'wgs84',
|
|
6410
6759
|
geocode = false,
|
|
6411
|
-
altitude = false
|
|
6760
|
+
altitude = false,
|
|
6761
|
+
highAccuracyExpireTime
|
|
6412
6762
|
} = {}, callbackId) {
|
|
6763
|
+
const errorCallback = warpPlusErrorCallback(callbackId, 'getLocation');
|
|
6413
6764
|
plus.geolocation.getCurrentPosition(
|
|
6414
6765
|
position => {
|
|
6415
6766
|
getLocationSuccess(type, position, callbackId);
|
|
@@ -6420,13 +6771,12 @@ var serviceContext = (function () {
|
|
|
6420
6771
|
getLocationSuccess(type, e, callbackId);
|
|
6421
6772
|
return
|
|
6422
6773
|
}
|
|
6423
|
-
|
|
6424
|
-
invoke$1(callbackId, {
|
|
6425
|
-
errMsg: 'getLocation:fail ' + e.message
|
|
6426
|
-
});
|
|
6774
|
+
errorCallback(e);
|
|
6427
6775
|
}, {
|
|
6428
6776
|
geocode: geocode,
|
|
6429
|
-
enableHighAccuracy: altitude
|
|
6777
|
+
enableHighAccuracy: altitude,
|
|
6778
|
+
timeout: highAccuracyExpireTime,
|
|
6779
|
+
coordsType: type
|
|
6430
6780
|
}
|
|
6431
6781
|
);
|
|
6432
6782
|
}
|
|
@@ -6625,64 +6975,32 @@ var serviceContext = (function () {
|
|
|
6625
6975
|
})
|
|
6626
6976
|
}
|
|
6627
6977
|
|
|
6628
|
-
function compressImage$1 (tempFilePath) {
|
|
6629
|
-
const dstPath = `${TEMP_PATH}/compressed/${Date.now()}_${getFileName(tempFilePath)}`;
|
|
6630
|
-
return new Promise((resolve, reject) => {
|
|
6631
|
-
plus.nativeUI.showWaiting();
|
|
6632
|
-
plus.zip.compressImage({
|
|
6633
|
-
src: tempFilePath,
|
|
6634
|
-
dst: dstPath,
|
|
6635
|
-
overwrite: true
|
|
6636
|
-
}, () => {
|
|
6637
|
-
plus.nativeUI.closeWaiting();
|
|
6638
|
-
resolve(dstPath);
|
|
6639
|
-
}, (error) => {
|
|
6640
|
-
plus.nativeUI.closeWaiting();
|
|
6641
|
-
reject(error);
|
|
6642
|
-
});
|
|
6643
|
-
})
|
|
6644
|
-
}
|
|
6645
|
-
|
|
6646
6978
|
function chooseImage$1 ({
|
|
6647
6979
|
count,
|
|
6648
6980
|
sizeType,
|
|
6649
|
-
sourceType
|
|
6981
|
+
sourceType,
|
|
6982
|
+
crop
|
|
6650
6983
|
} = {}, callbackId) {
|
|
6651
6984
|
const errorCallback = warpPlusErrorCallback(callbackId, 'chooseImage', 'cancel');
|
|
6652
6985
|
|
|
6653
6986
|
function successCallback (paths) {
|
|
6654
6987
|
const tempFiles = [];
|
|
6655
6988
|
const tempFilePaths = [];
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
return getFileInfo$2(path)
|
|
6669
|
-
})
|
|
6670
|
-
}
|
|
6671
|
-
return fileInfo
|
|
6672
|
-
}).then(({ size }) => {
|
|
6673
|
-
tempFilePaths.push(path);
|
|
6674
|
-
tempFiles.push({
|
|
6675
|
-
path,
|
|
6676
|
-
size
|
|
6989
|
+
Promise.all(paths.map((path) => getFileInfo$2(path)))
|
|
6990
|
+
.then((filesInfo) => {
|
|
6991
|
+
filesInfo.forEach((file, index) => {
|
|
6992
|
+
const path = paths[index];
|
|
6993
|
+
tempFilePaths.push(path);
|
|
6994
|
+
tempFiles.push({ path, size: file.size });
|
|
6995
|
+
});
|
|
6996
|
+
|
|
6997
|
+
invoke$1(callbackId, {
|
|
6998
|
+
errMsg: 'chooseImage:ok',
|
|
6999
|
+
tempFilePaths,
|
|
7000
|
+
tempFiles
|
|
6677
7001
|
});
|
|
6678
7002
|
})
|
|
6679
|
-
|
|
6680
|
-
invoke$1(callbackId, {
|
|
6681
|
-
errMsg: 'chooseImage:ok',
|
|
6682
|
-
tempFilePaths,
|
|
6683
|
-
tempFiles
|
|
6684
|
-
});
|
|
6685
|
-
}).catch(errorCallback);
|
|
7003
|
+
.catch(errorCallback);
|
|
6686
7004
|
}
|
|
6687
7005
|
|
|
6688
7006
|
function openCamera () {
|
|
@@ -6690,7 +7008,9 @@ var serviceContext = (function () {
|
|
|
6690
7008
|
camera.captureImage(path => successCallback([path]),
|
|
6691
7009
|
errorCallback, {
|
|
6692
7010
|
filename: TEMP_PATH + '/camera/',
|
|
6693
|
-
resolution: 'high'
|
|
7011
|
+
resolution: 'high',
|
|
7012
|
+
crop,
|
|
7013
|
+
sizeType
|
|
6694
7014
|
});
|
|
6695
7015
|
}
|
|
6696
7016
|
|
|
@@ -6700,7 +7020,9 @@ var serviceContext = (function () {
|
|
|
6700
7020
|
multiple: true,
|
|
6701
7021
|
system: false,
|
|
6702
7022
|
filename: TEMP_PATH + '/gallery/',
|
|
6703
|
-
permissionAlert: true
|
|
7023
|
+
permissionAlert: true,
|
|
7024
|
+
crop,
|
|
7025
|
+
sizeType
|
|
6704
7026
|
});
|
|
6705
7027
|
}
|
|
6706
7028
|
|
|
@@ -6744,38 +7066,20 @@ var serviceContext = (function () {
|
|
|
6744
7066
|
const errorCallback = warpPlusErrorCallback(callbackId, 'chooseVideo', 'cancel');
|
|
6745
7067
|
|
|
6746
7068
|
function successCallback (tempFilePath = '') {
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
plus.io.getVideoInfo({
|
|
6762
|
-
filePath: tempFilePath,
|
|
6763
|
-
success (videoInfo) {
|
|
6764
|
-
const result = {
|
|
6765
|
-
errMsg: 'chooseVideo:ok',
|
|
6766
|
-
tempFilePath: tempFilePath
|
|
6767
|
-
};
|
|
6768
|
-
result.size = videoInfo.size;
|
|
6769
|
-
result.duration = videoInfo.duration;
|
|
6770
|
-
result.width = videoInfo.width;
|
|
6771
|
-
result.height = videoInfo.height;
|
|
6772
|
-
invoke$1(callbackId, result);
|
|
6773
|
-
},
|
|
6774
|
-
errorCallback
|
|
6775
|
-
});
|
|
6776
|
-
}, error => {
|
|
6777
|
-
plus.nativeUI.closeWaiting();
|
|
6778
|
-
errorCallback(error);
|
|
7069
|
+
plus.io.getVideoInfo({
|
|
7070
|
+
filePath: tempFilePath,
|
|
7071
|
+
success (videoInfo) {
|
|
7072
|
+
const result = {
|
|
7073
|
+
errMsg: 'chooseVideo:ok',
|
|
7074
|
+
tempFilePath: tempFilePath
|
|
7075
|
+
};
|
|
7076
|
+
result.size = videoInfo.size;
|
|
7077
|
+
result.duration = videoInfo.duration;
|
|
7078
|
+
result.width = videoInfo.width;
|
|
7079
|
+
result.height = videoInfo.height;
|
|
7080
|
+
invoke$1(callbackId, result);
|
|
7081
|
+
},
|
|
7082
|
+
fail: errorCallback
|
|
6779
7083
|
});
|
|
6780
7084
|
}
|
|
6781
7085
|
|
|
@@ -6787,7 +7091,8 @@ var serviceContext = (function () {
|
|
|
6787
7091
|
multiple: true,
|
|
6788
7092
|
maximum: 1,
|
|
6789
7093
|
filename: TEMP_PATH + '/gallery/',
|
|
6790
|
-
permissionAlert: true
|
|
7094
|
+
permissionAlert: true,
|
|
7095
|
+
videoCompress: compressed
|
|
6791
7096
|
});
|
|
6792
7097
|
}
|
|
6793
7098
|
|
|
@@ -6796,7 +7101,8 @@ var serviceContext = (function () {
|
|
|
6796
7101
|
plusCamera.startVideoCapture(successCallback, errorCallback, {
|
|
6797
7102
|
index: camera === 'front' ? 2 : 1,
|
|
6798
7103
|
videoMaximumDuration: maxDuration,
|
|
6799
|
-
filename: TEMP_PATH + '/camera/'
|
|
7104
|
+
filename: TEMP_PATH + '/camera/',
|
|
7105
|
+
videoCompress: compressed
|
|
6800
7106
|
});
|
|
6801
7107
|
}
|
|
6802
7108
|
|
|
@@ -6831,7 +7137,7 @@ var serviceContext = (function () {
|
|
|
6831
7137
|
});
|
|
6832
7138
|
}
|
|
6833
7139
|
|
|
6834
|
-
function compressImage$
|
|
7140
|
+
function compressImage$1 (options, callbackId) {
|
|
6835
7141
|
const dst = `${TEMP_PATH}/compressed/${Date.now()}_${getFileName(options.src)}`;
|
|
6836
7142
|
const errorCallback = warpPlusErrorCallback(callbackId, 'compressImage');
|
|
6837
7143
|
plus.zip.compressImage(Object.assign({}, options, {
|
|
@@ -6845,11 +7151,11 @@ var serviceContext = (function () {
|
|
|
6845
7151
|
}
|
|
6846
7152
|
|
|
6847
7153
|
function compressVideo$1 (options, callbackId) {
|
|
6848
|
-
const
|
|
7154
|
+
const filename = `${TEMP_PATH}/compressed/${Date.now()}_${getFileName(options.src)}`;
|
|
6849
7155
|
const successCallback = warpPlusSuccessCallback(callbackId, 'compressVideo');
|
|
6850
7156
|
const errorCallback = warpPlusErrorCallback(callbackId, 'compressVideo');
|
|
6851
7157
|
plus.zip.compressVideo(Object.assign({}, options, {
|
|
6852
|
-
|
|
7158
|
+
filename
|
|
6853
7159
|
}), successCallback, errorCallback);
|
|
6854
7160
|
}
|
|
6855
7161
|
|
|
@@ -6863,11 +7169,14 @@ var serviceContext = (function () {
|
|
|
6863
7169
|
return options
|
|
6864
7170
|
}, data => {
|
|
6865
7171
|
return {
|
|
7172
|
+
orientation: data.orientation,
|
|
7173
|
+
type: data.type,
|
|
6866
7174
|
duration: data.duration,
|
|
6867
|
-
|
|
7175
|
+
size: data.size / 1024,
|
|
6868
7176
|
height: data.height,
|
|
6869
7177
|
width: data.width,
|
|
6870
|
-
|
|
7178
|
+
fps: data.fps || 30,
|
|
7179
|
+
bitrate: data.bitrate
|
|
6871
7180
|
}
|
|
6872
7181
|
});
|
|
6873
7182
|
|
|
@@ -6945,6 +7254,19 @@ var serviceContext = (function () {
|
|
|
6945
7254
|
return {
|
|
6946
7255
|
errMsg: 'previewImage:ok'
|
|
6947
7256
|
}
|
|
7257
|
+
}
|
|
7258
|
+
|
|
7259
|
+
function closePreviewImagePlus () {
|
|
7260
|
+
try {
|
|
7261
|
+
plus.nativeUI.closePreviewImage();
|
|
7262
|
+
return {
|
|
7263
|
+
errMsg: 'closePreviewImagePlus:ok'
|
|
7264
|
+
}
|
|
7265
|
+
} catch (error) {
|
|
7266
|
+
return {
|
|
7267
|
+
errMsg: 'closePreviewImagePlus:fail'
|
|
7268
|
+
}
|
|
7269
|
+
}
|
|
6948
7270
|
}
|
|
6949
7271
|
|
|
6950
7272
|
let recorder$1;
|
|
@@ -7162,6 +7484,7 @@ var serviceContext = (function () {
|
|
|
7162
7484
|
responseType,
|
|
7163
7485
|
sslVerify = true,
|
|
7164
7486
|
firstIpv4 = false,
|
|
7487
|
+
tls,
|
|
7165
7488
|
timeout = (__uniConfig.networkTimeout && __uniConfig.networkTimeout.request) || 60 * 1000
|
|
7166
7489
|
} = {}) {
|
|
7167
7490
|
const stream = requireNativePlugin('stream');
|
|
@@ -7215,7 +7538,8 @@ var serviceContext = (function () {
|
|
|
7215
7538
|
timeout: timeout || 6e5,
|
|
7216
7539
|
// 配置和weex模块内相反
|
|
7217
7540
|
sslVerify: !sslVerify,
|
|
7218
|
-
firstIpv4: firstIpv4
|
|
7541
|
+
firstIpv4: firstIpv4,
|
|
7542
|
+
tls
|
|
7219
7543
|
};
|
|
7220
7544
|
if (method !== 'GET') {
|
|
7221
7545
|
options.body = typeof data === 'string' ? data : JSON.stringify(data);
|
|
@@ -7301,6 +7625,26 @@ var serviceContext = (function () {
|
|
|
7301
7625
|
return {
|
|
7302
7626
|
errMsg: 'operateRequestTask:fail'
|
|
7303
7627
|
}
|
|
7628
|
+
}
|
|
7629
|
+
|
|
7630
|
+
function configMTLS$1 ({ certificates }, callbackId) {
|
|
7631
|
+
const stream = requireNativePlugin('stream');
|
|
7632
|
+
stream.configMTLS(certificates, ({ type, code, message }) => {
|
|
7633
|
+
switch (type) {
|
|
7634
|
+
case 'success':
|
|
7635
|
+
invoke$1(callbackId, {
|
|
7636
|
+
errMsg: 'configMTLS:ok',
|
|
7637
|
+
code
|
|
7638
|
+
});
|
|
7639
|
+
break
|
|
7640
|
+
case 'fail':
|
|
7641
|
+
invoke$1(callbackId, {
|
|
7642
|
+
errMsg: 'configMTLS:fail ' + message,
|
|
7643
|
+
code
|
|
7644
|
+
});
|
|
7645
|
+
break
|
|
7646
|
+
}
|
|
7647
|
+
});
|
|
7304
7648
|
}
|
|
7305
7649
|
|
|
7306
7650
|
const socketTasks = {};
|
|
@@ -7468,7 +7812,7 @@ var serviceContext = (function () {
|
|
|
7468
7812
|
}
|
|
7469
7813
|
if (files && files.length) {
|
|
7470
7814
|
files.forEach(file => {
|
|
7471
|
-
uploader.addFile(getRealPath$1(file.uri), {
|
|
7815
|
+
uploader.addFile(getRealPath$1(file.uri || file.filePath), {
|
|
7472
7816
|
key: file.name || 'file'
|
|
7473
7817
|
});
|
|
7474
7818
|
});
|
|
@@ -7595,6 +7939,8 @@ var serviceContext = (function () {
|
|
|
7595
7939
|
}
|
|
7596
7940
|
}
|
|
7597
7941
|
|
|
7942
|
+
let univerifyManager;
|
|
7943
|
+
|
|
7598
7944
|
function getService (provider) {
|
|
7599
7945
|
return new Promise((resolve, reject) => {
|
|
7600
7946
|
plus.oauth.getServices(services => {
|
|
@@ -7607,20 +7953,36 @@ var serviceContext = (function () {
|
|
|
7607
7953
|
/**
|
|
7608
7954
|
* 微信登录
|
|
7609
7955
|
*/
|
|
7610
|
-
function login (params, callbackId) {
|
|
7956
|
+
function login (params, callbackId, plus = true) {
|
|
7611
7957
|
const provider = params.provider || 'weixin';
|
|
7612
|
-
const errorCallback =
|
|
7958
|
+
const errorCallback = warpErrorCallback(callbackId, 'login', plus);
|
|
7959
|
+
const authOptions = provider === 'apple'
|
|
7960
|
+
? { scope: 'email' }
|
|
7961
|
+
: params.univerifyStyle
|
|
7962
|
+
? { univerifyStyle: univerifyButtonsClickHandling(params.univerifyStyle, errorCallback) }
|
|
7963
|
+
: {};
|
|
7964
|
+
const _invoke = plus ? invoke$1 : callback.invoke;
|
|
7613
7965
|
|
|
7614
7966
|
getService(provider).then(service => {
|
|
7615
7967
|
function login () {
|
|
7968
|
+
if (params.onlyAuthorize && provider === 'weixin') {
|
|
7969
|
+
service.authorize(({ code }) => {
|
|
7970
|
+
_invoke(callbackId, {
|
|
7971
|
+
code,
|
|
7972
|
+
authResult: '',
|
|
7973
|
+
errMsg: 'login:ok'
|
|
7974
|
+
});
|
|
7975
|
+
}, errorCallback);
|
|
7976
|
+
return
|
|
7977
|
+
}
|
|
7616
7978
|
service.login(res => {
|
|
7617
7979
|
const authResult = res.target.authResult;
|
|
7618
|
-
|
|
7980
|
+
_invoke(callbackId, {
|
|
7619
7981
|
code: authResult.code,
|
|
7620
7982
|
authResult: authResult,
|
|
7621
7983
|
errMsg: 'login:ok'
|
|
7622
7984
|
});
|
|
7623
|
-
}, errorCallback,
|
|
7985
|
+
}, errorCallback, authOptions);
|
|
7624
7986
|
}
|
|
7625
7987
|
// 先注销再登录
|
|
7626
7988
|
// apple登录logout之后无法重新触发获取email,fullname;一键登录无logout
|
|
@@ -7688,6 +8050,12 @@ var serviceContext = (function () {
|
|
|
7688
8050
|
});
|
|
7689
8051
|
});
|
|
7690
8052
|
}
|
|
8053
|
+
/**
|
|
8054
|
+
* 获取用户信息-兼容
|
|
8055
|
+
*/
|
|
8056
|
+
function getUserProfile (params, callbackId) {
|
|
8057
|
+
return getUserInfo(params, callbackId)
|
|
8058
|
+
}
|
|
7691
8059
|
|
|
7692
8060
|
/**
|
|
7693
8061
|
* 获取用户信息
|
|
@@ -7704,14 +8072,121 @@ var serviceContext = (function () {
|
|
|
7704
8072
|
}
|
|
7705
8073
|
}
|
|
7706
8074
|
|
|
7707
|
-
function preLogin$1 (params, callbackId) {
|
|
7708
|
-
const successCallback =
|
|
7709
|
-
const errorCallback =
|
|
8075
|
+
function preLogin$1 (params, callbackId, plus) {
|
|
8076
|
+
const successCallback = warpSuccessCallback(callbackId, 'preLogin', plus);
|
|
8077
|
+
const errorCallback = warpErrorCallback(callbackId, 'preLogin', plus);
|
|
7710
8078
|
getService(params.provider).then(service => service.preLogin(successCallback, errorCallback)).catch(errorCallback);
|
|
7711
8079
|
}
|
|
7712
8080
|
|
|
7713
8081
|
function closeAuthView () {
|
|
7714
|
-
getService('univerify').then(service => service.closeAuthView())
|
|
8082
|
+
return getService('univerify').then(service => service.closeAuthView())
|
|
8083
|
+
}
|
|
8084
|
+
|
|
8085
|
+
function getCheckBoxState (params, callbackId, plus) {
|
|
8086
|
+
const successCallback = warpSuccessCallback(callbackId, 'getCheckBoxState', plus);
|
|
8087
|
+
const errorCallback = warpErrorCallback(callbackId, 'getCheckBoxState', plus);
|
|
8088
|
+
try {
|
|
8089
|
+
getService('univerify').then(service => {
|
|
8090
|
+
const state = service.getCheckBoxState();
|
|
8091
|
+
successCallback({ state });
|
|
8092
|
+
});
|
|
8093
|
+
} catch (error) {
|
|
8094
|
+
errorCallback(error);
|
|
8095
|
+
}
|
|
8096
|
+
}
|
|
8097
|
+
|
|
8098
|
+
/**
|
|
8099
|
+
* 一键登录自定义登陆按钮点击处理
|
|
8100
|
+
*/
|
|
8101
|
+
function univerifyButtonsClickHandling (univerifyStyle, errorCallback) {
|
|
8102
|
+
if (isPlainObject(univerifyStyle) && isPlainObject(univerifyStyle.buttons) && toRawType(univerifyStyle.buttons.list) === 'Array') {
|
|
8103
|
+
univerifyStyle.buttons.list.forEach((button, index) => {
|
|
8104
|
+
univerifyStyle.buttons.list[index].onclick = function () {
|
|
8105
|
+
const res = {
|
|
8106
|
+
code: '30008',
|
|
8107
|
+
message: '用户点击了自定义按钮',
|
|
8108
|
+
index,
|
|
8109
|
+
provider: button.provider
|
|
8110
|
+
};
|
|
8111
|
+
isPlainObject(univerifyManager)
|
|
8112
|
+
? univerifyManager._triggerUniverifyButtonsClick(res)
|
|
8113
|
+
: closeAuthView().then(() => {
|
|
8114
|
+
errorCallback(res);
|
|
8115
|
+
});
|
|
8116
|
+
};
|
|
8117
|
+
});
|
|
8118
|
+
}
|
|
8119
|
+
return univerifyStyle
|
|
8120
|
+
}
|
|
8121
|
+
|
|
8122
|
+
class UniverifyManager {
|
|
8123
|
+
constructor () {
|
|
8124
|
+
this.provider = 'univerify';
|
|
8125
|
+
this.eventName = 'api.univerifyButtonsClick';
|
|
8126
|
+
}
|
|
8127
|
+
|
|
8128
|
+
close () {
|
|
8129
|
+
closeAuthView();
|
|
8130
|
+
}
|
|
8131
|
+
|
|
8132
|
+
login (options) {
|
|
8133
|
+
this._warp((data, callbackId) => login(data, callbackId, false), this._getOptions(options));
|
|
8134
|
+
}
|
|
8135
|
+
|
|
8136
|
+
getCheckBoxState (options) {
|
|
8137
|
+
this._warp((_, callbackId) => getCheckBoxState(_, callbackId, false), options);
|
|
8138
|
+
}
|
|
8139
|
+
|
|
8140
|
+
preLogin (options) {
|
|
8141
|
+
this._warp((data, callbackId) => preLogin$1(data, callbackId, false), this._getOptions(options));
|
|
8142
|
+
}
|
|
8143
|
+
|
|
8144
|
+
onButtonsClick (callback) {
|
|
8145
|
+
UniServiceJSBridge.on(this.eventName, callback);
|
|
8146
|
+
}
|
|
8147
|
+
|
|
8148
|
+
offButtonsClick (callback) {
|
|
8149
|
+
UniServiceJSBridge.off(this.eventName, callback);
|
|
8150
|
+
}
|
|
8151
|
+
|
|
8152
|
+
_triggerUniverifyButtonsClick (res) {
|
|
8153
|
+
UniServiceJSBridge.emit(this.eventName, res);
|
|
8154
|
+
}
|
|
8155
|
+
|
|
8156
|
+
_warp (fn, options) {
|
|
8157
|
+
return callback.warp(fn)(this._getOptions(options))
|
|
8158
|
+
}
|
|
8159
|
+
|
|
8160
|
+
_getOptions (options = {}) {
|
|
8161
|
+
return Object.assign({}, options, { provider: this.provider })
|
|
8162
|
+
}
|
|
8163
|
+
}
|
|
8164
|
+
|
|
8165
|
+
function getUniverifyManager () {
|
|
8166
|
+
return univerifyManager || (univerifyManager = new UniverifyManager())
|
|
8167
|
+
}
|
|
8168
|
+
|
|
8169
|
+
function warpSuccessCallback (callbackId, name, plus = true) {
|
|
8170
|
+
return plus
|
|
8171
|
+
? warpPlusSuccessCallback(callbackId, name)
|
|
8172
|
+
: (options) => {
|
|
8173
|
+
callback.invoke(callbackId, Object.assign({}, options, {
|
|
8174
|
+
errMsg: `${name}:ok`
|
|
8175
|
+
}));
|
|
8176
|
+
}
|
|
8177
|
+
}
|
|
8178
|
+
|
|
8179
|
+
function warpErrorCallback (callbackId, name, plus = true) {
|
|
8180
|
+
return plus
|
|
8181
|
+
? warpPlusErrorCallback(callbackId, name)
|
|
8182
|
+
: (error) => {
|
|
8183
|
+
const { code = 0, message: errorMessage } = error;
|
|
8184
|
+
callback.invoke(callbackId, {
|
|
8185
|
+
errMsg: `${name}:fail ${errorMessage || ''}`,
|
|
8186
|
+
errCode: code,
|
|
8187
|
+
code
|
|
8188
|
+
});
|
|
8189
|
+
}
|
|
7715
8190
|
}
|
|
7716
8191
|
|
|
7717
8192
|
function requestPayment (params, callbackId) {
|
|
@@ -8240,6 +8715,25 @@ var serviceContext = (function () {
|
|
|
8240
8715
|
});
|
|
8241
8716
|
}
|
|
8242
8717
|
|
|
8718
|
+
const sendHostEvent = sendNativeEvent;
|
|
8719
|
+
|
|
8720
|
+
function navigateToMiniProgram (data, callbackId) {
|
|
8721
|
+
sendHostEvent(
|
|
8722
|
+
'navigateToUniMP',
|
|
8723
|
+
data,
|
|
8724
|
+
(res) => {
|
|
8725
|
+
if (res.errMsg && res.errMsg.indexOf(':ok') === -1) {
|
|
8726
|
+
return invoke$1(callbackId, {
|
|
8727
|
+
errMsg: res.errMsg
|
|
8728
|
+
})
|
|
8729
|
+
}
|
|
8730
|
+
invoke$1(callbackId, {
|
|
8731
|
+
errMsg: 'navigateToMiniProgram:ok'
|
|
8732
|
+
});
|
|
8733
|
+
}
|
|
8734
|
+
);
|
|
8735
|
+
}
|
|
8736
|
+
|
|
8243
8737
|
const VD_SYNC_VERSION = 2;
|
|
8244
8738
|
|
|
8245
8739
|
const PAGE_CREATE = 2;
|
|
@@ -8284,20 +8778,18 @@ var serviceContext = (function () {
|
|
|
8284
8778
|
return titleNView
|
|
8285
8779
|
}
|
|
8286
8780
|
|
|
8287
|
-
function parseTitleNView (routeOptions) {
|
|
8781
|
+
function parseTitleNView (id, routeOptions) {
|
|
8288
8782
|
const windowOptions = routeOptions.window;
|
|
8289
8783
|
const titleNView = windowOptions.titleNView;
|
|
8290
|
-
routeOptions.meta.statusBarStyle =
|
|
8291
|
-
|
|
8784
|
+
routeOptions.meta.statusBarStyle =
|
|
8785
|
+
windowOptions.navigationBarTextStyle === 'black' ? 'dark' : 'light';
|
|
8786
|
+
if (
|
|
8787
|
+
// 无头
|
|
8292
8788
|
titleNView === false ||
|
|
8293
8789
|
titleNView === 'false' ||
|
|
8294
|
-
(
|
|
8295
|
-
|
|
8296
|
-
|
|
8297
|
-
) || (
|
|
8298
|
-
windowOptions.transparentTitle === 'always' &&
|
|
8299
|
-
!isPlainObject(titleNView)
|
|
8300
|
-
)
|
|
8790
|
+
(windowOptions.navigationStyle === 'custom' &&
|
|
8791
|
+
!isPlainObject(titleNView)) ||
|
|
8792
|
+
(windowOptions.transparentTitle === 'always' && !isPlainObject(titleNView))
|
|
8301
8793
|
) {
|
|
8302
8794
|
return false
|
|
8303
8795
|
}
|
|
@@ -8310,30 +8802,76 @@ var serviceContext = (function () {
|
|
|
8310
8802
|
always: 'float'
|
|
8311
8803
|
};
|
|
8312
8804
|
|
|
8313
|
-
const navigationBarBackgroundColor =
|
|
8805
|
+
const navigationBarBackgroundColor =
|
|
8806
|
+
windowOptions.navigationBarBackgroundColor;
|
|
8314
8807
|
const ret = {
|
|
8315
8808
|
autoBackButton: !routeOptions.meta.isQuit,
|
|
8316
|
-
titleText:
|
|
8317
|
-
|
|
8809
|
+
titleText:
|
|
8810
|
+
titleImage === '' ? windowOptions.navigationBarTitleText || '' : '',
|
|
8811
|
+
titleColor:
|
|
8812
|
+
windowOptions.navigationBarTextStyle === 'black' ? '#000000' : '#ffffff',
|
|
8318
8813
|
type: titleNViewTypeList[transparentTitle],
|
|
8319
|
-
backgroundColor:
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
|
|
8323
|
-
|
|
8324
|
-
|
|
8325
|
-
|
|
8326
|
-
|
|
8327
|
-
|
|
8328
|
-
|
|
8329
|
-
|
|
8814
|
+
backgroundColor:
|
|
8815
|
+
/^#[a-z0-9]{6}$/i.test(navigationBarBackgroundColor) ||
|
|
8816
|
+
navigationBarBackgroundColor === 'transparent'
|
|
8817
|
+
? navigationBarBackgroundColor
|
|
8818
|
+
: '#f7f7f7',
|
|
8819
|
+
tags:
|
|
8820
|
+
titleImage === ''
|
|
8821
|
+
? []
|
|
8822
|
+
: [
|
|
8823
|
+
{
|
|
8824
|
+
tag: 'img',
|
|
8825
|
+
src: titleImage,
|
|
8826
|
+
position: {
|
|
8827
|
+
left: 'auto',
|
|
8828
|
+
top: 'auto',
|
|
8829
|
+
width: 'auto',
|
|
8830
|
+
height: '26px'
|
|
8831
|
+
}
|
|
8832
|
+
}
|
|
8833
|
+
]
|
|
8330
8834
|
};
|
|
8331
8835
|
|
|
8332
8836
|
if (isPlainObject(titleNView)) {
|
|
8333
|
-
return
|
|
8837
|
+
return initTitleNViewI18n(
|
|
8838
|
+
id,
|
|
8839
|
+
Object.assign(ret, parseTitleNViewButtons(titleNView))
|
|
8840
|
+
)
|
|
8334
8841
|
}
|
|
8842
|
+
return initTitleNViewI18n(id, ret)
|
|
8843
|
+
}
|
|
8335
8844
|
|
|
8336
|
-
|
|
8845
|
+
function initTitleNViewI18n (id, titleNView) {
|
|
8846
|
+
const i18nResult = initNavigationBarI18n(titleNView);
|
|
8847
|
+
if (!i18nResult) {
|
|
8848
|
+
return titleNView
|
|
8849
|
+
}
|
|
8850
|
+
const [titleTextI18n, searchInputPlaceholderI18n] = i18nResult;
|
|
8851
|
+
if (titleTextI18n || searchInputPlaceholderI18n) {
|
|
8852
|
+
uni.onLocaleChange(() => {
|
|
8853
|
+
const webview = plus.webview.getWebviewById(id + '');
|
|
8854
|
+
if (!webview) {
|
|
8855
|
+
return
|
|
8856
|
+
}
|
|
8857
|
+
const newTitleNView = {};
|
|
8858
|
+
if (titleTextI18n) {
|
|
8859
|
+
newTitleNView.titleText = titleNView.titleText;
|
|
8860
|
+
}
|
|
8861
|
+
if (searchInputPlaceholderI18n) {
|
|
8862
|
+
newTitleNView.searchInput = {
|
|
8863
|
+
placeholder: titleNView.searchInput.placeholder
|
|
8864
|
+
};
|
|
8865
|
+
}
|
|
8866
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
8867
|
+
console.log('[uni-app] updateWebview', webview.id, newTitleNView);
|
|
8868
|
+
}
|
|
8869
|
+
webview.setStyle({
|
|
8870
|
+
titleNView: newTitleNView
|
|
8871
|
+
});
|
|
8872
|
+
});
|
|
8873
|
+
}
|
|
8874
|
+
return titleNView
|
|
8337
8875
|
}
|
|
8338
8876
|
|
|
8339
8877
|
function parsePullToRefresh (routeOptions) {
|
|
@@ -8424,10 +8962,12 @@ var serviceContext = (function () {
|
|
|
8424
8962
|
};
|
|
8425
8963
|
|
|
8426
8964
|
// 合并
|
|
8427
|
-
routeOptions.window = parseStyleUnit(
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
|
|
8965
|
+
routeOptions.window = parseStyleUnit(
|
|
8966
|
+
Object.assign(
|
|
8967
|
+
JSON.parse(JSON.stringify(__uniConfig.window || {})),
|
|
8968
|
+
routeOptions.window || {}
|
|
8969
|
+
)
|
|
8970
|
+
);
|
|
8431
8971
|
|
|
8432
8972
|
Object.keys(routeOptions.window).forEach(name => {
|
|
8433
8973
|
if (WEBVIEW_STYLE_BLACKLIST.indexOf(name) === -1) {
|
|
@@ -8436,7 +8976,10 @@ var serviceContext = (function () {
|
|
|
8436
8976
|
});
|
|
8437
8977
|
|
|
8438
8978
|
const backgroundColor = routeOptions.window.backgroundColor;
|
|
8439
|
-
if (
|
|
8979
|
+
if (
|
|
8980
|
+
/^#[a-z0-9]{6}$/i.test(backgroundColor) ||
|
|
8981
|
+
backgroundColor === 'transparent'
|
|
8982
|
+
) {
|
|
8440
8983
|
if (!webviewStyle.background) {
|
|
8441
8984
|
webviewStyle.background = backgroundColor;
|
|
8442
8985
|
}
|
|
@@ -8445,7 +8988,7 @@ var serviceContext = (function () {
|
|
|
8445
8988
|
}
|
|
8446
8989
|
}
|
|
8447
8990
|
|
|
8448
|
-
const titleNView = parseTitleNView(routeOptions);
|
|
8991
|
+
const titleNView = parseTitleNView(id, routeOptions);
|
|
8449
8992
|
if (titleNView) {
|
|
8450
8993
|
if (
|
|
8451
8994
|
id === 1 &&
|
|
@@ -8470,7 +9013,8 @@ var serviceContext = (function () {
|
|
|
8470
9013
|
delete webviewStyle.popGesture;
|
|
8471
9014
|
}
|
|
8472
9015
|
|
|
8473
|
-
if (routeOptions.meta.isQuit) {
|
|
9016
|
+
if (routeOptions.meta.isQuit) {
|
|
9017
|
+
// 退出
|
|
8474
9018
|
webviewStyle.popGesture = plus.os.name === 'iOS' ? 'appback' : 'none';
|
|
8475
9019
|
}
|
|
8476
9020
|
|
|
@@ -8685,31 +9229,63 @@ var serviceContext = (function () {
|
|
|
8685
9229
|
});
|
|
8686
9230
|
}
|
|
8687
9231
|
|
|
8688
|
-
function onWebviewPopGesture (webview) {
|
|
9232
|
+
function onWebviewPopGesture (webview) {
|
|
8689
9233
|
let popStartStatusBarStyle;
|
|
8690
9234
|
webview.addEventListener('popGesture', e => {
|
|
8691
9235
|
if (e.type === 'start') {
|
|
8692
9236
|
// 设置下一个页面的 statusBarStyle
|
|
8693
9237
|
const pages = getCurrentPages();
|
|
8694
|
-
const page = pages[pages.length - 2];
|
|
9238
|
+
const page = pages[pages.length - 2];
|
|
8695
9239
|
popStartStatusBarStyle = lastStatusBarStyle;
|
|
8696
9240
|
const statusBarStyle = page && page.$page.meta.statusBarStyle;
|
|
8697
9241
|
statusBarStyle && setStatusBarStyle(statusBarStyle);
|
|
8698
9242
|
} else if (e.type === 'end' && !e.result) {
|
|
8699
9243
|
// 拖拽未完成,设置为当前状态栏前景色
|
|
8700
9244
|
setStatusBarStyle(popStartStatusBarStyle);
|
|
8701
|
-
} else if (e.type === 'end' && e.result) {
|
|
9245
|
+
} else if (e.type === 'end' && e.result) {
|
|
8702
9246
|
const pages = getCurrentPages();
|
|
8703
9247
|
const page = pages[pages.length - 1];
|
|
8704
9248
|
page && page.$remove();
|
|
8705
|
-
|
|
8706
9249
|
setStatusBarStyle();
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
|
|
8710
|
-
|
|
9250
|
+
if (page && isDirectPage(page)) {
|
|
9251
|
+
reLaunchEntryPage();
|
|
9252
|
+
} else {
|
|
9253
|
+
UniServiceJSBridge.emit('onAppRoute', {
|
|
9254
|
+
type: 'navigateBack'
|
|
9255
|
+
});
|
|
9256
|
+
}
|
|
8711
9257
|
}
|
|
8712
9258
|
});
|
|
9259
|
+
}
|
|
9260
|
+
|
|
9261
|
+
/**
|
|
9262
|
+
* 是否处于直达页面
|
|
9263
|
+
* @param page
|
|
9264
|
+
* @returns
|
|
9265
|
+
*/
|
|
9266
|
+
function isDirectPage (page) {
|
|
9267
|
+
return (
|
|
9268
|
+
__uniConfig.realEntryPagePath &&
|
|
9269
|
+
page.$page.route === __uniConfig.entryPagePath
|
|
9270
|
+
)
|
|
9271
|
+
}
|
|
9272
|
+
/**
|
|
9273
|
+
* 重新启动到首页
|
|
9274
|
+
*/
|
|
9275
|
+
function reLaunchEntryPage () {
|
|
9276
|
+
__uniConfig.entryPagePath = __uniConfig.realEntryPagePath;
|
|
9277
|
+
delete __uniConfig.realEntryPagePath;
|
|
9278
|
+
uni.reLaunch({
|
|
9279
|
+
url: addLeadingSlash(__uniConfig.entryPagePath)
|
|
9280
|
+
});
|
|
9281
|
+
}
|
|
9282
|
+
|
|
9283
|
+
function hasLeadingSlash (str) {
|
|
9284
|
+
return str.indexOf('/') === 0
|
|
9285
|
+
}
|
|
9286
|
+
|
|
9287
|
+
function addLeadingSlash (str) {
|
|
9288
|
+
return hasLeadingSlash(str) ? str : '/' + str
|
|
8713
9289
|
}
|
|
8714
9290
|
|
|
8715
9291
|
let preloadWebview;
|
|
@@ -8834,7 +9410,7 @@ var serviceContext = (function () {
|
|
|
8834
9410
|
|
|
8835
9411
|
function createPreloadWebview () {
|
|
8836
9412
|
if (!preloadWebview || preloadWebview.__uniapp_route) { // 不存在,或已被使用
|
|
8837
|
-
preloadWebview = plus.webview.create(VIEW_WEBVIEW_PATH, String(id$1++));
|
|
9413
|
+
preloadWebview = plus.webview.create(VIEW_WEBVIEW_PATH, String(id$1++), { contentAdjust: false });
|
|
8838
9414
|
if (process.env.NODE_ENV !== 'production') {
|
|
8839
9415
|
console.log(`[uni-app] preloadWebview[${preloadWebview.id}]`);
|
|
8840
9416
|
}
|
|
@@ -9213,6 +9789,80 @@ var serviceContext = (function () {
|
|
|
9213
9789
|
return pageVm
|
|
9214
9790
|
}
|
|
9215
9791
|
|
|
9792
|
+
const extend = Object.assign;
|
|
9793
|
+
|
|
9794
|
+
function createLaunchOptions () {
|
|
9795
|
+
return {
|
|
9796
|
+
path: '',
|
|
9797
|
+
query: {},
|
|
9798
|
+
scene: 1001,
|
|
9799
|
+
referrerInfo: {
|
|
9800
|
+
appId: '',
|
|
9801
|
+
extraData: {}
|
|
9802
|
+
}
|
|
9803
|
+
}
|
|
9804
|
+
}
|
|
9805
|
+
|
|
9806
|
+
const enterOptions = createLaunchOptions();
|
|
9807
|
+
const launchOptions = createLaunchOptions();
|
|
9808
|
+
|
|
9809
|
+
function getEnterOptions () {
|
|
9810
|
+
return enterOptions
|
|
9811
|
+
}
|
|
9812
|
+
|
|
9813
|
+
function initEnterOptions ({
|
|
9814
|
+
path,
|
|
9815
|
+
query,
|
|
9816
|
+
referrerInfo
|
|
9817
|
+
}) {
|
|
9818
|
+
extend(enterOptions, {
|
|
9819
|
+
path,
|
|
9820
|
+
query: query ? parseQuery(query) : {},
|
|
9821
|
+
referrerInfo: referrerInfo || {}
|
|
9822
|
+
});
|
|
9823
|
+
}
|
|
9824
|
+
|
|
9825
|
+
function initLaunchOptions ({
|
|
9826
|
+
path,
|
|
9827
|
+
query,
|
|
9828
|
+
referrerInfo
|
|
9829
|
+
}) {
|
|
9830
|
+
extend(launchOptions, {
|
|
9831
|
+
path,
|
|
9832
|
+
query: query ? parseQuery(query) : {},
|
|
9833
|
+
referrerInfo: referrerInfo || {}
|
|
9834
|
+
});
|
|
9835
|
+
extend(enterOptions, launchOptions);
|
|
9836
|
+
return launchOptions
|
|
9837
|
+
}
|
|
9838
|
+
|
|
9839
|
+
function parseRedirectInfo () {
|
|
9840
|
+
const weexPlus = weex.requireModule('plus');
|
|
9841
|
+
if (weexPlus.getRedirectInfo) {
|
|
9842
|
+
const {
|
|
9843
|
+
path,
|
|
9844
|
+
query,
|
|
9845
|
+
extraData,
|
|
9846
|
+
userAction,
|
|
9847
|
+
fromAppid
|
|
9848
|
+
} =
|
|
9849
|
+
weexPlus.getRedirectInfo() || {};
|
|
9850
|
+
const referrerInfo = {
|
|
9851
|
+
appId: fromAppid,
|
|
9852
|
+
extraData: {}
|
|
9853
|
+
};
|
|
9854
|
+
if (extraData) {
|
|
9855
|
+
referrerInfo.extraData = extraData;
|
|
9856
|
+
}
|
|
9857
|
+
return {
|
|
9858
|
+
path: path || '',
|
|
9859
|
+
query: query ? '?' + query : '',
|
|
9860
|
+
referrerInfo,
|
|
9861
|
+
userAction
|
|
9862
|
+
}
|
|
9863
|
+
}
|
|
9864
|
+
}
|
|
9865
|
+
|
|
9216
9866
|
let isInitEntryPage = false;
|
|
9217
9867
|
|
|
9218
9868
|
function initEntryPage () {
|
|
@@ -9227,9 +9877,16 @@ var serviceContext = (function () {
|
|
|
9227
9877
|
const weexPlus = weex.requireModule('plus');
|
|
9228
9878
|
|
|
9229
9879
|
if (weexPlus.getRedirectInfo) {
|
|
9230
|
-
const
|
|
9231
|
-
|
|
9232
|
-
|
|
9880
|
+
const {
|
|
9881
|
+
path,
|
|
9882
|
+
query,
|
|
9883
|
+
referrerInfo
|
|
9884
|
+
} = parseRedirectInfo();
|
|
9885
|
+
if (path) {
|
|
9886
|
+
entryPagePath = path;
|
|
9887
|
+
entryPageQuery = query;
|
|
9888
|
+
}
|
|
9889
|
+
__uniConfig.referrerInfo = referrerInfo;
|
|
9233
9890
|
} else {
|
|
9234
9891
|
const argsJsonStr = plus.runtime.arguments;
|
|
9235
9892
|
if (!argsJsonStr) {
|
|
@@ -9252,6 +9909,7 @@ var serviceContext = (function () {
|
|
|
9252
9909
|
const entryRoute = '/' + entryPagePath;
|
|
9253
9910
|
const routeOptions = __uniRoutes.find(route => route.path === entryRoute);
|
|
9254
9911
|
if (!routeOptions) {
|
|
9912
|
+
console.error(`[uni-app] ${entryPagePath} not found...`);
|
|
9255
9913
|
return
|
|
9256
9914
|
}
|
|
9257
9915
|
|
|
@@ -10004,7 +10662,7 @@ var serviceContext = (function () {
|
|
|
10004
10662
|
let currentSize = 0;
|
|
10005
10663
|
for (let index = 0; index < length; index++) {
|
|
10006
10664
|
const key = plus.storage.key(index);
|
|
10007
|
-
if (key !== STORAGE_KEYS && key.indexOf(STORAGE_DATA_TYPE) + STORAGE_DATA_TYPE.length !== key.length) {
|
|
10665
|
+
if (key !== STORAGE_KEYS && (key.indexOf(STORAGE_DATA_TYPE) < 0 || key.indexOf(STORAGE_DATA_TYPE) + STORAGE_DATA_TYPE.length !== key.length)) {
|
|
10008
10666
|
const value = plus.storage.getItem(key);
|
|
10009
10667
|
currentSize += key.length + value.length;
|
|
10010
10668
|
keys.push(key);
|
|
@@ -10158,7 +10816,7 @@ var serviceContext = (function () {
|
|
|
10158
10816
|
});
|
|
10159
10817
|
toast = true;
|
|
10160
10818
|
} else {
|
|
10161
|
-
if (icon && !~['success', 'loading', 'none'].indexOf(icon)) {
|
|
10819
|
+
if (icon && !~['success', 'loading', 'error', 'none'].indexOf(icon)) {
|
|
10162
10820
|
icon = 'success';
|
|
10163
10821
|
}
|
|
10164
10822
|
const waitingOptions = {
|
|
@@ -10185,11 +10843,11 @@ var serviceContext = (function () {
|
|
|
10185
10843
|
interval: duration
|
|
10186
10844
|
};
|
|
10187
10845
|
} else {
|
|
10188
|
-
if (
|
|
10846
|
+
if (['success', 'error'].indexOf(icon) !== -1) {
|
|
10189
10847
|
waitingOptions.loading = {
|
|
10190
10848
|
display: 'block',
|
|
10191
10849
|
height: '55px',
|
|
10192
|
-
icon: '__uniappsuccess.png',
|
|
10850
|
+
icon: icon === 'success' ? '__uniappsuccess.png' : '__uniapperror.png',
|
|
10193
10851
|
interval: duration
|
|
10194
10852
|
};
|
|
10195
10853
|
}
|
|
@@ -10236,24 +10894,34 @@ var serviceContext = (function () {
|
|
|
10236
10894
|
cancelText,
|
|
10237
10895
|
cancelColor,
|
|
10238
10896
|
confirmText,
|
|
10239
|
-
confirmColor
|
|
10897
|
+
confirmColor,
|
|
10898
|
+
editable = false,
|
|
10899
|
+
placeholderText = ''
|
|
10240
10900
|
} = {}, callbackId) {
|
|
10901
|
+
const buttons = showCancel ? [cancelText, confirmText] : [confirmText];
|
|
10902
|
+
const tip = editable ? placeholderText : buttons;
|
|
10903
|
+
|
|
10241
10904
|
content = content || ' ';
|
|
10242
|
-
plus.nativeUI
|
|
10905
|
+
plus.nativeUI[editable ? 'prompt' : 'confirm'](content, (e) => {
|
|
10243
10906
|
if (showCancel) {
|
|
10244
|
-
|
|
10907
|
+
const isConfirm = e.index === 1;
|
|
10908
|
+
const res = {
|
|
10245
10909
|
errMsg: 'showModal:ok',
|
|
10246
|
-
confirm:
|
|
10910
|
+
confirm: isConfirm,
|
|
10247
10911
|
cancel: e.index === 0 || e.index === -1
|
|
10248
|
-
}
|
|
10912
|
+
};
|
|
10913
|
+
isConfirm && editable && (res.content = e.value);
|
|
10914
|
+
invoke$1(callbackId, res);
|
|
10249
10915
|
} else {
|
|
10250
|
-
|
|
10916
|
+
const res = {
|
|
10251
10917
|
errMsg: 'showModal:ok',
|
|
10252
10918
|
confirm: e.index === 0,
|
|
10253
10919
|
cancel: false
|
|
10254
|
-
}
|
|
10920
|
+
};
|
|
10921
|
+
editable && (res.content = e.value);
|
|
10922
|
+
invoke$1(callbackId, res);
|
|
10255
10923
|
}
|
|
10256
|
-
}, title,
|
|
10924
|
+
}, title, tip, buttons);
|
|
10257
10925
|
}
|
|
10258
10926
|
function showActionSheet$1 ({
|
|
10259
10927
|
itemList = [],
|
|
@@ -10347,9 +11015,10 @@ var serviceContext = (function () {
|
|
|
10347
11015
|
text,
|
|
10348
11016
|
iconPath,
|
|
10349
11017
|
selectedIconPath,
|
|
10350
|
-
pagePath
|
|
11018
|
+
pagePath,
|
|
11019
|
+
visible
|
|
10351
11020
|
}) {
|
|
10352
|
-
tabBar$1.setTabBarItem(index, text, iconPath, selectedIconPath);
|
|
11021
|
+
tabBar$1.setTabBarItem(index, text, iconPath, selectedIconPath, visible);
|
|
10353
11022
|
const route = pagePath && __uniRoutes.find(({ path }) => path === pagePath);
|
|
10354
11023
|
if (route) {
|
|
10355
11024
|
const meta = route.meta;
|
|
@@ -10553,8 +11222,7 @@ var serviceContext = (function () {
|
|
|
10553
11222
|
callbackId,
|
|
10554
11223
|
data
|
|
10555
11224
|
}, pageId) => {
|
|
10556
|
-
|
|
10557
|
-
getAdData(adpid, width, count, (res) => {
|
|
11225
|
+
getAdData(data, (res) => {
|
|
10558
11226
|
operateAdView(pageId, callbackId, 'success', res);
|
|
10559
11227
|
}, (err) => {
|
|
10560
11228
|
operateAdView(pageId, callbackId, 'fail', err);
|
|
@@ -10563,7 +11231,8 @@ var serviceContext = (function () {
|
|
|
10563
11231
|
|
|
10564
11232
|
const _adDataCache = {};
|
|
10565
11233
|
|
|
10566
|
-
function getAdData (
|
|
11234
|
+
function getAdData (data, onsuccess, onerror) {
|
|
11235
|
+
const { adpid, width } = data;
|
|
10567
11236
|
const key = adpid + '-' + width;
|
|
10568
11237
|
const adDataList = _adDataCache[key];
|
|
10569
11238
|
if (adDataList && adDataList.length > 0) {
|
|
@@ -10572,11 +11241,7 @@ var serviceContext = (function () {
|
|
|
10572
11241
|
}
|
|
10573
11242
|
|
|
10574
11243
|
plus.ad.getAds(
|
|
10575
|
-
|
|
10576
|
-
adpid,
|
|
10577
|
-
count,
|
|
10578
|
-
width
|
|
10579
|
-
},
|
|
11244
|
+
data,
|
|
10580
11245
|
(res) => {
|
|
10581
11246
|
const list = res.ads;
|
|
10582
11247
|
onsuccess(list.splice(0, 1)[0]);
|
|
@@ -10617,6 +11282,7 @@ var serviceContext = (function () {
|
|
|
10617
11282
|
|
|
10618
11283
|
this._preload = options.preload !== undefined ? options.preload : true;
|
|
10619
11284
|
this._isLoad = false;
|
|
11285
|
+
this._isLoading = false;
|
|
10620
11286
|
this._adError = '';
|
|
10621
11287
|
this._loadPromiseResolve = null;
|
|
10622
11288
|
this._loadPromiseReject = null;
|
|
@@ -10625,6 +11291,7 @@ var serviceContext = (function () {
|
|
|
10625
11291
|
const rewardAd = this._rewardAd = plus.ad.createRewardedVideoAd(options);
|
|
10626
11292
|
rewardAd.onLoad((e) => {
|
|
10627
11293
|
this._isLoad = true;
|
|
11294
|
+
this._isLoading = false;
|
|
10628
11295
|
this._lastLoadTime = Date.now();
|
|
10629
11296
|
this._dispatchEvent('load', {});
|
|
10630
11297
|
|
|
@@ -10634,6 +11301,8 @@ var serviceContext = (function () {
|
|
|
10634
11301
|
}
|
|
10635
11302
|
});
|
|
10636
11303
|
rewardAd.onClose((e) => {
|
|
11304
|
+
this._isLoad = false;
|
|
11305
|
+
this._isLoading = false;
|
|
10637
11306
|
if (this._preload) {
|
|
10638
11307
|
this._loadAd();
|
|
10639
11308
|
}
|
|
@@ -10643,6 +11312,7 @@ var serviceContext = (function () {
|
|
|
10643
11312
|
this._dispatchEvent('verify', { isValid: e.isValid });
|
|
10644
11313
|
});
|
|
10645
11314
|
rewardAd.onError((e) => {
|
|
11315
|
+
this._isLoading = false;
|
|
10646
11316
|
const { code, message } = e;
|
|
10647
11317
|
const data = { code: code, errMsg: message };
|
|
10648
11318
|
this._adError = message;
|
|
@@ -10656,62 +11326,228 @@ var serviceContext = (function () {
|
|
|
10656
11326
|
this._loadPromiseReject = null;
|
|
10657
11327
|
}
|
|
10658
11328
|
});
|
|
10659
|
-
rewardAd.onAdClicked((e) => {
|
|
10660
|
-
this._dispatchEvent('adClicked', {});
|
|
10661
|
-
});
|
|
11329
|
+
rewardAd.onAdClicked((e) => {
|
|
11330
|
+
this._dispatchEvent('adClicked', {});
|
|
11331
|
+
});
|
|
11332
|
+
|
|
11333
|
+
if (this._preload) {
|
|
11334
|
+
this._loadAd();
|
|
11335
|
+
}
|
|
11336
|
+
}
|
|
11337
|
+
|
|
11338
|
+
get isExpired () {
|
|
11339
|
+
return (this._lastLoadTime !== 0 && (Math.abs(Date.now() - this._lastLoadTime) > EXPIRED_TIME))
|
|
11340
|
+
}
|
|
11341
|
+
|
|
11342
|
+
load () {
|
|
11343
|
+
return new Promise((resolve, reject) => {
|
|
11344
|
+
this._loadPromiseResolve = resolve;
|
|
11345
|
+
this._loadPromiseReject = reject;
|
|
11346
|
+
if (this._isLoading) {
|
|
11347
|
+
return
|
|
11348
|
+
}
|
|
11349
|
+
if (this._isLoad) {
|
|
11350
|
+
resolve();
|
|
11351
|
+
return
|
|
11352
|
+
}
|
|
11353
|
+
this._loadAd();
|
|
11354
|
+
})
|
|
11355
|
+
}
|
|
11356
|
+
|
|
11357
|
+
show () {
|
|
11358
|
+
return new Promise((resolve, reject) => {
|
|
11359
|
+
if (this._isLoading) {
|
|
11360
|
+
return
|
|
11361
|
+
}
|
|
11362
|
+
|
|
11363
|
+
const provider = this.getProvider();
|
|
11364
|
+
if (provider === ProviderType.CSJ && this.isExpired) {
|
|
11365
|
+
this._isLoad = false;
|
|
11366
|
+
// TODO
|
|
11367
|
+
this._dispatchEvent('error', EXPIRED_TEXT);
|
|
11368
|
+
reject(new Error(EXPIRED_TEXT.errMsg));
|
|
11369
|
+
return
|
|
11370
|
+
}
|
|
11371
|
+
|
|
11372
|
+
if (this._isLoad) {
|
|
11373
|
+
this._rewardAd.show();
|
|
11374
|
+
resolve();
|
|
11375
|
+
} else {
|
|
11376
|
+
reject(new Error(this._adError));
|
|
11377
|
+
}
|
|
11378
|
+
})
|
|
11379
|
+
}
|
|
11380
|
+
|
|
11381
|
+
getProvider () {
|
|
11382
|
+
return this._rewardAd.getProvider()
|
|
11383
|
+
}
|
|
11384
|
+
|
|
11385
|
+
destroy () {
|
|
11386
|
+
this._rewardAd.destroy();
|
|
11387
|
+
}
|
|
11388
|
+
|
|
11389
|
+
_loadAd () {
|
|
11390
|
+
this._isLoad = false;
|
|
11391
|
+
this._isLoading = true;
|
|
11392
|
+
this._rewardAd.load();
|
|
11393
|
+
}
|
|
11394
|
+
|
|
11395
|
+
_dispatchEvent (name, data) {
|
|
11396
|
+
this._callbacks[name].forEach(callback => {
|
|
11397
|
+
if (typeof callback === 'function') {
|
|
11398
|
+
callback(data || {});
|
|
11399
|
+
}
|
|
11400
|
+
});
|
|
11401
|
+
}
|
|
11402
|
+
}
|
|
11403
|
+
|
|
11404
|
+
function createRewardedVideoAd (options) {
|
|
11405
|
+
return new RewardedVideoAd(options)
|
|
11406
|
+
}
|
|
11407
|
+
|
|
11408
|
+
const eventTypes = {
|
|
11409
|
+
load: 'load',
|
|
11410
|
+
close: 'close',
|
|
11411
|
+
error: 'error',
|
|
11412
|
+
adClicked: 'adClicked'
|
|
11413
|
+
};
|
|
11414
|
+
|
|
11415
|
+
const eventNames$1 = [
|
|
11416
|
+
eventTypes.load,
|
|
11417
|
+
eventTypes.close,
|
|
11418
|
+
eventTypes.error,
|
|
11419
|
+
eventTypes.adClicked
|
|
11420
|
+
];
|
|
11421
|
+
|
|
11422
|
+
class AdBase {
|
|
11423
|
+
constructor (adInstance, options) {
|
|
11424
|
+
const _callbacks = this._callbacks = {};
|
|
11425
|
+
eventNames$1.forEach(item => {
|
|
11426
|
+
_callbacks[item] = [];
|
|
11427
|
+
const name = item[0].toUpperCase() + item.substr(1);
|
|
11428
|
+
this[`on${name}`] = function (callback) {
|
|
11429
|
+
_callbacks[item].push(callback);
|
|
11430
|
+
};
|
|
11431
|
+
});
|
|
11432
|
+
|
|
11433
|
+
this._preload = options.preload !== undefined ? options.preload : false;
|
|
11434
|
+
|
|
11435
|
+
this._isLoaded = false;
|
|
11436
|
+
this._isLoading = false;
|
|
11437
|
+
this._adError = '';
|
|
11438
|
+
this._loadPromiseResolve = null;
|
|
11439
|
+
this._loadPromiseReject = null;
|
|
11440
|
+
this._showPromiseResolve = null;
|
|
11441
|
+
this._showPromiseReject = null;
|
|
11442
|
+
|
|
11443
|
+
const ad = this._ad = adInstance;
|
|
11444
|
+
ad.onLoad((e) => {
|
|
11445
|
+
this._isLoaded = true;
|
|
11446
|
+
this._isLoading = false;
|
|
11447
|
+
|
|
11448
|
+
if (this._loadPromiseResolve != null) {
|
|
11449
|
+
this._loadPromiseResolve();
|
|
11450
|
+
this._loadPromiseResolve = null;
|
|
11451
|
+
}
|
|
11452
|
+
if (this._showPromiseResolve != null) {
|
|
11453
|
+
this._showPromiseResolve();
|
|
11454
|
+
this._showPromiseResolve = null;
|
|
11455
|
+
this._showAd();
|
|
11456
|
+
}
|
|
11457
|
+
|
|
11458
|
+
this._dispatchEvent(eventTypes.load, {});
|
|
11459
|
+
});
|
|
11460
|
+
ad.onClose((e) => {
|
|
11461
|
+
this._isLoaded = false;
|
|
11462
|
+
this._isLoading = false;
|
|
11463
|
+
this._dispatchEvent(eventTypes.close, { isEnded: e.isEnded });
|
|
11464
|
+
|
|
11465
|
+
if (this._preload === true) {
|
|
11466
|
+
this._loadAd();
|
|
11467
|
+
}
|
|
11468
|
+
});
|
|
11469
|
+
ad.onError((e) => {
|
|
11470
|
+
this._isLoading = false;
|
|
10662
11471
|
|
|
10663
|
-
|
|
10664
|
-
|
|
10665
|
-
|
|
10666
|
-
|
|
11472
|
+
const data = {
|
|
11473
|
+
code: e.code,
|
|
11474
|
+
errMsg: e.message
|
|
11475
|
+
};
|
|
10667
11476
|
|
|
10668
|
-
|
|
10669
|
-
|
|
11477
|
+
this._adError = data;
|
|
11478
|
+
|
|
11479
|
+
this._dispatchEvent(eventTypes.error, data);
|
|
11480
|
+
|
|
11481
|
+
const error = new Error(JSON.stringify(this._adError));
|
|
11482
|
+
error.code = e.code;
|
|
11483
|
+
error.errMsg = e.message;
|
|
11484
|
+
|
|
11485
|
+
if (this._loadPromiseReject != null) {
|
|
11486
|
+
this._loadPromiseReject(error);
|
|
11487
|
+
this._loadPromiseReject = null;
|
|
11488
|
+
}
|
|
11489
|
+
|
|
11490
|
+
if (this._showPromiseReject != null) {
|
|
11491
|
+
this._showPromiseReject(error);
|
|
11492
|
+
this._showPromiseReject = null;
|
|
11493
|
+
}
|
|
11494
|
+
});
|
|
11495
|
+
ad.onAdClicked && ad.onAdClicked((e) => {
|
|
11496
|
+
this._dispatchEvent(eventTypes.adClicked, {});
|
|
11497
|
+
});
|
|
10670
11498
|
}
|
|
10671
11499
|
|
|
10672
11500
|
load () {
|
|
10673
11501
|
return new Promise((resolve, reject) => {
|
|
10674
|
-
if (this._isLoad) {
|
|
10675
|
-
resolve();
|
|
10676
|
-
return
|
|
10677
|
-
}
|
|
10678
11502
|
this._loadPromiseResolve = resolve;
|
|
10679
11503
|
this._loadPromiseReject = reject;
|
|
10680
|
-
this.
|
|
11504
|
+
if (this._isLoading) {
|
|
11505
|
+
return
|
|
11506
|
+
}
|
|
11507
|
+
|
|
11508
|
+
if (this._isLoaded) {
|
|
11509
|
+
resolve();
|
|
11510
|
+
} else {
|
|
11511
|
+
this._loadAd();
|
|
11512
|
+
}
|
|
10681
11513
|
})
|
|
10682
11514
|
}
|
|
10683
11515
|
|
|
10684
11516
|
show () {
|
|
10685
11517
|
return new Promise((resolve, reject) => {
|
|
10686
|
-
|
|
10687
|
-
|
|
10688
|
-
|
|
10689
|
-
|
|
10690
|
-
this._dispatchEvent('error', EXPIRED_TEXT);
|
|
10691
|
-
reject(new Error(EXPIRED_TEXT.errMsg));
|
|
11518
|
+
this._showPromiseResolve = resolve;
|
|
11519
|
+
this._showPromiseReject = reject;
|
|
11520
|
+
|
|
11521
|
+
if (this._isLoading) {
|
|
10692
11522
|
return
|
|
10693
11523
|
}
|
|
10694
11524
|
|
|
10695
|
-
if (this.
|
|
10696
|
-
this.
|
|
11525
|
+
if (this._isLoaded) {
|
|
11526
|
+
this._showAd();
|
|
10697
11527
|
resolve();
|
|
10698
11528
|
} else {
|
|
10699
|
-
|
|
11529
|
+
this._loadAd();
|
|
10700
11530
|
}
|
|
10701
11531
|
})
|
|
10702
11532
|
}
|
|
10703
11533
|
|
|
10704
|
-
|
|
10705
|
-
|
|
11534
|
+
destroy () {
|
|
11535
|
+
this._ad.destroy();
|
|
10706
11536
|
}
|
|
10707
11537
|
|
|
10708
|
-
|
|
10709
|
-
this.
|
|
11538
|
+
getProvider () {
|
|
11539
|
+
return this._ad.getProvider()
|
|
10710
11540
|
}
|
|
10711
11541
|
|
|
10712
11542
|
_loadAd () {
|
|
10713
|
-
this.
|
|
10714
|
-
this.
|
|
11543
|
+
this._adError = '';
|
|
11544
|
+
this._isLoaded = false;
|
|
11545
|
+
this._isLoading = true;
|
|
11546
|
+
this._ad.load();
|
|
11547
|
+
}
|
|
11548
|
+
|
|
11549
|
+
_showAd () {
|
|
11550
|
+
this._ad.show();
|
|
10715
11551
|
}
|
|
10716
11552
|
|
|
10717
11553
|
_dispatchEvent (name, data) {
|
|
@@ -10723,19 +11559,88 @@ var serviceContext = (function () {
|
|
|
10723
11559
|
}
|
|
10724
11560
|
}
|
|
10725
11561
|
|
|
10726
|
-
|
|
10727
|
-
|
|
11562
|
+
class FullScreenVideoAd extends AdBase {
|
|
11563
|
+
constructor (options = {}) {
|
|
11564
|
+
super(plus.ad.createFullScreenVideoAd(options), options);
|
|
11565
|
+
}
|
|
10728
11566
|
}
|
|
10729
11567
|
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
'error',
|
|
10734
|
-
'adClicked'
|
|
10735
|
-
];
|
|
11568
|
+
function createFullScreenVideoAd (options) {
|
|
11569
|
+
return new FullScreenVideoAd(options)
|
|
11570
|
+
}
|
|
10736
11571
|
|
|
10737
|
-
class
|
|
11572
|
+
class InterstitialAd extends AdBase {
|
|
10738
11573
|
constructor (options = {}) {
|
|
11574
|
+
super(plus.ad.createInterstitialAd(options), options);
|
|
11575
|
+
|
|
11576
|
+
this._loadAd();
|
|
11577
|
+
}
|
|
11578
|
+
}
|
|
11579
|
+
|
|
11580
|
+
function createInterstitialAd (options) {
|
|
11581
|
+
return new InterstitialAd(options)
|
|
11582
|
+
}
|
|
11583
|
+
|
|
11584
|
+
const sdkCache = {};
|
|
11585
|
+
const sdkQueue = {};
|
|
11586
|
+
|
|
11587
|
+
function initSDK (options) {
|
|
11588
|
+
const provider = options.provider;
|
|
11589
|
+
if (!sdkCache[provider]) {
|
|
11590
|
+
sdkCache[provider] = {};
|
|
11591
|
+
}
|
|
11592
|
+
if (typeof sdkCache[provider].instance === 'object') {
|
|
11593
|
+
options.success(sdkCache[provider].instance);
|
|
11594
|
+
return
|
|
11595
|
+
}
|
|
11596
|
+
|
|
11597
|
+
if (!sdkQueue[provider]) {
|
|
11598
|
+
sdkQueue[provider] = [];
|
|
11599
|
+
}
|
|
11600
|
+
sdkQueue[provider].push(options);
|
|
11601
|
+
|
|
11602
|
+
if (sdkCache[provider].loading === true) {
|
|
11603
|
+
options.__plugin = sdkCache[provider].plugin;
|
|
11604
|
+
return
|
|
11605
|
+
}
|
|
11606
|
+
sdkCache[provider].loading = true;
|
|
11607
|
+
const plugin = requireNativePlugin(provider) || {};
|
|
11608
|
+
const initFunction = plugin.init || plugin.initSDK;
|
|
11609
|
+
if (!initFunction) {
|
|
11610
|
+
sdkQueue[provider].forEach((item) => {
|
|
11611
|
+
item.fail({
|
|
11612
|
+
code: -1,
|
|
11613
|
+
message: 'provider [' + provider + '] invalid'
|
|
11614
|
+
});
|
|
11615
|
+
});
|
|
11616
|
+
sdkQueue[provider].length = 0;
|
|
11617
|
+
sdkCache[provider].loading = false;
|
|
11618
|
+
return
|
|
11619
|
+
}
|
|
11620
|
+
sdkCache[provider].plugin = plugin;
|
|
11621
|
+
options.__plugin = plugin;
|
|
11622
|
+
initFunction((res) => {
|
|
11623
|
+
const code = res.code;
|
|
11624
|
+
const isSuccess = (provider === 'BXM-AD') ? (code === 0 || code === 1) : (code === 0);
|
|
11625
|
+
if (isSuccess) {
|
|
11626
|
+
sdkCache[provider].instance = plugin;
|
|
11627
|
+
} else {
|
|
11628
|
+
sdkCache[provider].loading = false;
|
|
11629
|
+
}
|
|
11630
|
+
|
|
11631
|
+
sdkQueue[provider].forEach((item) => {
|
|
11632
|
+
if (isSuccess) {
|
|
11633
|
+
item.success(item.__plugin);
|
|
11634
|
+
} else {
|
|
11635
|
+
item.fail(res);
|
|
11636
|
+
}
|
|
11637
|
+
});
|
|
11638
|
+
sdkQueue[provider].length = 0;
|
|
11639
|
+
});
|
|
11640
|
+
}
|
|
11641
|
+
|
|
11642
|
+
class InteractiveAd {
|
|
11643
|
+
constructor (options) {
|
|
10739
11644
|
const _callbacks = this._callbacks = {};
|
|
10740
11645
|
eventNames$1.forEach(item => {
|
|
10741
11646
|
_callbacks[item] = [];
|
|
@@ -10745,80 +11650,165 @@ var serviceContext = (function () {
|
|
|
10745
11650
|
};
|
|
10746
11651
|
});
|
|
10747
11652
|
|
|
10748
|
-
this.
|
|
11653
|
+
this._ad = null;
|
|
10749
11654
|
this._adError = '';
|
|
11655
|
+
this._adpid = options.adpid;
|
|
11656
|
+
this._provider = options.provider;
|
|
11657
|
+
this._userData = options.userData || {};
|
|
11658
|
+
this._isLoaded = false;
|
|
11659
|
+
this._isLoading = false;
|
|
10750
11660
|
this._loadPromiseResolve = null;
|
|
10751
11661
|
this._loadPromiseReject = null;
|
|
10752
|
-
this.
|
|
10753
|
-
|
|
10754
|
-
const ad = this._ad = plus.ad.createFullScreenVideoAd(options);
|
|
10755
|
-
ad.onLoad((e) => {
|
|
10756
|
-
this._isLoad = true;
|
|
10757
|
-
this._lastLoadTime = Date.now();
|
|
10758
|
-
this._dispatchEvent('load', {});
|
|
11662
|
+
this._showPromiseResolve = null;
|
|
11663
|
+
this._showPromiseReject = null;
|
|
10759
11664
|
|
|
10760
|
-
|
|
10761
|
-
|
|
10762
|
-
this._loadPromiseResolve = null;
|
|
10763
|
-
}
|
|
10764
|
-
});
|
|
10765
|
-
ad.onClose((e) => {
|
|
10766
|
-
this._isLoad = false;
|
|
10767
|
-
this._dispatchEvent('close', { isEnded: e.isEnded });
|
|
11665
|
+
setTimeout(() => {
|
|
11666
|
+
this._init();
|
|
10768
11667
|
});
|
|
10769
|
-
|
|
10770
|
-
const { code, message } = e;
|
|
10771
|
-
const data = { code: code, errMsg: message };
|
|
10772
|
-
this._adError = message;
|
|
10773
|
-
if (code === -5008) {
|
|
10774
|
-
this._isLoad = false;
|
|
10775
|
-
}
|
|
10776
|
-
this._dispatchEvent('error', data);
|
|
11668
|
+
}
|
|
10777
11669
|
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
11670
|
+
_init () {
|
|
11671
|
+
this._adError = '';
|
|
11672
|
+
initSDK({
|
|
11673
|
+
provider: this._provider,
|
|
11674
|
+
success: (res) => {
|
|
11675
|
+
this._ad = res;
|
|
11676
|
+
if (this._userData) {
|
|
11677
|
+
this.bindUserData(this._userData);
|
|
11678
|
+
}
|
|
11679
|
+
this._loadAd();
|
|
11680
|
+
},
|
|
11681
|
+
fail: (err) => {
|
|
11682
|
+
this._adError = err;
|
|
11683
|
+
this._dispatchEvent(eventTypes.error, err);
|
|
10781
11684
|
}
|
|
10782
11685
|
});
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
11686
|
+
}
|
|
11687
|
+
|
|
11688
|
+
getProvider () {
|
|
11689
|
+
return this._provider
|
|
10786
11690
|
}
|
|
10787
11691
|
|
|
10788
11692
|
load () {
|
|
10789
11693
|
return new Promise((resolve, reject) => {
|
|
10790
|
-
if (this._isLoad) {
|
|
10791
|
-
resolve();
|
|
10792
|
-
return
|
|
10793
|
-
}
|
|
10794
11694
|
this._loadPromiseResolve = resolve;
|
|
10795
11695
|
this._loadPromiseReject = reject;
|
|
10796
|
-
this.
|
|
11696
|
+
if (this._isLoading) {
|
|
11697
|
+
return
|
|
11698
|
+
}
|
|
11699
|
+
|
|
11700
|
+
if (this._adError) {
|
|
11701
|
+
this._init();
|
|
11702
|
+
return
|
|
11703
|
+
}
|
|
11704
|
+
|
|
11705
|
+
if (this._isLoaded) {
|
|
11706
|
+
resolve();
|
|
11707
|
+
} else {
|
|
11708
|
+
this._loadAd();
|
|
11709
|
+
}
|
|
10797
11710
|
})
|
|
10798
11711
|
}
|
|
10799
11712
|
|
|
10800
11713
|
show () {
|
|
10801
11714
|
return new Promise((resolve, reject) => {
|
|
10802
|
-
|
|
10803
|
-
|
|
11715
|
+
this._showPromiseResolve = resolve;
|
|
11716
|
+
this._showPromiseReject = reject;
|
|
11717
|
+
|
|
11718
|
+
if (this._isLoading) {
|
|
11719
|
+
return
|
|
11720
|
+
}
|
|
11721
|
+
|
|
11722
|
+
if (this._adError) {
|
|
11723
|
+
this._init();
|
|
11724
|
+
return
|
|
11725
|
+
}
|
|
11726
|
+
|
|
11727
|
+
if (this._isLoaded) {
|
|
11728
|
+
this._showAd();
|
|
10804
11729
|
resolve();
|
|
10805
11730
|
} else {
|
|
10806
|
-
|
|
11731
|
+
this._loadAd();
|
|
10807
11732
|
}
|
|
10808
11733
|
})
|
|
10809
11734
|
}
|
|
10810
11735
|
|
|
10811
|
-
|
|
10812
|
-
|
|
11736
|
+
destroy () {
|
|
11737
|
+
if (this._ad !== null && this._ad.destroy) {
|
|
11738
|
+
this._ad.destroy({
|
|
11739
|
+
adpid: this._adpid
|
|
11740
|
+
});
|
|
11741
|
+
}
|
|
10813
11742
|
}
|
|
10814
11743
|
|
|
10815
|
-
|
|
10816
|
-
this._ad.
|
|
11744
|
+
bindUserData (data) {
|
|
11745
|
+
if (this._ad !== null && this._ad.bindUserData) {
|
|
11746
|
+
this._ad.bindUserData(data);
|
|
11747
|
+
}
|
|
10817
11748
|
}
|
|
10818
11749
|
|
|
10819
11750
|
_loadAd () {
|
|
10820
|
-
this.
|
|
10821
|
-
|
|
11751
|
+
if (this._ad !== null) {
|
|
11752
|
+
if (this._isLoading === true) {
|
|
11753
|
+
return
|
|
11754
|
+
}
|
|
11755
|
+
this._isLoading = true;
|
|
11756
|
+
|
|
11757
|
+
this._ad.loadData({
|
|
11758
|
+
adpid: this._adpid,
|
|
11759
|
+
...this._userData
|
|
11760
|
+
}, (res) => {
|
|
11761
|
+
this._isLoaded = true;
|
|
11762
|
+
this._isLoading = false;
|
|
11763
|
+
|
|
11764
|
+
if (this._loadPromiseResolve != null) {
|
|
11765
|
+
this._loadPromiseResolve();
|
|
11766
|
+
this._loadPromiseResolve = null;
|
|
11767
|
+
}
|
|
11768
|
+
if (this._showPromiseResolve != null) {
|
|
11769
|
+
this._showPromiseResolve();
|
|
11770
|
+
this._showPromiseResolve = null;
|
|
11771
|
+
this._showAd();
|
|
11772
|
+
}
|
|
11773
|
+
|
|
11774
|
+
this._dispatchEvent(eventTypes.load, res);
|
|
11775
|
+
}, (err) => {
|
|
11776
|
+
this._isLoading = false;
|
|
11777
|
+
|
|
11778
|
+
if (this._showPromiseReject != null) {
|
|
11779
|
+
this._showPromiseReject(this._createError(err));
|
|
11780
|
+
this._showPromiseReject = null;
|
|
11781
|
+
}
|
|
11782
|
+
|
|
11783
|
+
this._dispatchEvent(eventTypes.error, err);
|
|
11784
|
+
});
|
|
11785
|
+
}
|
|
11786
|
+
}
|
|
11787
|
+
|
|
11788
|
+
_showAd () {
|
|
11789
|
+
if (this._ad !== null && this._isLoaded === true) {
|
|
11790
|
+
this._ad.show({
|
|
11791
|
+
adpid: this._adpid
|
|
11792
|
+
}, (res) => {
|
|
11793
|
+
this._isLoaded = false;
|
|
11794
|
+
}, (err) => {
|
|
11795
|
+
this._isLoaded = false;
|
|
11796
|
+
|
|
11797
|
+
if (this._showPromiseReject != null) {
|
|
11798
|
+
this._showPromiseReject(this._createError(err));
|
|
11799
|
+
this._showPromiseReject = null;
|
|
11800
|
+
}
|
|
11801
|
+
|
|
11802
|
+
this._dispatchEvent(eventTypes.error, err);
|
|
11803
|
+
});
|
|
11804
|
+
}
|
|
11805
|
+
}
|
|
11806
|
+
|
|
11807
|
+
_createError (err) {
|
|
11808
|
+
const error = new Error(JSON.stringify(err));
|
|
11809
|
+
error.code = err.code;
|
|
11810
|
+
error.errMsg = err.message;
|
|
11811
|
+
return error
|
|
10822
11812
|
}
|
|
10823
11813
|
|
|
10824
11814
|
_dispatchEvent (name, data) {
|
|
@@ -10830,8 +11820,14 @@ var serviceContext = (function () {
|
|
|
10830
11820
|
}
|
|
10831
11821
|
}
|
|
10832
11822
|
|
|
10833
|
-
function
|
|
10834
|
-
|
|
11823
|
+
function createInteractiveAd (options) {
|
|
11824
|
+
if (!options.provider) {
|
|
11825
|
+
return new Error('provider invalid')
|
|
11826
|
+
}
|
|
11827
|
+
if (!options.adpid) {
|
|
11828
|
+
return new Error('adpid invalid')
|
|
11829
|
+
}
|
|
11830
|
+
return new InteractiveAd(options)
|
|
10835
11831
|
}
|
|
10836
11832
|
|
|
10837
11833
|
var api = /*#__PURE__*/Object.freeze({
|
|
@@ -10920,11 +11916,12 @@ var serviceContext = (function () {
|
|
|
10920
11916
|
stopVoice: stopVoice,
|
|
10921
11917
|
chooseImage: chooseImage$1,
|
|
10922
11918
|
chooseVideo: chooseVideo$1,
|
|
10923
|
-
compressImage: compressImage$
|
|
11919
|
+
compressImage: compressImage$1,
|
|
10924
11920
|
compressVideo: compressVideo$1,
|
|
10925
11921
|
getImageInfo: getImageInfo$1,
|
|
10926
11922
|
getVideoInfo: getVideoInfo$1,
|
|
10927
11923
|
previewImagePlus: previewImagePlus,
|
|
11924
|
+
closePreviewImagePlus: closePreviewImagePlus,
|
|
10928
11925
|
operateRecorder: operateRecorder,
|
|
10929
11926
|
saveImageToPhotosAlbum: saveImageToPhotosAlbum$1,
|
|
10930
11927
|
saveVideoToPhotosAlbum: saveVideoToPhotosAlbum,
|
|
@@ -10933,6 +11930,7 @@ var serviceContext = (function () {
|
|
|
10933
11930
|
createRequestTaskById: createRequestTaskById,
|
|
10934
11931
|
createRequestTask: createRequestTask,
|
|
10935
11932
|
operateRequestTask: operateRequestTask,
|
|
11933
|
+
configMTLS: configMTLS$1,
|
|
10936
11934
|
createSocketTask: createSocketTask,
|
|
10937
11935
|
operateSocketTask: operateSocketTask,
|
|
10938
11936
|
operateUploadTask: operateUploadTask,
|
|
@@ -10940,9 +11938,12 @@ var serviceContext = (function () {
|
|
|
10940
11938
|
getProvider: getProvider$1,
|
|
10941
11939
|
login: login,
|
|
10942
11940
|
getUserInfo: getUserInfo,
|
|
11941
|
+
getUserProfile: getUserProfile,
|
|
10943
11942
|
operateWXData: operateWXData,
|
|
10944
11943
|
preLogin: preLogin$1,
|
|
10945
11944
|
closeAuthView: closeAuthView,
|
|
11945
|
+
getCheckBoxState: getCheckBoxState,
|
|
11946
|
+
getUniverifyManager: getUniverifyManager,
|
|
10946
11947
|
requestPayment: requestPayment,
|
|
10947
11948
|
subscribePush: subscribePush,
|
|
10948
11949
|
unsubscribePush: unsubscribePush,
|
|
@@ -10958,6 +11959,8 @@ var serviceContext = (function () {
|
|
|
10958
11959
|
onNativeEventReceive: onNativeEventReceive,
|
|
10959
11960
|
sendNativeEvent: sendNativeEvent,
|
|
10960
11961
|
loadSubPackage: loadSubPackage$2,
|
|
11962
|
+
sendHostEvent: sendHostEvent,
|
|
11963
|
+
navigateToMiniProgram: navigateToMiniProgram,
|
|
10961
11964
|
navigateBack: navigateBack$1,
|
|
10962
11965
|
navigateTo: navigateTo$1,
|
|
10963
11966
|
reLaunch: reLaunch$1,
|
|
@@ -10995,7 +11998,9 @@ var serviceContext = (function () {
|
|
|
10995
11998
|
showTabBar: showTabBar$2,
|
|
10996
11999
|
requestComponentInfo: requestComponentInfo$2,
|
|
10997
12000
|
createRewardedVideoAd: createRewardedVideoAd,
|
|
10998
|
-
createFullScreenVideoAd: createFullScreenVideoAd
|
|
12001
|
+
createFullScreenVideoAd: createFullScreenVideoAd,
|
|
12002
|
+
createInterstitialAd: createInterstitialAd,
|
|
12003
|
+
createInteractiveAd: createInteractiveAd
|
|
10999
12004
|
});
|
|
11000
12005
|
|
|
11001
12006
|
var platformApi = Object.assign(Object.create(null), api, eventApis);
|
|
@@ -18204,8 +19209,9 @@ var serviceContext = (function () {
|
|
|
18204
19209
|
}
|
|
18205
19210
|
|
|
18206
19211
|
function Pattern (image, repetition) {
|
|
18207
|
-
this.
|
|
18208
|
-
this.
|
|
19212
|
+
this.type = 'pattern';
|
|
19213
|
+
this.data = image;
|
|
19214
|
+
this.colorStop = repetition;
|
|
18209
19215
|
}
|
|
18210
19216
|
|
|
18211
19217
|
class CanvasGradient {
|
|
@@ -18915,6 +19921,13 @@ var serviceContext = (function () {
|
|
|
18915
19921
|
constructor (id, pageVm) {
|
|
18916
19922
|
this.id = id;
|
|
18917
19923
|
this.pageVm = pageVm;
|
|
19924
|
+
}
|
|
19925
|
+
|
|
19926
|
+
on (name, callback) {
|
|
19927
|
+
operateMapPlayer$3(this.id, this.pageVm, 'on', {
|
|
19928
|
+
name,
|
|
19929
|
+
callback
|
|
19930
|
+
});
|
|
18918
19931
|
}
|
|
18919
19932
|
}
|
|
18920
19933
|
|
|
@@ -18922,7 +19935,7 @@ var serviceContext = (function () {
|
|
|
18922
19935
|
{
|
|
18923
19936
|
return plus.maps.getMapById(this.pageVm.$page.id + '-map-' + this.id)
|
|
18924
19937
|
}
|
|
18925
|
-
};
|
|
19938
|
+
};
|
|
18926
19939
|
|
|
18927
19940
|
methods.forEach(function (method) {
|
|
18928
19941
|
MapContext.prototype[method] = callback.warp(function (options, callbackId) {
|
|
@@ -19386,11 +20399,16 @@ var serviceContext = (function () {
|
|
|
19386
20399
|
}
|
|
19387
20400
|
|
|
19388
20401
|
return invokeMethod('previewImagePlus', args)
|
|
20402
|
+
}
|
|
20403
|
+
|
|
20404
|
+
function closePreviewImage (args = {}) {
|
|
20405
|
+
return invokeMethod('closePreviewImagePlus', args)
|
|
19389
20406
|
}
|
|
19390
20407
|
|
|
19391
20408
|
var require_context_module_1_15 = /*#__PURE__*/Object.freeze({
|
|
19392
20409
|
__proto__: null,
|
|
19393
|
-
previewImage: previewImage$1
|
|
20410
|
+
previewImage: previewImage$1,
|
|
20411
|
+
closePreviewImage: closePreviewImage
|
|
19394
20412
|
});
|
|
19395
20413
|
|
|
19396
20414
|
const callbacks$8 = {
|
|
@@ -20376,6 +21394,51 @@ var serviceContext = (function () {
|
|
|
20376
21394
|
loadFontFace: loadFontFace$1
|
|
20377
21395
|
});
|
|
20378
21396
|
|
|
21397
|
+
function getLocale$1 () {
|
|
21398
|
+
// 优先使用 $locale
|
|
21399
|
+
const app = getApp({
|
|
21400
|
+
allowDefault: true
|
|
21401
|
+
});
|
|
21402
|
+
if (app && app.$vm) {
|
|
21403
|
+
return app.$vm.$locale
|
|
21404
|
+
}
|
|
21405
|
+
return i18n.getLocale()
|
|
21406
|
+
}
|
|
21407
|
+
|
|
21408
|
+
function setLocale (locale) {
|
|
21409
|
+
const oldLocale = getApp().$vm.$locale;
|
|
21410
|
+
if (oldLocale !== locale) {
|
|
21411
|
+
getApp().$vm.$locale = locale;
|
|
21412
|
+
{
|
|
21413
|
+
const pages = getCurrentPages();
|
|
21414
|
+
pages.forEach((page) => {
|
|
21415
|
+
UniServiceJSBridge.publishHandler(
|
|
21416
|
+
'setLocale',
|
|
21417
|
+
locale,
|
|
21418
|
+
page.$page.id
|
|
21419
|
+
);
|
|
21420
|
+
});
|
|
21421
|
+
weex.requireModule('plus').setLanguage(locale);
|
|
21422
|
+
}
|
|
21423
|
+
callbacks$a.forEach(callbackId => {
|
|
21424
|
+
invoke$1(callbackId, { locale });
|
|
21425
|
+
});
|
|
21426
|
+
return true
|
|
21427
|
+
}
|
|
21428
|
+
return false
|
|
21429
|
+
}
|
|
21430
|
+
const callbacks$a = [];
|
|
21431
|
+
function onLocaleChange (callbackId) {
|
|
21432
|
+
callbacks$a.push(callbackId);
|
|
21433
|
+
}
|
|
21434
|
+
|
|
21435
|
+
var require_context_module_1_27 = /*#__PURE__*/Object.freeze({
|
|
21436
|
+
__proto__: null,
|
|
21437
|
+
getLocale: getLocale$1,
|
|
21438
|
+
setLocale: setLocale,
|
|
21439
|
+
onLocaleChange: onLocaleChange
|
|
21440
|
+
});
|
|
21441
|
+
|
|
20379
21442
|
function pageScrollTo$1 (args) {
|
|
20380
21443
|
const pages = getCurrentPages();
|
|
20381
21444
|
if (pages.length) {
|
|
@@ -20384,7 +21447,7 @@ var serviceContext = (function () {
|
|
|
20384
21447
|
return {}
|
|
20385
21448
|
}
|
|
20386
21449
|
|
|
20387
|
-
var
|
|
21450
|
+
var require_context_module_1_28 = /*#__PURE__*/Object.freeze({
|
|
20388
21451
|
__proto__: null,
|
|
20389
21452
|
pageScrollTo: pageScrollTo$1
|
|
20390
21453
|
});
|
|
@@ -20397,7 +21460,7 @@ var serviceContext = (function () {
|
|
|
20397
21460
|
return {}
|
|
20398
21461
|
}
|
|
20399
21462
|
|
|
20400
|
-
var
|
|
21463
|
+
var require_context_module_1_29 = /*#__PURE__*/Object.freeze({
|
|
20401
21464
|
__proto__: null,
|
|
20402
21465
|
setPageMeta: setPageMeta$1
|
|
20403
21466
|
});
|
|
@@ -20422,19 +21485,19 @@ var serviceContext = (function () {
|
|
|
20422
21485
|
|
|
20423
21486
|
const hideTabBarRedDot$1 = removeTabBarBadge$1;
|
|
20424
21487
|
|
|
20425
|
-
const callbacks$
|
|
21488
|
+
const callbacks$b = [];
|
|
20426
21489
|
|
|
20427
21490
|
onMethod('onTabBarMidButtonTap', res => {
|
|
20428
|
-
callbacks$
|
|
21491
|
+
callbacks$b.forEach(callbackId => {
|
|
20429
21492
|
invoke$1(callbackId, res);
|
|
20430
21493
|
});
|
|
20431
21494
|
});
|
|
20432
21495
|
|
|
20433
21496
|
function onTabBarMidButtonTap (callbackId) {
|
|
20434
|
-
callbacks$
|
|
21497
|
+
callbacks$b.push(callbackId);
|
|
20435
21498
|
}
|
|
20436
21499
|
|
|
20437
|
-
var
|
|
21500
|
+
var require_context_module_1_30 = /*#__PURE__*/Object.freeze({
|
|
20438
21501
|
__proto__: null,
|
|
20439
21502
|
removeTabBarBadge: removeTabBarBadge$1,
|
|
20440
21503
|
showTabBarRedDot: showTabBarRedDot$1,
|
|
@@ -20442,23 +21505,23 @@ var serviceContext = (function () {
|
|
|
20442
21505
|
onTabBarMidButtonTap: onTabBarMidButtonTap
|
|
20443
21506
|
});
|
|
20444
21507
|
|
|
20445
|
-
const callbacks$
|
|
21508
|
+
const callbacks$c = [];
|
|
20446
21509
|
onMethod('onViewDidResize', res => {
|
|
20447
|
-
callbacks$
|
|
21510
|
+
callbacks$c.forEach(callbackId => {
|
|
20448
21511
|
invoke$1(callbackId, res);
|
|
20449
21512
|
});
|
|
20450
21513
|
});
|
|
20451
21514
|
|
|
20452
21515
|
function onWindowResize (callbackId) {
|
|
20453
|
-
callbacks$
|
|
21516
|
+
callbacks$c.push(callbackId);
|
|
20454
21517
|
}
|
|
20455
21518
|
|
|
20456
21519
|
function offWindowResize (callbackId) {
|
|
20457
21520
|
// 此处和微信平台一致查询不到去掉最后一个
|
|
20458
|
-
callbacks$
|
|
21521
|
+
callbacks$c.splice(callbacks$c.indexOf(callbackId), 1);
|
|
20459
21522
|
}
|
|
20460
21523
|
|
|
20461
|
-
var
|
|
21524
|
+
var require_context_module_1_31 = /*#__PURE__*/Object.freeze({
|
|
20462
21525
|
__proto__: null,
|
|
20463
21526
|
onWindowResize: onWindowResize,
|
|
20464
21527
|
offWindowResize: offWindowResize
|
|
@@ -20496,10 +21559,11 @@ var serviceContext = (function () {
|
|
|
20496
21559
|
'./ui/create-media-query-observer.js': require_context_module_1_24,
|
|
20497
21560
|
'./ui/create-selector-query.js': require_context_module_1_25,
|
|
20498
21561
|
'./ui/load-font-face.js': require_context_module_1_26,
|
|
20499
|
-
'./ui/
|
|
20500
|
-
'./ui/
|
|
20501
|
-
'./ui/
|
|
20502
|
-
'./ui/
|
|
21562
|
+
'./ui/locale.js': require_context_module_1_27,
|
|
21563
|
+
'./ui/page-scroll-to.js': require_context_module_1_28,
|
|
21564
|
+
'./ui/set-page-meta.js': require_context_module_1_29,
|
|
21565
|
+
'./ui/tab-bar.js': require_context_module_1_30,
|
|
21566
|
+
'./ui/window.js': require_context_module_1_31,
|
|
20503
21567
|
|
|
20504
21568
|
};
|
|
20505
21569
|
var req = function req(key) {
|
|
@@ -20538,6 +21602,9 @@ var serviceContext = (function () {
|
|
|
20538
21602
|
}
|
|
20539
21603
|
const evalJSCode =
|
|
20540
21604
|
`typeof UniViewJSBridge !== 'undefined' && UniViewJSBridge.subscribeHandler("${eventType}",${args},__PAGE_ID__)`;
|
|
21605
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
21606
|
+
console.log(`UNIAPP[publishHandler]:[${+new Date()}]`, 'length', evalJSCode.length);
|
|
21607
|
+
}
|
|
20541
21608
|
pageIds.forEach(id => {
|
|
20542
21609
|
const webview = plus.webview.getWebviewById(String(id));
|
|
20543
21610
|
webview && webview.evalJS(evalJSCode.replace('__PAGE_ID__', id));
|
|
@@ -20650,18 +21717,12 @@ var serviceContext = (function () {
|
|
|
20650
21717
|
callCurrentPageHook('onHide');
|
|
20651
21718
|
}
|
|
20652
21719
|
|
|
20653
|
-
function onAppEnterForeground () {
|
|
20654
|
-
|
|
20655
|
-
|
|
20656
|
-
|
|
20657
|
-
|
|
20658
|
-
|
|
20659
|
-
const args = {
|
|
20660
|
-
path: page.route,
|
|
20661
|
-
query: page.options
|
|
20662
|
-
};
|
|
20663
|
-
|
|
20664
|
-
callAppHook(getApp(), 'onShow', args);
|
|
21720
|
+
function onAppEnterForeground (enterOptions) {
|
|
21721
|
+
callAppHook(getApp(), 'onShow', enterOptions);
|
|
21722
|
+
const pages = getCurrentPages();
|
|
21723
|
+
if (pages.length === 0) {
|
|
21724
|
+
return
|
|
21725
|
+
}
|
|
20665
21726
|
callCurrentPageHook('onShow');
|
|
20666
21727
|
}
|
|
20667
21728
|
|
|
@@ -20981,7 +22042,11 @@ var serviceContext = (function () {
|
|
|
20981
22042
|
});
|
|
20982
22043
|
|
|
20983
22044
|
plus.globalEvent.addEventListener('resume', () => {
|
|
20984
|
-
|
|
22045
|
+
const info = parseRedirectInfo();
|
|
22046
|
+
if (info && info.userAction) {
|
|
22047
|
+
initEnterOptions(info);
|
|
22048
|
+
}
|
|
22049
|
+
emit('onAppEnterForeground', getEnterOptions());
|
|
20985
22050
|
});
|
|
20986
22051
|
|
|
20987
22052
|
plus.globalEvent.addEventListener('netchange', () => {
|
|
@@ -20992,10 +22057,15 @@ var serviceContext = (function () {
|
|
|
20992
22057
|
});
|
|
20993
22058
|
});
|
|
20994
22059
|
|
|
22060
|
+
let keyboardHeightChange = 0;
|
|
20995
22061
|
plus.globalEvent.addEventListener('KeyboardHeightChange', function (event) {
|
|
20996
|
-
|
|
20997
|
-
|
|
20998
|
-
|
|
22062
|
+
// 安卓设备首次获取高度为 0
|
|
22063
|
+
if (keyboardHeightChange !== event.height) {
|
|
22064
|
+
keyboardHeightChange = event.height;
|
|
22065
|
+
publish('onKeyboardHeightChange', {
|
|
22066
|
+
height: keyboardHeightChange
|
|
22067
|
+
});
|
|
22068
|
+
}
|
|
20999
22069
|
});
|
|
21000
22070
|
|
|
21001
22071
|
globalEvent.addEventListener('uistylechange', function (event) {
|
|
@@ -21033,14 +22103,20 @@ var serviceContext = (function () {
|
|
|
21033
22103
|
}
|
|
21034
22104
|
|
|
21035
22105
|
function initAppLaunch (appVm) {
|
|
21036
|
-
const args = {
|
|
22106
|
+
const args = initLaunchOptions({
|
|
21037
22107
|
path: __uniConfig.entryPagePath,
|
|
21038
|
-
query:
|
|
21039
|
-
|
|
21040
|
-
};
|
|
22108
|
+
query: __uniConfig.entryPageQuery,
|
|
22109
|
+
referrerInfo: __uniConfig.referrerInfo
|
|
22110
|
+
});
|
|
21041
22111
|
|
|
21042
22112
|
callAppHook(appVm, 'onLaunch', args);
|
|
21043
22113
|
callAppHook(appVm, 'onShow', args);
|
|
22114
|
+
// https://tower.im/teams/226535/todos/16905/
|
|
22115
|
+
const getAppState = weex.requireModule('plus').getAppState;
|
|
22116
|
+
const appState = getAppState && Number(getAppState());
|
|
22117
|
+
if (appState === 2) {
|
|
22118
|
+
callAppHook(appVm, 'onHide', args);
|
|
22119
|
+
}
|
|
21044
22120
|
}
|
|
21045
22121
|
|
|
21046
22122
|
function initTabBar () {
|
|
@@ -21101,12 +22177,13 @@ var serviceContext = (function () {
|
|
|
21101
22177
|
});
|
|
21102
22178
|
}
|
|
21103
22179
|
|
|
21104
|
-
function registerApp (appVm) {
|
|
22180
|
+
function registerApp (appVm, Vue) {
|
|
21105
22181
|
if (process.env.NODE_ENV !== 'production') {
|
|
21106
22182
|
console.log('[uni-app] registerApp');
|
|
21107
22183
|
}
|
|
21108
22184
|
appCtx = appVm;
|
|
21109
22185
|
appCtx.$vm = appVm;
|
|
22186
|
+
initAppLocale(Vue, appVm);
|
|
21110
22187
|
|
|
21111
22188
|
Object.assign(appCtx, defaultApp); // 拷贝默认实现
|
|
21112
22189
|
|
|
@@ -21933,7 +23010,7 @@ var serviceContext = (function () {
|
|
|
21933
23010
|
|
|
21934
23011
|
return {
|
|
21935
23012
|
version: VD_SYNC_VERSION,
|
|
21936
|
-
locale: plus.
|
|
23013
|
+
locale: weex.requireModule('plus').getLanguage(),
|
|
21937
23014
|
disableScroll,
|
|
21938
23015
|
onPageScroll,
|
|
21939
23016
|
onPageReachBottom,
|
|
@@ -22010,6 +23087,8 @@ var serviceContext = (function () {
|
|
|
22010
23087
|
|
|
22011
23088
|
initPolyfill(Vue);
|
|
22012
23089
|
|
|
23090
|
+
uniIdMixin(Vue);
|
|
23091
|
+
|
|
22013
23092
|
Vue.prototype.getOpenerEventChannel = function () {
|
|
22014
23093
|
if (!this.$root.$scope.eventChannel) {
|
|
22015
23094
|
this.$root.$scope.eventChannel = new EventChannel();
|
|
@@ -22045,12 +23124,12 @@ var serviceContext = (function () {
|
|
|
22045
23124
|
console.log('[uni-app] launchApp');
|
|
22046
23125
|
}
|
|
22047
23126
|
plus.updateConfigInfo && plus.updateConfigInfo();
|
|
22048
|
-
registerApp(this);
|
|
23127
|
+
registerApp(this, Vue);
|
|
22049
23128
|
oldMount.call(this, el, hydrating);
|
|
22050
23129
|
});
|
|
22051
23130
|
return
|
|
22052
23131
|
}
|
|
22053
|
-
registerApp(this);
|
|
23132
|
+
registerApp(this, Vue);
|
|
22054
23133
|
}
|
|
22055
23134
|
return oldMount.call(this, el, hydrating)
|
|
22056
23135
|
};
|
|
@@ -22089,7 +23168,8 @@ var serviceContext = (function () {
|
|
|
22089
23168
|
__registerPage: registerPage,
|
|
22090
23169
|
uni: uni$1,
|
|
22091
23170
|
getApp: getApp$1,
|
|
22092
|
-
getCurrentPages: getCurrentPages$1
|
|
23171
|
+
getCurrentPages: getCurrentPages$1,
|
|
23172
|
+
EventChannel
|
|
22093
23173
|
};
|
|
22094
23174
|
|
|
22095
23175
|
return index$1;
|