浏览代码

商品资料库修改

喻文俊 3 年之前
父节点
当前提交
237f9f9f93
共有 2 个文件被更改,包括 21 次插入6 次删除
  1. 16 1
      common/config/caimeiApi.js
  2. 5 5
      components/cm-module/productDetails/cm-product-doc.vue

+ 16 - 1
common/config/caimeiApi.js

@@ -370,6 +370,20 @@ const caimeiApi = {
 	   let m = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) + ':'
 	   let s = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds())
 	   return `${Y}${M}${D}${h}${m}${s}`
+    },
+    easyFormatData(timestamp){
+        //时间转换
+        let a = new Date(timestamp).getTime()
+        const date = new Date(a)
+        const Y = date.getFullYear() + '-'
+        const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
+        const D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + '  '
+        const h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':'
+        const m = (date.getMinutes() <10 ? '0'+date.getMinutes() : date.getMinutes()) 
+        // const s = date.getSeconds(); // 秒
+        const dateString = Y + M + D + h + m
+        // console.log('dateString', dateString); // > dateString 2021-07-06 14:23
+        return dateString
     }
 }
 
@@ -398,5 +412,6 @@ module.exports = {
     regexSets: caimeiApi.regexSets,
     timestampToTime: caimeiApi.timestampToTime,
     BannerNavigateTo:caimeiApi.BannerNavigateTo,
-    FlooryNavigateTo:caimeiApi.FlooryNavigateTo 
+    FlooryNavigateTo:caimeiApi.FlooryNavigateTo,
+    easyFormatData:caimeiApi.easyFormatData
 }

+ 5 - 5
components/cm-module/productDetails/cm-product-doc.vue

@@ -11,7 +11,7 @@
                 <template v-else>
                     <view class="section" v-for="(item, index) in imageArchiveList" :key="index">
                         <view class="cm-title">{{ item.title }}</view>
-                        <view class="cm-time">{{ $reg.formatDate('', item.addTime) }}</view>
+                        <view class="cm-time">{{ $api.easyFormatData(item.addTime) }}</view>
                         <view class="cm-img-list cm-list">
                             <template v-if="item.imageList">
                                 <image
@@ -44,7 +44,7 @@
                 <template v-else>
                     <view class="section" v-for="(item, index) in videoArchiveList" :key="index">
                         <view class="cm-title">{{ item.title }}</view>
-                        <view class="cm-time">{{ $reg.formatDate('', item.addTime) }}</view>
+                        <view class="cm-time">{{ $api.easyFormatData(item.addTime) }}</view>
                         <view class="cm-video-list">
                             <video
                                 class="cm-video"
@@ -86,7 +86,7 @@
                         <view class="cm-desc">
                             <view class="cm-title">{{ item.title }}</view>
                             <view class="cm-bottom">
-                                <view class="cm-time">{{ $reg.formatDate('', item.addTime) }}</view>
+                                <view class="cm-time">{{ $api.easyFormatData(item.addTime) }}</view>
                                 <view class="cm-preview" @click="previewFile(item)">预览文件</view>
                             </view>
                         </view>
@@ -252,13 +252,13 @@ export default {
                 this.handleStop(id)
                 return
             }
+            // 如果点击同一个播放器,就
             if (this.prevVideoId === id) return
             // this.handleFullScreen(id) // 点击播放时全屏
-            this.prevVideoId = this.currentVideoId
             // 暂停上一个播放器
             this.handelPause(this.prevVideoId)
             // 保存当前播放器id
-            this.currentVideoId = id
+            this.prevVideoId = id
         },
         // 开始播放
         handelPlay(id) {