Browse Source

bug 爆款视频 换脸

jiayufei 3 năm trước cách đây
mục cha
commit
76b8d2b0aa

+ 52 - 46
src/views/modules/Statistics/change-face/change-face.vue

@@ -13,7 +13,9 @@
                 <a-radio-button value="a">人脸合成</a-radio-button>
                 <a-radio-button value="b">合成列表</a-radio-button>
             </a-radio-group>
-            <span v-if="faceType === 'b'" class="add-acount-policy-btn"><a-button type="primary" @click="handleRefresh">刷新</a-button></span>
+            <span v-if="faceType === 'b'" class="add-acount-policy-btn">
+                <a-button type="primary" @click="handleRefresh">刷新</a-button>
+            </span>
         </div>
         <a-form-model
             v-if="faceType === 'a'"
@@ -62,9 +64,10 @@
                     <img v-if="!text" src="@/assets/noImg.png" style="width:60px">
                 </span>
                 <span slot="actions" slot-scope="text, record">
-                    <a @click="handlePushData(record)">推送</a>
-                    <a-divider type="vertical"/>
-                    <a @click="handleDownLoadData(record)">下载</a>
+                    <!-- TODO -->
+                    <!-- <a @click="handlePushData(record)">推送</a>
+                    <a-divider type="vertical"/> -->
+                    <a @click="handleDownLoadData(record)" :disabled="record.status !== 'finished'">下载</a>
                 </span>
             </a-table>
             <a-pagination
@@ -83,7 +86,7 @@
 <script>
 import {mapGetters} from 'vuex';
 import {fileInsertV2} from '@/api/actor';
-import {getAction, postAction, putAction, deleteAction} from '@/api/manage';
+import {getAction, postAction} from '@/api/manage';
 
 import BMF from 'browser-md5-file';
 let COS = require('cos-js-sdk-v5');
@@ -91,6 +94,7 @@ let cos = new COS({
     SecretId: 'AKIDE6IpMi8fJQRCg1iuWzFajjRs43kbbets',
     SecretKey: 'tXzuwMfplTTK3c9GFUyETilasvQfePu9'
 });
+
 export default {
     name: 'change-face',
     props: {
@@ -105,6 +109,10 @@ export default {
     },
     data() {
         return {
+            departValueInfoModality: [],
+            departValueInfoMod: [],
+            departValueInfoSence: [],
+            getProjectId: '',
             defaultCurrent: 1,
             dataAllList: [],
             totalAll: 100,
@@ -155,7 +163,6 @@ export default {
         },
         defaultList(newVal) {
             if (newVal) {
-                console.log(newVal, 'newVal--newVal');
                 this.faceShowList = newVal;
             }
         }
@@ -164,7 +171,6 @@ export default {
         ...mapGetters(['userInfo']),
         // 分页操作按钮
         onShowSizeChange(current, pageSize) {
-            console.log(this.dataAllList, current, '-------00000');
             this.defaultCurrent = current;
             const defaultData = [...this.dataAllList];
             this.dataSource = [...defaultData.slice(2 * current - 2, 2 * current)];
@@ -172,13 +178,15 @@ export default {
         handleFaceTypeChange(e) {
             if (e.target.value === 'b') {
                 this.handleInitTable();
+                this.handleGetDetailList();
+                this.handleGetMaterialTagInfo();
             }
         },
         handleInitTable() {
             const paramsData = {
                 videoMd5: this.faceShowList.videoCode
             };
-            postAction('http://192.168.1.34:8000/jeecg-boot/task/query', paramsData).then(result => {
+            postAction('/task/query', paramsData).then(result => {
                 if (result.code === 0) {
                     this.dataAllList = result.data;
                     this.dataSource = result.data.slice(0, 2);
@@ -191,10 +199,38 @@ export default {
                 console.log(error, 'eeee');
             });
         },
-        // 推送操作
+        handleGetDetailList() {
+            getAction('/ctop/materialInfo/queryById', {
+                id: this.faceShowList.videoCode
+            }).then(res => {
+                if (res.success) {
+                    this.getProjectId = res.result.projectId;
+                }
+            });
+        },
+        handleGetMaterialTagInfo() {
+            getAction('/ctop/materialTagInfo/detail', {
+                code: this.faceShowList.videoCode
+            }).then(res => {
+                if (res.success) {
+                    this.departValueInfoModality = res.modalityTagList.map(item => item.tagId);
+                    this.departValueInfoMod = res.modTagList.map(item => item.tagId);
+                    this.departValueInfoSence = res.senceTagList.map(item => item.tagId);
+                }
+            });
+        },
+        // TODO 推送操作
         handlePushData(list) {
             console.log(list, '推送操作');
-            const paramsData = {};
+            const paramsData = {
+                projectId: this.getProjectId, // 项目选择
+                planId: 'admin',
+                shotId: 'admin',
+                clipId: 'admin',
+                modalityTagList: this.departValueInfoModality, // 形式标签
+                senceTagList: this.departValueInfoSence, // 场景标签
+                modTagList: this.departValueInfoMod // 基调标签
+            };
             fileInsertV2(paramsData).then(res => {
                 if (res.success) {
                     console.log(res, 'res---res推送');
@@ -203,7 +239,7 @@ export default {
         },
         // 下载操作
         handleDownLoadData(list) {
-            const randomTime = new Time().getTime() + '_check.mp4';
+            const randomTime = new Date().getTime() + '_check.mp4';
             fetch(list.input_video_url)
                 .then(res => res.blob())
                 .then(blob => {
@@ -228,22 +264,22 @@ export default {
         },
         // 确定按钮
         handlePolicyOperationSure() {
-            console.log(this.urlResult, this.md5Result, '确定按钮');
             if (this.faceType === 'a') {
                 if (!this.md5Result) {
                     this.$message.error('请上传图片');
                     return;
                 }
                 const paramsData = {
-                    inputVideoUrl: 'https://media-1301855440.cos.ap-chongqing.myqcloud.com/video/2021-08-05/%E4%BC%9A%E7%8E%A9-%E6%B1%9F%E6%96%8C%E7%BB%84-%E7%BC%96%E6%9C%B1%E6%B1%9F%E6%96%8C-%E6%91%84%E6%9D%A8%E5%A8%81-%E5%89%AA%E9%83%91%E7%BF%94%E7%82%9C-08.03%20%282%29-1628164520693.mp4',
+                    inputVideoUrl: this.faceShowList.url,
+                    // 'https://media-1301855440.cos.ap-chongqing.myqcloud.com/video/2021-08-05/%E4%BC%9A%E7%8E%A9-%E6%B1%9F%E6%96%8C%E7%BB%84-%E7%BC%96%E6%9C%B1%E6%B1%9F%E6%96%8C-%E6%91%84%E6%9D%A8%E5%A8%81-%E5%89%AA%E9%83%91%E7%BF%94%E7%82%9C-08.03%20%282%29-1628164520693.mp4',
                     inputImageUrl: this.urlResult,
                     videoMd5: this.faceShowList.videoCode,
                     imageMd5: this.md5Result,
                     createBy: this.userInfo().id
                 };
-                postAction('http://192.168.1.34:8000/jeecg-boot/task/single', paramsData).then(result => {
-                    console.log(result, 'v--确定按钮');
+                postAction('/task/single', paramsData).then(result => {
                     if (result.code === 0) {
+                        this.handlePolicyOperationCancel();
                         this.$emit('sureface');
                     }
                     else {
@@ -272,7 +308,6 @@ export default {
         },
         beforeUpload(info) {
             const isZip = info.type.includes('png') || info.type.includes('jpeg');
-            // const fileOvesize = info.size > (1024 * 1024);
             if (!isZip) {
                 this.$message.error('请上传正确类型的图片');
                 this.imageUrl = '';
@@ -285,35 +320,6 @@ export default {
             this.getBase64(info, imageUrl => {
                 this.imageUrl = imageUrl;
             });
-            // if (fileOvesize) {
-            //     this.$message.error('图片大小不能超过1M');
-            //     this.imageUrl = '';
-            //     this.urlResult = '';
-            //     this.md5Result = '';
-            //     return;
-            // }
-            // new Promise(function (resolve, reject) {
-            //     let width = 108;
-            //     let height = 108;
-            //     let _URL = window.URL || window.webkitURL;
-            //     let img = new Image();
-            //     img.onload = function () {
-            //         let valid = img.width === width && img.height === height;
-            //         valid ? resolve() : reject();
-            //     };
-            //     img.src = _URL.createObjectURL(info);
-            // }).then(() => {
-            //     this.handleMd5(info);
-            //     this.getBase64(info, imageUrl => {
-            //         this.imageUrl = imageUrl;
-            //     });
-            // }, () => {
-            //     this.$message.error('图片尺寸必须是108*108!');
-            //     this.imageUrl = '';
-            //     this.urlResult = '';
-            //     this.md5Result = '';
-            //     return Promise.reject();
-            // });
         },
         handleMd5(file) {
             let bmf = new BMF();
@@ -365,7 +371,7 @@ export default {
                     that.urlResult = 'http://' + data.Location;
                 }
             );
-        },
+        }
     }
 }
 </script>

+ 52 - 66
src/views/modules/Statistics/popularVideo.vue

@@ -631,7 +631,6 @@ export default {
 		},
 		handleFaceSureModal() {
 			this.search();
-			this.faceTypeStatus = false;
 		},
         disabledDate(current) {           
             return current && current > moment();
@@ -739,45 +738,37 @@ export default {
             })
         },
         // 获取展示数据
-        getNewPlan(){
-            let url=''
-            if(this.tabKey==1){
+        getNewPlan() {
+            let url = '';
+            if(this.tabKey == 1) {
                 // 头条
-                url='/ctop/bytedanceVideoEtlInfo/list'
-            }else{
+                url = '/ctop/bytedanceVideoEtlInfo/list';
+            }
+			else {
                 // 快手
-                
-                url='/ctop/kuaishouVideoEtlInfo/list'
-                
+                url = '/ctop/kuaishouVideoEtlInfo/list';
             }
-            
-            this.loading=true;
-
-            getAction(url,{
-                type:this.value,
-                clipId:this.clipId==''?null:this.clipId,
-                shotId:this.shotId==''?null:this.shotId,
-                planId:this.planId==''?null:this.planId,
-                startDate:this.dateRange[0].format('YYYY-MM-DD'),
-                endDate:this.dateRange[1].format('YYYY-MM-DD'),
-                pageSize:this.ipagination.pageSize,
-                pageNo:this.ipagination.current
-            }).then(res=>{
-                console.log(res);
+            this.dataTable = [];
+            this.loading = true;
+            getAction(url, {
+                type: this.value,
+                clipId: this.clipId==''?null:this.clipId,
+                shotId: this.shotId==''?null:this.shotId,
+                planId: this.planId==''?null:this.planId,
+                startDate: this.dateRange[0].format('YYYY-MM-DD'),
+                endDate: this.dateRange[1].format('YYYY-MM-DD'),
+                pageSize: this.ipagination.pageSize,
+                pageNo: this.ipagination.current
+            }).then(res => {
                 this.loading=false;
-            
                 if(res.success){
-                    
                     if(res.result){
                         this.dataTable=res.result.records
                         this.ipagination.total=res.result.total
                     }
-
                 }
             })
-        
         },
-
         // 查询按钮
         search(){
             // if(this.accountId || this.operate){
@@ -786,11 +777,9 @@ export default {
             // }else{
             //     this.$message.error('请选择具体账户或者运营')
             // }
-            this.ipagination.current=1;
-            this.getNewPlan()
-            
+            this.ipagination.current = 1;
+            this.getNewPlan();
         },
-    
     },
     watch: {
         dateValue(newName,oldName){
@@ -814,65 +803,62 @@ export default {
     },
     filters: {
         toPercentage(val) {
-        if(typeof val != 'string'){
-            return (val * 100).toFixed(2) + '%'
-        }else{
-            return val
-        }
-        
+			if (typeof val !== 'string') {
+				return (val * 100).toFixed(2) + '%';
+			}
+			else {
+				return val;
+			}
         },
         //保留两位小数并且变成货币格式
-        decimalsHandle(val){
-            
-            if(val && typeof val !='string'){
-                if(val>=0){
+        decimalsHandle(val) {
+            if(val && typeof val != 'string') {
+                if(val >= 0) {
                     val=parseFloat(val).toFixed(2);
-                    let numberStr = val.toString()
-                    let str = numberStr.split('.')
-                    
+                    let numberStr = val.toString();
+                    let str = numberStr.split('.');
                     let str0=str[0].split('').reverse();
                     for (let i = 0; i < str0.length; i++) {
                         if ((i + 1) % 4 === 0) {
-                            str0.splice(i, 0, ',')
+                            str0.splice(i, 0, ',');
                         }
                     }
-                    str0.reverse()
-                    let handleResult = ''
+                    str0.reverse();
+                    let handleResult = '';
                     for (let j = 0; j < str0.length; j++) {
-                        handleResult += str0[j]
+                        handleResult += str0[j];
                     }
-                    
-                    return handleResult+'.'+str[1]
-                }else{
-                    val=parseFloat(val).toFixed(2);
-                    let numberStr = val.toString()
-                    let str = numberStr.split('.')
-                    
+                    return handleResult + '.' + str[1];
+                }
+				else {
+                    val = parseFloat(val).toFixed(2);
+                    let numberStr = val.toString();
+                    let str = numberStr.split('.');
                     let str0=str[0].substr(1).split('').reverse();
                     for (let i = 0; i < str0.length; i++) {
                         if ((i + 1) % 4 === 0) {
                             str0.splice(i, 0, ',')
                         }
                     }
-                    str0.reverse()
-                    let handleResult = ''
+                    str0.reverse();
+                    let handleResult = '';
                     for (let j = 0; j < str0.length; j++) {
-                        handleResult += str0[j]
+                        handleResult += str0[j];
                     }
                     
-                    return '-'+handleResult+'.'+str[1]
+                    return '-' + handleResult + '.' + str[1];
                 }
-                
-            }else if(typeof val =='string'){
-                return val
             }
-            else{
-                return 0
+			else if(typeof val == 'string') {
+                return val;
+            }
+            else {
+                return 0;
             }           
         },
         //变成货币格式
         formatCurrency(val){
-        if(val){
+        if (val) {
             let numberStr = val.toString()
             let str = numberStr.split('').reverse()
             for (let i = 0; i < str.length; i++) {