lex 2 anos atrás
pai
commit
cc709d9267

+ 6 - 0
src/components/col-search/index.module.less

@@ -54,6 +54,12 @@
         input::placeholder {
           color: #fff;
         }
+        input {
+          color: #fff;
+        }
+        .van-field__clear {
+          color: #fff;
+        }
       }
     }
   }

+ 5 - 1
src/teacher/music/upload/index.tsx

@@ -263,7 +263,11 @@ export default defineComponent({
         xmlFileUrl: this.xmlFileUrl,
         canEvaluate: Number(this.canEvaluate),
         chargeType: this.chargeType === 0 ? 'FREE' : 'CHARGE',
-        paymentType: this.paymentType ? this.paymentType : this.chargeType === 0 ? 'FREE' : 'CHARGE',
+        paymentType: this.paymentType
+          ? this.paymentType
+          : this.chargeType === 0
+          ? 'FREE'
+          : 'CHARGE',
         exquisiteFlag: this.exquisiteFlag,
         composer: this.composer,
         musicPrice: this.chargeType === 0 ? 0 : this.musicPrice, // 当选择免费时,重置金额为0

+ 0 - 6
src/views/music/component/song/index.tsx

@@ -2,14 +2,8 @@ import { CellGroup, Cell, Icon, Image, Popup, Tag, Toast } from 'vant'
 import { computed, defineComponent, PropType, ref } from 'vue'
 import styles from './index.module.less'
 import IconPlay from '@/common/images/icon-play.png'
-import IconMore from '@/common/images/icon_more.png'
 import { useRouter } from 'vue-router'
 import { state } from '@/state'
-import request from '@/helpers/request'
-import ColShare from '@/components/col-share'
-import MusicIcon from '../../list/icons/music-icon.png'
-import collection_active from '../images/collection_active.png'
-import collection from '../images/collection.png'
 export const getAssetsHomeFile = (fileName: string) => {
   const path = `../images/${fileName}`
   const modules = import.meta.globEager('../images/*')

+ 12 - 2
src/views/music/music-detail/imageFunction.ts

@@ -3,7 +3,12 @@ export const imgToCanvas = async (url: string) => {
   console.log('imgToCanvas', url)
   const img = document.createElement('img')
   img.setAttribute('crossOrigin', 'anonymous')
-  img.src = url + `?${new Date().getTime()}`
+  // 为了处理base64 和 连接加载不同的
+  if (url.includes('data:image')) {
+    img.src = url
+  } else {
+    img.src = url + `?${new Date().getTime()}`
+  }
 
   // 防止跨域引起的 Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
   await new Promise(resolve => (img.onload = resolve))
@@ -37,7 +42,12 @@ export const addWatermark = async (canvas, text) => {
     // ctx.fillStyle = '#fff'
     const img = document.createElement('img')
     img.setAttribute('crossOrigin', 'anonymous')
-    img.src = imgList + `?${new Date().getTime()}`
+    // 为了处理base64 和 连接加载不同的
+    if (imgList.includes('data:image')) {
+      img.src = imgList
+    } else {
+      img.src = imgList + `?${new Date().getTime()}`
+    }
     // 防止跨域引起的 Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
     await new Promise(resolve => (img.onload = resolve))
     // 创建canvas DOM元素,并设置其宽高和图片一样

+ 5 - 1
src/views/music/music-detail/index.module.less

@@ -413,7 +413,11 @@
 }
 
 .buyBtn {
-  --van-button-default-height: 38px;
+  --van-button-default-height: 42px;
+  flex: 1;
+  display: flex;
+  align-items: center;
+  justify-content: flex-end;
   :global {
     .van-button {
       padding: 0 22px;

+ 43 - 28
src/views/music/music-detail/index.tsx

@@ -196,7 +196,14 @@ export default defineComponent({
     }
 
     const setAccompanyUrl = () => {
-      const url = 'http://dev.colexiu.com'
+      let url = location.host
+      if (
+        location.host.includes('dev.colexiu') ||
+        location.host.includes('192.168') ||
+        location.host.includes('localhost')
+      ) {
+        url = 'http://dev.colexiu.com'
+      }
       const music = musicDetail.value
       let subjectId = ''
       if (music.background && music.background.length > 0) {
@@ -236,14 +243,10 @@ export default defineComponent({
         // 允许播放时间
         const players = player.value
         const playTime = (players.duration * freeRate.value) / 100 || 0
-        // 时间,是否购买,是否免费
-        if (
-          players.currentTime >= playTime &&
-          musicDetail.value?.orderStatus !== 'PAID' &&
-          !paymentType.value.includes('FREE')
-        ) {
-          // players.stop()
-          players.pause()
+        // 时间,不能播放
+        if (players.currentTime >= playTime && !buyState.value.play) {
+          players.stop()
+          // players.pause()
         }
       })
     }
@@ -401,6 +404,17 @@ export default defineComponent({
       return []
     })
 
+    const buyState = computed(() => {
+      const music = musicDetail.value
+      return {
+        play: music.play ? true : false, // 是否可以播放
+        free: music?.paymentType.includes('FREE'),
+        charge: music?.paymentType.includes('CHARGE'),
+        vip: music?.paymentType.includes('VIP'),
+        buy: music?.orderStatus === 'PAID' // 是否已买
+      }
+    })
+
     const shareStatus = ref(false)
     const shareUrl = ref('')
     const shareDiscount = ref(0)
@@ -549,14 +563,12 @@ export default defineComponent({
               <div class={styles.videoOperation}>
                 {musicDetail.value?.audioFileUrl && (
                   <>
-                    {(paymentType.value.includes('CHARGE') ||
-                      paymentType.value.includes('VIP')) &&
-                      musicDetail.value?.orderStatus !== 'PAID' && (
-                        <div class={[styles.audition]}>
-                          <img src={iconListen} />
-                          <span>每首曲目可试听{freeRate.value}%</span>
-                        </div>
-                      )}
+                    {!buyState.value.play && (
+                      <div class={[styles.audition]}>
+                        <img src={iconListen} />
+                        <span>每首曲目可试听{freeRate.value}%</span>
+                      </div>
+                    )}
 
                     <div class={[styles.audio, styles.collectCell]}>
                       <audio id="player" controls ref={audio}>
@@ -615,8 +627,7 @@ export default defineComponent({
             <ColSticky position="bottom" background="white">
               <div ref={footers}>
                 {/* 判断是否是免费的,或者已经购买过 */}
-                {paymentType.value.includes('FREE') ||
-                musicDetail.value?.orderStatus === 'PAID' ? (
+                {buyState.value.play ? (
                   <Button
                     round
                     block
@@ -628,16 +639,19 @@ export default defineComponent({
                   </Button>
                 ) : (
                   <div class={styles.colSticky}>
-                    <div class={styles.priceSection}>
-                      <span>点播价:</span>
-                      <span class={styles.price}>
-                        <i>¥</i>
-                        {moneyFormat(musicDetail.value?.musicPrice)}
-                      </span>
-                    </div>
+                    {/* 只有,有点播类型的才显示价格 */}
+                    {buyState.value.charge && (
+                      <div class={styles.priceSection}>
+                        <span>点播价:</span>
+                        <span class={styles.price}>
+                          <i>¥</i>
+                          {moneyFormat(musicDetail.value?.musicPrice)}
+                        </span>
+                      </div>
+                    )}
                     <div class={[styles.buyBtn]}>
                       {/* 判断是否是需要收费的 */}
-                      {paymentType.value.includes('CHARGE') && (
+                      {buyState.value.charge && (
                         <Button
                           round
                           type="primary"
@@ -650,9 +664,10 @@ export default defineComponent({
                       )}
 
                       {/* 判断是否有会员的 */}
-                      {paymentType.value.includes('VIP') && (
+                      {buyState.value.vip && (
                         <Button
                           round
+                          block={!buyState.value.charge ? true : false}
                           type="primary"
                           color="linear-gradient(180deg, #F7BD8D 0%, #CD8806 100%)"
                           class={styles.memeber}

+ 33 - 30
src/views/music/search/select-tag.tsx

@@ -2,7 +2,7 @@ import request from '@/helpers/request'
 import { useAsyncState } from '@vueuse/core'
 import { defineComponent, reactive, Ref, ref, watch } from 'vue'
 import { state as appState } from '@/state'
-import { Button } from 'vant'
+import { Button, Toast } from 'vant'
 import SelectTagsChild from './select-tags-child'
 import styles from './select.module.less'
 
@@ -35,42 +35,23 @@ export default defineComponent({
       null
     )
     const resetTags = () => {
-      tags.value = {}
-      // for (const key in tags) {
-      //   if (Object.prototype.hasOwnProperty.call(tags, key)) {
-      //     // delete tags[key]
-      //   }
-      // }
+      tags.value = []
       emit('cancel')
     }
 
     const defaultTags = (defaultValue || '').split(',').map(id => Number(id))
-    const tags: Ref<{ [key in string]: number[] }> = ref({})
+    const tags: Ref<Array<any | number>> = ref([])
     const names = {}
     watch(state, () => {
       if (state.value) {
         const list = (state.value && state.value.data) || []
-        if (exquisiteFlag) {
-          list.unshift({
-            name: '乐谱类型',
-            id: -1,
-            children: [
-              {
-                id: 1,
-                name: '精品'
-              }
-            ]
-          })
-        }
 
         for (const item of list) {
-          const allids = item.children.map(c => {
-            names[c.id] = c.name
-            return c.id
-          })
-          tags.value[item.id] = defaultTags.filter(id => {
-            return allids.includes(Number(id))
-          })
+          // const allids = item.map(c => {
+          //   names[c.id] = c.name
+          //   return c.id
+          // })
+          names[item.id] = item.name
         }
       }
     })
@@ -81,13 +62,35 @@ export default defineComponent({
 
     return () => {
       const list = (state.value && state.value.data) || []
-      console.log(list, 'list')
       return (
         <div class={styles.select}>
           <h4 class={styles.title}>全部标签</h4>
           <div class={styles.content}>
             {/* 曲谱类型,精品曲谱、普通曲谱 */}
-            {list.map(item => {
+            {list.length > 0 && (
+              <div class={styles.list}>
+                <SelectTagsChild
+                  // @ts-ignore
+                  selected={tags.value || []}
+                  child={list || []}
+                  onSelect={(val: any) => {
+                    if (tags.value.length >= 3) {
+                      Toast('最多只能选3个标签')
+                      return
+                    }
+                    setTimeout(() => {
+                      val.forEach(i => {
+                        if (!tags.value.includes(i)) {
+                          tags.value.push(i)
+                        }
+                      })
+                    }, 100)
+                  }}
+                  {...restProps}
+                />
+              </div>
+            )}
+            {/* {list.map(item => {
               if (!item.children || item.children.length <= 0) {
                 return null
               }
@@ -106,7 +109,7 @@ export default defineComponent({
                   />
                 </div>
               )
-            })}
+            })} */}
           </div>
           <footer class="van-safe-area-bottom van-hairline--top">
             <Button class={styles.btn} round onClick={resetTags}>

+ 5 - 5
src/views/order-detail/payment/index.tsx

@@ -94,11 +94,11 @@ export default defineComponent({
       } catch {}
       // 不管接口是否报错,都返回
       this.$emit('update:modelValue', false)
-      // 为了单独处理支付 曲目购买
-      if (!noBack && orderStatus.orderObject.orderType == 'MUSIC') {
-        postMessage({ api: 'back', content: {} })
-        return
-      }
+      // 为了单独处理支付 曲目购买  && orderStatus.orderObject.orderType == 'MUSIC'
+      // if (!noBack) {
+      //   postMessage({ api: 'back', content: {} })
+      //   return
+      // }
 
       !noBack && this.$router.go(-1)
       this.onBackOut && this.onBackOut()