From 50f47cc532ee436259bbea63fcbc96c38c3d0c01 Mon Sep 17 00:00:00 2001 From: X1627315083 <1627315083@qq.com> Date: Wed, 9 Oct 2024 15:45:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B4=BB=E5=8A=A8=E4=BD=9C?= =?UTF-8?q?=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.dev | 2 +- src/component/WorksPage/publish.vue | 74 ++++++++++++++++++----------- src/views/HomeView/HomeView.vue | 26 ++++++---- src/views/HomeView/Works.vue | 11 +++-- 4 files changed, 68 insertions(+), 45 deletions(-) diff --git a/.env.dev b/.env.dev index 8eaa7f4e..cff0b1cb 100644 --- a/.env.dev +++ b/.env.dev @@ -6,6 +6,6 @@ NODE_ENV = 'development' VUE_APP_BASE_URL = 'https://develop.api.aida.com.hk' VUE_APP_BASE_URL = 'https://www.api.aida.com.hk' # 佩佩 -# VUE_APP_BASE_URL = 'http://192.168.1.4:5567' +VUE_APP_BASE_URL = 'http://192.168.1.4:5567' # 海波 # VUE_APP_BASE_URL = 'http://192.168.1.9:5567' diff --git a/src/component/WorksPage/publish.vue b/src/component/WorksPage/publish.vue index 30945319..3191c665 100644 --- a/src/component/WorksPage/publish.vue +++ b/src/component/WorksPage/publish.vue @@ -9,7 +9,6 @@ :closable="false" :mask="publishMask" :keyboard="false" - :destroyOnClose="true" >
@@ -37,7 +36,8 @@
{{$t('Publish.Description')}}
- + +
@@ -54,7 +54,7 @@
{{$t('Publish.Close')}}
-
{{beenPublished == 0?$t('Publish.Publish'):$t('Publish.UpdatePublish')}}
+
{{!subPublishDate?.id?$t('Publish.Publish'):$t('Publish.UpdatePublish')}}
@@ -83,12 +83,10 @@ export default defineComponent({ const store = useStore(); let publish: any = ref(false);//弹窗 let publishMask:any = ref(false)//弹窗遮罩 - let setBeenPublished:any = inject('setBeenPublished') let publishData:any = reactive({ publishName:'', loadingShow:false, publishMarginTop:0, - beenPublished:inject('beenPublished'),//history回来时候表示是否已经发布0为没发布 publishList:[], publishIndex:0,//当前图片索引 isShowMark:false, @@ -97,14 +95,18 @@ export default defineComponent({ url:'', }, subPublishDate:{ + id:'', + portfolioDes:'' }, selectPermissions:{ isAllowComment:true, isDisplayArea:true, isSecondaryCreation:true, - } + }, }) - let tagList = ref([{tagId:1,tagName:'#RCAworkshop_2024 ',title:'The process is simple: use AiDA to post your design work on the "Gallery ", and the one with the most likes(at least 20 likes) will be invited to the AiDA Workshop offline event in Hong Kong on November 14th, to exchange ideas with the Royal College of Art (RCA), Jae Lim, co-founder of the renowned fashion brand BESFXXK, and outstanding designers! '}]) + let portfolio:any = inject('portfolio') + let setPortfolio:any = inject('setPortfolio') + let tagList = ref([{id:1,tagName:'#RCAworkshop_2024',title:'The process is simple: use AiDA to post your design work on the "Gallery ", and the one with the most likes(at least 20 likes) will be invited to the AiDA Workshop offline event in Hong Kong on November 14th, to exchange ideas with the Royal College of Art (RCA), Jae Lim, co-founder of the renowned fashion brand BESFXXK, and outstanding designers! '}]) // let textarea: any = ref(null) // let setCopy = ()=>{ // textarea.value.select() @@ -123,14 +125,14 @@ export default defineComponent({ accountId : JSON.parse(userInfo).userId, createDate:'', idDeleted:'', - id:'', - portfolioDes:'', - portfolioName:'', + id:portfolio.value.id?portfolio.value.id:'', + portfolioDes:portfolio.value.portfolioDes?portfolio.value.portfolioDes:'', + portfolioName:portfolio.value.portfolioName?portfolio.value.portfolioName:'', portfolioType:'History', status:'', updateDate:'', collectionId:'', - tagsDTO:[], + tagsDTO:portfolio.value.tagsDTO?portfolio.value.tagsDTO:[], // isAllowLikes:true, } } @@ -145,24 +147,32 @@ export default defineComponent({ // 使用match方法提取匹配的字符串 const matches = text.match(regex); // 处理提取结果,去掉空格并返回 - return matches ? matches.map((match:any) => match.trim()) : []; + return matches ? matches.map((match:any) => match.replace(/\s+/g, '')) : []; // 去掉所有空格 } let textareaChange = ()=>{ let tagListArr = extractHashtags(publishData.subPublishDate.portfolioDes) let tagsDTO:any = [] - tagListArr.forEach((item:any) => { - const index = tagList.value.findIndex((obj:any) => obj.tagName === item); - if(index>-1){ - let obj = { - tagName:tagList.value[index], - tagId:tagList.value[index].tagId + for (let i = 0; i < tagListArr.length; i++) { + const index = tagList.value.findIndex((obj:any) => obj.tagName === tagListArr[i]); + const tagsDTOIndex = publishData.subPublishDate.tagsDTO.findIndex((obj:any) => obj.tagName === tagListArr[i]); + let obj + if(tagsDTOIndex>-1){ + obj = { + tagName:publishData.subPublishDate.tagsDTO[tagsDTOIndex].tagName, + id:publishData.subPublishDate.tagsDTO[tagsDTOIndex].id } - tagsDTO.push(tagList.value[index]) - }else{ - tagsDTO.push({tagName:item}) + }else if(index > -1){ + obj = { + tagName:tagList.value[index].tagName, + id:tagList.value[index].id + } + }else { + obj = {tagName:tagListArr[i]} } - }); - publishData.subPublishDate.tagsDTO = tagsDTO + tagsDTO.push(obj) + } + // publishData.subPublishDate.tagsDTO = tagsDTO + return tagsDTO } let setPermissionsItem = ()=>{ // publishData.selectPermissions.isAllowLikes && @@ -224,18 +234,24 @@ export default defineComponent({ let file = base64ToFile(publishData.selectDate.url,'collection') param.append('file',file) publishData.subPublishDate.openSource = publishData.selectPermissions.isSecondaryCreation?1:0 + let tagDTO = textareaChange() + publishData.subPublishDate.tagsDTO = tagDTO param.append('data',JSON.stringify(publishData.subPublishDate)) - param.append('tagsDTO',JSON.stringify(publishData.subPublishDate.tagsDTO)) let config:any = {headers:{'Content-Type':'multipart/form-data','Accept':'*/*' }} // let data = publishData.subPublishDate publishData.isShowMark = true Https.axiosPost(Https.httpUrls.publish, param,config) .then((rv) => { - cleardata() publishData.isShowMark = false - emit('setPublish') + let obj = { + id:rv, + portfolioName:publishData.subPublishDate.portfolioName, + portfolioDes:publishData.subPublishDate.portfolioDes, + tagsDTO:publishData.subPublishDate.tagsDTO, + } + cleardata() + setPortfolio(obj) message.success(t('Publish.jsContent4')) - setBeenPublished() }) .catch((rv) => { publishData.isShowMark = false @@ -248,8 +264,8 @@ export default defineComponent({ // if(tag.tag == 'RCAworkshop_2024'){ // publishData.subPublishDate.portfolioDes = '#AiDA x RCA workshop ' // } - publishData.subPublishDate.portfolioDes = publishData.subPublishDate.portfolioDes+tag.tagName - textareaChange() + if(!publishData.subPublishDate.portfolioDes) publishData.subPublishDate.portfolioDes = '' + publishData.subPublishDate.portfolioDes = publishData.subPublishDate.portfolioDes+tag.tagName + ' ' } return { publish, diff --git a/src/views/HomeView/HomeView.vue b/src/views/HomeView/HomeView.vue index f053f578..8e9ec649 100644 --- a/src/views/HomeView/HomeView.vue +++ b/src/views/HomeView/HomeView.vue @@ -274,12 +274,12 @@ export default defineComponent({ let userGroupId: any = computed(() => { return store.state.HomeStoreModule.userGroupId; }); //模特id //当likeDesignCollectionList长度为0时清空,startdesign时清空 - let beenPublished = ref(0) - let setBeenPublished = ()=>{ - beenPublished.value = 1 + let setPortfolio = (data:any)=>{ + console.log(data); + + portfolio.value = data } - provide('beenPublished',beenPublished) - provide('setBeenPublished',setBeenPublished) + provide('setPortfolio',setPortfolio) let designCollectionId: any = computed(() => { return store.state.HomeStoreModule.designCollectionId; }); @@ -338,12 +338,14 @@ export default defineComponent({ let isMannequinShow = ref(false) let chooseIsDesign:any = computed(()=>{ return store.state.UploadFilesModule.chooseIsDesign}) + let portfolio:any = ref({}) + provide('portfolio',portfolio) return { store, likeDesignCollectionList, designCollectionList, userGroupId, - beenPublished, + setPortfolio, designCollectionId, designId, contentImgMax, @@ -358,6 +360,7 @@ export default defineComponent({ allBoardData, isMannequinShow, chooseIsDesign, + portfolio, }; }, data() { @@ -532,8 +535,11 @@ export default defineComponent({ // this.likeDesignCollectionList.push(team) // }, affiche(text:any){ - let affiche:any = this.$refs.affiche - affiche.init(text) + nextTick(()=>{ + let affiche:any = this.$refs.affiche + affiche.init(text) + }) + // affiche.afficheMask = true }, dragstart (e:any, index:any) { @@ -952,7 +958,7 @@ export default defineComponent({ Https.httpUrls.historyChoose + `?userGroupId=${userGroupId}`; Https.axiosGet(url) .then((rv: any) => { - this.beenPublished = rv.beenPublished + this.setPortfolio(rv.portfolioDTO) this.store.commit("setUserGroupId", rv.userGroupId); this.dealHistoryChooseData(rv, type); this.isShowMark = false; @@ -979,7 +985,7 @@ export default defineComponent({ this.isShowMark = true; Https.axiosPost(Https.httpUrls.setPorfolioChoose, data).then( (rv: any) => { - this.beenPublished = rv.beenPublished + this.setPortfolio(rv.portfolioDTO) this.store.commit("setUserGroupId", rv.userGroupId); this.dealHistoryChooseData(rv, type); this.isShowMark = false; diff --git a/src/views/HomeView/Works.vue b/src/views/HomeView/Works.vue index 75f5e293..bb77ade2 100644 --- a/src/views/HomeView/Works.vue +++ b/src/views/HomeView/Works.vue @@ -7,7 +7,8 @@ - + + @@ -87,10 +88,10 @@ export default defineComponent({ name: useI18n().t('works.MyWorks'), value: 'myWorks' }, - // { - // name: 'RCA Workshop 2024', - // value: 'RCAworkshop_2024' - // }, + { + name: 'RCA Workshop 2024', + value: 'RCAworkshop_2024' + }, ], worksList: [ ],