Explorar el Código

bug 爆款视频 换脸

jiayufei hace 3 años
padre
commit
6094c41180

+ 61 - 22
src/views/modules/Statistics/change-face/change-face.vue

@@ -4,6 +4,7 @@
         v-if="faceShowStatus"
         title="换脸操作"
         :visible="faceShowStatus"
+        :confirmLoading="confirmLoading"
         dialog-class="change-face-modal"
         @ok="handlePolicyOperationSure"
         @cancel="handlePolicyOperationCancel"
@@ -43,7 +44,8 @@
                         <div class="ant-upload-text">Upload</div>
                     </div>
                 </a-upload>
-                <p>提示:上传人脸照片只会识别一次</p>
+                <p style="margin: 0;">1、请保证脸部无遮挡、光线充足</p>
+                <p style="margin: 0;">2、视频、照片中只能出现一张人脸</p>
             </a-form-model-item>
         </a-form-model>
         <div v-else-if="faceType === 'b'" class="face-right-div">
@@ -64,9 +66,8 @@
                     <img v-if="!text" src="@/assets/noImg.png" style="width:60px">
                 </span>
                 <span slot="actions" slot-scope="text, record">
-                    <!-- TODO -->
-                    <!-- <a @click="handlePushData(record)">推送</a>
-                    <a-divider type="vertical"/> -->
+                    <a :disabled="!faceShowList.projectId || record.status !== 'finished'" @click="handlePushData(record)">推送</a>
+                    <a-divider type="vertical"/>
                     <a @click="handleDownLoadData(record)" :disabled="record.status !== 'finished'">下载</a>
                 </span>
             </a-table>
@@ -109,13 +110,14 @@ export default {
     },
     data() {
         return {
+            confirmLoading: false,
             departValueInfoModality: [],
             departValueInfoMod: [],
             departValueInfoSence: [],
             getProjectId: '',
             defaultCurrent: 1,
             dataAllList: [],
-            totalAll: 100,
+            totalAll: 0,
             uploadType: 'face',
             dataSource: [],
             settlementColumns: [
@@ -178,14 +180,15 @@ export default {
         handleFaceTypeChange(e) {
             if (e.target.value === 'b') {
                 this.handleInitTable();
-                this.handleGetDetailList();
                 this.handleGetMaterialTagInfo();
             }
         },
         handleInitTable() {
             const paramsData = {
-                videoMd5: this.faceShowList.videoCode
+                videoMd5: this.faceShowList.projectId ? this.faceShowList.code : this.faceShowList.videoCode
             };
+            // http://192.168.1.34:8000
+            // http://faceswap.tjyourong.com.cn
             postAction('http://faceswap.tjyourong.com.cn/jeecg-boot/task/query', paramsData).then(result => {
                 if (result.code === 0) {
                     this.dataAllList = result.data;
@@ -201,7 +204,7 @@ export default {
         },
         handleGetDetailList() {
             getAction('/ctop/materialInfo/queryById', {
-                id: this.faceShowList.videoCode
+                id: this.faceShowList.projectId ? this.faceShowList.code : this.faceShowList.videoCode
             }).then(res => {
                 if (res.success) {
                     this.getProjectId = res.result.projectId;
@@ -210,7 +213,7 @@ export default {
         },
         handleGetMaterialTagInfo() {
             getAction('/ctop/materialTagInfo/detail', {
-                code: this.faceShowList.videoCode
+                code: this.faceShowList.projectId ? this.faceShowList.code : this.faceShowList.videoCode
             }).then(res => {
                 if (res.success) {
                     this.departValueInfoModality = res.modalityTagList.map(item => item.tagId);
@@ -221,26 +224,44 @@ export default {
         },
         // TODO 推送操作
         handlePushData(list) {
-            console.log(list, '推送操作');
             const paramsData = {
-                projectId: this.getProjectId, // 项目选择
-                planId: 'admin',
-                shotId: 'admin',
-                clipId: 'admin',
+                projectId: this.faceShowList.projectId, // 项目选择
+                ascription: {
+                    planId: 'e9ca23d68d884d4ebb19d07889727dae',
+                    shotId: 'e9ca23d68d884d4ebb19d07889727dae',
+                    clipId: 'e9ca23d68d884d4ebb19d07889727dae'
+                },
+                status: '1',
+                code: list.output_video_md5,
+                url: list.output_video_url && list.output_video_url.split(':')[1],
+                type: 'VIDEO',
+                userId: this.userInfo().id,
                 modalityTagList: this.departValueInfoModality, // 形式标签
                 senceTagList: this.departValueInfoSence, // 场景标签
                 modTagList: this.departValueInfoMod // 基调标签
             };
-            fileInsertV2(paramsData).then(res => {
-                if (res.success) {
-                    console.log(res, 'res---res推送');
+            const that = this;
+            this.$confirm({
+                title: '提示',
+                content: '是否进行推送操作',
+                onOk() {
+                    fileInsertV2(paramsData).then(res => {
+                        if (res.code === 0) {
+                            that.handlePolicyOperationCancel();
+                            that.$emit('sureface');
+                            that.$message.error('素材已经同步到未审核列表,请进入查看');
+                        }
+                        else {
+                            that.$message.error(res.message);
+                        }
+                    });
                 }
             });
         },
         // 下载操作
         handleDownLoadData(list) {
             const randomTime = new Date().getTime() + '_check.mp4';
-            fetch(list.input_video_url)
+            fetch(list.output_video_url)
                 .then(res => res.blob())
                 .then(blob => {
                     const a = document.createElement('a');
@@ -262,18 +283,29 @@ export default {
             this.defaultCurrent = 1;
             this.handleInitTable();
         },
+        checkTv(data) {
+            const index = data.lastIndexOf(".");
+            let tv_id = '';
+            tv_id = data.substring(index);
+            if(tv_id !== ".mp4" && tv_id !== ".rmvb" && tv_id !== ".avi" && tv_id !== ".ts") {
+                return data + '.mp4';
+            }
+            else {
+                return data;
+            }
+        },
         // 确定按钮
         handlePolicyOperationSure() {
             if (this.faceType === 'a') {
+                this.confirmLoading = true;
                 if (!this.md5Result) {
                     this.$message.error('请上传图片');
                     return;
                 }
                 const paramsData = {
-                    inputVideoUrl: this.faceShowList.url,
-                    // 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.checkTv(this.faceShowList.url),
                     inputImageUrl: this.urlResult,
-                    videoMd5: this.faceShowList.videoCode,
+                    videoMd5: this.faceShowList.projectId ? this.faceShowList.code : this.faceShowList.videoCode,
                     imageMd5: this.md5Result,
                     createBy: this.userInfo().id
                 };
@@ -281,12 +313,19 @@ export default {
                     if (result.code === 0) {
                         this.handlePolicyOperationCancel();
                         this.$emit('sureface');
+                        this.$message.success('图片上传成功');
+                        this.confirmLoading = false;
                     }
                     else {
-                        this.$message.error(result.message);
+                        this.$message.success('目标图片已存在,请下载视频');
+                        this.faceType = 'b';
+                        this.handleInitTable();
+                        this.handleGetMaterialTagInfo();
+                        this.confirmLoading = false;
                     }
                 }).catch(error => {
                     console.log(error, 'eeee');
+                    this.confirmLoading = false;
                 });
             }
             else {

+ 8 - 5
src/views/modules/Statistics/popularVideo.vue

@@ -306,6 +306,7 @@
 				</div>
 			</a-col>
 		</a-row>
+		<!-- 换脸模块 -->
 		<change-face
 			:status="faceTypeStatus"
 			:defaultList="faceChangeList"
@@ -760,11 +761,13 @@ export default {
                 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
+                this.loading = false;
+                if(res.success) {
+                    if(res.result) {
+						this.$nextTick(() => {
+							this.dataTable = [...res.result.records];
+                        	this.ipagination.total = res.result.total;
+						});
                     }
                 }
             })

+ 24 - 1
src/views/modules/material/videoMaterial.vue

@@ -726,7 +726,7 @@ a {
                       </div>
                       <a href="javascript:;" style="margin-right: 20px">驳回</a>
                     </a-popconfirm>
-
+                    <a v-show="active === '1'" style="margin-right: 20px" @click="handleChangeFace(items)">换脸</a>
                     <a-popconfirm
                       @confirm="okEditShow(items, '1')"
                       v-show="active != '1' && active != '3'"
@@ -1735,10 +1735,19 @@ a {
     <account-check ref="check" @synchro="implement"></account-check>
     <accountCheckBytedance ref="accountCheckBytedance" @synchro="implement" />
     <permission-modal ref="modalForm" @ok="modalFormOkElse"></permission-modal>
+    <!-- 换脸模块 -->
+		<change-face
+			:status="faceTypeStatus"
+			:defaultList="faceChangeList"
+			@closeface="handleFaceCloseModal"
+			@sureface="handleFaceSureModal"
+		>
+		</change-face>
   </a-card>
 </template>
 
 <script>
+import changeFace from '@/views/modules/Statistics/change-face/change-face';
 import PermissionModal from './modules/DepartModal'
 import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 import JEllipsis from '@/components/jeecg/JEllipsis'
@@ -1768,10 +1777,13 @@ export default {
     PermissionModal,
     accountCheckBytedance,
     selectTableProject,
+    changeFace
   },
 
   data() {
     return {
+      faceTypeStatus: false,
+      faceChangeList: {},
       designList: [],
       // 标签的数据
       labelValue: [],
@@ -2064,6 +2076,17 @@ export default {
     },
   },
   methods: {
+    handleChangeFace(data) {
+      console.log(data, '-------------------------')
+      this.faceTypeStatus = true;
+			this.faceChangeList = data;
+    },
+    handleFaceCloseModal() {
+			this.faceTypeStatus = false;
+		},
+		handleFaceSureModal() {
+			this.searchQuery();
+		},
     // 获取设计人员
     getDesignList() {
       postAction('/ctop/kuaishou/videoReport/getDesignList').then((res) => {

+ 2 - 2
vue.config.js

@@ -69,7 +69,7 @@ module.exports = {
 		proxy: {
 			'/jeecg-boot': {
 				// target: 'http://192.168.1.8:8080', //请求本地 需要jeecg-boot后台项目  蒙蒙
-				// target: 'http://192.168.1.3:8080', //请求本地 需要jeecg-boot后台项目  蒙蒙
+				target: 'http://192.168.1.3:8080', //请求本地 需要jeecg-boot后台项目  蒙蒙
 				// target: 'http://192.168.0.59:8088', //请求本地 需要jeecg-boot后台项目  英豪
 				// target: 'http://192.168.1.62:7001', //请求本地 需要jeecg-boot后台项目  英豪
 				// target: 'http://192.168.6.162:9806', //请求本地 需要jeecg-boot后台项目  祚云
@@ -80,7 +80,7 @@ module.exports = {
 				// target: 'http://192.168.1.219:8081', //请求本地 需要jeecg-boot后台项目  赵西安
 				// target: 'http://192.168.1.193:8080', //请求本地 需要jeecg-boot后台项目  李煜一
 				// target: 'http://192.168.1.193:31012', //请求本地 需要jeecg-boot后台项目  李煜一
-				 target: 'http://api.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
+				//  target: 'http://api.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
 				// target: 'https://trac.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
 				// target: 'http://39.106.184.70:8088/', //请求本地 需要jeecg-boot后台项目
 				//  target: 'http://adsp.tjyourong.com.cn/', //请求本地 需要jeecg-boot后台项目