This commit is contained in:
parent
ecf897688a
commit
53c793050c
|
|
@ -190,7 +190,7 @@ module.exports = function (webpackEnv) {
|
||||||
sourceMap: isEnvProduction
|
sourceMap: isEnvProduction
|
||||||
? shouldUseSourceMap
|
? shouldUseSourceMap
|
||||||
: isEnvDevelopment,
|
: isEnvDevelopment,
|
||||||
root: paths.appSrc,
|
root: paths.appRootSrc,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,6 @@ const locale: LocaleDef<
|
||||||
subtitle: '副标题',
|
subtitle: '副标题',
|
||||||
addrDetail: '地址',
|
addrDetail: '地址',
|
||||||
type: '房屋类型',
|
type: '房屋类型',
|
||||||
lock: '锁',
|
|
||||||
floor: '楼层',
|
floor: '楼层',
|
||||||
totalFloors: '总楼层',
|
totalFloors: '总楼层',
|
||||||
roomNumber: '房间数',
|
roomNumber: '房间数',
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,44 @@
|
||||||
import { EntityDict } from 'oak-app-domain';
|
import { EntityDict } from 'oak-app-domain';
|
||||||
import { Feature, BasicFeatures } from 'oak-frontend-base';
|
import { AspectWrapper } from 'oak-domain/lib/types';
|
||||||
import { aspectDict } from '../aspects';
|
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';
|
import { RuntimeContext } from '../RuntimeContext';
|
||||||
|
|
||||||
type DoSthAcion = {
|
type DoSthAcion = {
|
||||||
type: 'doSth',
|
type: 'doSth';
|
||||||
payload: {
|
payload: {
|
||||||
args: string;
|
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) {
|
get(params: any) {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
action(action: DoSthAcion) {
|
action(action: DoSthAcion) {
|
||||||
throw new Error('Method not implemented.');
|
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']) {
|
constructor(
|
||||||
super();
|
aspectWrapper: AspectWrapper<EntityDict, RuntimeContext, AspectDict>,
|
||||||
|
cache: BasicFeatures<
|
||||||
|
EntityDict,
|
||||||
|
RuntimeContext,
|
||||||
|
AspectDict & CommonAspectDict<EntityDict, RuntimeContext>
|
||||||
|
>['cache']
|
||||||
|
) {
|
||||||
|
super(aspectWrapper);
|
||||||
this.cache = cache;
|
this.cache = cache;
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { EntityDict } from 'oak-app-domain';
|
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 { CommonAspectDict } from 'oak-common-aspect';
|
||||||
import * as Sample from './Sample';
|
import * as Sample from './Sample';
|
||||||
import { AspectDict } from '../aspects/AspectDict';
|
import { AspectDict } from '../aspects/AspectDict';
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import './utils/polyfill';
|
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 { EntityDict, storageSchema, ActionDefDict } from 'oak-app-domain';
|
||||||
import { CommonAspectDict } from 'oak-common-aspect';
|
import { CommonAspectDict } from 'oak-common-aspect';
|
||||||
|
|
@ -12,7 +12,6 @@ import { data } from './data';
|
||||||
import { routers } from './exceptionRouters';
|
import { routers } from './exceptionRouters';
|
||||||
import { checkers } from './checkers';
|
import { checkers } from './checkers';
|
||||||
|
|
||||||
|
|
||||||
// dev需要将下面内容也传入
|
// dev需要将下面内容也传入
|
||||||
import { AspectDict } from './aspects/AspectDict';
|
import { AspectDict } from './aspects/AspectDict';
|
||||||
import { aspectDict } from './aspects';
|
import { aspectDict } from './aspects';
|
||||||
|
|
@ -20,7 +19,7 @@ import { triggers } from './triggers';
|
||||||
import { watchers } from './watchers';
|
import { watchers } from './watchers';
|
||||||
|
|
||||||
import { AspectWrapper } from 'oak-domain/lib/types';
|
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';
|
import { AppType } from 'oak-app-domain/Application/Schema';
|
||||||
|
|
||||||
export default function initialize(type: AppType, url?: string) {
|
export default function initialize(type: AppType, url?: string) {
|
||||||
|
|
@ -73,7 +72,7 @@ export default function initialize(type: AppType, url?: string) {
|
||||||
checkers,
|
checkers,
|
||||||
watchers,
|
watchers,
|
||||||
data as any,
|
data as any,
|
||||||
ActionDefDict,
|
ActionDefDict
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import './utils/polyfill';
|
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 { SimpleConnector } from 'oak-domain/lib/utils/SimpleConnector';
|
||||||
|
|
||||||
import { AspectWrapper } from 'oak-domain/lib/types';
|
import { AspectWrapper } from 'oak-domain/lib/types';
|
||||||
|
|
@ -15,10 +15,9 @@ import { checkers } from './checkers';
|
||||||
import { makeException } from './types/Exception';
|
import { makeException } from './types/Exception';
|
||||||
import { AspectDict } from './aspects/AspectDict';
|
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';
|
import { AppType } from 'oak-app-domain/Application/Schema';
|
||||||
|
|
||||||
|
|
||||||
export default function initialize(type: AppType, url: string) {
|
export default function initialize(type: AppType, url: string) {
|
||||||
let wholeFeatures = {};
|
let wholeFeatures = {};
|
||||||
const createFeatures = (
|
const createFeatures = (
|
||||||
|
|
@ -60,18 +59,22 @@ export default function initialize(type: AppType, url: string) {
|
||||||
*/
|
*/
|
||||||
if (type === 'wechatMp') {
|
if (type === 'wechatMp') {
|
||||||
// 如果是小程序,需要显式传入url
|
// 如果是小程序,需要显式传入url
|
||||||
const apiPath = process.env.NODE_ENV === 'development' ? '3001': '/oak-api'; // 生产环境通过路径映射增加oak-api
|
const apiPath =
|
||||||
const protocol = process.env.NODE_ENV === 'development' ? 'http://' : 'https://';
|
process.env.NODE_ENV === 'development' ? '3001' : '/oak-api'; // 生产环境通过路径映射增加oak-api
|
||||||
|
const protocol =
|
||||||
|
process.env.NODE_ENV === 'development' ? 'http://' : 'https://';
|
||||||
URL = `${protocol}${url}${apiPath}/aspect`;
|
URL = `${protocol}${url}${apiPath}/aspect`;
|
||||||
}
|
} else if (process.env.NODE_ENV === 'development') {
|
||||||
else if (process.env.NODE_ENV === 'development') {
|
|
||||||
URL = 'http://localhost:3001/aspect';
|
URL = 'http://localhost:3001/aspect';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// web和public环境只需要传相对路径
|
// web和public环境只需要传相对路径
|
||||||
URL = `/oak-api/aspect`;
|
URL = `/oak-api/aspect`;
|
||||||
}
|
}
|
||||||
const connector = new SimpleConnector(URL, makeException, RuntimeContext.FromCxtStr);
|
const connector = new SimpleConnector(
|
||||||
|
URL,
|
||||||
|
makeException,
|
||||||
|
RuntimeContext.FromCxtStr
|
||||||
|
);
|
||||||
const { i18n } = init<
|
const { i18n } = init<
|
||||||
EntityDict,
|
EntityDict,
|
||||||
RuntimeContext,
|
RuntimeContext,
|
||||||
|
|
@ -84,7 +87,7 @@ export default function initialize(type: AppType, url: string) {
|
||||||
routers,
|
routers,
|
||||||
connector,
|
connector,
|
||||||
checkers,
|
checkers,
|
||||||
ActionDefDict,
|
ActionDefDict
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue