Commit de60a9f2 authored by 徐光星's avatar 徐光星

feat: 增加历史记录页面路由

parent db75319e
...@@ -21,4 +21,11 @@ export default class ActivityController extends Controller { ...@@ -21,4 +21,11 @@ export default class ActivityController extends Controller {
} }
ctx.body = body; ctx.body = body;
} }
public async history(ctx: Context) {
// 获取页面历史记录页面数据
const apollo = ctx.app.config.apollo || {};
const body = await ctx.renderToHtml('activity.js', { url: ctx.url, apollo });
ctx.body = body;
}
} }
...@@ -10,4 +10,5 @@ export default (application: Application) => { ...@@ -10,4 +10,5 @@ export default (application: Application) => {
}); });
router.get('/activity/:id', controller.activity.home); router.get('/activity/:id', controller.activity.home);
router.get('/history/:id', controller.activity.history);
}; };
\ No newline at end of file
...@@ -5,6 +5,9 @@ export default { ...@@ -5,6 +5,9 @@ export default {
getPageById(params) { getPageById(params) {
return http.get(`${config.apiHost}/editor/get/${params.pageId}?lite=1`); return http.get(`${config.apiHost}/editor/get/${params.pageId}?lite=1`);
}, },
getHistoryDataById(params) {
return http.get(`${config.apiHost}/editor/getHistoryPage/${params.id}?lite=1`);
},
getShopCartCount() { getShopCartCount() {
return http.get(`${config.kdspHost}/api/kdsp/shop-cart/count`); return http.get(`${config.kdspHost}/api/kdsp/shop-cart/count`);
}, },
......
...@@ -12,6 +12,11 @@ export default function createRouter() { ...@@ -12,6 +12,11 @@ export default function createRouter() {
{ {
path: '/activity/:pageId', path: '/activity/:pageId',
component: Activity component: Activity
},
{
name: 'history',
path: '/history/:id',
component: Activity
} }
] ]
}); });
......
...@@ -207,12 +207,15 @@ export default class Activity extends Mixins(TransformStyleMixin, BottomNavStyle ...@@ -207,12 +207,15 @@ export default class Activity extends Mixins(TransformStyleMixin, BottomNavStyle
} }
async fetchApi(options) { async fetchApi(options) {
const { store, route } = options; const { store, route } = options;
const { pageId } = route.params; const { pageId, id } = route.params;
try { try {
await store.dispatch('getFinanceSetting'); await store.dispatch('getFinanceSetting');
} catch (err) { } catch (err) {
console.log(err); console.log(err);
} }
if (route.name && route.name == 'history') {
return store.dispatch('getHistoryPageData', { id });
}
return store.dispatch('getPageDate', { pageId }); return store.dispatch('getPageDate', { pageId });
} }
updateShopCartCount() { updateShopCartCount() {
......
...@@ -29,6 +29,16 @@ export default class EditorModule implements Module<EditorState, RootState> { ...@@ -29,6 +29,16 @@ export default class EditorModule implements Module<EditorState, RootState> {
commit(SET_EMPTY_PAGE, true); commit(SET_EMPTY_PAGE, true);
} }
}, },
async getHistoryPageData({ commit }, condition) {
const [res] = await api.getHistoryDataById(condition);
if (res) {
const { page, ...rest } = res as PageInfo;
commit(SET_PAGE_INFO, { ...rest, page: JSON.parse(page as string) });
commit(SET_EMPTY_PAGE, false);
} else {
commit(SET_EMPTY_PAGE, true);
}
},
}; };
mutations: MutationTree<EditorState> = { mutations: MutationTree<EditorState> = {
......
{ {
"api": { "api": {
"apiHost": "https://quantum-blocks-toc.liangkebang.net", "apiHost": "https://quantum-blocks-ds.liangkebang.net",
"h5Host": "https://quantum-h5-toc.liangkebang.net", "h5Host": "https://quantum-h5-ds.liangkebang.net",
"opapiHost": "https://opapi-toc.liangkebang.net", "opapiHost": "https://opapi-ds.liangkebang.net",
"passportHost": "https://passportapi-toc.liangkebang.net", "passportHost": "https://passportapi-ds.liangkebang.net",
"talosHost": "https://talos-toc.liangkebang.net", "talosHost": "https://talos-ds.liangkebang.net",
"kdspHost": "https://kdsp-api-toc.liangkebang.net", "kdspHost": "https://kdsp-api-ds.liangkebang.net",
"loginUrl": "", "loginUrl": "",
"newApolloFlag": true, "newApolloFlag": true,
"h5ShopHost": "https://tenet-toc.liangkebang.net/#", "h5ShopHost": "https://tenet-ds.liangkebang.net/#",
"mallHost": "https://mall-toc.liangkebang.net", "mallHost": "https://mall-ds.liangkebang.net",
"xyqbH5Host": "https://mapi-toc.liangkebang.net", "xyqbH5Host": "https://mapi-ds.liangkebang.net",
"yxmTenantId": 560761, "yxmTenantId": 560761,
"appIdMap": { "appIdMap": {
"560761": "wxe16bf9293671506c", "560761": "wxe16bf9293671506c",
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
} }
}, },
"redis": { "redis": {
"port": "30895", "port": "31980",
"host": "172.16.4.89", "host": "172.16.92.18",
"password": "", "password": "",
"db": 0 "db": 0
}, },
......
{"apiHost":"https://quantum-blocks-toc.liangkebang.net","h5Host":"https://quantum-h5-toc.liangkebang.net","opapiHost":"https://opapi-toc.liangkebang.net","passportHost":"https://passportapi-toc.liangkebang.net","talosHost":"https://talos-toc.liangkebang.net","kdspHost":"https://kdsp-api-toc.liangkebang.net","loginUrl":"","newApolloFlag":true,"h5ShopHost":"https://tenet-toc.liangkebang.net/#","mallHost":"https://mall-toc.liangkebang.net","xyqbH5Host":"https://mapi-toc.liangkebang.net","yxmTenantId":560761,"appIdMap":{"560761":"wxe16bf9293671506c","560867":"wxccb8435d68e8c7d6"},"qiniuUpHost":"https://up-z0.qiniup.com","qiniuHost":"https://appsync.lkbang.net"} {"apiHost":"https://quantum-blocks-ds.liangkebang.net","h5Host":"https://quantum-h5-ds.liangkebang.net","opapiHost":"https://opapi-ds.liangkebang.net","passportHost":"https://passportapi-ds.liangkebang.net","talosHost":"https://talos-ds.liangkebang.net","kdspHost":"https://kdsp-api-ds.liangkebang.net","loginUrl":"","newApolloFlag":true,"h5ShopHost":"https://tenet-ds.liangkebang.net/#","mallHost":"https://mall-ds.liangkebang.net","xyqbH5Host":"https://mapi-ds.liangkebang.net","yxmTenantId":560761,"appIdMap":{"560761":"wxe16bf9293671506c","560867":"wxccb8435d68e8c7d6"},"qiniuUpHost":"https://up-z0.qiniup.com","qiniuHost":"https://appsync.lkbang.net"}
\ No newline at end of file \ No newline at end of file
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"test": "cross-env NODE_ENV=production EGG_SERVER_ENV=sit egg-scripts start --port 80 --workers 1", "test": "cross-env NODE_ENV=production EGG_SERVER_ENV=sit egg-scripts start --port 80 --workers 1",
"stop": "egg-scripts stop", "stop": "egg-scripts stop",
"backend": "nohup egg-scripts start --port 7001 --workers 4", "backend": "nohup egg-scripts start --port 7001 --workers 4",
"dev": "cross-env NODE_ENV=test APOLLO_CLUSTER=k8s NAMESPACE=toc npm run apollo && egg-bin dev -r egg-ts-helper/register", "dev": "cross-env NODE_ENV=test APOLLO_CLUSTER=k8s NAMESPACE=ds npm run apollo && egg-bin dev -r egg-ts-helper/register",
"debug": "egg-bin debug -r egg-ts-helper/register", "debug": "egg-bin debug -r egg-ts-helper/register",
"apollo": "node bin/apollo.js", "apollo": "node bin/apollo.js",
"build": "cross-env NODE_ENV=production APOLLO_CLUSTER=3C npm run apollo && cross-env COS_ENV=production easy build --devtool", "build": "cross-env NODE_ENV=production APOLLO_CLUSTER=3C npm run apollo && cross-env COS_ENV=production easy build --devtool",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment