|
@@ -178,12 +178,12 @@
|
|
|
import axios from 'axios';
|
|
|
import Cookies from 'js-cookie';
|
|
|
import { Toast } from 'vant';
|
|
|
-import { isBrowser, appType, appVersionCode, formatSecondsAsDaysOrTime } from '../utils/help.js';
|
|
|
-import FontAmount from '../components/FontAmount.vue';
|
|
|
-import CustomCardCover from '../components/CustomCardCover.vue';
|
|
|
-import Report from '../log-center/log';
|
|
|
-import { RewardType, PlayType } from '../types';
|
|
|
-import MobileGuidePage from '../components/MobileGuidePage.vue';
|
|
|
+import { isBrowser, appType, appVersionCode, formatSecondsAsDaysOrTime, getDetailSSR } from '@/utils/help.js';
|
|
|
+import FontAmount from '@/components/FontAmount.vue';
|
|
|
+import CustomCardCover from '@/components/CustomCardCover.vue';
|
|
|
+import Report from '@/log-center/log';
|
|
|
+import { RewardType, PlayType } from '@/types';
|
|
|
+import MobileGuidePage from '@/components/MobileGuidePage.vue';
|
|
|
|
|
|
var moment = require('moment');
|
|
|
var ClipboardJS = require('clipboard');
|
|
@@ -302,31 +302,34 @@ export default {
|
|
|
this.layer_show = true;
|
|
|
});
|
|
|
},
|
|
|
- async asyncData(params) {
|
|
|
- let { route } = params;
|
|
|
- let { data } = await axios.post(`${baseURL}/denet/post/getDetail`, {
|
|
|
- baseInfo: {
|
|
|
- appVersionCode: appVersionCode,
|
|
|
- mid: '00000000-0000-0000-0000-000000000000',
|
|
|
- },
|
|
|
+ async asyncData(context) {
|
|
|
+ let { route, error } = context;
|
|
|
+ let result = await getDetailSSR({
|
|
|
+ context,
|
|
|
params: {
|
|
|
postId: route.params.id || '',
|
|
|
},
|
|
|
+ url: `${baseURL}/denet/post/getDetail`,
|
|
|
});
|
|
|
- if (data.code == 0) {
|
|
|
- if (data.data && data.data.postBizData && typeof data.data.postBizData == 'string') {
|
|
|
- data.data.postBizData = JSON.parse(data.data.postBizData);
|
|
|
+ if (result.code == 0) {
|
|
|
+ if (result.data && result.data.postBizData && typeof result.data.postBizData == 'string') {
|
|
|
+ result.data.postBizData = JSON.parse(result.data.postBizData);
|
|
|
}
|
|
|
- if (data.data.postBizData === null) {
|
|
|
- data.data.postBizData = {
|
|
|
+ if (result.data.postBizData === null) {
|
|
|
+ result.data.postBizData = {
|
|
|
postUserInfo: {},
|
|
|
};
|
|
|
}
|
|
|
return {
|
|
|
- detail: data.data,
|
|
|
- customCover: data.data.postBizData && data.data.postBizData.posterType == 2 ? 1 : 0,
|
|
|
- customGiveaway: data.data.postBizData && data.data.postBizData.rewardType == 2 ? 1 : 0,
|
|
|
+ detail: result.data,
|
|
|
+ customCover: result.data.postBizData && result.data.postBizData.posterType == 2 ? 1 : 0,
|
|
|
+ customGiveaway: result.data.postBizData && result.data.postBizData.rewardType == 2 ? 1 : 0,
|
|
|
};
|
|
|
+ } else {
|
|
|
+ return error({
|
|
|
+ message: result.msg,
|
|
|
+ statusCode: 500,
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
methods: {
|