Merge pull request '添加了属性' (#37) from xbx into master
Reviewed-on: http://git.luyuan.tk/luyuan/beelink/pulls/37
This commit is contained in:
		
						commit
						8709d8ffb7
					
				
							
								
								
									
										1
									
								
								src/types/index.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								src/types/index.d.ts
									
									
									
									
										vendored
									
									
								
							@ -16,6 +16,7 @@ declare module 'axios' {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// 图片选择
 | 
			
		||||
export interface ImgInfo {
 | 
			
		||||
    file: string;
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										41
									
								
								src/utils/vod.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								src/utils/vod.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,41 @@
 | 
			
		||||
import { get } from '@/api/base'
 | 
			
		||||
import TcVod from "vod-js-sdk-v6"
 | 
			
		||||
 | 
			
		||||
interface OnFunctio {
 | 
			
		||||
    (info: unknown): unknown;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
interface UploaderDone {
 | 
			
		||||
    fileId: string;
 | 
			
		||||
    video: {
 | 
			
		||||
        url: string;
 | 
			
		||||
        verify_content: string;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function uploadflie(file: File,on?: OnFunctio): Promise<UploaderDone> {
 | 
			
		||||
    const getSignature = () => {
 | 
			
		||||
        return new Promise<string>((res) => {
 | 
			
		||||
            get<string>('signature').then((data) => {
 | 
			
		||||
                console.log(data)
 | 
			
		||||
                res(data.data)
 | 
			
		||||
            })
 | 
			
		||||
        })
 | 
			
		||||
    } 
 | 
			
		||||
    // const res =  await get<string>('signature');
 | 
			
		||||
    // console.log(res.data)
 | 
			
		||||
    const tcVod = new TcVod({
 | 
			
		||||
        getSignature: getSignature
 | 
			
		||||
    })
 | 
			
		||||
    const uploader = tcVod.upload({
 | 
			
		||||
        mediaFile: file
 | 
			
		||||
    })
 | 
			
		||||
    if(on != undefined){
 | 
			
		||||
        uploader.on('media_progress', (info) => {
 | 
			
		||||
            on(info)
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
    const data = uploader.done();
 | 
			
		||||
    return data;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -92,7 +92,7 @@
 | 
			
		||||
                        <div class="label">短视频</div>
 | 
			
		||||
                        <a-upload
 | 
			
		||||
                            list-type="picture"
 | 
			
		||||
                            action="//jsonplaceholder.typicode.com/posts/"
 | 
			
		||||
                            :customRequest="uploads"
 | 
			
		||||
                        >
 | 
			
		||||
                            <div class="upload-image">
 | 
			
		||||
                                <PlaySquareOutlined style="fontSize: 22px;" />
 | 
			
		||||
@ -261,6 +261,7 @@
 | 
			
		||||
import { computed, defineComponent, reactive, Ref, ref } from "vue";
 | 
			
		||||
import { UserOutlined, SmileOutlined, PlaySquareOutlined } from '@ant-design/icons-vue';
 | 
			
		||||
import NavBottom from '@/components/NavBottom.vue';
 | 
			
		||||
import { uploadflie } from "@/utils/vod"
 | 
			
		||||
import store from '@/store';
 | 
			
		||||
 | 
			
		||||
export default defineComponent({
 | 
			
		||||
@ -429,6 +430,18 @@ export default defineComponent({
 | 
			
		||||
            console.log('12');
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
        interface AntUpload{
 | 
			
		||||
            action: string;
 | 
			
		||||
            data: unknown;
 | 
			
		||||
            file: File;
 | 
			
		||||
        }
 | 
			
		||||
        async function uploads(file: AntUpload){
 | 
			
		||||
            let res = await uploadflie(file.file, (info) => {
 | 
			
		||||
                console.log(info)
 | 
			
		||||
            });
 | 
			
		||||
            console.log(res)
 | 
			
		||||
        }
 | 
			
		||||
        // uploadflie()
 | 
			
		||||
        return {
 | 
			
		||||
            modalNode,
 | 
			
		||||
            formData,
 | 
			
		||||
@ -450,7 +463,8 @@ export default defineComponent({
 | 
			
		||||
            passwordForm,
 | 
			
		||||
            updateUserPassword,
 | 
			
		||||
            submitInfo,
 | 
			
		||||
            userinfo
 | 
			
		||||
            userinfo,
 | 
			
		||||
            uploads
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user