添加活动作品

This commit is contained in:
X1627315083
2024-10-09 15:45:17 +08:00
parent fbbf2359cd
commit 50f47cc532
4 changed files with 68 additions and 45 deletions

View File

@@ -9,7 +9,6 @@
:closable="false"
:mask="publishMask"
:keyboard="false"
:destroyOnClose="true"
>
<div class="generalModel_btn">
<div class="generalModel_closeIcon" @click.stop="cancelDsign()">
@@ -37,7 +36,8 @@
</div>
<div class="publidh_right_name publidh_content_item">
<div class="publidh_content_item_title">{{$t('Publish.Description')}}</div>
<textarea @input="textareaChange()" ref="textarea" v-model="subPublishDate.portfolioDes"></textarea>
<!-- <textarea @input="textareaChange()" ref="textarea" v-model="subPublishDate.portfolioDes"></textarea> -->
<textarea ref="textarea" v-model="subPublishDate.portfolioDes"></textarea>
</div>
<div class="publidh_content_item_tagList">
<div v-for="item,index in tagList" @click="pushTag(item,index)">
@@ -54,7 +54,7 @@
</div>
<div class="publidh_right_btn">
<div class="started_btn" @click="cancelDsign">{{$t('Publish.Close')}}</div>
<div class="started_btn" @click="setPublish">{{beenPublished == 0?$t('Publish.Publish'):$t('Publish.UpdatePublish')}}</div>
<div class="started_btn" @click="setPublish">{{!subPublishDate?.id?$t('Publish.Publish'):$t('Publish.UpdatePublish')}}</div>
</div>
</div>
</div>
@@ -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,