From 354ee30e2ab1e831a0cbd83c24b31ebb3072deae Mon Sep 17 00:00:00 2001
From: wkj <278599135@qq.com>
Date: Fri, 9 Sep 2022 19:21:35 +0800
Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=9B=BE=E7=89=87=E7=BB=84?=
=?UTF-8?q?=E4=BB=B6=E5=88=A0=E9=99=A4=E4=BF=AE=E6=AD=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/components/extraFile/display/web.d.ts | 1 +
lib/components/extraFile/gallery/index.js | 89 +++++++-------
lib/components/extraFile/gallery/web.d.ts | 1 +
lib/components/func/debugPanel/web.d.ts | 1 +
lib/general-app-domain/Captcha/Schema.d.ts | 1 -
lib/general-app-domain/Modi/Schema.d.ts | 3 -
lib/general-app-domain/Oper/Schema.d.ts | 3 -
lib/pages/address/list/web.d.ts | 1 +
lib/pages/address/upsert/web.d.ts | 1 +
lib/pages/article/detail/web.d.ts | 1 +
lib/pages/article/list/web.d.ts | 1 +
lib/pages/article/preview/web.d.ts | 1 +
lib/pages/article/upsert/web.d.ts | 1 +
lib/pages/login/web.d.ts | 1 +
lib/pages/mobile/login/web.d.ts | 1 +
lib/pages/mobile/me/web.d.ts | 1 +
lib/pages/pickers/area/web.d.ts | 1 +
lib/pages/token/me/web.d.ts | 1 +
lib/pages/user/manage/detail/web.d.ts | 1 +
lib/pages/user/manage/upsert/web.d.ts | 1 +
lib/pages/user/manage/web.d.ts | 1 +
lib/pages/user/manage/web.pc.d.ts | 1 +
lib/pages/user/search/web.d.ts | 1 +
lib/pages/userEntityGrant/confirm/web.d.ts | 1 +
lib/pages/userEntityGrant/detail/web.d.ts | 1 +
lib/pages/userEntityGrant/grant/web.d.ts | 1 +
lib/pages/userRelation/detail/web.d.ts | 1 +
lib/pages/userRelation/detail2/web.d.ts | 1 +
lib/pages/userRelation/list/web.d.ts | 1 +
lib/pages/userRelation/listTwo/web.d.ts | 1 +
lib/pages/userRelation/listTwo/web.pc.d.ts | 1 +
lib/pages/userRelation/manage/web.d.ts | 1 +
lib/pages/userRelation/onEntity/web.d.ts | 1 +
lib/pages/userRelation/onUser/web.d.ts | 1 +
lib/pages/userRelation/upsert/web.d.ts | 1 +
lib/pages/userRelation/upsert/web.pc.d.ts | 1 +
lib/pages/wechatQrCode/scan/web.d.ts | 1 +
lib/pages/wechatUser/login/web.d.ts | 1 +
src/components/extraFile/gallery/index.ts | 130 ++++++++++++---------
39 files changed, 155 insertions(+), 105 deletions(-)
diff --git a/lib/components/extraFile/display/web.d.ts b/lib/components/extraFile/display/web.d.ts
index cfaabf286..5eaeadcc2 100644
--- a/lib/components/extraFile/display/web.d.ts
+++ b/lib/components/extraFile/display/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(): JSX.Element;
diff --git a/lib/components/extraFile/gallery/index.js b/lib/components/extraFile/gallery/index.js
index 728754e82..13c361040 100644
--- a/lib/components/extraFile/gallery/index.js
+++ b/lib/components/extraFile/gallery/index.js
@@ -11,9 +11,9 @@ exports.default = OakComponent({
isList: true,
formData: function (_a) {
var _b, _c;
- var files = _a.data, features = _a.features;
+ var originalFiles = _a.data, features = _a.features;
return tslib_1.__awaiter(this, void 0, void 0, function () {
- var application, number2, files2;
+ var application, number2, files;
var _this = this;
return tslib_1.__generator(this, function (_d) {
switch (_d.label) {
@@ -21,25 +21,27 @@ exports.default = OakComponent({
case 1:
application = _d.sent();
number2 = this.props.maxNumber;
- files2 = files;
+ files = originalFiles;
if (this.props.tag1) {
- files2 = files2.filter(function (ele) { return (ele === null || ele === void 0 ? void 0 : ele.tag1) === _this.props.tag1; });
+ files = files === null || files === void 0 ? void 0 : files.filter(function (ele) { return (ele === null || ele === void 0 ? void 0 : ele.tag1) === _this.props.tag1; });
}
if (this.props.tag2) {
- files2 = files2.filter(function (ele) { return (ele === null || ele === void 0 ? void 0 : ele.tag2) === _this.props.tag2; });
+ files = files === null || files === void 0 ? void 0 : files.filter(function (ele) { return (ele === null || ele === void 0 ? void 0 : ele.tag2) === _this.props.tag2; });
}
if (typeof number2 === 'number' &&
(number2 === 0 || (files === null || files === void 0 ? void 0 : files.length) >= number2)) {
return [2 /*return*/, {
- files: files2,
+ files: files,
disableInsert: true,
systemConfig: (_b = application === null || application === void 0 ? void 0 : application.system) === null || _b === void 0 ? void 0 : _b.config,
+ originalFiles: originalFiles,
}];
}
return [2 /*return*/, {
- files: files2,
+ files: files,
disableInsert: false,
systemConfig: (_c = application === null || application === void 0 ? void 0 : application.system) === null || _c === void 0 ? void 0 : _c.config,
+ originalFiles: originalFiles,
}];
}
});
@@ -276,7 +278,6 @@ exports.default = OakComponent({
if (callback) {
callback(updateData);
}
- ;
ele = {
updateData: updateData,
};
@@ -316,18 +317,6 @@ exports.default = OakComponent({
});
});
},
- setNewUploadFiles: function (file) {
- var filename = file.filename, size = file.size, id = file.id;
- var newUploadFiles = this.state.newUploadFiles;
- var file2 = newUploadFiles.find(function (ele) { return ele.filename = filename && ele.size === size; });
- Object.assign(file2, {
- status: 'success',
- id: id,
- });
- this.setState({
- newUploadFiles: tslib_1.__spreadArray([], tslib_1.__read(newUploadFiles), false),
- });
- },
onItemTapped: function (event) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _a, files, systemConfig, index, imageUrl, urls, detail, result;
@@ -361,14 +350,16 @@ exports.default = OakComponent({
},
onDelete: function (event) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
- var _a, value, index, id, result, confirm_1;
+ var originalFiles, _a, value, index, id, findIndex, result, confirm_1;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
+ originalFiles = this.state.originalFiles;
_a = event.currentTarget.dataset, value = _a.value, index = _a.index;
id = value.id;
+ findIndex = originalFiles === null || originalFiles === void 0 ? void 0 : originalFiles.findIndex(function (ele) { return (ele === null || ele === void 0 ? void 0 : ele.id) === id; });
if (!(0, mockId_1.isMockId)(id)) return [3 /*break*/, 1];
- this.removeNode('', "".concat(index));
+ this.removeNode('', "".concat(findIndex));
return [3 /*break*/, 3];
case 1: return [4 /*yield*/, wx.showModal({
title: '确认删除吗',
@@ -378,7 +369,7 @@ exports.default = OakComponent({
result = _b.sent();
confirm_1 = result.confirm;
if (confirm_1) {
- this.removeNode('', "".concat(index));
+ this.removeNode('', "".concat(findIndex));
}
_b.label = 3;
case 3: return [2 /*return*/];
@@ -386,28 +377,16 @@ exports.default = OakComponent({
});
});
},
- customDelete: function (index) {
+ onWebDelete: function (value) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
- var newUploadFiles, arr;
- return tslib_1.__generator(this, function (_a) {
- newUploadFiles = this.state.newUploadFiles;
- arr = tslib_1.__spreadArray([], tslib_1.__read(newUploadFiles), false);
- arr.splice(index, 1);
- this.setState({
- newUploadFiles: arr,
- });
- return [2 /*return*/];
- });
- });
- },
- onWebDelete: function (value, index) {
- return tslib_1.__awaiter(this, void 0, void 0, function () {
- var id, confirm_2;
+ var originalFiles, id, findIndex, confirm_2;
var _this = this;
return tslib_1.__generator(this, function (_a) {
+ originalFiles = this.state.originalFiles;
id = value.id;
+ findIndex = originalFiles === null || originalFiles === void 0 ? void 0 : originalFiles.findIndex(function (ele) { return (ele === null || ele === void 0 ? void 0 : ele.id) === id; });
if ((0, mockId_1.isMockId)(id)) {
- this.removeNode('', "".concat(index));
+ this.removeNode('', "".concat(findIndex));
}
else {
confirm_2 = index_1.default.confirm({
@@ -418,7 +397,7 @@ exports.default = OakComponent({
cancelBtn: '取消',
confirmBtn: '确定',
onConfirm: function () {
- _this.removeNode('', "".concat(index));
+ _this.removeNode('', "".concat(findIndex));
confirm_2.hide();
},
onCancel: function () {
@@ -459,7 +438,7 @@ exports.default = OakComponent({
types_1.OakUnloggedInException.name) {
this.navigateTo({
url: '/login',
- });
+ }, undefined, true);
return [2 /*return*/];
}
throw error_2;
@@ -468,6 +447,32 @@ exports.default = OakComponent({
});
});
},
+ setNewUploadFiles: function (file) {
+ var filename = file.filename, size = file.size, id = file.id;
+ var newUploadFiles = this.state.newUploadFiles;
+ var file2 = newUploadFiles.findIndex(function (ele) { return (ele.filename = filename && ele.size === size); });
+ Object.assign(file2, {
+ status: 'success',
+ id: id,
+ });
+ this.setState({
+ newUploadFiles: tslib_1.__spreadArray([], tslib_1.__read(newUploadFiles), false),
+ });
+ },
+ customDelete: function (index) {
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
+ var newUploadFiles, arr;
+ return tslib_1.__generator(this, function (_a) {
+ newUploadFiles = this.state.newUploadFiles;
+ arr = tslib_1.__spreadArray([], tslib_1.__read(newUploadFiles), false);
+ arr.splice(index, 1);
+ this.setState({
+ newUploadFiles: arr,
+ });
+ return [2 /*return*/];
+ });
+ });
+ },
},
observers: {
maxNumber: function () {
diff --git a/lib/components/extraFile/gallery/web.d.ts b/lib/components/extraFile/gallery/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/components/extraFile/gallery/web.d.ts
+++ b/lib/components/extraFile/gallery/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/components/func/debugPanel/web.d.ts b/lib/components/func/debugPanel/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/components/func/debugPanel/web.d.ts
+++ b/lib/components/func/debugPanel/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/general-app-domain/Captcha/Schema.d.ts b/lib/general-app-domain/Captcha/Schema.d.ts
index cd2c03bf7..3a26edc06 100644
--- a/lib/general-app-domain/Captcha/Schema.d.ts
+++ b/lib/general-app-domain/Captcha/Schema.d.ts
@@ -43,7 +43,6 @@ declare type AttrFilter = {
code: Q_StringValue;
visitorId: Q_StringValue;
reason: Q_StringValue;
- env: Object;
expired: Q_BooleanValue;
expiresAt: Q_DateValue;
iState: Q_EnumValue;
diff --git a/lib/general-app-domain/Modi/Schema.d.ts b/lib/general-app-domain/Modi/Schema.d.ts
index 928c89ecc..49b0c3fbb 100644
--- a/lib/general-app-domain/Modi/Schema.d.ts
+++ b/lib/general-app-domain/Modi/Schema.d.ts
@@ -45,9 +45,6 @@ declare type AttrFilter = {
entity: Q_StringValue;
entityId: Q_StringValue;
action: Q_StringValue;
- data: Object;
- filter: Object;
- extra: Object;
iState: Q_EnumValue;
};
export declare type Filter = MakeFilter>;
diff --git a/lib/general-app-domain/Oper/Schema.d.ts b/lib/general-app-domain/Oper/Schema.d.ts
index ceca4a779..75390b64e 100644
--- a/lib/general-app-domain/Oper/Schema.d.ts
+++ b/lib/general-app-domain/Oper/Schema.d.ts
@@ -38,9 +38,6 @@ declare type AttrFilter = {
$$createAt$$: Q_DateValue;
$$updateAt$$: Q_DateValue;
action: Q_StringValue;
- data: Object;
- filter: Object;
- extra: Object;
operatorId: Q_StringValue | SubQuery.UserIdSubQuery;
operator: User.Filter;
};
diff --git a/lib/pages/address/list/web.d.ts b/lib/pages/address/list/web.d.ts
index cfaabf286..5eaeadcc2 100644
--- a/lib/pages/address/list/web.d.ts
+++ b/lib/pages/address/list/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(): JSX.Element;
diff --git a/lib/pages/address/upsert/web.d.ts b/lib/pages/address/upsert/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/address/upsert/web.d.ts
+++ b/lib/pages/address/upsert/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/article/detail/web.d.ts b/lib/pages/article/detail/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/article/detail/web.d.ts
+++ b/lib/pages/article/detail/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/article/list/web.d.ts b/lib/pages/article/list/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/article/list/web.d.ts
+++ b/lib/pages/article/list/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/article/preview/web.d.ts b/lib/pages/article/preview/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/article/preview/web.d.ts
+++ b/lib/pages/article/preview/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/article/upsert/web.d.ts b/lib/pages/article/upsert/web.d.ts
index 5a31aa4b8..6b79ea6c3 100644
--- a/lib/pages/article/upsert/web.d.ts
+++ b/lib/pages/article/upsert/web.d.ts
@@ -1,2 +1,3 @@
+///
import '@wangeditor/editor/dist/css/style.css';
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/login/web.d.ts b/lib/pages/login/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/login/web.d.ts
+++ b/lib/pages/login/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/mobile/login/web.d.ts b/lib/pages/mobile/login/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/mobile/login/web.d.ts
+++ b/lib/pages/mobile/login/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/mobile/me/web.d.ts b/lib/pages/mobile/me/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/mobile/me/web.d.ts
+++ b/lib/pages/mobile/me/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/pickers/area/web.d.ts b/lib/pages/pickers/area/web.d.ts
index cfaabf286..5eaeadcc2 100644
--- a/lib/pages/pickers/area/web.d.ts
+++ b/lib/pages/pickers/area/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(): JSX.Element;
diff --git a/lib/pages/token/me/web.d.ts b/lib/pages/token/me/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/token/me/web.d.ts
+++ b/lib/pages/token/me/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/user/manage/detail/web.d.ts b/lib/pages/user/manage/detail/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/user/manage/detail/web.d.ts
+++ b/lib/pages/user/manage/detail/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/user/manage/upsert/web.d.ts b/lib/pages/user/manage/upsert/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/user/manage/upsert/web.d.ts
+++ b/lib/pages/user/manage/upsert/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/user/manage/web.d.ts b/lib/pages/user/manage/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/user/manage/web.d.ts
+++ b/lib/pages/user/manage/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/user/manage/web.pc.d.ts b/lib/pages/user/manage/web.pc.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/user/manage/web.pc.d.ts
+++ b/lib/pages/user/manage/web.pc.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/user/search/web.d.ts b/lib/pages/user/search/web.d.ts
index cfaabf286..5eaeadcc2 100644
--- a/lib/pages/user/search/web.d.ts
+++ b/lib/pages/user/search/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(): JSX.Element;
diff --git a/lib/pages/userEntityGrant/confirm/web.d.ts b/lib/pages/userEntityGrant/confirm/web.d.ts
index cfaabf286..5eaeadcc2 100644
--- a/lib/pages/userEntityGrant/confirm/web.d.ts
+++ b/lib/pages/userEntityGrant/confirm/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(): JSX.Element;
diff --git a/lib/pages/userEntityGrant/detail/web.d.ts b/lib/pages/userEntityGrant/detail/web.d.ts
index cfaabf286..5eaeadcc2 100644
--- a/lib/pages/userEntityGrant/detail/web.d.ts
+++ b/lib/pages/userEntityGrant/detail/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(): JSX.Element;
diff --git a/lib/pages/userEntityGrant/grant/web.d.ts b/lib/pages/userEntityGrant/grant/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/userEntityGrant/grant/web.d.ts
+++ b/lib/pages/userEntityGrant/grant/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/userRelation/detail/web.d.ts b/lib/pages/userRelation/detail/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/userRelation/detail/web.d.ts
+++ b/lib/pages/userRelation/detail/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/userRelation/detail2/web.d.ts b/lib/pages/userRelation/detail2/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/userRelation/detail2/web.d.ts
+++ b/lib/pages/userRelation/detail2/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/userRelation/list/web.d.ts b/lib/pages/userRelation/list/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/userRelation/list/web.d.ts
+++ b/lib/pages/userRelation/list/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/userRelation/listTwo/web.d.ts b/lib/pages/userRelation/listTwo/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/userRelation/listTwo/web.d.ts
+++ b/lib/pages/userRelation/listTwo/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/userRelation/listTwo/web.pc.d.ts b/lib/pages/userRelation/listTwo/web.pc.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/userRelation/listTwo/web.pc.d.ts
+++ b/lib/pages/userRelation/listTwo/web.pc.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/userRelation/manage/web.d.ts b/lib/pages/userRelation/manage/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/userRelation/manage/web.d.ts
+++ b/lib/pages/userRelation/manage/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/userRelation/onEntity/web.d.ts b/lib/pages/userRelation/onEntity/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/userRelation/onEntity/web.d.ts
+++ b/lib/pages/userRelation/onEntity/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/userRelation/onUser/web.d.ts b/lib/pages/userRelation/onUser/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/userRelation/onUser/web.d.ts
+++ b/lib/pages/userRelation/onUser/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/userRelation/upsert/web.d.ts b/lib/pages/userRelation/upsert/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/userRelation/upsert/web.d.ts
+++ b/lib/pages/userRelation/upsert/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/userRelation/upsert/web.pc.d.ts b/lib/pages/userRelation/upsert/web.pc.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/userRelation/upsert/web.pc.d.ts
+++ b/lib/pages/userRelation/upsert/web.pc.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/wechatQrCode/scan/web.d.ts b/lib/pages/wechatQrCode/scan/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/wechatQrCode/scan/web.d.ts
+++ b/lib/pages/wechatQrCode/scan/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/lib/pages/wechatUser/login/web.d.ts b/lib/pages/wechatUser/login/web.d.ts
index 11df1296a..ad0b8f2aa 100644
--- a/lib/pages/wechatUser/login/web.d.ts
+++ b/lib/pages/wechatUser/login/web.d.ts
@@ -1 +1,2 @@
+///
export default function render(this: any): JSX.Element;
diff --git a/src/components/extraFile/gallery/index.ts b/src/components/extraFile/gallery/index.ts
index 5c5f07f55..a6c1e8775 100644
--- a/src/components/extraFile/gallery/index.ts
+++ b/src/components/extraFile/gallery/index.ts
@@ -8,34 +8,32 @@ import { composeFileUrl } from '../../../utils/extraFile';
export default OakComponent({
entity: 'extraFile',
isList: true,
- async formData({ data: files, features }) {
+ async formData({ data: originalFiles, features }) {
const application = await features.application.getApplication();
const number2 = this.props.maxNumber;
- let files2 = files;
+ let files = originalFiles as Array;
if (this.props.tag1) {
- files2 = files2.filter(
- ele => ele?.tag1 === this.props.tag1
- );
+ files = files?.filter((ele) => ele?.tag1 === this.props.tag1);
}
if (this.props.tag2) {
- files2 = files2.filter(
- ele => ele?.tag2 === this.props.tag2
- );
+ files = files?.filter((ele) => ele?.tag2 === this.props.tag2);
}
if (
typeof number2 === 'number' &&
(number2 === 0 || files?.length >= number2)
) {
return {
- files: files2,
+ files,
disableInsert: true,
systemConfig: application?.system?.config,
+ originalFiles,
};
}
return {
- files: files2,
+ files,
disableInsert: false,
systemConfig: application?.system?.config,
+ originalFiles,
};
},
data: {
@@ -171,22 +169,29 @@ export default OakComponent({
await Promise.all(
uploadFiles.map(async (uploadFile) => {
const { name, type: fileType, size, raw } = uploadFile;
- this.pushExtraFile({
- name,
- fileType,
- size,
- extra1: raw,
- }, callback);
+ this.pushExtraFile(
+ {
+ name,
+ fileType,
+ size,
+ extra1: raw,
+ },
+ callback
+ );
})
);
},
- async pushExtraFile(options: {
- name: string;
- extra1: any;
- fileType: string;
- size: number;
- }, callback?: (file:any) => void) {
- const { type, origin, tag1, tag2, entity, entityId, autoUpload } = this.props;
+ async pushExtraFile(
+ options: {
+ name: string;
+ extra1: any;
+ fileType: string;
+ size: number;
+ },
+ callback?: (file: any) => void
+ ) {
+ const { type, origin, tag1, tag2, entity, entityId, autoUpload } =
+ this.props;
const { name, extra1, fileType, size } = options;
const extension = name.substring(name.lastIndexOf('.') + 1);
const filename = name.substring(0, name.lastIndexOf('.'));
@@ -208,8 +213,9 @@ export default OakComponent({
// autoUpload为true, 选择直接上传七牛,再提交extraFile
if (autoUpload) {
try {
- const { bucket } =
- await this.features.extraFile.upload(updateData);
+ const { bucket } = await this.features.extraFile.upload(
+ updateData
+ );
try {
Object.assign(updateData, {
bucket,
@@ -220,7 +226,7 @@ export default OakComponent({
await this.addExtraFile(updateData);
if (callback) {
callback(updateData);
- };
+ }
const ele: Parameters[1] = {
updateData,
};
@@ -235,8 +241,9 @@ export default OakComponent({
const ele: Parameters[1] = {
updateData,
beforeExecute: async (updateData) => {
- const { bucket } =
- await this.features.extraFile.upload(updateData);
+ const { bucket } = await this.features.extraFile.upload(
+ updateData
+ );
Object.assign(updateData, {
bucket,
extra1: null,
@@ -247,18 +254,6 @@ export default OakComponent({
this.pushNode(undefined, ele);
}
},
- setNewUploadFiles(file: any) {
- const { filename, size, id } = file;
- const { newUploadFiles } = this.state;
- const file2 = newUploadFiles.find((ele: any) => ele.filename = filename && ele.size === size) as any;
- Object.assign(file2, {
- status: 'success',
- id,
- })
- this.setState({
- newUploadFiles: [...newUploadFiles],
- })
- },
async onItemTapped(event: WechatMiniprogram.Touch) {
const { files, systemConfig } = this.state;
const { index } = event.currentTarget.dataset;
@@ -284,10 +279,13 @@ export default OakComponent({
}
},
async onDelete(event: WechatMiniprogram.Touch) {
+ const { originalFiles } = this.state;
const { value, index } = event.currentTarget.dataset;
const { id } = value;
+ const findIndex = originalFiles?.findIndex((ele) => ele?.id === id);
+
if (isMockId(id)) {
- this.removeNode('', `${index}`);
+ this.removeNode('', `${findIndex}`);
} else {
const result = await wx.showModal({
title: '确认删除吗',
@@ -295,22 +293,16 @@ export default OakComponent({
});
const { confirm } = result;
if (confirm) {
- this.removeNode('', `${index}`);
+ this.removeNode('', `${findIndex}`);
}
}
},
- async customDelete(index: number) {
- const { newUploadFiles } = this.state;
- const arr = [...newUploadFiles];
- arr.splice(index, 1);
- this.setState({
- newUploadFiles: arr,
- })
- },
- async onWebDelete(value: any, index: number) {
+ async onWebDelete(value: any) {
+ const { originalFiles } = this.state;
const { id } = value;
+ const findIndex = originalFiles?.findIndex((ele) => ele?.id === id);
if (isMockId(id)) {
- this.removeNode('', `${index}`);
+ this.removeNode('', `${findIndex}`);
} else {
const confirm = Dialog.confirm({
header: '确认删除当前文件?',
@@ -320,7 +312,7 @@ export default OakComponent({
cancelBtn: '取消',
confirmBtn: '确定',
onConfirm: () => {
- this.removeNode('', `${index}`);
+ this.removeNode('', `${findIndex}`);
confirm.hide();
},
onCancel: () => {
@@ -349,14 +341,40 @@ export default OakComponent({
(error).constructor.name ===
OakUnloggedInException.name
) {
- this.navigateTo({
- url: '/login',
- });
+ this.navigateTo(
+ {
+ url: '/login',
+ },
+ undefined,
+ true
+ );
return;
}
throw error;
}
},
+ setNewUploadFiles(file: any) {
+ const { filename, size, id } = file;
+ const { newUploadFiles } = this.state;
+ const file2 = newUploadFiles.findIndex(
+ (ele: any) => (ele.filename = filename && ele.size === size)
+ ) as any;
+ Object.assign(file2, {
+ status: 'success',
+ id,
+ });
+ this.setState({
+ newUploadFiles: [...newUploadFiles],
+ });
+ },
+ async customDelete(index: number) {
+ const { newUploadFiles } = this.state;
+ const arr = [...newUploadFiles];
+ arr.splice(index, 1);
+ this.setState({
+ newUploadFiles: arr,
+ });
+ },
},
observers: {