优化小程序发布
This commit is contained in:
		| @@ -31,7 +31,8 @@ | ||||
|           <el-table-column slot="options" label="操作" fixed="right" align="center" width="300"> | ||||
|             <template slot-scope="{row}"> | ||||
|               <el-button type="text" @click="handleEdit(row)">编辑</el-button> | ||||
|               <el-button type="text" @click="handleZip(row)">打包</el-button> | ||||
|               <el-button type="text" @click="handleZip(row)" v-if="row.count==0">打包</el-button> | ||||
|               <el-button type="text" @click="handleCancelZip(row)" v-else>停止</el-button> | ||||
|               <el-button type="text" v-if="/^打包时间/.test(row.error)" @click="handleDownload(row)">下载</el-button> | ||||
|               <el-button v-if="row.target" type="text" @click="handleUpdateSystem(row)">更新部署</el-button> | ||||
|             </template> | ||||
| @@ -113,7 +114,8 @@ export default { | ||||
|         // privateKey: {required: true, message: "请输入 小程序上传私钥"}, | ||||
|         // projectPath: {required: true, message: "请输入 项目地址"}, | ||||
|         version: {required: true, message: "请选择 定制方案"}, | ||||
|       } | ||||
|       }, | ||||
|       timer: {} | ||||
|     } | ||||
|   }, | ||||
|   methods: { | ||||
| @@ -155,15 +157,15 @@ export default { | ||||
|       }).then(res => { | ||||
|         if (res?.code == 0) { | ||||
|           row.count = 1 | ||||
|           let timer = setInterval(() => { | ||||
|           this.timer[id] = setInterval(() => { | ||||
|             if (row.count >= 100) { | ||||
|               clearInterval(timer) | ||||
|               clearInterval(this.timer[id]) | ||||
|               this.$message.error("打包失败!") | ||||
|             } else if (row.count <= 25) { | ||||
|               row.count++ | ||||
|             } else this.handleConfirmZip(row).then(v => { | ||||
|               if (v.error) { | ||||
|                 clearInterval(timer) | ||||
|                 clearInterval(this.timer[id]) | ||||
|                 row.error = v.error | ||||
|                 row.count = 0 | ||||
|               } else row.count++ | ||||
| @@ -172,6 +174,10 @@ export default { | ||||
|         } | ||||
|       }).catch(() => this.$message.error("打包失败!")) | ||||
|     }, | ||||
|     handleCancelZip(row) { | ||||
|       clearInterval(this.timer[row.id]) | ||||
|       row.count = 0 | ||||
|     }, | ||||
|     handleUpdateSystem(row) { | ||||
|       let {appid} = row | ||||
|       return this.instance.post("/node/wxmp/updateSystem", null, { | ||||
| @@ -225,6 +231,9 @@ export default { | ||||
|   }, | ||||
|   created() { | ||||
|     this.getTableData() | ||||
|   }, | ||||
|   beforeDestroy() { | ||||
|     Object.values(this.timer).map(t => clearInterval(t)) | ||||
|   } | ||||
| } | ||||
| </script> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user