This commit is contained in:
X1627315083
2024-01-26 17:27:33 +08:00
parent 2ec8b12fbf
commit 1c380aec02
4 changed files with 264 additions and 70 deletions

View File

@@ -1017,6 +1017,7 @@ export default defineComponent({
name: "collection.png",
})
let num = 0
console.log(allBoardData);
for (let key in allBoardData) {
if (key !== "colorBoards" && key !== "moodTemplateId") {
if(this.exportNav[num]?.change || key == 'disposeMoodboard'){

View File

@@ -35,7 +35,7 @@
<div class="operate_list" v-if="column?.Operations">
<div class="operate_item" @click="turnToDetail(record)">{{ $t('HistoryPage.Detail') }}</div>
<!-- <div class="operate_item" @click="renameCollection(record,index)">{{ $t('HistoryPage.Rename') }}</div> -->
<div class="operate_item" @click="setExport(record)">{{ $t('HomeView.Export') }}</div>
<div class="operate_item" @click="setExport(record,'')">{{ $t('HomeView.Export') }}</div>
<div class="operate_item" @click="deleteGroup(record, index)">{{ $t('HistoryPage.Delete') }}</div>
</div>
</template>
@@ -44,7 +44,7 @@
</div>
</div>
</div>
<HistoryDetail ref="historyDetail" :groupDetails="groupDetails" :collectionName="collectionName"></HistoryDetail>
<oldHistoryDetail ref="historyDetail" :groupDetails="groupDetails" :collectionName="collectionName"></oldHistoryDetail>
<!-- <a-modal class="rename_modal_component"
v-model:visible="renameVisivle"
@@ -62,14 +62,14 @@
<div class="rename_submit_button" @click="confrimRename()">{{ $t('HistoryPage.Submit') }}</div>
</div>
</a-modal> -->
<RobotAssist></RobotAssist>
<!-- <RobotAssist></RobotAssist> -->
</div>
<OldExportNewCoolection id="oldExportNewCoolection" allBoardData="allBoardData"></OldExportNewCoolection>
<OldExportNewCoolection id="oldExportNewCoolection" ref="OldExportNewCoolection" allBoardData="allBoardData"></OldExportNewCoolection>
</template>
<script lang="ts">
import { defineComponent,ref,createVNode,computed, nextTick} from 'vue'
import HeaderComponent from "@/component/HomePage/Header.vue";
import HistoryDetail from "@/component/Detail/HistoryDetail.vue";
import oldHistoryDetail from "@/component/Detail/oldHistoryDetail.vue";
import { Https } from "@/tool/https";
import { formatTime } from "@/tool/util"
import { Modal,message } from 'ant-design-vue';
@@ -87,7 +87,7 @@ const FileSaver = require("file-saver");
export default defineComponent({
components: {
HeaderComponent,
HistoryDetail,
oldHistoryDetail,
RobotAssist,
OldExportNewCoolection
},
@@ -152,10 +152,12 @@ export default defineComponent({
},
methods:{
turnToDetail(record:any){
this.groupDetails = record.groupDetails
// this.groupDetails = record.groupDetails
let historyDetail:any = this.$refs.historyDetail
this.collectionName = record.name
historyDetail.changeDetailShow()
// historyDetail.init(this.data)
this.setExport(record,'look')
// historyDetail.changeDetailShow()
},
@@ -181,11 +183,10 @@ export default defineComponent({
collectionName:this.searchCollectionName,
startDate:startDate,
endDate:endDate,
userId:83,
userId:this?.userInfo?.userId,
}
Https.axiosPost('https://old.api.aida.com.hk/api/history/queryUserGroup', data).then(
(rv: any) => {
console.log(rv);
this.collectionList = rv.content
this.total = rv.total
}
@@ -223,7 +224,7 @@ export default defineComponent({
}
let filesList = data.map((v:any)=>{
let newData:any = {
imgUrl:v.url,
imgUrl:v.url.replace(/www\.aida\.com\.hk/, 'files.aida.com.hk'),
id:v.id,
status:'done',
resData:v,
@@ -239,8 +240,18 @@ export default defineComponent({
})
return filesList
},
dealHistoryChooseData(data:any,type:any){
dealLikeDesign(data:any){
let filesList = data.map((v:any)=>{
let newData:any = {
designItemUrl:v.url.replace(/www\.aida\.com\.hk/, 'files.aida.com.hk'),
imgUrl:v.url.replace(/www\.aida\.com\.hk/, 'files.aida.com.hk'),
id:v.designId,
}
return newData
})
return filesList
},
dealHistoryChooseData(data:any,str:any){
let collectionData = {
moodboardFiles:this.dealViewChooseData(data.collection.moodBoards),
printboardFiles:this.dealViewChooseData(data.collection.printBoards),
@@ -248,19 +259,19 @@ export default defineComponent({
colorBoards:this.dealViewChooseColor(data.collection.colorBoards),
skecthboardFiles:this.dealViewChooseData(data.collection.sketchBoards),
marketingSketchFiles:this.dealViewChooseData(data.collection.marketingSketchs),
moodTemplateId:data.collection.moodTemplateId
moodTemplateId:data.collection.moodTemplateId,
likeDesignCollectionList:this.dealLikeDesign(data.userLikeDetails)
}
this.allBoardData = collectionData
// if(type === 'normal'){
// let likeDesignCollectionList = data.userLikeDetails.map((v:any)=>{
// let data = {
// ...v,
// groupDetailId:v.id,
// designItemUrl:v.url,
// }
// return data
// })
// }
if(str == 'look'){
let historyDetail:any = this.$refs.historyDetail
historyDetail.init(collectionData)
}else{
let OldExportNewCoolection:any = this.$refs.OldExportNewCoolection
OldExportNewCoolection.init(collectionData)
}
},
dealViewChooseColor(data:any){
let colorList = data.map((v:any)=>{
@@ -275,51 +286,84 @@ export default defineComponent({
})
return colorList
},
setExport(recold:any){
setExport(recold:any,str:any){
let url = 'https://old.api.aida.com.hk/api/history/choose' + `?userGroupId=${recold.id}`
Https.axiosGet(url).then(
(rv: any) => {
this.dealHistoryChooseData(rv,'')
nextTick().then(()=>{
this.exportCanvas()
})
this.dealHistoryChooseData(rv,str)
if(str == 'look'){
}else{
nextTick().then(()=>{
this.exportCanvas()
})
}
}
).catch(rv=>{
});
},
exportCanvas(){
async exportCanvas(){
let collectionReview:any = document.querySelector("#oldExportNewCoolection")
let a = document.createElement('a');
this.isShowMark = true
html2canvas(collectionReview,{useCORS:true,scale:3}).then((canvas) => {
let blob:any = dataURLtoBlob(canvas.toDataURL('image/png'));
let allBoardData:any = this.store.state.UploadFilesModule.allBoardData
let index = 0
let img = [
{
imgUrl:URL.createObjectURL(blob),
name:'collection.png'
}
]
for(let key in allBoardData){
if(key !== 'colorBoards' && key !== 'moodTemplateId'){
for(let item of allBoardData[key]){
let nameTail = item.imgUrl.split('.').pop()
console.log(nameTail, 666)
let data = {
imgUrl:item.imgUrl,
name:item.resData.name + index + '.' + nameTail
}
img.push(data)
index ++
}
}
let img:any = []
await html2canvas(collectionReview, { useCORS: true, scale: 3 }).then(
async (canvas) => {
let blob: any = dataURLtoBlob(
canvas.toDataURL("image/png")
);
let index = 0;
img.push({
imgUrl: URL.createObjectURL(blob),
name: "collection.png",
})
let num = 0
for (let key in this.allBoardData) {
if (key !== "colorBoards" && key !== "moodTemplateId") {
for (let item of this.allBoardData[key]) {
if(this.allBoardData[key][0]==undefined){
break
}
let nameTail = item?.imgUrl?.split(".").pop().split("?").shift();
// console.log(item);
let data = {
imgUrl: item.imgUrl,
name:
(item?.resData?.name?item?.resData?.name:'') +
index +
"." +
nameTail,
};
img.push(data);
index++;
}
num++
}
}
// a.setAttribute('href', URL.createObjectURL(blob));
// a.setAttribute('download', `collection.png`);
// a.click();
}
);
this.downImg(img);
},
getImgArrayBuffer(url:any) {
return new Promise((resolve, reject) => {
//通过请求获取文件blob格式
let xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", url, true);
xmlhttp.responseType = "blob";
xmlhttp.onload = function () {
if (this.status == 200) {
resolve(this.response);
} else {
reject(this.status);
}
this.downImg(img)
// a.setAttribute('href', URL.createObjectURL(blob));
// a.setAttribute('download', `collection.png`);
// a.click();
})
};
xmlhttp.send();
});
},
downImg(imagesParams:any) {
let _this:any = this;