This commit is contained in:
Wang Kejun 2022-07-25 12:08:14 +08:00
parent ecf897688a
commit 53c793050c
6 changed files with 48 additions and 29 deletions

View File

@ -190,7 +190,7 @@ module.exports = function (webpackEnv) {
sourceMap: isEnvProduction
? shouldUseSourceMap
: isEnvDevelopment,
root: paths.appSrc,
root: paths.appRootSrc,
},
},
{

View File

@ -85,7 +85,6 @@ const locale: LocaleDef<
subtitle: '副标题',
addrDetail: '地址',
type: '房屋类型',
lock: '锁',
floor: '楼层',
totalFloors: '总楼层',
roomNumber: '房间数',

View File

@ -1,26 +1,44 @@
import { EntityDict } from 'oak-app-domain';
import { Feature, BasicFeatures } from 'oak-frontend-base';
import { aspectDict } from '../aspects';
import { AspectWrapper } from 'oak-domain/lib/types';
import { BasicFeatures } from 'oak-frontend-base/lib/features';
import { Feature } from 'oak-frontend-base/lib/types/Feature';
import { CommonAspectDict } from 'oak-common-aspect';
import { AspectDict } from '../aspects/AspectDict';
import { RuntimeContext } from '../RuntimeContext';
type DoSthAcion = {
type: 'doSth',
type: 'doSth';
payload: {
args: string;
}
}
};
};
export class Sample extends Feature<EntityDict, RuntimeContext, typeof aspectDict> {
export class Sample extends Feature<
EntityDict,
RuntimeContext,
AspectDict & CommonAspectDict<EntityDict, RuntimeContext>
> {
get(params: any) {
throw new Error('Method not implemented.');
}
action(action: DoSthAcion) {
throw new Error('Method not implemented.');
}
cache: BasicFeatures<EntityDict, RuntimeContext, typeof aspectDict>['cache'];
cache: BasicFeatures<
EntityDict,
RuntimeContext,
AspectDict & CommonAspectDict<EntityDict, RuntimeContext>
>['cache'];
constructor(cache: BasicFeatures<EntityDict, RuntimeContext, typeof aspectDict>['cache']) {
super();
constructor(
aspectWrapper: AspectWrapper<EntityDict, RuntimeContext, AspectDict>,
cache: BasicFeatures<
EntityDict,
RuntimeContext,
AspectDict & CommonAspectDict<EntityDict, RuntimeContext>
>['cache']
) {
super(aspectWrapper);
this.cache = cache;
};
};
}
}

View File

@ -1,5 +1,5 @@
import { EntityDict } from 'oak-app-domain';
import { BasicFeatures } from 'oak-frontend-base';
import { BasicFeatures } from 'oak-frontend-base/lib/features';
import { CommonAspectDict } from 'oak-common-aspect';
import * as Sample from './Sample';
import { AspectDict } from '../aspects/AspectDict';

View File

@ -1,5 +1,5 @@
import './utils/polyfill';
import { initialize as init } from 'oak-frontend-base/src/initialize.dev';
import { initialize as init } from 'oak-frontend-base/lib/initialize.dev';
import { EntityDict, storageSchema, ActionDefDict } from 'oak-app-domain';
import { CommonAspectDict } from 'oak-common-aspect';
@ -12,7 +12,6 @@ import { data } from './data';
import { routers } from './exceptionRouters';
import { checkers } from './checkers';
// dev需要将下面内容也传入
import { AspectDict } from './aspects/AspectDict';
import { aspectDict } from './aspects';
@ -20,7 +19,7 @@ import { triggers } from './triggers';
import { watchers } from './watchers';
import { AspectWrapper } from 'oak-domain/lib/types';
import { BasicFeatures } from 'oak-frontend-base';
import { BasicFeatures } from 'oak-frontend-base/lib/features';
import { AppType } from 'oak-app-domain/Application/Schema';
export default function initialize(type: AppType, url?: string) {
@ -73,7 +72,7 @@ export default function initialize(type: AppType, url?: string) {
checkers,
watchers,
data as any,
ActionDefDict,
ActionDefDict
);
return {

View File

@ -1,5 +1,5 @@
import './utils/polyfill';
import { initialize as init } from 'oak-frontend-base/src/initialize.prod';
import { initialize as init } from 'oak-frontend-base/lib/initialize.prod';
import { SimpleConnector } from 'oak-domain/lib/utils/SimpleConnector';
import { AspectWrapper } from 'oak-domain/lib/types';
@ -15,10 +15,9 @@ import { checkers } from './checkers';
import { makeException } from './types/Exception';
import { AspectDict } from './aspects/AspectDict';
import { BasicFeatures } from 'oak-frontend-base';
import { BasicFeatures } from 'oak-frontend-base/lib/features';
import { AppType } from 'oak-app-domain/Application/Schema';
export default function initialize(type: AppType, url: string) {
let wholeFeatures = {};
const createFeatures = (
@ -60,18 +59,22 @@ export default function initialize(type: AppType, url: string) {
*/
if (type === 'wechatMp') {
// 如果是小程序需要显式传入url
const apiPath = process.env.NODE_ENV === 'development' ? '3001': '/oak-api'; // 生产环境通过路径映射增加oak-api
const protocol = process.env.NODE_ENV === 'development' ? 'http://' : 'https://';
const apiPath =
process.env.NODE_ENV === 'development' ? '3001' : '/oak-api'; // 生产环境通过路径映射增加oak-api
const protocol =
process.env.NODE_ENV === 'development' ? 'http://' : 'https://';
URL = `${protocol}${url}${apiPath}/aspect`;
}
else if (process.env.NODE_ENV === 'development') {
} else if (process.env.NODE_ENV === 'development') {
URL = 'http://localhost:3001/aspect';
}
else {
} else {
// web和public环境只需要传相对路径
URL = `/oak-api/aspect`;
}
const connector = new SimpleConnector(URL, makeException, RuntimeContext.FromCxtStr);
const connector = new SimpleConnector(
URL,
makeException,
RuntimeContext.FromCxtStr
);
const { i18n } = init<
EntityDict,
RuntimeContext,
@ -84,7 +87,7 @@ export default function initialize(type: AppType, url: string) {
routers,
connector,
checkers,
ActionDefDict,
ActionDefDict
);
return {