Merge branch 'dev' of codeup.aliyun.com:61c14a7efa282c88e103c23f/oak-general-business into dev
This commit is contained in:
commit
37f32b0ba5
|
|
@ -1,6 +1,6 @@
|
||||||
// index.ts
|
// index.ts
|
||||||
|
|
||||||
OakPage({
|
export default OakPage({
|
||||||
path: 'address:list',
|
path: 'address:list',
|
||||||
entity: 'address',
|
entity: 'address',
|
||||||
projection: {
|
projection: {
|
||||||
|
|
@ -23,21 +23,21 @@ OakPage({
|
||||||
},
|
},
|
||||||
isList: true,
|
isList: true,
|
||||||
formData: async ({ data }) => ({
|
formData: async ({ data }) => ({
|
||||||
addresses: data.map(
|
addresses: data.map((address) => ({
|
||||||
(address) => ({
|
|
||||||
name: address?.name!,
|
name: address?.name!,
|
||||||
phone: address?.phone!,
|
phone: address?.phone!,
|
||||||
districtName: address?.area?.name!,
|
districtName: address?.area?.name!,
|
||||||
areaText: address?.area && `${address?.area?.parent?.parent?.name}${address?.area?.parent?.name}${address?.area?.name}`,
|
areaText:
|
||||||
|
address?.area &&
|
||||||
|
`${address?.area?.parent?.parent?.name}${address?.area?.parent?.name}${address?.area?.name}`,
|
||||||
detail: address?.detail,
|
detail: address?.detail,
|
||||||
})
|
})),
|
||||||
),
|
|
||||||
}),
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
goNewAddress() {
|
goNewAddress() {
|
||||||
this.navigateTo({
|
this.navigateTo({
|
||||||
url: '../upsert/index',
|
url: '../upsert/index',
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
OakPage({
|
export default OakPage({
|
||||||
path: 'address:upsert',
|
path: 'address:upsert',
|
||||||
entity: 'address',
|
entity: 'address',
|
||||||
projection: {
|
projection: {
|
||||||
|
|
@ -28,7 +28,9 @@ OakPage({
|
||||||
// provinceName: address?.area?.parent.parent.name,
|
// provinceName: address?.area?.parent.parent.name,
|
||||||
districtName: address?.area?.name!,
|
districtName: address?.area?.name!,
|
||||||
area: address?.area,
|
area: address?.area,
|
||||||
areaText: address?.area && `${address?.area?.parent?.parent?.name}${address?.area?.parent?.name}${address?.area?.name}`,
|
areaText:
|
||||||
|
address?.area &&
|
||||||
|
`${address?.area?.parent?.parent?.name}${address?.area?.parent?.name}${address?.area?.name}`,
|
||||||
detail: address?.detail,
|
detail: address?.detail,
|
||||||
}),
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -49,6 +51,6 @@ OakPage({
|
||||||
},
|
},
|
||||||
reset() {
|
reset() {
|
||||||
this.resetUpdateData();
|
this.resetUpdateData();
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { composeFileUrl } from '../../../../src/utils/extraFile';
|
import { composeFileUrl } from '../../../../src/utils/extraFile';
|
||||||
|
|
||||||
OakPage({
|
export default OakPage({
|
||||||
path: 'mobile:me',
|
path: 'mobile:me',
|
||||||
entity: 'mobile',
|
entity: 'mobile',
|
||||||
isList: true,
|
isList: true,
|
||||||
|
|
@ -19,13 +19,12 @@ OakPage({
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
console.log(e.detail.code);
|
console.log(e.detail.code);
|
||||||
}
|
} catch (err) {
|
||||||
catch (err) {
|
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
refreshing: false,
|
refreshing: false,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
OakPage({
|
export default OakPage({
|
||||||
path: 'area:picker',
|
path: 'area:picker',
|
||||||
entity: 'area',
|
entity: 'area',
|
||||||
projection: {
|
projection: {
|
||||||
|
|
@ -14,8 +14,8 @@ OakPage({
|
||||||
parent: {
|
parent: {
|
||||||
level: 'country',
|
level: 'country',
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
isList: true,
|
isList: true,
|
||||||
formData: async ({ data: arealist }) => ({
|
formData: async ({ data: arealist }) => ({
|
||||||
|
|
@ -29,21 +29,22 @@ OakPage({
|
||||||
onItemClicked(input: any) {
|
onItemClicked(input: any) {
|
||||||
// resolveInput里用的是target,原来的代码用的是currentTarget,可能有问题
|
// resolveInput里用的是target,原来的代码用的是currentTarget,可能有问题
|
||||||
const { dataset } = this.resolveInput(input);
|
const { dataset } = this.resolveInput(input);
|
||||||
const item = (this.state.arealist!).find(
|
const item = this.state.arealist!.find(
|
||||||
(ele) => ele?.id === dataset!.id
|
(ele) => ele?.id === dataset!.id
|
||||||
);
|
);
|
||||||
|
|
||||||
const { depth, id } = item!;
|
const { depth, id } = item!;
|
||||||
if (depth !== this.props.depth) {
|
if (depth !== this.props.depth) {
|
||||||
this.setFilters([{
|
this.setFilters([
|
||||||
|
{
|
||||||
filter: {
|
filter: {
|
||||||
parentId: id,
|
parentId: id,
|
||||||
}
|
},
|
||||||
}]);
|
},
|
||||||
}
|
]);
|
||||||
else {
|
} else {
|
||||||
this.setForeignKey(id!);
|
this.setForeignKey(id!);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
OakPage({
|
export default OakPage({
|
||||||
path: 'token:login',
|
path: 'token:login',
|
||||||
entity: 'token',
|
entity: 'token',
|
||||||
projection: {
|
projection: {
|
||||||
|
|
@ -19,7 +19,7 @@ OakPage({
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
loggedIn: false,
|
loggedIn: false,
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async onLoginClicked(options: WechatMiniprogram.Touch) {
|
async onLoginClicked(options: WechatMiniprogram.Touch) {
|
||||||
|
|
@ -30,6 +30,6 @@ OakPage({
|
||||||
|
|
||||||
onReturnClicked() {
|
onReturnClicked() {
|
||||||
this.navigateBack();
|
this.navigateBack();
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
import { ROOT_ROLE_ID } from '../../../../src/constants';
|
import { ROOT_ROLE_ID } from '../../../../src/constants';
|
||||||
import { composeFileUrl } from '../../../../src/utils/extraFile';
|
import { composeFileUrl } from '../../../../src/utils/extraFile';
|
||||||
|
|
||||||
OakPage(
|
export default OakPage({
|
||||||
{
|
|
||||||
path: 'token:me',
|
path: 'token:me',
|
||||||
entity: 'token',
|
entity: 'token',
|
||||||
isList: true,
|
isList: true,
|
||||||
|
|
@ -121,5 +120,4 @@ OakPage(
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
import { composeFileUrl } from "../../../../../src/utils/extraFile";
|
import { composeFileUrl } from "../../../../../src/utils/extraFile";
|
||||||
|
|
||||||
OakPage(
|
export default OakPage({
|
||||||
{
|
|
||||||
path: 'user:manage:detail',
|
path: 'user:manage:detail',
|
||||||
entity: 'user',
|
entity: 'user',
|
||||||
projection: {
|
projection: {
|
||||||
|
|
@ -170,5 +169,4 @@ OakPage(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
import { composeFileUrl } from "../../../../src/utils/extraFile";
|
import { composeFileUrl } from "../../../../src/utils/extraFile";
|
||||||
|
|
||||||
OakPage(
|
export default OakPage({
|
||||||
{
|
|
||||||
path: 'user:manage',
|
path: 'user:manage',
|
||||||
entity: 'user',
|
entity: 'user',
|
||||||
projection: {
|
projection: {
|
||||||
|
|
@ -84,5 +83,4 @@ OakPage(
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
@ -19,7 +19,7 @@ const IDCardTypeOptions = [
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
OakPage({
|
export default OakPage({
|
||||||
path: 'user:manage:upsert',
|
path: 'user:manage:upsert',
|
||||||
entity: 'user',
|
entity: 'user',
|
||||||
projection: {
|
projection: {
|
||||||
|
|
@ -35,31 +35,31 @@ OakPage({
|
||||||
isList: false,
|
isList: false,
|
||||||
formData: async ({ data: user }) => {
|
formData: async ({ data: user }) => {
|
||||||
const { birth, gender, idCardType } = user || {};
|
const { birth, gender, idCardType } = user || {};
|
||||||
const birthText = birth && (new Date(birth)).toLocaleDateString();
|
const birthText = birth && new Date(birth).toLocaleDateString();
|
||||||
const GenderDict = {
|
const GenderDict = {
|
||||||
male: '男',
|
male: '男',
|
||||||
female: '女',
|
female: '女',
|
||||||
};
|
};
|
||||||
const genderText = gender && GenderDict[gender];
|
const genderText = gender && GenderDict[gender];
|
||||||
const genderIndex = gender && GenderOptions.find(
|
const genderIndex =
|
||||||
ele => ele.value === gender
|
gender && GenderOptions.find((ele) => ele.value === gender);
|
||||||
);
|
|
||||||
const IdCardTypeDict = {
|
const IdCardTypeDict = {
|
||||||
'ID-Card': '身份证',
|
'ID-Card': '身份证',
|
||||||
'passport': '护照',
|
passport: '护照',
|
||||||
'Mainland-passport': '港澳通行证',
|
'Mainland-passport': '港澳通行证',
|
||||||
};
|
};
|
||||||
const idCardTypeText = idCardType && IdCardTypeDict[idCardType];
|
const idCardTypeText = idCardType && IdCardTypeDict[idCardType];
|
||||||
const idCardTypeIndex = idCardType && IDCardTypeOptions.find(
|
const idCardTypeIndex =
|
||||||
ele => ele.value === gender
|
idCardType && IDCardTypeOptions.find((ele) => ele.value === gender);
|
||||||
);
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
return Object.assign({}, user, {
|
return Object.assign({}, user, {
|
||||||
birthText,
|
birthText,
|
||||||
genderText,
|
genderText,
|
||||||
idCardTypeText,
|
idCardTypeText,
|
||||||
oldestBirthday: `${now.getFullYear() - 120}-01-01`,
|
oldestBirthday: `${now.getFullYear() - 120}-01-01`,
|
||||||
today: `${now.getFullYear()}-${now.getMonth() + 1}-${now.getDate()}`,
|
today: `${now.getFullYear()}-${
|
||||||
|
now.getMonth() + 1
|
||||||
|
}-${now.getDate()}`,
|
||||||
genderIndex,
|
genderIndex,
|
||||||
idCardTypeIndex,
|
idCardTypeIndex,
|
||||||
});
|
});
|
||||||
|
|
@ -84,17 +84,23 @@ OakPage({
|
||||||
},
|
},
|
||||||
onGenderChange(input: any) {
|
onGenderChange(input: any) {
|
||||||
const { value } = this.resolveInput(input);
|
const { value } = this.resolveInput(input);
|
||||||
this.setUpdateData('gender', GenderOptions[value as unknown as number].value)
|
this.setUpdateData(
|
||||||
|
'gender',
|
||||||
|
GenderOptions[value as unknown as number].value
|
||||||
|
);
|
||||||
},
|
},
|
||||||
onIdCardTypeChange(input: any) {
|
onIdCardTypeChange(input: any) {
|
||||||
const { value } = this.resolveInput(input);
|
const { value } = this.resolveInput(input);
|
||||||
this.setUpdateData('idCardType', IDCardTypeOptions[value as unknown as number].value)
|
this.setUpdateData(
|
||||||
|
'idCardType',
|
||||||
|
IDCardTypeOptions[value as unknown as number].value
|
||||||
|
);
|
||||||
},
|
},
|
||||||
async confirm() {
|
async confirm() {
|
||||||
await this.execute(this.props.oakId ? 'update' : 'create');
|
await this.execute(this.props.oakId ? 'update' : 'create');
|
||||||
if (this.props.oakFrom === 'user:manage:list') {
|
if (this.props.oakFrom === 'user:manage:list') {
|
||||||
this.navigateBack();
|
this.navigateBack();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
OakPage({
|
export default OakPage({
|
||||||
path: 'userEntityGrant:confirm',
|
path: 'userEntityGrant:confirm',
|
||||||
entity: 'userEntityGrant',
|
entity: 'userEntityGrant',
|
||||||
projection: {
|
projection: {
|
||||||
|
|
@ -10,11 +10,11 @@ OakPage({
|
||||||
formData: async ({ data: userEntityGrant }) => {
|
formData: async ({ data: userEntityGrant }) => {
|
||||||
return {
|
return {
|
||||||
relation: userEntityGrant?.relation,
|
relation: userEntityGrant?.relation,
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleConfirm() {
|
handleConfirm() {
|
||||||
this.execute('confirm');
|
this.execute('confirm');
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
OakPage({
|
export default OakPage({
|
||||||
path: 'userEntityGrant:detail',
|
path: 'userEntityGrant:detail',
|
||||||
entity: 'userEntityGrant',
|
entity: 'userEntityGrant',
|
||||||
projection: {
|
projection: {
|
||||||
|
|
@ -41,7 +41,8 @@ OakPage({
|
||||||
for (let i = 0; i < str.length; i++) {
|
for (let i = 0; i < str.length; i++) {
|
||||||
buf2[i] = str.charCodeAt(i);
|
buf2[i] = str.charCodeAt(i);
|
||||||
}
|
}
|
||||||
qrCodeUrl = 'data:image/jpeg;base64,' + wx.arrayBufferToBase64(buf2);
|
qrCodeUrl =
|
||||||
|
'data:image/jpeg;base64,' + wx.arrayBufferToBase64(buf2);
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
relation: userEntityGrant?.relation,
|
relation: userEntityGrant?.relation,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { EntityDict } from 'general-app-domain';
|
import { EntityDict } from 'general-app-domain';
|
||||||
import { DeduceCreateOperation, DeduceCreateSingleOperation, OakException, OakCongruentRowExists } from "oak-domain/lib/types";
|
import { DeduceCreateOperation, DeduceCreateSingleOperation, OakException, OakCongruentRowExists } from "oak-domain/lib/types";
|
||||||
|
|
||||||
OakPage({
|
export default OakPage({
|
||||||
path: 'userEntityGrant:upsert',
|
path: 'userEntityGrant:upsert',
|
||||||
entity: 'userEntityGrant',
|
entity: 'userEntityGrant',
|
||||||
|
|
||||||
|
|
@ -17,7 +17,7 @@ OakPage({
|
||||||
},
|
},
|
||||||
isList: false,
|
isList: false,
|
||||||
formData: async ({ data: userEntityGrant }) => ({
|
formData: async ({ data: userEntityGrant }) => ({
|
||||||
...userEntityGrant
|
...userEntityGrant,
|
||||||
}),
|
}),
|
||||||
properties: {
|
properties: {
|
||||||
entity: String,
|
entity: String,
|
||||||
|
|
@ -25,8 +25,7 @@ OakPage({
|
||||||
relations: String,
|
relations: String,
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
data: {
|
data: {},
|
||||||
},
|
|
||||||
lifetimes: {
|
lifetimes: {
|
||||||
ready() {
|
ready() {
|
||||||
this.setUpdateData('entity', this.props.entity);
|
this.setUpdateData('entity', this.props.entity);
|
||||||
|
|
@ -34,8 +33,8 @@ OakPage({
|
||||||
this.setUpdateData('type', this.props.type);
|
this.setUpdateData('type', this.props.type);
|
||||||
this.setState({
|
this.setState({
|
||||||
relationArr: JSON.parse(this.props.relations),
|
relationArr: JSON.parse(this.props.relations),
|
||||||
})
|
});
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
radioChange(input: any) {
|
radioChange(input: any) {
|
||||||
|
|
@ -49,18 +48,24 @@ OakPage({
|
||||||
[OakCongruentRowExists.name]
|
[OakCongruentRowExists.name]
|
||||||
);
|
);
|
||||||
|
|
||||||
const { data } = result as DeduceCreateSingleOperation<EntityDict['userEntityGrant']['OpSchema']>;
|
const { data } = result as DeduceCreateSingleOperation<
|
||||||
|
EntityDict['userEntityGrant']['OpSchema']
|
||||||
|
>;
|
||||||
const { id } = data;
|
const { id } = data;
|
||||||
|
|
||||||
this.navigateTo({
|
this.navigateTo({
|
||||||
url: '../detail/index',
|
url: '../detail/index',
|
||||||
oakId: id,
|
oakId: id,
|
||||||
});
|
});
|
||||||
}
|
} catch (error) {
|
||||||
catch (error) {
|
if (
|
||||||
if ((<OakException>error).constructor.name === OakCongruentRowExists.name) {
|
(<OakException>error).constructor.name ===
|
||||||
|
OakCongruentRowExists.name
|
||||||
|
) {
|
||||||
// 这里由于编译的问题,用instanceof会不通过检查
|
// 这里由于编译的问题,用instanceof会不通过检查
|
||||||
const data = (<OakCongruentRowExists<EntityDict, 'userEntityGrant'>>error).getData();
|
const data = (<
|
||||||
|
OakCongruentRowExists<EntityDict, 'userEntityGrant'>
|
||||||
|
>error).getData();
|
||||||
this.navigateTo({
|
this.navigateTo({
|
||||||
url: '../detail/index',
|
url: '../detail/index',
|
||||||
oakId: data.id,
|
oakId: data.id,
|
||||||
|
|
@ -68,5 +73,5 @@ OakPage({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { composeFileUrl } from '../../../../src/utils/extraFile';
|
import { composeFileUrl } from '../../../../src/utils/extraFile';
|
||||||
|
|
||||||
OakPage(
|
export default OakPage(
|
||||||
{
|
{
|
||||||
path: 'userRelation:list',
|
path: 'userRelation:list',
|
||||||
entity: 'user',
|
entity: 'user',
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { expandUuidTo36Bytes } from 'oak-domain/lib/utils/uuid'
|
import { expandUuidTo36Bytes } from 'oak-domain/lib/utils/uuid'
|
||||||
|
|
||||||
|
|
||||||
OakPage(
|
export default OakPage(
|
||||||
{
|
{
|
||||||
path: 'wechatQrCode:scan',
|
path: 'wechatQrCode:scan',
|
||||||
entity: 'wechatQrCode',
|
entity: 'wechatQrCode',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue