Prechádzať zdrojové kódy

商品资料库修改

喻文俊 3 rokov pred
rodič
commit
6c149dc064

+ 27 - 16
src/main/resources/static/js/document/beautyArchiveDetailMixin.js

@@ -8,6 +8,7 @@ var beautyArchiveDetailMixin = {
         //页面配置
         archiveId: '',  //资料列表id
         currentVideoUrl: '', //正在播放的视频链接(上一个播放的的视频)
+        currentVideo: '',
         showVideoDialog: false,
         isPlayer: false, //是否正在播放
         imageGroup: {},
@@ -59,34 +60,44 @@ var beautyArchiveDetailMixin = {
         },
         //显示视频播放窗口
         handleShowPlayer: function (url) {
+            var _self = this;
             if (this.checkPermission() !== 0) return;
             //暂停上一个正在播放的播放器
-            this.currentVideoUrl = url;
+            // this.currentVideoUrl = url;
+            this.isPlayer = true;
+            this.currentVideoUrl = 'https://www.w3school.com.cn/i/movie.ogg';
             this.showVideoDialog = true;
+            setTimeout(function(){
+                // var video = this.$refs.videoRef;
+                _self.currentVideo = document.querySelector('#realPlayer');
+                _self.currentVideo.addEventListener('pause', function () {
+                    _self.isPlayer = false;
+                    console.log('暂停播放');
+                });
+                _self.currentVideo.addEventListener('ended', function () {
+                    _self.isPlayer = false;
+                    console.log('播放结束');
+                });
+                _self.currentVideo.addEventListener('error', function () {
+                    _self.isPlayer = false;
+                    console.log('播放错误');
+                });
+                _self.currentVideo.addEventListener('play', function () {
+                    _self.isPlayer = true;
+                    console.log('开始播放');
+                });
+            })
         },
         //隐藏视频播放窗口
         handleClosePlayer: function () {
             this.$refs.videoRef.pause();
             this.currentVideoUrl = '';
             this.showVideoDialog = false;
+            this.isPlayer = false;
         },
         //播放视频
         handlePlayer: function () {
-            var _self = this;
-            var video = this.$refs.videoRef;
-            video.addEventListener('pause', function () {
-                _self.isPlayer = false
-            });
-            video.addEventListener('ended', function () {
-                _self.isPlayer = false
-            });
-            video.addEventListener('error', function () {
-                _self.isPlayer = false
-            });
-            video.addEventListener('play', function () {
-                _self.isPlayer = true
-            });
-            if (!_self.isPlayer) video.play();
+            if (!this.isPlayer) this.currentVideo.play();
         },
         //预览office文件 word ppt pdf
         handlePreviewOffice: function (file) {

+ 1 - 1
src/main/resources/templates/document/beauty-archive-detail.html

@@ -111,7 +111,7 @@
                 <!-- 弹出播放窗口 -->
                 <div class="cm-player" v-if="showVideoDialog" @click="handleClosePlayer">
                     <span class="cm-player-btn" @click.stop="handlePlayer" v-if="!isPlayer"></span>
-                    <video controls width="1000" height="560" ref="videoRef" autoplay>
+                    <video id="realPlayer" controls  ref="videoRef" autoplay>
                         <source :src="currentVideoUrl" type="video/mp4">
                         您的浏览器不支持Video标签。
                     </video>

+ 6 - 11
src/main/resources/templates/product/detail.html

@@ -238,8 +238,7 @@
                     <li class="swiper-slide mfc" v-for="p in recommends">
                         <div class="item">
                             <a class="image" :href="'/product-'+p.productId+'.html'" target="_blank">
-                                <img :src="p.image" :alt="p.name"
-                                     onerror="javascript:this.src='/img/base/placeholder.png';">
+                                <img :src="p.image" :alt="p.name" onerror="javascript:this.src='/img/base/placeholder.png';">
                                 <span v-html="p.name"></span>
                             </a>
                         </div>
@@ -259,8 +258,7 @@
     <div class="wrap clear">
         <div v-if="!isPC" class="mShopBox">
             <a th:href="@{'/supplier-'+${product.shopId}+'.html'}">
-                <span class="name"><em th:text="${product.shopTitle}"></em><i
-                        th:if="not${#strings.isEmpty(product.license)}" class="icon mIcon shop"></i></span>
+                <span class="name"><em th:text="${product.shopTitle}"></em><i th:if="not${#strings.isEmpty(product.license)}" class="icon mIcon shop"></i></span>
                 <span>经营范围:<em th:text="${product.businessScope}"></em></span>
                 <span>所在地区:<em th:text="${product.shopAddress}"></em></span>
                 <span>满意度:<em><i th:each="i:${#numbers.sequence(1,5)}" class="mIcon heart"></i></em></span>
@@ -269,12 +267,9 @@
         <div class="productInfo">
             <div class="tabTit">
                 <span :class="tabsIndex == 0 ? 'on' : ''" @click="detailsClicktab(0)">商品详情</span>
-                <span :class="tabsIndex == 1 ? 'on' : ''" v-if="parameters.length>0 && !isNoneDisabled"
-                      @click="detailsClicktab(1)">相关参数</span>
-                <span :class="tabsIndex == 2 ? 'on' : ''" v-if="isServiceInfo && !isNoneDisabled"
-                      @click="detailsClicktab(2)">服务项目</span>
-                <span :class="tabsIndex == 3 ? 'on' : ''" v-if="isTrainingMethod"
-                      @click="detailsClicktab(3)">培训方案</span>
+                <span :class="tabsIndex == 1 ? 'on' : ''" v-if="parameters.length>0 && !isNoneDisabled" @click="detailsClicktab(1)">相关参数</span>
+                <span :class="tabsIndex == 2 ? 'on' : ''" v-if="isServiceInfo && !isNoneDisabled" @click="detailsClicktab(2)">服务项目</span>
+                <span :class="tabsIndex == 3 ? 'on' : ''" v-if="isTrainingMethod" @click="detailsClicktab(3)">培训方案</span>
                 <span v-if="archiveId !== 0" :class="tabsIndex == 4 ? 'on' : ''" @click="detailsClicktab(4)">相关资料</span>
                 <!--<span>评价</span>-->
             </div>
@@ -362,7 +357,7 @@
                         <!-- 弹出播放窗口 -->
                         <div class="cm-player" v-if="showVideoDialog" @click="handleClosePlayer">
                             <span class="cm-player-btn" @click.stop="handlePlayer" v-if="!isPlayer"></span>
-                            <video controls ref="videoRef" autoplay>
+                            <video id="realPlayer" controls ref="videoRef" autoplay>
                                 <source :src="currentVideoUrl" type="video/mp4">
                                 您的浏览器不支持Video标签。
                             </video>