build
This commit is contained in:
parent
9c0b1f69e4
commit
a84c28fed1
|
|
@ -45,9 +45,9 @@ export declare function syncUserInfoWechatMp<ED extends EntityDict, Cxt extends
|
|||
iv: string;
|
||||
signature: string;
|
||||
}, context: Cxt): Promise<void>;
|
||||
export declare function sendCaptcha<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>({ mobile, env, type: type2 }: {
|
||||
export declare function sendCaptcha<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>({ mobile, env, type: type2, }: {
|
||||
mobile: string;
|
||||
env: WechatMpEnv | WebEnv;
|
||||
env: WechatMpEnv | WebEnv | NativeEnv;
|
||||
type: 'login' | 'changePassword' | 'confirm';
|
||||
}, context: Cxt): Promise<string>;
|
||||
export declare function switchTo<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>({ userId }: {
|
||||
|
|
|
|||
|
|
@ -1034,7 +1034,7 @@ export async function syncUserInfoWechatMp({ nickname, avatarUrl, encryptedData,
|
|||
// 实测发现解密出来的和userInfo完全一致……
|
||||
await setUserInfoFromWechat(user, { nickname, avatar: avatarUrl }, context);
|
||||
}
|
||||
export async function sendCaptcha({ mobile, env, type: type2 }, context) {
|
||||
export async function sendCaptcha({ mobile, env, type: type2, }, context) {
|
||||
const { type } = env;
|
||||
assert(type === 'web' || type === 'native');
|
||||
let { visitorId } = env;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
import { EntityDict } from '../../../oak-app-domain';
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'message', false, {
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'user', false, {
|
||||
user: EntityDict['user']['Schema'];
|
||||
failTimes: number;
|
||||
}, {
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends key
|
|||
type?: ButtonProps['type'] | AmButtonProps['type'];
|
||||
executeText?: string | undefined;
|
||||
buttonProps?: (ButtonProps & {
|
||||
color?: "success" | "default" | "primary" | "warning" | "danger" | undefined;
|
||||
color?: "success" | "default" | "warning" | "primary" | "danger" | undefined;
|
||||
fill?: "none" | "solid" | "outline" | undefined;
|
||||
size?: "small" | "large" | "middle" | "mini" | undefined;
|
||||
size?: "small" | "middle" | "large" | "mini" | undefined;
|
||||
block?: boolean | undefined;
|
||||
loading?: boolean | "auto" | undefined;
|
||||
loadingText?: string | undefined;
|
||||
|
|
@ -24,7 +24,7 @@ declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends key
|
|||
type?: "button" | "reset" | "submit" | undefined;
|
||||
shape?: "default" | "rounded" | "rectangular" | undefined;
|
||||
children?: import("react").ReactNode;
|
||||
} & Pick<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement>, "id" | "onMouseUp" | "onMouseDown" | "onTouchStart" | "onTouchEnd"> & {
|
||||
} & Pick<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement>, "id" | "onMouseDown" | "onMouseUp" | "onTouchStart" | "onTouchEnd"> & {
|
||||
className?: string | undefined;
|
||||
style?: (import("react").CSSProperties & Partial<Record<"--text-color" | "--background-color" | "--border-radius" | "--border-width" | "--border-style" | "--border-color", string>>) | undefined;
|
||||
tabIndex?: number | undefined;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,19 @@ export default OakComponent({
|
|||
indexFrom: 0,
|
||||
count: 1,
|
||||
},
|
||||
user$ref: {
|
||||
$entity: 'user',
|
||||
data: {
|
||||
id: 1,
|
||||
mobile$user: {
|
||||
$entity: 'mobile',
|
||||
data: {
|
||||
id: 1,
|
||||
mobile: 1,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
mobile$user: {
|
||||
$entity: 'mobile',
|
||||
data: {
|
||||
|
|
@ -70,7 +83,7 @@ export default OakComponent({
|
|||
const avatarFile = user?.extraFile$entity && user?.extraFile$entity[0];
|
||||
const avatar = features.extraFile.getUrl(avatarFile);
|
||||
const nickname = user && user.nickname;
|
||||
const mobileData = user && user.mobile$user && user.mobile$user[0];
|
||||
const mobileData = user && user.mobile$user && user.mobile$user[0] || user && user.user$ref && user.user$ref.filter((ele) => ele.mobile$user)[0]?.mobile$user[0];
|
||||
const { mobile } = mobileData || {};
|
||||
const mobileCount = user?.mobile$user?.length || 0;
|
||||
const isLoggedIn = !!token;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { EntityDict } from '../../../oak-app-domain';
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, keyof EntityDict, false, {
|
||||
type: "login" | "bind";
|
||||
type: "bind" | "login";
|
||||
url: string;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
console.log('走不到这里');
|
||||
console.log('走不到这里[data/area]');
|
||||
import area from './area.dev';
|
||||
export default area;
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
console.warn('不应该跑到这里');
|
||||
console.warn('不应该跑到这里[features/weiXinJsSdk]');
|
||||
export * from './weiXinJsSdk.web';
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export declare function createToDo<ED extends EntityDict & BaseEntityDict, T ext
|
|||
title: string;
|
||||
description?: string;
|
||||
redirectTo: EntityDict['toDo']['OpSchema']['redirectTo'];
|
||||
}, userIds?: string[]): Promise<0 | 1>;
|
||||
}, userIds?: string[]): Promise<1 | 0>;
|
||||
/**
|
||||
* 完成todo例程,当在entity对象上进行action操作时(操作条件是filter),将对应的todo完成
|
||||
* 必须在entity的action的后trigger中调用
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ export default class CTYun {
|
|||
bucket2 = defaultBucket;
|
||||
}
|
||||
assert(bucket2);
|
||||
const b = buckets.find((ele) => ele.name === bucket2);
|
||||
const b = buckets.find(ele => ele.name === bucket2);
|
||||
assert(b, `${bucket2}不是一个有效的桶配置`);
|
||||
Object.assign(extraFile, {
|
||||
bucket: bucket2,
|
||||
|
|
@ -35,37 +35,34 @@ export default class CTYun {
|
|||
const uploadMeta = extraFile.uploadMeta;
|
||||
let response;
|
||||
try {
|
||||
response = await uploadFn(
|
||||
file,
|
||||
'file',
|
||||
uploadMeta.uploadHost,
|
||||
{
|
||||
key: uploadMeta.key,
|
||||
Policy: uploadMeta.policy,
|
||||
AWSAccessKeyId: uploadMeta.accessKey,
|
||||
signature: uploadMeta.signature,
|
||||
},
|
||||
true
|
||||
);
|
||||
} catch (err) {
|
||||
response = await uploadFn(file, 'file', uploadMeta.uploadHost, {
|
||||
key: uploadMeta.key,
|
||||
Policy: uploadMeta.policy,
|
||||
AWSAccessKeyId: uploadMeta.accessKey,
|
||||
signature: uploadMeta.signature,
|
||||
}, true);
|
||||
}
|
||||
catch (err) {
|
||||
// 网络错误
|
||||
throw new OakNetworkException('网络异常,请求失败');
|
||||
}
|
||||
let isSuccess = false;
|
||||
if (process.env.OAK_PLATFORM === 'wechatMp') {
|
||||
// 小程序端上传 使用wx.uploadFile
|
||||
// 小程序端上传 使用wx.uploadFile
|
||||
// 待测试
|
||||
if (response.errMsg === 'uploadFile:ok') {
|
||||
const data = JSON.parse(response.data);
|
||||
isSuccess = !!(data.status === 204);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
isSuccess = !!(response.status === 204);
|
||||
}
|
||||
// 解析回调
|
||||
if (isSuccess) {
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
throw new OakUploadException('图片上传天翼云失败');
|
||||
}
|
||||
}
|
||||
|
|
@ -76,9 +73,7 @@ export default class CTYun {
|
|||
}
|
||||
const { config } = getConfig(context, 'Cos', 'ctyun');
|
||||
if (config) {
|
||||
let bucket = config.buckets.find(
|
||||
(ele) => ele.name === extraFile.bucket
|
||||
);
|
||||
let bucket = config.buckets.find((ele) => ele.name === extraFile.bucket);
|
||||
if (bucket) {
|
||||
const { domain, protocol } = bucket;
|
||||
let protocol2 = protocol;
|
||||
|
|
@ -97,6 +92,7 @@ export default class CTYun {
|
|||
async checkWhetherSuccess(extraFile, context) {
|
||||
return true;
|
||||
}
|
||||
async removeFile(extraFile, context) {}
|
||||
async removeFile(extraFile, context) {
|
||||
}
|
||||
}
|
||||
;
|
||||
|
|
|
|||
|
|
@ -35,17 +35,12 @@ export default class Qiniu {
|
|||
const uploadMeta = extraFile.uploadMeta;
|
||||
let response;
|
||||
try {
|
||||
response = await uploadFn(
|
||||
file,
|
||||
'file',
|
||||
uploadMeta.uploadHost,
|
||||
{
|
||||
key: uploadMeta.key,
|
||||
token: uploadMeta.uploadToken,
|
||||
},
|
||||
true
|
||||
);
|
||||
} catch (err) {
|
||||
response = await uploadFn(file, 'file', uploadMeta.uploadHost, {
|
||||
key: uploadMeta.key,
|
||||
token: uploadMeta.uploadToken,
|
||||
}, true);
|
||||
}
|
||||
catch (err) {
|
||||
// 网络错误
|
||||
throw new OakNetworkException('网络异常,请求失败');
|
||||
}
|
||||
|
|
@ -56,14 +51,16 @@ export default class Qiniu {
|
|||
const data = JSON.parse(response.data);
|
||||
isSuccess = !!(data.success === true || data.key);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
const data = await response.json();
|
||||
isSuccess = !!(data.success === true || data.key);
|
||||
}
|
||||
// 解析回调
|
||||
if (isSuccess) {
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
throw new OakUploadException('图片上传七牛失败');
|
||||
}
|
||||
}
|
||||
|
|
@ -74,9 +71,7 @@ export default class Qiniu {
|
|||
}
|
||||
const { config } = getConfig(context, 'Cos', 'qiniu');
|
||||
if (config) {
|
||||
let bucket = config.buckets.find(
|
||||
(ele) => ele.name === extraFile.bucket
|
||||
);
|
||||
let bucket = config.buckets.find((ele) => ele.name === extraFile.bucket);
|
||||
if (bucket) {
|
||||
const { domain, protocol } = bucket;
|
||||
let protocol2 = protocol;
|
||||
|
|
@ -96,23 +91,15 @@ export default class Qiniu {
|
|||
const key = this.formKey(extraFile);
|
||||
const { instance, config } = getConfig(context, 'Cos', 'qiniu');
|
||||
// web环境下访问不了七牛接口,用mockData过
|
||||
const mockData =
|
||||
process.env.OAK_PLATFORM === 'web' ? { fsize: 100 } : undefined;
|
||||
const mockData = process.env.OAK_PLATFORM === 'web' ? { fsize: 100 } : undefined;
|
||||
const b = config.buckets.find((ele) => ele.name === extraFile.bucket);
|
||||
assert(
|
||||
b,
|
||||
`extraFile中的bucket名称在七牛配置中找不到「${extraFile.bucket}」`
|
||||
);
|
||||
assert(b, `extraFile中的bucket名称在七牛配置中找不到「${extraFile.bucket}」`);
|
||||
try {
|
||||
const result = await instance.getKodoFileStat(
|
||||
extraFile.bucket,
|
||||
b.zone,
|
||||
key,
|
||||
mockData
|
||||
);
|
||||
const result = await instance.getKodoFileStat(extraFile.bucket, b.zone, key, mockData);
|
||||
const { fsize } = result;
|
||||
return fsize > 0;
|
||||
} catch (err) {
|
||||
}
|
||||
catch (err) {
|
||||
// 七牛如果文件不存在会抛出status = 612的异常
|
||||
if (err instanceof OakExternalException) {
|
||||
const data = err.data;
|
||||
|
|
@ -129,18 +116,11 @@ export default class Qiniu {
|
|||
// web环境下访问不了七牛接口,用mockData过
|
||||
const mockData = process.env.OAK_PLATFORM === 'web' ? true : undefined;
|
||||
const b = config.buckets.find((ele) => ele.name === extraFile.bucket);
|
||||
assert(
|
||||
b,
|
||||
`extraFile中的bucket名称在七牛配置中找不到「${extraFile.bucket}」`
|
||||
);
|
||||
assert(b, `extraFile中的bucket名称在七牛配置中找不到「${extraFile.bucket}」`);
|
||||
try {
|
||||
await instance.removeKodoFile(
|
||||
extraFile.bucket,
|
||||
b.zone,
|
||||
key,
|
||||
mockData
|
||||
);
|
||||
} catch (err) {
|
||||
await instance.removeKodoFile(extraFile.bucket, b.zone, key, mockData);
|
||||
}
|
||||
catch (err) {
|
||||
// 七牛如果文件不存在会抛出status = 612的异常
|
||||
if (err instanceof OakExternalException) {
|
||||
const data = err.data;
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ export declare function syncUserInfoWechatMp<ED extends EntityDict, Cxt extends
|
|||
iv: string;
|
||||
signature: string;
|
||||
}, context: Cxt): Promise<void>;
|
||||
export declare function sendCaptcha<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>({ mobile, env, type: type2 }: {
|
||||
export declare function sendCaptcha<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>({ mobile, env, type: type2, }: {
|
||||
mobile: string;
|
||||
env: WechatMpEnv | WebEnv;
|
||||
env: WechatMpEnv | WebEnv | NativeEnv;
|
||||
type: 'login' | 'changePassword' | 'confirm';
|
||||
}, context: Cxt): Promise<string>;
|
||||
export declare function switchTo<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>({ userId }: {
|
||||
|
|
|
|||
|
|
@ -1043,7 +1043,7 @@ async function syncUserInfoWechatMp({ nickname, avatarUrl, encryptedData, iv, si
|
|||
await setUserInfoFromWechat(user, { nickname, avatar: avatarUrl }, context);
|
||||
}
|
||||
exports.syncUserInfoWechatMp = syncUserInfoWechatMp;
|
||||
async function sendCaptcha({ mobile, env, type: type2 }, context) {
|
||||
async function sendCaptcha({ mobile, env, type: type2, }, context) {
|
||||
const { type } = env;
|
||||
(0, assert_1.assert)(type === 'web' || type === 'native');
|
||||
let { visitorId } = env;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export declare function createToDo<ED extends EntityDict & BaseEntityDict, T ext
|
|||
title: string;
|
||||
description?: string;
|
||||
redirectTo: EntityDict['toDo']['OpSchema']['redirectTo'];
|
||||
}, userIds?: string[]): Promise<0 | 1>;
|
||||
}, userIds?: string[]): Promise<1 | 0>;
|
||||
/**
|
||||
* 完成todo例程,当在entity对象上进行action操作时(操作条件是filter),将对应的todo完成
|
||||
* 必须在entity的action的后trigger中调用
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class Qiniu {
|
|||
bucket2 = defaultBucket;
|
||||
}
|
||||
(0, assert_1.assert)(bucket2);
|
||||
const b = buckets.find(ele => ele.name === bucket2);
|
||||
const b = buckets.find((ele) => ele.name === bucket2);
|
||||
(0, assert_1.assert)(b, `${bucket2}不是一个有效的桶配置`);
|
||||
Object.assign(extraFile, {
|
||||
bucket: bucket2,
|
||||
|
|
@ -94,7 +94,7 @@ class Qiniu {
|
|||
const { instance, config } = (0, getContextConfig_1.getConfig)(context, 'Cos', 'qiniu');
|
||||
// web环境下访问不了七牛接口,用mockData过
|
||||
const mockData = process.env.OAK_PLATFORM === 'web' ? { fsize: 100 } : undefined;
|
||||
const b = config.buckets.find(ele => ele.name === extraFile.bucket);
|
||||
const b = config.buckets.find((ele) => ele.name === extraFile.bucket);
|
||||
(0, assert_1.assert)(b, `extraFile中的bucket名称在七牛配置中找不到「${extraFile.bucket}」`);
|
||||
try {
|
||||
const result = await instance.getKodoFileStat(extraFile.bucket, b.zone, key, mockData);
|
||||
|
|
@ -117,7 +117,7 @@ class Qiniu {
|
|||
const { instance, config } = (0, getContextConfig_1.getConfig)(context, 'Cos', 'qiniu');
|
||||
// web环境下访问不了七牛接口,用mockData过
|
||||
const mockData = process.env.OAK_PLATFORM === 'web' ? true : undefined;
|
||||
const b = config.buckets.find(ele => ele.name === extraFile.bucket);
|
||||
const b = config.buckets.find((ele) => ele.name === extraFile.bucket);
|
||||
(0, assert_1.assert)(b, `extraFile中的bucket名称在七牛配置中找不到「${extraFile.bucket}」`);
|
||||
try {
|
||||
await instance.removeKodoFile(extraFile.bucket, b.zone, key, mockData);
|
||||
|
|
|
|||
Loading…
Reference in New Issue