diff --git a/src/utils/index.js b/src/utils/index.js index f61ed3f..e2758e4 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -54,7 +54,7 @@ export function parseTime(time, cFormat) { * @returns {string} */ export function formatTime(time, option) { - if(time == null) return '----' + if (time == null) return '----' if (('' + time).length === 10) { time = parseInt(time) * 1000 @@ -94,8 +94,23 @@ export function formatTime(time, option) { } export function formatTimeTwo(time) { - if(time == null) return "无" - //time = time * 1000 + if (time == null) return '无' + // time = time * 1000 + const d = new Date(time) + return ( + d.getFullYear() + '年' + + (d.getMonth() + 1) + + '月' + + d.getDate() + + '日' + + d.getHours() + + '时' + + d.getMinutes() + + '分' + ) +} +export function formatTimeThree(time) { + time = time * 1000 const d = new Date(time) return ( d.getFullYear() + '年' + @@ -109,7 +124,6 @@ export function formatTimeTwo(time) { '分' ) } - /** * @param {string} url * @returns {Object} diff --git a/src/views/wechat/live/index.vue b/src/views/wechat/live/index.vue index 579e605..b3e550f 100644 --- a/src/views/wechat/live/index.vue +++ b/src/views/wechat/live/index.vue @@ -88,7 +88,7 @@ - + - - + + + + + + @@ -188,15 +196,15 @@ import pagination from '@crud/Pagination' import MaterialList from '@/components/material' import LiveGoods from '@/views/components/livegoods' import udOperation from '@crud/UD.operation' - +import {formatTimeThree} from '@/utils/index' // crud交由presenter持有 const defaultCrud = CRUD({ optShow: { add: true, edit: false, del: false, download: true - },title: '直播房间', url: 'api/yxWechatLive', sort: 'roomId,desc', crudMethod: { ...crudYxWechatLive }}) -const defaultForm = { product: [],roomid: null,productId: null, name: null, coverImge: null, startDate: null, endDate : null,shareImge: null, liveStatus: null, coverImgArr: [],shareImgArr: [],anchorImgArr: [],startTime: null, endTime: null, anchorName: null, anchorWechat: null, anchorImge: null, type: null, screenType: null, closeLike: null,closeGoods: null, closeComment: null } + },title: '直播房间', url: 'api/yxWechatLive', sort: 'room_id,desc', crudMethod: { ...crudYxWechatLive }}) +const defaultForm = { product: [],roomId: null,productId: null, name: null, coverImge: null, startDate: null, endDate : null,shareImge: null, liveStatus: null, coverImgArr: [],shareImgArr: [],anchorImgArr: [],startTime: null, endTime: null, anchorName: null, anchorWechat: null, anchorImge: null, type: null, screenType: null, closeLike: null,closeGoods: null, closeComment: null } export default { name: 'YxWechatLive', components: { pagination, crudOperation, rrOperation ,MaterialList,udOperation,LiveGoods}, @@ -258,6 +266,7 @@ export default { } }, methods: { + formatTimeThree, getGoods(p) { var ids = [] p.forEach((item,index) => {