This commit is contained in:
parent
a8fffbc18d
commit
6c3a95ce2a
|
|
@ -7,7 +7,12 @@
|
|||
"lodash": "^4.17.21",
|
||||
"oak-common-aspect": "file:../oak-common-aspect",
|
||||
"oak-domain": "file:../oak-domain",
|
||||
"oak-external-sdk": "file:../oak-external-sdk",
|
||||
"oak-memory-tree-store": "file:../oak-memory-tree-store",
|
||||
"react": "^18.1.0",
|
||||
"react-dom": "^18.1.0",
|
||||
"react-router-dom": "^6.3.0",
|
||||
"rmc-pull-to-refresh": "^1.0.13",
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
@ -22,7 +27,8 @@
|
|||
"@types/luxon": "^2.0.9",
|
||||
"@types/mocha": "^8.2.0",
|
||||
"@types/node": "^14.14.25",
|
||||
"@types/react": "^17.0.2",
|
||||
"@types/react": "^18.0.12",
|
||||
"@types/react-dom": "^18.0.5",
|
||||
"@types/uuid": "^8.3.0",
|
||||
"@types/wechat-miniprogram": "^3.4.1",
|
||||
"assert": "^2.0.0",
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ async function initDataInStore<ED extends EntityDict, Cxt extends Context<ED>>(
|
|||
}
|
||||
|
||||
function getMaterializedData() {
|
||||
if (/* process.env.OAK_PLATFORM === 'weChatMp' */true) {
|
||||
if (process.env.OAK_PLATFORM === 'weChatMp') {
|
||||
try {
|
||||
const data = wx.getStorageSync('debugStore');
|
||||
const stat = wx.getStorageSync('debugStoreStat');
|
||||
|
|
@ -44,8 +44,25 @@ function getMaterializedData() {
|
|||
};
|
||||
}
|
||||
return;
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
catch (e) {
|
||||
} else if (process.env.OAK_PLATFORM === 'web') {
|
||||
try {
|
||||
const data = JSON.parse(
|
||||
window.localStorage.getItem('debugStore') as string
|
||||
);
|
||||
const stat = JSON.parse(
|
||||
window.localStorage.getItem('debugStoreStat') as string
|
||||
);
|
||||
if (data && stat) {
|
||||
return {
|
||||
data,
|
||||
stat,
|
||||
};
|
||||
}
|
||||
return;
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -54,7 +71,7 @@ function getMaterializedData() {
|
|||
let lastMaterializedVersion = 0;
|
||||
|
||||
function materializeData(data: any, stat: { create: number, update: number, remove: number, commit: number }) {
|
||||
if (/* process.env.OAK_PLATFORM === 'weChatMp' */true) {
|
||||
if (process.env.OAK_PLATFORM === 'weChatMp') {
|
||||
try {
|
||||
wx.setStorageSync('debugStore', data);
|
||||
wx.setStorageSync('debugStoreStat', stat);
|
||||
|
|
@ -63,8 +80,7 @@ function materializeData(data: any, stat: { create: number, update: number, remo
|
|||
title: '数据已物化',
|
||||
icon: 'success',
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
wx.showToast({
|
||||
title: '物化数据失败',
|
||||
|
|
@ -72,6 +88,20 @@ function materializeData(data: any, stat: { create: number, update: number, remo
|
|||
});
|
||||
}
|
||||
}
|
||||
else if (process.env.OAK_PLATFORM === 'web') {
|
||||
try {
|
||||
window.localStorage.setItem(
|
||||
'debugStore',
|
||||
typeof data === 'string' ? data : JSON.stringify(data)
|
||||
);
|
||||
window.localStorage.setItem('debugStoreStat', JSON.stringify(stat));
|
||||
lastMaterializedVersion = stat.commit;
|
||||
alert('数据已物化');
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
alert('物化数据失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,10 +1,3 @@
|
|||
/* import { initialize as InitializeWechatMp, MakeOakComponent, MakeOakPage } from './platforms/wechatMp';
|
||||
|
||||
export {
|
||||
InitializeWechatMp,
|
||||
MakeOakComponent,
|
||||
MakeOakPage,
|
||||
}; */
|
||||
|
||||
export * from './types/Feature';
|
||||
export * from './types/ExceptionRoute';
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
export function initialize() {
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue