Merge branch 'dev' of codeup.aliyun.com:61c14a7efa282c88e103c23f/oak-general-business into dev

This commit is contained in:
Xu Chang 2023-01-12 23:22:12 +08:00
commit a43e17d3f8
7 changed files with 60 additions and 34 deletions

View File

@ -25,6 +25,11 @@ exports.default = OakComponent({
var userId = features.token.getUserId(true); var userId = features.token.getUserId(true);
var application = features.application.getApplication(); var application = features.application.getApplication();
var systemId = application.systemId; var systemId = application.systemId;
if (!userId) {
return {
id: 'illegal',
};
}
return { return {
userId: userId, userId: userId,
// systemId, // systemId,

View File

@ -34,7 +34,7 @@ exports.default = OakComponent({
_c), _c),
filter: (_d = {}, filter: (_d = {},
_d["".concat(entity, "Id")] = entityId, _d["".concat(entity, "Id")] = entityId,
_d) _d),
}, },
_b.extraFile$entity = { _b.extraFile$entity = {
$entity: 'extraFile', $entity: 'extraFile',
@ -129,10 +129,17 @@ exports.default = OakComponent({
{ {
name: '通过分享二维码', name: '通过分享二维码',
mode: 'byQrCode', mode: 'byQrCode',
} },
], ],
idRemoveMp: '', idRemoveMp: '',
}, },
observers: {
'entity,entityId': function (entity, entityId) {
if (this.state.oakFullpath && entity && entityId) {
this.refresh();
}
},
},
lifetimes: {}, lifetimes: {},
methods: { methods: {
goUpsert: function () { goUpsert: function () {
@ -180,7 +187,7 @@ exports.default = OakComponent({
$in: relations.map(function (ele) { return ele.id; }), $in: relations.map(function (ele) { return ele.id; }),
}, },
}, },
} },
], ],
_b), idRemove); _b), idRemove);
return [4 /*yield*/, this.execute()]; return [4 /*yield*/, this.execute()];
@ -278,6 +285,6 @@ exports.default = OakComponent({
} }
}); });
}); });
} },
}, },
}); });

View File

@ -26,7 +26,7 @@ exports.default = OakComponent({
} }
else { else {
(0, assert_1.default)(type === 'web'); (0, assert_1.default)(type === 'web');
var passport = config.passport; var passport = config.passport || [];
grantByEmail = passport.includes('email'); grantByEmail = passport.includes('email');
grantByMobile = passport.includes('mobile'); grantByMobile = passport.includes('mobile');
grantByUserEntityGrant = passport.includes('wechat'); grantByUserEntityGrant = passport.includes('wechat');

View File

@ -1,6 +1,6 @@
{ {
"name": "oak-general-business", "name": "oak-general-business",
"version": "2.3.1", "version": "2.3.2",
"description": "oak框架中公共业务逻辑的实现", "description": "oak框架中公共业务逻辑的实现",
"author": { "author": {
"name": "XuChang" "name": "XuChang"

View File

@ -1,4 +1,3 @@
export default OakComponent({ export default OakComponent({
entity: 'message', entity: 'message',
isList: true, isList: true,
@ -23,7 +22,11 @@ export default OakComponent({
const userId = features.token.getUserId(true); const userId = features.token.getUserId(true);
const application = features.application.getApplication(); const application = features.application.getApplication();
const { systemId } = application; const { systemId } = application;
if (!userId) {
return {
id: 'illegal',
};
}
return { return {
userId, userId,
// systemId, // systemId,

View File

@ -29,7 +29,7 @@ export default OakComponent({
}, },
filter: { filter: {
[`${entity}Id`]: entityId, [`${entity}Id`]: entityId,
} },
}, },
extraFile$entity: { extraFile$entity: {
$entity: 'extraFile', $entity: 'extraFile',
@ -124,14 +124,22 @@ export default OakComponent({
{ {
name: '通过分享二维码', name: '通过分享二维码',
mode: 'byQrCode', mode: 'byQrCode',
} },
], ],
idRemoveMp: '', idRemoveMp: '',
}, },
observers: {
'entity,entityId': function (entity, entityId) {
if (this.state.oakFullpath && entity && entityId) {
this.refresh();
}
},
},
lifetimes: {}, lifetimes: {},
methods: { methods: {
goUpsert() { goUpsert() {
const { entity, entityId, relations, redirectToAfterConfirm } = this.props; const { entity, entityId, relations, redirectToAfterConfirm } =
this.props;
this.navigateTo( this.navigateTo(
{ {
url: '/userRelation/upsert', url: '/userRelation/upsert',
@ -162,11 +170,10 @@ export default OakComponent({
const { entity, entityId } = this.props; const { entity, entityId } = this.props;
const entityStr = firstLetterUpperCase(entity!); const entityStr = firstLetterUpperCase(entity!);
const { users } = this.state; const { users } = this.state;
const user = users.find( const user = users.find((ele: any) => ele.id === idRemove);
(ele: any) => ele.id === idRemove
);
const relations = user[`user${entityStr}$user`]; const relations = user[`user${entityStr}$user`];
this.updateItem({ this.updateItem(
{
[`user${entityStr}$user`]: [ [`user${entityStr}$user`]: [
{ {
id: generateNewId(), id: generateNewId(),
@ -177,9 +184,11 @@ export default OakComponent({
$in: relations.map((ele: any) => ele.id), $in: relations.map((ele: any) => ele.id),
}, },
}, },
} },
] ],
}, idRemove); },
idRemove
);
await this.execute(); await this.execute();
}, },
@ -204,8 +213,11 @@ export default OakComponent({
}, },
chooseActionMp(e: WechatMiniprogram.TouchEvent) { chooseActionMp(e: WechatMiniprogram.TouchEvent) {
const { entity, entityId, relations, redirectToAfterConfirm } = this.props; const { entity, entityId, relations, redirectToAfterConfirm } =
const { item: { mode }} = e.detail; this.props;
const {
item: { mode },
} = e.detail;
if (mode === 'byMobile') { if (mode === 'byMobile') {
this.navigateTo({ this.navigateTo({
url: '/userRelation/upsert/byMobile', url: '/userRelation/upsert/byMobile',
@ -213,8 +225,7 @@ export default OakComponent({
entityId, entityId,
relations, relations,
}); });
} } else {
else {
this.navigateTo({ this.navigateTo({
url: '/userRelation/upsert/byUserEntityGrant', url: '/userRelation/upsert/byUserEntityGrant',
entity, entity,
@ -259,7 +270,7 @@ export default OakComponent({
cancelDeleteMp() { cancelDeleteMp() {
this.setState({ this.setState({
idRemoveMp: '', idRemoveMp: '',
}) });
}, },
async confirmDeleteMp() { async confirmDeleteMp() {
@ -267,7 +278,7 @@ export default OakComponent({
await this.confirmDelete(idRemoveMp); await this.confirmDelete(idRemoveMp);
this.setState({ this.setState({
idRemoveMp: '', idRemoveMp: '',
}) });
} },
}, },
}); });

View File

@ -23,7 +23,7 @@ export default OakComponent({
grantByUserEntityGrant = true; grantByUserEntityGrant = true;
} else { } else {
assert(type === 'web'); assert(type === 'web');
const { passport } = config; const passport = config.passport || [];
grantByEmail = passport.includes('email'); grantByEmail = passport.includes('email');
grantByMobile = passport.includes('mobile'); grantByMobile = passport.includes('mobile');
grantByUserEntityGrant = passport.includes('wechat'); grantByUserEntityGrant = passport.includes('wechat');