Browse Source

更新打包

lex 1 year ago
parent
commit
52b33a1456

+ 1 - 1
src/router/routes-tenant.ts

@@ -201,7 +201,7 @@ export default [
             }
           },
           {
-            path: '',
+            path: '/music-songbook/musicSongbook',
             name: 'musicSongbook',
             component: () => import('@/tenant/music/songbook'),
             meta: {

+ 1 - 1
src/state.ts

@@ -18,7 +18,7 @@ export const state = reactive({
     unionId: 0 // 是否已关联账号
   } as any, // 管乐团信息
   projectType: 'default' as 'default' | 'tenant', // 机构端,还是默认
-  payBackPath: '/tenant/',
+  payBackPath: '/tenant.html',
   platformType: '' as 'STUDENT' | 'TEACHER',
   platformApi: '/api-student' as '/api-student' | '/api-teacher',
   version: '', // 版本号 例如: 1.0.0

+ 1 - 1
src/tenant/activation-code/index.tsx

@@ -151,7 +151,7 @@ export default defineComponent({
                 {state.list.map((item: any) => (
                   <Row>
                     <Col span={5}>{item.activationCode}</Col>
-                    <Col span={4}>6个月</Col>
+                    <Col span={4}>{item.purchaseCycle}个月</Col>
                     <Col
                       span={6}
                       class={item.activationStatus ? styles.c1 : styles.c3}

BIN
src/tenant/images/album-bg.png


BIN
src/tenant/images/bg-image-search.png


BIN
src/tenant/images/music-bg.png


+ 28 - 22
src/tenant/music/personal/practice.tsx

@@ -43,29 +43,35 @@ export default defineComponent({
       return (
         <>
           {prevNum.value > 0 && (
-            <Cell titleClass={styles.pTitle} title="最近练习" border={false} />
+            <>
+              <Cell
+                titleClass={styles.pTitle}
+                title="最近练习"
+                border={false}
+              />
+              <div class={styles.practice}>
+                <Song
+                  showTitleImg
+                  list={list}
+                  onDetail={(item: any) => {
+                    const url =
+                      location.origin +
+                      location.pathname +
+                      '#/music-detail?id=' +
+                      item.id
+                    openDefaultWebView(url, () => {
+                      router.push({
+                        path: '/music-detail',
+                        query: {
+                          id: item.id
+                        }
+                      })
+                    })
+                  }}
+                />
+              </div>
+            </>
           )}
-          <div class={styles.practice}>
-            <Song
-              showTitleImg
-              list={list}
-              onDetail={(item: any) => {
-                const url =
-                  location.origin +
-                  location.pathname +
-                  '#/music-detail?id=' +
-                  item.id
-                openDefaultWebView(url, () => {
-                  router.push({
-                    path: '/music-detail',
-                    query: {
-                      id: item.id
-                    }
-                  })
-                })
-              }}
-            />
-          </div>
         </>
       )
     }

+ 22 - 4
src/tenant/music/personal/tenant-album.tsx

@@ -44,6 +44,15 @@ export default defineComponent({
       loading.value = false
     }
 
+    const onDetail = (item: any) => {
+      router.push({
+        path: '/train-tool',
+        query: {
+          albumId: item.id
+        }
+      })
+    }
+
     return () => {
       return (
         <List
@@ -55,11 +64,15 @@ export default defineComponent({
         >
           {rows.value.length
             ? rows.value.map((item: any) => (
-                <CellGroup class={styles.tennatCellGroup} border={false}>
-                  <Cell isLink>
+                <CellGroup
+                  class={styles.tennatCellGroup}
+                  border={false}
+                  onClick={() => onDetail(item)}
+                >
+                  <Cell isLink clickable={false}>
                     {{
                       icon: () => (
-                        <img src={item.coverImg} class={styles.tenantLogo} />
+                        <img src={item.tenantImg} class={styles.tenantLogo} />
                       ),
                       title: () => (
                         <div class={styles.tenantName}>{item.tenantName}</div>
@@ -68,7 +81,12 @@ export default defineComponent({
                   </Cell>
                   <Cell>
                     {{
-                      icon: () => <Image class={styles.tenantCoverImg} />,
+                      icon: () => (
+                        <Image
+                          src={item.coverImg}
+                          class={styles.tenantCoverImg}
+                        />
+                      ),
                       title: () => (
                         <div class={styles.tenantContent}>
                           <h2>{item.name}</h2>

+ 1 - 0
src/tenant/music/search/all-search.module.less

@@ -0,0 +1 @@
+.albumSection {}

+ 64 - 0
src/tenant/music/search/all-search.tsx

@@ -0,0 +1,64 @@
+import { defineComponent, onMounted, onUnmounted, reactive, ref } from 'vue'
+import styles from './all-search.module.less'
+import { useRoute, useRouter } from 'vue-router'
+import MusicGrid from '../component/music-grid'
+import request from '@/helpers/request'
+
+export default defineComponent({
+  name: 'MusicSearch',
+  props: {
+    defauleParams: {
+      type: Object,
+      default: () => ({})
+    }
+  },
+  emits: ['confirm'],
+  setup(props) {
+    const route = useRoute()
+    const router = useRouter()
+    const state = reactive({
+      albumList: [] as any
+    })
+
+    const getAlbumList = async () => {
+      try {
+        const { data } = await request.post('/api-student/music/album/list', {
+          data: {
+            ...props.defauleParams,
+            page: 1,
+            rows: 3
+          }
+        })
+        console.log(data)
+        state.albumList = data.rows || []
+      } catch {
+        //
+      }
+    }
+
+    // music-songbook/search
+    onMounted(() => {
+      getAlbumList()
+    })
+
+    return () => (
+      <div class={styles.allSearch}>
+        <div class={styles.albumSection}>
+          <div class={styles.musicGrid}>
+            <MusicGrid
+              list={state.albumList}
+              onGoto={(n: any) => {
+                router.push({
+                  name: 'music-album-detail',
+                  params: {
+                    id: n.id
+                  }
+                })
+              }}
+            />
+          </div>
+        </div>
+      </div>
+    )
+  }
+})

+ 27 - 81
src/tenant/music/search/header.tsx

@@ -11,13 +11,12 @@ import Search from '@/components/col-search'
 import { useLocalStorage } from '@vueuse/core'
 import styles from './index.module.less'
 import classNames from 'classnames'
-import SelectTag from './select-tag'
 import { getRandomKey } from '../music'
 import SelectSubject from './select-subject'
 import { SubjectEnum, useSubjectId } from '@/helpers/hooks'
 import { state } from '@/state'
 import TheSticky from '@/components/the-sticky'
-import bgImg from '../../images/bg-image.png'
+import bgImg from '../../images/bg-image-search.png'
 
 export const mitter = mitt()
 
@@ -54,9 +53,8 @@ export default defineComponent({
     const route = useRoute()
     const keyword = ref('')
     const tagids = ref('')
-    const tagVisibility = ref(false)
     const words = useLocalStorage<string[]>('music-search', [])
-    const activeTab = ref('songe')
+    const activeTab = ref('all')
 
     onBeforeRouteUpdate(() => {
       const getSubject: any = useSubjectId(SubjectEnum.SEARCH)
@@ -65,7 +63,7 @@ export default defineComponent({
       if (route.path === '/music-songbook/search') {
         keyword.value = ''
         tagids.value = ''
-        activeTab.value = 'songe'
+        activeTab.value = 'all'
         try {
           selectTagRef.value?.resetTags?.()
         } catch (error) {
@@ -87,18 +85,12 @@ export default defineComponent({
       }
       if (val) {
         words.value.unshift(val)
+        console.log(words.value.length, 'words.value.length')
         words.value.length = Math.min(words.value.length, 10)
       }
       mitter.emit('search', val)
     }
 
-    const onComfirm = (tags, name = '') => {
-      const data = Object.values(tags).flat().filter(Boolean).join(',')
-      tagids.value = data
-      mitter.emit('confirm', tags)
-      tagVisibility.value = false
-    }
-
     const onComfirmSubject = (item: any) => {
       // console.log('onSort', item)
       subject.name = item.name
@@ -124,15 +116,10 @@ export default defineComponent({
       id: getSubject.id || ''
     })
 
-    // this.historyTag = [{id: 0, title: '血液病'},{id: 7, title: '血液病有哪几种'},
-    //     {id: 3, title: '儿童淋巴瘤'}, {id: 4, title: '喉咙痛声音嘶哑'}, {id: 5, title: '咽喉癌的早期症状'},
-    //     {id: 6, title: '成人淋巴癌'},{id: 1, title: '肺癌'},{id: 2, title: '白血病'}
-    //   ]
     const tagRef = ref<any>([])
     const collapse = reactive({
-      // historyTag:
-      line: 1,
-      arrowStatus: true
+      line: 0,
+      arrowStatus: false
     })
 
     // 历史搜索默认收起
@@ -141,70 +128,36 @@ export default defineComponent({
         if (!words.value || !words.value.length) {
           return
         }
-        let offsetLeft = 0
+        let offsetLeft = -1
         collapse.line = 0
         const tags = tagRef.value
         tags.forEach((item: any, index: number) => {
           try {
-            console.log(index, '1212', 'tagRef', item)
+            item.$el.style.display = 'block'
             if (index === 0) {
               collapse.line = 1
               offsetLeft = item.$el.offsetLeft
             } else if (item.$el.offsetLeft === offsetLeft && index != 0) {
               // 如果某个标签的offsetLeft和第一个标签的offsetLeft相等  说明增加了一行
               collapse.line += 1
-              console.log(11111, collapse.line)
             }
 
-            if (collapse.line > 2) {
-              //从第3行开始 隐藏标签
-              item.$el.style.display = 'none'
-              console.log(item.$el.style)
-              // 显示展开按钮  class名chu是在前面动态添加的
-              if (item.className === 'chu') {
-                // item.style.display = 'inline-block'
-                // item.style.marginTop = 0 + 'px'
+            if (!collapse.arrowStatus) {
+              if (collapse.line > 2) {
+                //从第3行开始 隐藏标签
+                item.$el.style.display = 'none'
+              } else {
+                item.$el.style.display = 'block'
               }
+            } else {
+              item.$el.style.display = 'block'
             }
           } catch (e: any) {
             console.log(e, 'Error')
           }
         })
-        if (collapse.line > 2) {
-          // 超过2行  手动添加“展开”按钮
-          // words.value.push({id:0, title: '展开'})
-        }
-
-        console.log(collapse.line, 'collapse.line')
       })
     }
-    // 历史搜索展开
-    // const openAll = () => {
-    //   let tags = tagRef
-    //   let index = words.value.findIndex((item) => {
-    //     return item.title === '展开'
-    //   })
-    //   // 展开状态  删除“展开”按钮
-    //   words.value.splice(index, 1, )
-    //   // 添加“收起”按钮
-    //   words.value.splice(tags.length - 1, 0, {id:0, title: '收起'})
-    //   // 将所有的标签都显示
-    //   tags.forEach((item,index) => {
-    //     item.style.display = 'inline-block'
-    //   })
-    // }
-
-    // // 点击某个历史搜索
-    // clickTag(item) {
-    //   if (item.title === '展开') {
-    //     this.openAll()
-    //   } else if (item.title === '收起') {
-    //     this.defaultClose()
-    //   } else {
-
-    //   }
-
-    // }
     // 首先调用默认收起的方法
     defaultClose()
 
@@ -266,7 +219,6 @@ export default defineComponent({
                 <div class={styles.content}>
                   {words.value.map((item: any, index: number) => (
                     <Tag
-                      // ref={(el: any) => (tagRef[index] = el)}
                       ref={(el: any) => (tagRef.value[index] = el)}
                       round
                       class={[styles.searchKeyword, 'van-ellipsis']}
@@ -277,8 +229,16 @@ export default defineComponent({
                     </Tag>
                   ))}
                   {collapse.line > 2 && (
-                    <span class={styles.arrowMore}>
-                      <Icon name={'arrow-down'} />
+                    <span
+                      class={[styles.arrowMore]}
+                      onClick={() => {
+                        collapse.arrowStatus = !collapse.arrowStatus
+                        defaultClose()
+                      }}
+                    >
+                      <Icon
+                        name={collapse.arrowStatus ? 'arrow-up' : 'arrow-down'}
+                      />
                     </span>
                   )}
                 </div>
@@ -295,26 +255,12 @@ export default defineComponent({
               v-model:active={activeTab.value}
               onChange={val => (activeTab.value = val)}
             >
+              <Tab title="综合" name="all"></Tab>
               <Tab title="单曲" name="songe"></Tab>
               <Tab title="专辑" name="album"></Tab>
             </Tabs>
           )}
           <RouterView />
-          <Popup
-            show={tagVisibility.value}
-            round
-            closeable
-            position="bottom"
-            style={{ height: '60%' }}
-            teleport="body"
-            onUpdate:show={val => (tagVisibility.value = val)}
-          >
-            <SelectTag
-              ref={selectTagRef}
-              onConfirm={onComfirm}
-              onCancel={() => {}}
-            />
-          </Popup>
 
           {/* 声部弹框 */}
           <Popup

+ 2 - 3
src/tenant/music/search/index.module.less

@@ -47,7 +47,6 @@
   .keywords {
     margin-top: 10px;
     padding: 0 14px;
-    padding-bottom: 10px;
     display: flex;
     align-items: center;
 
@@ -111,7 +110,7 @@
 .sticky {
   :global {
     .van-sticky {
-      background: url('../../images/bg-image.png') no-repeat top center;
+      background: url('../../images/bg-image-search.png') no-repeat top center;
       background-size: 100% 214px;
       box-shadow: none !important;
     }
@@ -155,7 +154,7 @@
   :global {
     .van-tab {
       font-size: 16px !important;
-      margin-top: 15px;
+
       color: #999999;
     }
 

+ 20 - 7
src/tenant/music/search/index.tsx

@@ -7,6 +7,7 @@ import { useRoute, useRouter } from 'vue-router'
 import { getRandomKey } from '../music'
 import { mitter } from './header'
 import { SubjectEnum, useSubjectId } from '@/helpers/hooks'
+import AllSearch from './all-search'
 
 export default defineComponent({
   name: 'MusicSearch',
@@ -20,7 +21,7 @@ export default defineComponent({
     const subject = ref()
     const tagVisibility = ref(false)
     const words = useLocalStorage<string[]>('music-search', [])
-    const activeTab = ref('songe')
+    const activeTab = ref('all')
 
     const getSubject: any = useSubjectId(SubjectEnum.SEARCH)
     subject.value = getSubject.id
@@ -57,6 +58,7 @@ export default defineComponent({
     const musicList = ref(null)
 
     const changeTab = (val: any) => {
+      console.log(val, 'val')
       activeTab.value = val
     }
 
@@ -65,6 +67,8 @@ export default defineComponent({
       mitter.on('search', onSearch)
       mitter.on('confirm', onComfirm)
       mitter.on('confirmSubject', onConfirmSubject)
+
+      console.log(activeTab.value, 'activeTab.value')
     })
 
     onUnmounted(() => {
@@ -77,18 +81,27 @@ export default defineComponent({
     return () => {
       return (
         <div class={styles.search}>
-          {activeTab.value === 'album' ? (
+          {activeTab.value === 'all' && (
+            <AllSearch
+              defauleParams={{
+                albumTagIds: tagids.value,
+                subjectIds: subject.value
+              }}
+            />
+          )}
+          {activeTab.value === 'album' && (
             <AlbumList
               hideSearch
               ref={albumList}
               defauleParams={{
-                search: keyword.value,
-                tagids: tagids.value,
+                // search: keyword.value,
+                // tagids: tagids.value,
                 albumTagIds: tagids.value,
                 subjectIds: subject.value
               }}
             />
-          ) : (
+          )}
+          {activeTab.value === 'songe' && (
             <MusicList
               hideSearch
               ref={musicList}
@@ -102,8 +115,8 @@ export default defineComponent({
                 })
               }}
               defauleParams={{
-                search: keyword.value,
-                tagids: tagids.value,
+                // search: keyword.value,
+                // tagids: tagids.value,
                 musicTagIds: tagids.value,
                 subjectIds: subject.value
               }}

+ 1 - 0
src/tenant/music/train-list/index.module.less

@@ -89,6 +89,7 @@
   border-radius: 18px;
   background-color: #fff;
   margin: 6px;
+  min-height: 40vh;
 }
 
 .bgImg {

+ 179 - 228
src/tenant/music/train-list/index.tsx

@@ -1,35 +1,16 @@
 import { defineComponent, nextTick, onMounted, reactive, ref } from 'vue'
-import {
-  Sticky,
-  List,
-  Popup,
-  Icon,
-  Switch,
-  Tabs,
-  Tab,
-  DropdownMenu,
-  DropdownItem,
-  Tag
-} from 'vant'
+import { List, DropdownMenu, DropdownItem, Tag, Sticky, Button } from 'vant'
 import Search from '@/components/col-search'
 import request from '@/helpers/request'
-// import Item from './item'
-import SelectTag from '../search/select-tag'
 import { useRoute, useRouter } from 'vue-router'
 import ColResult from '@/components/col-result'
 import styles from './index.module.less'
 import { getRandomKey } from '../music'
 import { openDefaultWebView, state as baseState } from '@/state'
-import SelectSubject from '../search/select-subject'
 import { SubjectEnum, useSubjectId } from '@/helpers/hooks'
 import Song from '../component/song'
 import ColHeader from '@/components/col-header'
-import { useRect } from '@vant/use'
-import { useAsyncState } from '@vueuse/core'
 import bgImg from '../../images/bg-image.png'
-import iconSearch from './icons/icon_search.png'
-import iconFree from './icons/icon-free.png'
-import { browser } from '@/helpers/utils'
 import TheSticky from '@/components/the-sticky'
 
 const noop = () => {
@@ -39,18 +20,6 @@ const noop = () => {
 export default defineComponent({
   name: 'MusicList',
   props: {
-    hideSearch: {
-      type: Boolean,
-      default: false
-    },
-    defauleParams: {
-      type: Object,
-      default: () => ({})
-    },
-    onItemClick: {
-      type: Function,
-      default: noop
-    },
     teacherId: {
       type: String || Number,
       default: ''
@@ -60,77 +29,24 @@ export default defineComponent({
       default: false
     }
   },
-  setup(
-    { hideSearch, defauleParams, onItemClick, teacherId, myself },
-    { expose }
-  ) {
-    const teacherDetaultSubject = ref({
-      id: '',
-      name: ''
-    })
-    if (baseState.platformType === 'TEACHER') {
-      // defaultSubject
-      const users = baseState.user.data
-      teacherDetaultSubject.value = {
-        name: users.defaultSubjectName || '全部声部',
-        id: users.defaultSubject || ''
-      }
-    } else {
-      const subjects: any = useSubjectId(SubjectEnum.SEARCH)
-      // 判断是否已有数据
-      if (!subjects.id) {
-        const users = baseState.user.data
-        const subjectId = users.subjectId
-          ? Number(users.subjectId.split(',')[0])
-          : ''
-        const subjectName = users.subjectName
-          ? users.subjectName.split(',')[0]
-          : ''
-        if (subjectId) {
-          useSubjectId(
-            SubjectEnum.SEARCH,
-            JSON.stringify({
-              id: subjectId,
-              name: subjectName
-            }),
-            'set'
-          )
-        }
-      }
-    }
-
+  setup({ onItemClick }, { expose }) {
     localStorage.setItem('behaviorId', getRandomKey())
     const route = useRoute()
     const router = useRouter()
-    const tempParams: any = {}
-    if (baseState.version) {
-      tempParams.version = baseState.version || '' // 处理ios审核版本
-      tempParams.platform =
-        baseState.platformType === 'STUDENT' ? 'ios-student' : 'ios-teacher'
-    }
-    // 判断是否在搜索页面用过
-    if (!hideSearch) {
-      if (baseState.platformType === 'TEACHER') {
-        tempParams.subjectIds = teacherDetaultSubject.value.id
-      } else {
-        const getSubject: any = useSubjectId(SubjectEnum.SEARCH)
-        tempParams.subjectIds = getSubject.id
-      }
-
-      // const getMusic: any = useSubjectId(SubjectEnum.MUSIC_FREE)
-    }
     //
     const params = reactive({
       search: (route.query.search as string) || '',
       subjectType: (route.query.subjectType as string) || '',
       page: 1,
-      ...tempParams
+      subjectId: null,
+      level: '',
+      type: ''
     })
-    const subjectList = ref<any>([])
     const data = ref<any>(null)
     const loading = ref(false)
     const finished = ref(false)
     const isError = ref(false)
+    const searchObj = ref<any>({})
 
     const apiSuffix = ref(
       baseState.platformType === 'STUDENT' ? '/api-student' : '/api-teacher'
@@ -144,9 +60,6 @@ export default defineComponent({
     }
 
     const FetchList = async () => {
-      if (loading.value) {
-        return
-      }
       loading.value = true
       isError.value = false
       const tempParams = {
@@ -160,7 +73,6 @@ export default defineComponent({
             data: tempParams
           }
         )
-        console.log(res, 'res')
         if (data.value) {
           const result = (data.value?.rows || []).concat(res.data.rows || [])
           data.value.rows = result
@@ -174,70 +86,6 @@ export default defineComponent({
       loading.value = false
     }
 
-    // 设置默认声部
-    const setDefaultSubject = async (subjectId: any) => {
-      try {
-        await request.post('/api-teacher/teacher/defaultSubject', {
-          params: {
-            subjectId
-          }
-        })
-      } catch {
-        //
-      }
-    }
-
-    const onComfirmSubject = item => {
-      params.page = 1
-      params.subjectIds = item.id
-      data.value = null
-      if (baseState.platformType === 'TEACHER') {
-        teacherDetaultSubject.value = {
-          name: item.name,
-          id: item.id
-        }
-        setDefaultSubject(item.id)
-      } else {
-        subject.id = item.id
-        subject.name = item.name
-        useSubjectId(
-          SubjectEnum.SEARCH,
-          JSON.stringify({
-            id: item.id,
-            name: item.name
-          }),
-          'set'
-        )
-      }
-
-      FetchList()
-      subject.show = false
-    }
-
-    const getSubject: any = useSubjectId(SubjectEnum.SEARCH)
-    const subject = reactive({
-      show: false,
-      name: getSubject.id ? getSubject.name : '全部声部',
-      id: getSubject.id || ''
-    })
-
-    const getSubjectList = async () => {
-      const { data } = await request.get(
-        `${apiSuffix.value}/subject/subjectSelect?type=MUSIC`
-      )
-      if (Array.isArray(data)) {
-        const subject: any = []
-        data.forEach((item: any) => {
-          if (item.subjects && item.subjects.length) {
-            item.subjects.forEach(s => {
-              subject.push(s)
-            })
-          }
-        })
-        subjectList.value = subject || []
-      }
-    }
-
     const getSelectCondition = async () => {
       const { data } = await request.post(
         `${apiSuffix.value}/tenantAlbumMusic/selectCondition`,
@@ -247,7 +95,7 @@ export default defineComponent({
           }
         }
       )
-      console.log(data)
+      searchObj.value = data || {}
     }
 
     onMounted(async () => {
@@ -261,87 +109,190 @@ export default defineComponent({
       } else if (params.subjectType === 'ENSEMBLE') {
         document.title = '合奏练习'
       }
-      getSubjectList()
-      getSelectCondition()
-    })
-
-    expose({
-      onSearch,
-      onComfirmSubject
+      loading.value = true
+      await getSelectCondition()
+      await FetchList()
     })
 
     return () => {
       return (
         <>
-          {!hideSearch && (
-            <div class={styles.sticky}>
-              <TheSticky>
-                <ColHeader
-                  background="transparent"
-                  isFixed={false}
-                  border={false}
-                  color="#131415"
-                />
-                <Search
-                  onSearch={onSearch}
-                  type="tenant"
-                  background="transparent"
-                  inputBackground="transparent"
-                  // leftIcon={iconSearch}
-                  v-slots={{
-                    left: () => (
-                      <DropdownMenu>
-                        <DropdownItem title="筛选">
-                          <div
-                            class={styles.searchResult}
-                            style={{ maxHeight: '45vh', overflowY: 'auto' }}
-                          >
-                            <div class={styles.searchTitle}>声部</div>
-                            <div
-                              class={[
-                                styles['radio-group'],
-                                styles.radio,
-                                styles['organ-radio']
-                              ]}
-                            >
-                              {subjectList.value.map((subject: any) => {
-                                const isActive =
-                                  subject.id ===
-                                  Number(params.subjectIds || null)
-                                const type = isActive ? 'primary' : 'default'
-                                return (
-                                  <Tag
-                                    size="large"
-                                    plain={isActive}
-                                    type={type}
-                                    round
-                                    onClick={() => {
-                                      console.log(subject, '1212')
-                                      // this.subject = { ...subject }
-                                    }}
-                                  >
-                                    {subject.name}
-                                  </Tag>
-                                )
-                              })}
+          <div class={styles.sticky}>
+            <TheSticky>
+              <ColHeader
+                background="transparent"
+                isFixed={false}
+                border={false}
+                color="#131415"
+              />
+              <Search
+                onSearch={onSearch}
+                type="tenant"
+                background="transparent"
+                inputBackground="transparent"
+                // leftIcon={iconSearch}
+                v-slots={{
+                  left: () => (
+                    <DropdownMenu>
+                      <DropdownItem title="筛选">
+                        <div
+                          class={styles.searchResult}
+                          style={{ maxHeight: '45vh', overflowY: 'auto' }}
+                        >
+                          {searchObj.value.subjects &&
+                            searchObj.value.subjects.length > 0 && (
+                              <>
+                                <div class={styles.searchTitle}>声部</div>
+                                <div
+                                  class={[
+                                    styles['radio-group'],
+                                    styles.radio,
+                                    styles['organ-radio']
+                                  ]}
+                                >
+                                  {searchObj.value.subjects.map(
+                                    (subject: any) => {
+                                      const isActive =
+                                        subject.id ===
+                                        Number(params.subjectId || null)
+                                      const type = isActive
+                                        ? 'primary'
+                                        : 'default'
+                                      return (
+                                        <Tag
+                                          size="large"
+                                          plain={isActive}
+                                          type={type}
+                                          round
+                                          onClick={() => {
+                                            console.log(subject, '1212')
+                                            // this.subject = { ...subject }
+                                          }}
+                                        >
+                                          {subject.name}
+                                        </Tag>
+                                      )
+                                    }
+                                  )}
+                                </div>
+                              </>
+                            )}
+                          {searchObj.value.levels &&
+                            searchObj.value.levels.length > 0 && (
+                              <>
+                                <div class={styles.searchTitle}>级别</div>
+                                <div
+                                  class={[
+                                    styles['radio-group'],
+                                    styles.radio,
+                                    styles['organ-radio']
+                                  ]}
+                                >
+                                  {searchObj.value.levels.map(
+                                    (subject: any) => {
+                                      const isActive = subject === params.level
+                                      const type = isActive
+                                        ? 'primary'
+                                        : 'default'
+                                      return (
+                                        <Tag
+                                          size="large"
+                                          plain={isActive}
+                                          type={type}
+                                          round
+                                          onClick={() => {
+                                            console.log(subject, '1212')
+                                            // this.subject = { ...subject }
+                                          }}
+                                        >
+                                          {subject}
+                                        </Tag>
+                                      )
+                                    }
+                                  )}
+                                </div>
+                              </>
+                            )}
+                          {searchObj.value.types &&
+                            searchObj.value.types.length > 0 && (
+                              <>
+                                <div class={styles.searchTitle}>类型</div>
+                                <div
+                                  class={[
+                                    styles['radio-group'],
+                                    styles.radio,
+                                    styles['organ-radio']
+                                  ]}
+                                >
+                                  {searchObj.value.types.map((subject: any) => {
+                                    const isActive = subject === params.type
+                                    const type = isActive
+                                      ? 'primary'
+                                      : 'default'
+                                    return (
+                                      <Tag
+                                        size="large"
+                                        plain={isActive}
+                                        type={type}
+                                        round
+                                        onClick={() => {
+                                          console.log(subject, '1212')
+                                          // this.subject = { ...subject }
+                                        }}
+                                      >
+                                        {subject}
+                                      </Tag>
+                                    )
+                                  })}
+                                </div>
+                              </>
+                            )}
+
+                          <Sticky position="bottom" offsetBottom={0}>
+                            <div class={['btnGroup', 'btnMore']}>
+                              <Button
+                                type="primary"
+                                plain
+                                round
+                                onClick={() => {
+                                  params.subjectId = null
+                                  params.level = ''
+                                  params.type = ''
+                                }}
+                              >
+                                重 置
+                              </Button>
+
+                              <Button
+                                type="primary"
+                                round
+                                block
+                                onClick={() => {
+                                  // this.onComfirm({ ...this.subject })
+                                }}
+                              >
+                                确 认
+                              </Button>
                             </div>
-                          </div>
-                        </DropdownItem>
-                      </DropdownMenu>
-                    )
-                  }}
-                />
-              </TheSticky>
-              <img class={styles.bgImg} src={bgImg} />
-            </div>
-          )}
+                          </Sticky>
+                        </div>
+                      </DropdownItem>
+                    </DropdownMenu>
+                  )
+                }}
+              />
+            </TheSticky>
+            <img class={styles.bgImg} src={bgImg} />
+          </div>
+
           <div class={styles.alumnList}>
             <List
-              loading={loading.value}
+              // loading={loading.value}
               finished={finished.value}
               finished-text={data.value && data.value.rows.length ? '' : ''}
               onLoad={FetchList}
               error={isError.value}
+              immediateCheck={false}
             >
               {data.value && data.value.rows.length ? (
                 <Song

+ 2 - 0
src/tenant/music/train-tool/index.module.less

@@ -44,6 +44,8 @@
     border-radius: 6px;
     position: relative;
     z-index: 9;
+
+    --van-image-error-icon-size: 118px;
   }
 
   .iconPian {

+ 60 - 37
src/tenant/music/train-tool/index.tsx

@@ -10,7 +10,7 @@ import iconRightTop from './images/icon-right-top.png'
 import iconAlbumCover from '../../images/icon-album-cover.png'
 import { state as baseState } from '@/state'
 import Song from '../component/song'
-import { useRouter } from 'vue-router'
+import { useRoute, useRouter } from 'vue-router'
 import ColResult from '@/components/col-result'
 import { moneyFormat } from '@/helpers/utils'
 import { orderStatus } from '@/views/order-detail/orderStatus'
@@ -19,11 +19,13 @@ import { postMessage } from '@/helpers/native-message'
 export default defineComponent({
   name: 'train-tool',
   setup() {
+    const route = useRoute()
     const router = useRouter()
     const background = ref<string>('rgba(55, 205, 177, 0)')
     const color = ref<string>('#fff')
     const state = reactive({
       details: {} as any,
+      albumId: route.query.albumId || null,
       activeTab: 'SUBJECT',
       loading: false,
       finished: false,
@@ -68,7 +70,10 @@ export default defineComponent({
           costPrice: 0,
           status: false
         }
-      ]
+      ],
+      ensembleCounts: false,
+      musicCounts: false,
+      subjectCounts: false
     })
     const params = reactive({
       page: 1,
@@ -81,10 +86,12 @@ export default defineComponent({
     const getDetails = async () => {
       try {
         const { data } = await request.post(
-          apiSuffix.value + '/userTenantAlbumRecord/detail'
+          apiSuffix.value +
+            '/userTenantAlbumRecord/detail?albumId=' +
+            state.albumId
         )
         state.details = data || {}
-
+        console.log(state.details, 'details')
         state.buyList.forEach((item: any, index: number) => {
           item.salePrice = (index + 1) * data.salePrice
           item.costPrice = (index + 1) * data.costPrice
@@ -93,6 +100,18 @@ export default defineComponent({
         state.selectMember = {
           ...state.buyList[0]
         }
+
+        state.ensembleCounts = data.ensembleCounts <= 0 ? false : true
+        state.subjectCounts = data.subjectCounts <= 0 ? false : true
+        state.musicCounts = data.musicCounts <= 0 ? false : true
+
+        if (state.subjectCounts) {
+          state.activeTab = 'SUBJECT'
+        } else if (state.ensembleCounts) {
+          state.activeTab = 'ENSEMBLE'
+        } else if (state.musicCounts) {
+          state.activeTab = 'MUSIC'
+        }
       } catch {
         //
       }
@@ -102,6 +121,7 @@ export default defineComponent({
       if (state.loading) {
         return
       }
+      console.log(state.details, 'state.details')
       state.loading = true
       state.isError = false
       const tempParams = {
@@ -178,37 +198,38 @@ export default defineComponent({
         }
       ]
 
-      // const res = await request.post('/api-student/userOrder/getPendingOrder', {
-      //   data: {
-      //     goodType: 'TENANT_ALBUM',
-      //     bizId: details.id
-      //   }
-      // })
+      const res = await request.post('/api-student/userOrder/getPendingOrder', {
+        data: {
+          goodType: 'TENANT_ALBUM',
+          bizId: details.id
+        }
+      })
 
-      // const result = res.data
-      // if (result) {
-      //   state.popupStatus = false
-      //   Dialog.confirm({
-      //     title: '提示',
-      //     message: '您有一个未支付的订单,是否继续支付?',
-      //     confirmButtonColor: '#269a93',
-      //     cancelButtonText: '取消订单',
-      //     confirmButtonText: '继续支付'
-      //   })
-      //     .then(async () => {
-      //       orderStatus.orderObject.orderNo = result.orderNo
-      //       orderStatus.orderObject.actualPrice = result.actualPrice
-      //       orderStatus.orderObject.discountPrice = result.discountPrice
-      //       routerTo()
-      //     })
-      //     .catch(() => {
-      //       Dialog.close()
-      //       // 只用取消订单,不用做其它处理
-      //       cancelPayment(result.orderNo)
-      //     })
-      // } else {
-      routerTo()
-      // }
+      const result = res.data
+      if (result) {
+        state.popupStatus = false
+        Dialog.confirm({
+          title: '提示',
+          message: '您有一个未支付的订单,是否继续支付?',
+          confirmButtonColor: '#269a93',
+          cancelButtonText: '取消订单',
+          confirmButtonText: '继续支付'
+        })
+          .then(async () => {
+            orderStatus.orderObject.orderNo = result.orderNo
+            orderStatus.orderObject.actualPrice = result.actualPrice
+            orderStatus.orderObject.discountPrice = result.discountPrice
+            orderStatus.orderObject.paymentConfig = result.paymentConfig
+            routerTo()
+          })
+          .catch(() => {
+            Dialog.close()
+            // 只用取消订单,不用做其它处理
+            cancelPayment(result.orderNo)
+          })
+      } else {
+        routerTo()
+      }
     }
     const routerTo = () => {
       const album = state.details
@@ -255,6 +276,7 @@ export default defineComponent({
                 height="100%"
                 fit="cover"
                 src={state.details?.coverImg || iconAlbumCover}
+                errorIcon={iconAlbumCover}
               />
               <span class={styles.numContent}>
                 <img src={iconMenu} class={styles.iconMenu} />共
@@ -303,9 +325,9 @@ export default defineComponent({
               FetchList()
             }}
           >
-            <Tab title="声部练习" name="SUBJECT"></Tab>
-            <Tab title="合奏练习" name="ENSEMBLE"></Tab>
-            <Tab title="独奏曲目" name="MUSIC"></Tab>
+            {state.subjectCounts && <Tab title="声部练习" name="SUBJECT"></Tab>}
+            {state.musicCounts && <Tab title="合奏练习" name="ENSEMBLE"></Tab>}
+            {state.ensembleCounts && <Tab title="独奏曲目" name="MUSIC"></Tab>}
           </Tabs>
 
           <div class={styles.alumnList}>
@@ -314,6 +336,7 @@ export default defineComponent({
               finished={state.finished}
               finished-text={' '}
               onLoad={FetchList}
+              immediateCheck={false}
               error={state.isError}
             >
               {state.list && state.list.length ? (

+ 55 - 37
src/tenant/trade/index.tsx

@@ -14,6 +14,7 @@ import {
 } from 'vant'
 import Search from '@/components/col-search'
 import request from '@/helpers/request'
+import iconMember from '@common/images/icon_member.png'
 // import Item from './item'
 
 import { useRouter } from 'vue-router'
@@ -136,7 +137,7 @@ export default defineComponent({
           `/api-student/userOrder/detailByOrderNo/${item.orderNo}`
         )
         const result = res.data
-        tradeOrder(result, () => {
+        tradeOrder({ ...result, paymentConfig: item.paymentConfig }, () => {
           router.push({
             path: '/orderDetail',
             query: {
@@ -231,44 +232,61 @@ export default defineComponent({
                     }
                     valueClass={styles.tradeType}
                   />
-                  <Cell
-                    border={false}
-                    class={styles.orderSection}
-                    v-slots={{
-                      icon: () => <Image class={styles.tradeLogo} />,
-                      title: () => (
-                        <div class={styles.goodsSection}>
-                          <div class={[styles.title]}>
-                            <span class={[styles.name, 'van-ellipsis']}>
-                              {item.orderName}
-                            </span>
-                            <span class={styles.desc}>
-                              ¥{moneyFormat(item.expectPrice)}
-                            </span>
-                          </div>
+                  {item.orderDetailList &&
+                    item.orderDetailList.map((orderDetail: any) => (
+                      <Cell
+                        border={false}
+                        class={styles.orderSection}
+                        v-slots={{
+                          icon: () => (
+                            <Image
+                              src={
+                                orderDetail.goodType === 'VIP'
+                                  ? iconMember
+                                  : orderDetail.bizInfo?.bizCover
+                              }
+                              class={styles.tradeLogo}
+                            />
+                          ),
+                          title: () => (
+                            <div class={styles.goodsSection}>
+                              <div class={[styles.title]}>
+                                <span class={[styles.name, 'van-ellipsis']}>
+                                  {orderDetail.bizInfo?.bizName}
+                                </span>
+                                <span class={styles.desc}>
+                                  ¥{moneyFormat(orderDetail.actualPrice)}
+                                </span>
+                              </div>
 
-                          <div class={styles.description}>
-                            <span class={[styles.d, 'van-ellipsis-l2']}>
-                              {item.orderDesc}
-                            </span>
-                            <span class={styles.t}>x6个月</span>
-                          </div>
+                              <div class={styles.description}>
+                                <span class={[styles.d, 'van-ellipsis']}>
+                                  {orderDetail.bizInfo?.bizDesc}
+                                </span>
+                                {orderDetail.goodType !== 'VIP' && (
+                                  <>
+                                    {orderDetail.goodType === 'TENANT_ALBUM' ? (
+                                      <span class={styles.t}>
+                                        x{orderDetail.bizInfo?.bizValidTime}个月
+                                      </span>
+                                    ) : (
+                                      <span class={styles.t}>永久</span>
+                                    )}
+                                  </>
+                                )}
+                              </div>
+
+                              {orderDetail.bizInfo?.bizMusicCount && (
+                                <span class={styles.songLength}>
+                                  共{orderDetail.bizInfo?.bizMusicCount}首
+                                </span>
+                              )}
+                            </div>
+                          )
+                        }}
+                      />
+                    ))}
 
-                          <span class={styles.songLength}>共35首</span>
-                        </div>
-                      )
-                      // default: () => (
-                      //   <div class={styles.content}>
-                      //     <span class={styles.price}>
-                      //       ¥
-                      //       {state.type === 'buy'
-                      //         ? moneyFormat(item.actualPrice)
-                      //         : moneyFormat(item.actualAmount)}
-                      //     </span>
-                      //   </div>
-                      // )
-                    }}
-                  />
                   <div class={styles.paymentPrice}>
                     {['PAYING', 'WAIT_PAY'].includes(item.status)
                       ? '需付款'

+ 38 - 8
src/tenant/trade/tradeOrder.ts

@@ -95,12 +95,12 @@ export const formatOrderDetail = async (item: any, amount?: IAmount) => {
             // 判断是否有优惠金额
             price: amount?.couponAmount
               ? Number(
-                (
-                  res.salePrice -
-                  amount.couponAmount +
-                  amount.discountPrice
-                ).toFixed(2)
-              )
+                  (
+                    res.salePrice -
+                    amount.couponAmount +
+                    amount.discountPrice
+                  ).toFixed(2)
+                )
               : res.salePrice || item.actualPrice,
             startTime: dayjs(res.startTime).format('YYYY-MM-DD'),
             endTime: dayjs(res.endTime).format('YYYY-MM-DD')
@@ -126,7 +126,6 @@ export const formatOrderDetail = async (item: any, amount?: IAmount) => {
       break
     case 'ALBUM':
       {
-        console.log(item)
         try {
           const res = await getAlbumDetail(item.bizId)
           tempList = {
@@ -139,6 +138,20 @@ export const formatOrderDetail = async (item: any, amount?: IAmount) => {
         }
       }
       break
+    case 'TENANT_ALBUM':
+      {
+        try {
+          const res = await getTenantAlbumDetail(item.bizId)
+          tempList = {
+            orderType: item.goodType,
+            goodName: item.goodName,
+            ...res
+          }
+        } catch (e: any) {
+          throw new Error(e.message)
+        }
+      }
+      break
     case 'ACTI_REGIST':
       {
         try {
@@ -236,6 +249,21 @@ export const getAlbumDetail = async (id: any) => {
   }
 }
 
+// 获取机构专辑详情
+export const getTenantAlbumDetail = async (id: any) => {
+  try {
+    const res = await request.post(
+      `${apiSuffix}/userTenantAlbumRecord/detail`,
+      {
+        data: { albumId: id }
+      }
+    )
+    return res.data
+  } catch {
+    throw new Error('获取机构专辑详情失败')
+  }
+}
+
 // 为了处理继续支付逻辑
 export const tradeOrder = (result: any, callBack?: any) => {
   const {
@@ -246,7 +274,8 @@ export const tradeOrder = (result: any, callBack?: any) => {
     orderType,
     orderDetailList,
     couponAmount, // 优惠金额
-    discountPrice
+    discountPrice,
+    paymentConfig // v2 类型的订单才会用
   } = result
   orderStatus.orderObject.orderType = orderType
   orderStatus.orderObject.orderName = orderName
@@ -255,6 +284,7 @@ export const tradeOrder = (result: any, callBack?: any) => {
   orderStatus.orderObject.orderNo = orderNo
   orderStatus.orderObject.discountPrice = discountPrice
   orderStatus.orderObject.orderList = []
+  orderStatus.orderObject.paymentConfig = paymentConfig
   try {
     orderDetailList.forEach(async (item: any) => {
       await formatOrderDetail(item, {

+ 17 - 41
src/views/order-detail/index.tsx

@@ -19,7 +19,12 @@ import Payment from './payment'
 import UrlPayment from '../adapay/payment'
 import ColHeader from '@/components/col-header'
 import { state } from '@/state'
-import { orderInfos, orderStatus, resestState } from './orderStatus'
+import {
+  orderInfos,
+  orderStatus,
+  orderTenantInfos,
+  resestState
+} from './orderStatus'
 import OrderVideo from './order-video'
 import OrderLive from './order-live'
 import OrderPractice from './order-practice'
@@ -54,7 +59,7 @@ export default defineComponent({
       exists: false, // 是否签署过用户注册协议
       bottomHeight: 0,
       paymentVendor: '', //支付厂商
-      paymentVersion: '', // 支付版本,可用值:V1 老版,V2 新版
+      paymentVersion: 'V1', // 支付版本,可用值:V1 老版,V2 新版
       showQrcode: false,
       orderTimer: null as any,
       qrCodeUrl: '',
@@ -150,8 +155,14 @@ export default defineComponent({
     async getOrderPayType() {
       try {
         const orderObject = orderStatus.orderObject
-        const bizId =
+        let bizId =
           orderObject.orderList.length > 0 ? orderObject.orderList[0].id : ''
+        if (orderObject.orderType === 'PRACTICE') {
+          bizId =
+            orderObject.orderList.length > 0
+              ? orderObject.orderList[0].teacherId
+              : ''
+        }
         const { data } = await request.post(
           state.platformApi + '/userOrder/orderPayType',
           {
@@ -193,6 +204,8 @@ export default defineComponent({
       // 判断是否有订单号
       if (orderStatus.orderObject.orderNo) {
         this.paymentStatus = true
+        this.orderInfo = orderStatus.orderObject.paymentConfig || {}
+        this.orderNo = orderStatus.orderObject.paymentConfig.orderNo
         return
       }
 
@@ -236,50 +249,13 @@ export default defineComponent({
             state.platformType === 'TEACHER'
               ? '/api-teacher/userOrder/executeOrder/v2'
               : '/api-student/userOrder/executeOrder/v2'
-          const orders: any = []
-          this.orderList.forEach((item: any) => {
-            const params: any = {
-              goodType: item.orderType,
-              goodName: item.goodsName,
-              goodNum: 1,
-              bizContent: {}
-            }
-            if (item.orderType === 'VIP') {
-              params.bizContent = item.id
-            } else if (item.orderType === 'MUSIC') {
-              params.bizContent = {
-                musicSheetId: item.id,
-                actualPrice: item.actualPrice || 0,
-                clientType: state.platformType
-              }
-            } else if (item.orderType === 'ALBUM') {
-              params.bizContent = {
-                musicSheetId: item.id,
-                actualPrice: item.actualPrice || 0,
-                clientType: state.platformType
-              }
-            } else if (item.orderType === 'TENANT_ALBUM') {
-              params.bizContent = {
-                tenantAlbumId: item.id,
-                actualPrice: item.actualPrice || 0,
-                buyNumber: 1,
-                buyMultiple: item.purchaseCycle / 6,
-                clientType: state.platformType
-              }
-              params.bizId = item.id
-              params.buyNumber = 1
-              params.buyMultiple = item.purchaseCycle / 6
-            }
-            orders.push(params)
-          })
-
           const res = await request.post(url, {
             data: {
               activityId: orderObject.activityId || null,
               // bizId: '',
               couponIds: orderObject.couponId,
               // currentPrice: 0,
-              goodsInfos: [...orders],
+              goodsInfos: [...orderTenantInfos()],
               orderDesc: orderObject.orderDesc,
               orderName: orderObject.orderName,
               orderType: orderObject.orderType,

+ 41 - 1
src/views/order-detail/orderStatus.ts

@@ -37,7 +37,7 @@ const original = () => {
       activityId: '' as any, // 活动编号
       couponId: '' as string, // 优惠券编号
       discountPrice: 0 as number // 优惠
-    }
+    } as any
     // orderObject: {
     //   orderNo: '',
     //   actualPrice: 28,
@@ -138,6 +138,46 @@ export const orderInfos = () => {
   })
 }
 
+export const orderTenantInfos = () => {
+  // 商品列表
+  const orderList = orderStatus.orderObject.orderList || []
+  return orderList.map((item: any) => {
+    const params: any = {
+      goodType: item.orderType,
+      goodName: item.goodsName,
+      goodNum: 1,
+      bizContent: {}
+    }
+    if (item.orderType === 'VIP') {
+      params.bizContent = item.id
+    } else if (item.orderType === 'MUSIC') {
+      params.bizContent = {
+        musicSheetId: item.id,
+        actualPrice: item.actualPrice || 0,
+        clientType: state.platformType
+      }
+    } else if (item.orderType === 'ALBUM') {
+      params.bizContent = {
+        musicSheetId: item.id,
+        actualPrice: item.actualPrice || 0,
+        clientType: state.platformType
+      }
+    } else if (item.orderType === 'TENANT_ALBUM') {
+      params.bizContent = {
+        tenantAlbumId: item.id,
+        actualPrice: item.actualPrice || 0,
+        buyNumber: 1,
+        buyMultiple: item.purchaseCycle / 6,
+        clientType: state.platformType
+      }
+      params.bizId = item.id
+      params.buyNumber = 1
+      params.buyMultiple = item.purchaseCycle / 6
+    }
+    return params
+  })
+}
+
 /**
  * @title 0元购买
  * @param {function} callBack 回调函数