Browse Source

优化修改

yuwenjun1997 2 years ago
parent
commit
ad75357e1e

+ 9 - 7
components/SimpleVideoList/index.vue

@@ -4,7 +4,9 @@
       <div class="video" v-for="(item, index) in list" :key="index" @click="onPlay(item)">
         <div class="cover">
           <!-- <video :src="item.ossUrl" :poster="item.cover" crossorigin="anonlymous" autoplay="true"></video> -->
-          <img :src="item.cover" alt="item.title" />
+          <!-- <img :src="item.cover" alt="item.title" /> -->
+          <img :src="item.cover" alt="item.title" v-if="item.cover" />
+            <video :src="item.ossUrl" crossorigin="anonlymous" v-else></video>
           <div class="name">
             <span>{{ item.title }}</span>
           </div>
@@ -87,12 +89,12 @@ export default {
         height: 248px;
         position: relative;
 
-        // video {
-        //   display: block;
-        //   width: 100%;
-        //   height: 100%;
-        //   background: #000;
-        // }
+        video {
+          display: block;
+          width: 100%;
+          height: 100%;
+          background: #000;
+        }
         img {
           display: block;
           width: 100%;

+ 2 - 1
pages/_template/ross/activity/challenge/index.vue

@@ -239,7 +239,8 @@ export default {
     onToSingUp() {
       // 活动未开启
       if (this.activityState === 0) {
-        this.promptStatus = 1
+        // this.promptStatus = 1
+        this.promptStatus = 2
         this.promptDialog = true
         return
       }

+ 1 - 1
pages/_template/ross/activity/challenge/list.vue

@@ -223,7 +223,7 @@ export default {
     async fetchContestInfo() {
       try {
         const { mobile } = this.userInfo
-        const res = await this.$http.api.checkContestInfo({ mobile })
+        const res = await this.$http.api.checkContestInfo({ mobile, authUserId: this.authUserId })
         this.signUpStatus = res.data.contestStatus
       } catch (error) {
         console.log(error)

+ 12 - 8
pages/_template/ross/activity/challenge/publish.vue

@@ -39,8 +39,8 @@
       <div class="video-list">
         <div class="video" v-for="(item, index) in videoList" :key="index" @click="onPlay(item)">
           <div class="cover">
-            <!-- <video :src="item.ossUrl" :poster="item.cover" crossorigin="anonlymous" autoplay="autoplay"></video> -->
-            <img :src="item.cover" alt="item.title" />
+            <img :src="item.cover" alt="item.title" v-if="item.cover" />
+            <video :src="item.ossUrl" crossorigin="anonlymous" v-else></video>
             <div class="name">
               <span>{{ item.title }}</span>
             </div>
@@ -120,6 +120,10 @@ export default {
       }
       try {
         await this.$refs.form.validate()
+        if (/iPad|iPhone|iPod/.test(navigator.userAgent)) {
+          this.publishVideoSave()
+          return
+        }
         // 生成封面
         const imageUrl = process.env.EVN === 'development' ? '/flower.mp4' : this.formData.ossUrl
         const cover = await getVideoBase64(imageUrl)
@@ -236,12 +240,12 @@ export default {
             height: 248px;
             position: relative;
 
-            // video {
-            //   display: block;
-            //   width: 100%;
-            //   height: 100%;
-            //   background: #000;
-            // }
+            video {
+              display: block;
+              width: 100%;
+              height: 100%;
+              background: #000;
+            }
 
             img {
               display: block;

+ 1 - 1
plugins/jssdk.js

@@ -11,7 +11,7 @@ Vue.prototype.$wxReady = async function (callback, apiList = []) {
     const wx = window.wx
     if (!wx) return
     wx.config({
-      debug: dev === 'development', // 开启调试模式,调用的所有 api 的返回值会在客户端 alert 出来,若要查看传入的参数,可以在 pc 端打开,参数信息会通过 log 打出,仅在 pc 端时才会打印。
+      debug: false && dev === 'development', // 开启调试模式,调用的所有 api 的返回值会在客户端 alert 出来,若要查看传入的参数,可以在 pc 端打开,参数信息会通过 log 打出,仅在 pc 端时才会打印。
       appId: appId, // 必填,公众号的唯一标识
       timestamp: res.data.timestamp, // 必填,生成签名的时间戳
       nonceStr: res.data.noncestr, // 必填,生成签名的随机串

+ 4 - 0
utils/index.js

@@ -139,6 +139,10 @@ export function getVideoBase64(url) {
     video.setAttribute('crossOrigin', 'anonlymous')
     video.setAttribute('preload', 'auto')
     video.setAttribute('src', url)
+    video.style.display = 'none'
+    if (/iPad|iPhone|iPod/.test(navigator.userAgent)){
+      video.setAttribute('autoplay', true)
+    }
     video.onloadeddata = () => {
       const canvas = document.createElement('canvas')
       const width = video.videoWidth