lex 2 lat temu
rodzic
commit
de8de96bb6

+ 21 - 8
src/components/o-upload-all/index.tsx

@@ -68,14 +68,22 @@ export default defineComponent({
       if (this.disabled) {
         return
       }
+      const type = this.uploadType === 'VIDEO' ? 'video' : 'img'
       postMessage(
         {
           api: 'chooseFile',
-          content: { type: 'img', max: 1, bucket: this.bucket }
+          content: { type: type, max: 1, bucket: this.bucket }
         },
         (res: any) => {
           console.log(res, 'fileUrl')
-          this.$emit('update:modelValue', [...this.modelValue, res.fileUrl])
+          // 判断是否是多选
+          if (this.maxCount > 1) {
+            this.$emit('update:modelValue', [...this.modelValue, res.fileUrl])
+            this.onUploadChange([...this.modelValue, res.fileUrl])
+          } else {
+            this.$emit('update:modelValue', [res.fileUrl])
+            this.onUploadChange([res.fileUrl])
+          }
         }
       )
     },
@@ -175,8 +183,13 @@ export default defineComponent({
         const uploadUrl = getOssUploadUrl(this.bucket) + key
         closeToast()
         // 判断是否是多选
-        this.$emit('update:modelValue', [...this.modelValue, uploadUrl])
-        this.onUploadChange([...this.modelValue, uploadUrl])
+        if (this.maxCount > 1) {
+          this.$emit('update:modelValue', [...this.modelValue, uploadUrl])
+          this.onUploadChange([...this.modelValue, uploadUrl])
+        } else {
+          this.$emit('update:modelValue', [uploadUrl])
+          this.onUploadChange([uploadUrl])
+        }
       } catch (error) {
         console.log(error, 'uploadFile')
       }
@@ -217,6 +230,10 @@ export default defineComponent({
         {this.native ? (
           this.maxCount > 1 ? (
             <div class={[styles.uploader, styles[this.size]]} onClick={this.nativeUpload}>
+              <Icon name={this.uploadIcon} class={['van-uploader__upload']} size="32" />
+            </div>
+          ) : (
+            <div class={[styles.uploader, styles[this.size]]} onClick={this.nativeUpload}>
               {this.modelValue.length > 0 ? (
                 <div class={['van-uploader__upload']}>
                   {this.modelValue.map((item: any) => (
@@ -246,10 +263,6 @@ export default defineComponent({
                 <Icon name={this.uploadIcon} class={['van-uploader__upload']} size="32" />
               )}
             </div>
-          ) : (
-            <div class={[styles.uploader, styles[this.size]]} onClick={this.nativeUpload}>
-              <Icon name={this.uploadIcon} class={['van-uploader__upload']} size="32" />
-            </div>
           )
         ) : this.maxCount > 1 ? (
           <Uploader

+ 1 - 0
src/school/orchestra-story/index.tsx

@@ -204,6 +204,7 @@ export default defineComponent({
                           {item.type === 'VIDEO' && (
                             <OVideo
                               src={child.url}
+                              height={'100%'}
                               poster={child.coverImage}
                               class={styles.swipeImg}
                             />

+ 2 - 0
src/school/orchestra-story/story-operation/index.tsx

@@ -23,6 +23,7 @@ import OUploadAll from '@/components/o-upload-all'
 import OHeader from '@/components/o-header'
 import ODialog from '@/components/o-dialog'
 import { useRoute, useRouter } from 'vue-router'
+import { browser } from '@/helpers/utils'
 
 export default defineComponent({
   name: 'story-operation',
@@ -334,6 +335,7 @@ export default defineComponent({
                       style={{ marginBottom: '12px' }}
                       v-model:modelValue={forms.video}
                       accept="video/*"
+                      native={browser().isApp}
                       uploadType="VIDEO"
                       uploadIcon={iconUploadVideo}
                       deletable={false}