2024-05-16 09:41:16 +08:00
< template >
2024-12-11 16:26:36 +08:00
< div ref = "publishModal" > < / div >
2024-05-16 09:41:16 +08:00
< a-modal
2024-05-22 10:45:52 +08:00
class = "publish_modal generalModel"
2024-05-16 09:41:16 +08:00
v - model : visible = "publish"
: footer = "null"
2024-12-11 16:26:36 +08:00
: get - container = "() => $refs.publishModal"
2024-05-16 09:41:16 +08:00
width = "50%"
: maskClosable = "false"
: centered = "true"
: closable = "false"
: mask = "publishMask"
: keyboard = "false"
>
2024-05-22 10:45:52 +08:00
< div class = "generalModel_btn" >
< div class = "generalModel_closeIcon" @click.stop ="cancelDsign()" >
2024-12-11 16:26:36 +08:00
< svg width = "46" height = "46" viewBox = "0 0 46 46" fill = "none" xmlns = "http://www.w3.org/2000/svg" >
2025-01-07 17:15:28 +08:00
< circle cx = "23" cy = "23" r = "23" fill = "white" fill -opacity = " 0.3 " / >
< rect x = "32.5063" y = "12" width = "3" height = "29" rx = "1.5" transform = "rotate(45 32.5063 12)" fill = "white" / >
< rect x = "34.6274" y = "32.5059" width = "3" height = "29" rx = "1.5" transform = "rotate(135 34.6274 32.5059)" fill = "white" / >
< / svg >
2024-05-16 09:41:16 +08:00
< / div >
< / div >
< div class = "publish_content" >
< div class = "modal_title_text" >
2024-06-21 10:30:09 +08:00
< div > { { $t ( 'Publish.Publish' ) } } < / div >
2024-05-16 09:41:16 +08:00
< div class = "modal_title_text_intro" > < / div >
< / div >
< div class = "publish_content_bottom" >
< div class = "publidh_left" >
< div class = "publidh_content_item" >
2024-06-21 10:30:09 +08:00
< div class = "publidh_content_item_title" > { { $t ( 'Publish.CoverPicture' ) } } < / div >
2024-05-16 09:41:16 +08:00
< div class = "publish_content_shrink publish_content_item" >
2024-05-16 17:14:22 +08:00
< img v-lazy = "selectDate.url" alt="" >
2024-05-16 09:41:16 +08:00
< / div >
< / div >
< / div >
< div class = "publidh_right" >
< div class = "publidh_right_name publidh_content_item" >
2024-06-21 10:30:09 +08:00
< div class = "publidh_content_item_title" > { { $t ( 'Publish.CollectionTitle' ) } } < / div >
2024-05-16 17:14:22 +08:00
< input type = "text" v-model = "subPublishDate.portfolioName" >
2024-10-04 11:29:50 +08:00
<!-- < div class = "publidh_content_item_tag" >
< a-tag closable color = "purple" > # RCAworkshop _2024 < / a-tag >
< / div > -- >
< / div >
2024-05-16 09:41:16 +08:00
< div class = "publidh_right_name publidh_content_item" >
2024-06-21 10:30:09 +08:00
< div class = "publidh_content_item_title" > { { $t ( 'Publish.Description' ) } } < / div >
2024-10-09 15:45:17 +08:00
<!-- < textarea @input ="textareaChange()" ref = "textarea" v-model = "subPublishDate.portfolioDes" > < / textarea > - - >
2024-05-16 17:14:22 +08:00
< textarea ref = "textarea" v-model = "subPublishDate.portfolioDes" > < / textarea >
2024-05-16 09:41:16 +08:00
< / div >
2024-10-08 00:44:17 +08:00
< div class = "publidh_content_item_tagList" >
< div v-for = "item,index in tagList" @click="pushTag(item,index)" >
2024-10-08 18:34:22 +08:00
< a-tag color = "purple" :title = "item.title" > { { item . tagName } } < / a-tag >
2024-10-08 00:44:17 +08:00
< / div >
2024-05-16 09:41:16 +08:00
< / div >
2024-06-17 09:39:01 +08:00
< div class = "publidh_right_detail publidh_content_item" >
2024-06-21 10:30:09 +08:00
< div class = "publidh_content_item_title" > { { $t ( 'Publish.Permissions' ) } } < / div >
2024-06-17 09:39:01 +08:00
< div >
2024-06-21 10:30:09 +08:00
< a-checkbox @change ="setPermissionsItem()" v -model :checked = "selectPermissions.isSecondaryCreation" > { { $t ( 'Publish.PermissionsItem1' ) } } < / a-checkbox >
2024-06-17 09:39:01 +08:00
< / div >
< / div >
2024-05-16 17:14:22 +08:00
< div class = "publidh_content_item publidh_right_zhuyi" >
2024-05-16 09:41:16 +08:00
< / div >
< div class = "publidh_right_btn" >
2024-06-21 10:30:09 +08:00
< div class = "started_btn" @click ="cancelDsign" > {{ $ t ( ' Publish.Close ' ) }} < / div >
2024-10-09 15:45:17 +08:00
< div class = "started_btn" @click ="setPublish" > {{ ! subPublishDate ? .id ? $ t ( ' Publish.Publish ' ) : $ t ( ' Publish.UpdatePublish ' ) }} < / div >
2024-05-16 09:41:16 +08:00
< / div >
< / div >
< / div >
2024-05-16 17:14:22 +08:00
< / div >
< div class = "mark_loading" v-show = "isShowMark" >
< a-spin size = "large" / >
2024-05-16 09:41:16 +08:00
< / div >
< / a-modal >
< / template >
< script lang = "ts" >
2024-07-08 09:42:21 +08:00
import { defineComponent , watch , createVNode , inject , ref , toRefs , computed , reactive , triggerRef , nextTick } from "vue" ;
2024-05-16 17:14:22 +08:00
import { Https } from "@/tool/https" ;
2024-05-16 09:41:16 +08:00
// import domTurnImg from '@/tool/domTurnImg'
import { ExclamationCircleOutlined } from '@ant-design/icons-vue' ;
import { Modal , message } from 'ant-design-vue' ;
2024-06-17 09:39:01 +08:00
import { downloadIamge , base64ToFile } from "@/tool/util" ;
2024-06-21 10:30:09 +08:00
import { useI18n } from 'vue-i18n' ;
2024-08-16 15:40:25 +08:00
import { useStore } from "vuex" ;
2024-05-16 09:41:16 +08:00
export default defineComponent ( {
2024-12-20 16:28:18 +08:00
emits : [ 'clearPublish' ] ,
2024-06-26 17:26:31 +08:00
setup ( prop , { emit } ) {
2024-06-21 10:30:09 +08:00
let { t } = useI18n ( )
2024-08-16 15:40:25 +08:00
const store = useStore ( ) ;
2024-05-16 09:41:16 +08:00
let publish : any = ref ( false ) ; //弹窗
let publishMask : any = ref ( false ) //弹窗遮罩
2024-05-16 17:14:22 +08:00
let publishData : any = reactive ( {
2024-06-17 09:39:01 +08:00
publishName : '' ,
2024-05-16 09:41:16 +08:00
loadingShow : false ,
publishMarginTop : 0 ,
publishList : [ ] ,
publishIndex : 0 , //当前图片索引
2024-05-16 17:14:22 +08:00
isShowMark : false ,
2024-06-17 09:39:01 +08:00
setPermissionsAll : true ,
2024-05-16 17:14:22 +08:00
selectDate : {
url : '' ,
} ,
subPublishDate : {
2024-10-09 15:45:17 +08:00
id : '' ,
portfolioDes : ''
2024-05-16 17:14:22 +08:00
} ,
2024-06-17 09:39:01 +08:00
selectPermissions : {
isAllowComment : true ,
isDisplayArea : true ,
isSecondaryCreation : true ,
2024-10-09 15:45:17 +08:00
} ,
2024-05-16 09:41:16 +08:00
} )
2024-10-09 15:45:17 +08:00
let portfolio : any = inject ( 'portfolio' )
let setPortfolio : any = inject ( 'setPortfolio' )
2024-12-31 11:05:33 +08:00
let tagList = ref ( [
// {id:1,tagName:'#AiDAworkshop_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! '},
2025-01-02 17:01:13 +08:00
{ id : 3 , tagName : '#NewYear_2025' , title : "✨New Year 2025! 🎉Let's kick off the year with a burst of inspiration and design!" }
2024-12-31 11:05:33 +08:00
] )
2024-05-16 09:41:16 +08:00
// let textarea: any = ref(null)
// let setCopy = ()=>{
// textarea.value.select()
// document.execCommand("copy");
// }
2024-05-16 17:14:22 +08:00
let init = ( data : any ) => {
2024-12-18 17:38:43 +08:00
let userInfo : any = store . state . UserHabit . userDetail
2024-06-17 09:39:01 +08:00
// console.log(data);
2024-05-16 09:41:16 +08:00
publish . value = true
2024-06-17 09:39:01 +08:00
publishData . selectDate . url = data . imgUrl
2024-05-16 17:14:22 +08:00
publishData . subPublishDate = {
2024-06-17 09:39:01 +08:00
userLikeGroupId : data . userlikeGroupId ,
// userLikeGroupId : data.id,
coverId : '' ,
// coverId : data.groupDetails[0].designOutfitId,
2024-12-18 17:38:43 +08:00
accountId : userInfo . userId ,
2024-05-16 17:14:22 +08:00
createDate : '' ,
idDeleted : '' ,
2024-10-09 15:45:17 +08:00
id : portfolio . value . id ? portfolio . value . id : '' ,
portfolioDes : portfolio . value . portfolioDes ? portfolio . value . portfolioDes : '' ,
portfolioName : portfolio . value . portfolioName ? portfolio . value . portfolioName : '' ,
2024-05-16 17:14:22 +08:00
portfolioType : 'History' ,
status : '' ,
updateDate : '' ,
collectionId : '' ,
2024-10-09 15:45:17 +08:00
tagsDTO : portfolio . value . tagsDTO ? portfolio . value . tagsDTO : [ ] ,
2024-06-17 09:39:01 +08:00
// isAllowLikes:true,
2024-05-16 17:14:22 +08:00
}
2024-05-16 09:41:16 +08:00
}
2024-05-16 17:14:22 +08:00
let setCover = ( item : any ) => {
publishData . subPublishDate . coverId = item . designOutfitId
publishData . selectDate . url = item . url
2024-05-16 09:41:16 +08:00
}
2024-10-08 00:44:17 +08:00
let extractHashtags = ( text : any ) => {
// const regex = /#\S+\s{2}/g;
const regex = /#\S+\s/g ;
// 使用match方法提取匹配的字符串
const matches = text . match ( regex ) ;
// 处理提取结果,去掉空格并返回
2024-10-09 15:45:17 +08:00
return matches ? matches . map ( ( match : any ) => match . replace ( /\s+/g , '' ) ) : [ ] ; // 去掉所有空格
2024-10-08 00:44:17 +08:00
}
let textareaChange = ( ) => {
2024-10-08 18:34:22 +08:00
let tagListArr = extractHashtags ( publishData . subPublishDate . portfolioDes )
let tagsDTO : any = [ ]
2024-10-09 15:45:17 +08:00
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
}
} else if ( index > - 1 ) {
obj = {
tagName : tagList . value [ index ] . tagName ,
id : tagList . value [ index ] . id
2024-10-08 18:34:22 +08:00
}
2024-10-09 15:45:17 +08:00
} else {
obj = { tagName : tagListArr [ i ] }
2024-10-08 18:34:22 +08:00
}
2024-10-09 15:45:17 +08:00
tagsDTO . push ( obj )
}
// publishData.subPublishDate.tagsDTO = tagsDTO
return tagsDTO
2024-05-16 09:41:16 +08:00
}
2024-06-17 09:39:01 +08:00
let setPermissionsItem = ( ) => {
// publishData.selectPermissions.isAllowLikes &&
if ( publishData . selectPermissions . isAllowComment && publishData . selectPermissions . isDisplayArea && publishData . selectPermissions . isSecondaryCreation ) {
publishData . setPermissionsAll = true
} else {
publishData . setPermissionsAll = false
}
}
let setPermissions = ( ) => {
// publishData.selectPermissions.isAllowLikes = publishData.setPermissionsAll;
publishData . selectPermissions . isAllowComment = publishData . setPermissionsAll
publishData . selectPermissions . isDisplayArea = publishData . setPermissionsAll
publishData . selectPermissions . isSecondaryCreation = publishData . setPermissionsAll
}
2024-05-16 17:14:22 +08:00
let cleardata = ( ) => {
2024-05-16 09:41:16 +08:00
publish . value = false
2024-05-16 17:14:22 +08:00
publishData . isShowMark = false
publishData . subPublishDate = { }
2024-12-20 16:28:18 +08:00
emit ( 'clearPublish' )
2024-05-16 09:41:16 +08:00
}
let cancelDsign = ( ) => {
Modal . confirm ( {
2024-06-21 10:30:09 +08:00
title : t ( 'Publish.jsContent1' ) ,
2024-05-16 09:41:16 +08:00
icon : createVNode ( ExclamationCircleOutlined ) ,
okText : 'Yes' ,
cancelText : 'No' ,
mask : false ,
centered : true ,
onOk ( ) {
2024-05-16 17:14:22 +08:00
cleardata ( )
2024-05-16 09:41:16 +08:00
}
} ) ;
}
let setPublish = ( ) => {
2024-06-17 09:39:01 +08:00
if ( ! publishData . subPublishDate . portfolioName ) {
2024-06-21 10:30:09 +08:00
return message . info ( t ( 'Publish.jsContent2' ) )
2024-06-17 09:39:01 +08:00
}
// if(!publishData.subPublishDate.portfolioDes){
// return message.info('Please enter a description')
// }
2024-05-16 09:41:16 +08:00
Modal . confirm ( {
2024-06-21 10:30:09 +08:00
title : t ( 'Publish.jsContent3' ) ,
2024-05-16 09:41:16 +08:00
icon : createVNode ( ExclamationCircleOutlined ) ,
okText : 'Yes' ,
cancelText : 'No' ,
mask : false ,
centered : true ,
onOk ( ) {
2024-05-16 17:14:22 +08:00
subPublish ( )
2024-05-16 09:41:16 +08:00
}
} ) ;
}
2024-05-16 17:14:22 +08:00
let subPublish = ( ) => {
2024-06-17 09:39:01 +08:00
let param = new FormData ( ) ;
// let fill = dataURLtoFile(publishData.selectDate.url,'collection')
// let aa = new File([fill], 'collection' + ".jpg");
let file = base64ToFile ( publishData . selectDate . url , 'collection' )
param . append ( 'file' , file )
publishData . subPublishDate . openSource = publishData . selectPermissions . isSecondaryCreation ? 1 : 0
2024-10-09 15:45:17 +08:00
let tagDTO = textareaChange ( )
publishData . subPublishDate . tagsDTO = tagDTO
2024-06-17 09:39:01 +08:00
param . append ( 'data' , JSON . stringify ( publishData . subPublishDate ) )
let config : any = { headers : { 'Content-Type' : 'multipart/form-data' , 'Accept' : '*/*' } }
// let data = publishData.subPublishDate
2024-05-16 17:14:22 +08:00
publishData . isShowMark = true
2024-06-17 09:39:01 +08:00
Https . axiosPost ( Https . httpUrls . publish , param , config )
2024-05-16 17:14:22 +08:00
. then ( ( rv ) => {
publishData . isShowMark = false
2024-10-09 15:45:17 +08:00
let obj = {
id : rv ,
portfolioName : publishData . subPublishDate . portfolioName ,
portfolioDes : publishData . subPublishDate . portfolioDes ,
tagsDTO : publishData . subPublishDate . tagsDTO ,
}
cleardata ( )
setPortfolio ( obj )
2024-06-21 10:30:09 +08:00
message . success ( t ( 'Publish.jsContent4' ) )
2024-05-16 17:14:22 +08:00
} )
. catch ( ( rv ) => {
publishData . isShowMark = false
} ) ;
}
2024-10-04 11:29:50 +08:00
let pushTag = ( tag : any , index : number ) => {
2024-10-08 00:44:17 +08:00
// let selectTag = tagList.value.splice(index,1)[0]
// if(tag.tag == 'RCAworkshop_2024'){
// publishData.subPublishDate.portfolioDes = '#AiDA x RCA workshop '
// }
2024-10-09 15:45:17 +08:00
if ( ! publishData . subPublishDate . portfolioDes ) publishData . subPublishDate . portfolioDes = ''
publishData . subPublishDate . portfolioDes = publishData . subPublishDate . portfolioDes + tag . tagName + ' '
2024-10-04 11:29:50 +08:00
}
2024-05-16 09:41:16 +08:00
return {
publish ,
publishMask ,
2024-05-16 17:14:22 +08:00
... toRefs ( publishData ) ,
2024-10-08 00:44:17 +08:00
tagList ,
2024-05-16 09:41:16 +08:00
// textarea,
// setCopy,
init ,
2024-10-08 00:44:17 +08:00
textareaChange ,
2024-06-17 09:39:01 +08:00
setPermissionsItem ,
setPermissions ,
2024-05-16 09:41:16 +08:00
// download,
// setScaleImageIndex,
// LikeFile,
2024-05-16 17:14:22 +08:00
setCover ,
2024-05-16 09:41:16 +08:00
cancelDsign ,
setPublish ,
2024-10-04 11:29:50 +08:00
pushTag ,
2024-05-16 09:41:16 +08:00
} ;
} ,
data ( ) {
return {
// moodTemplateId: "", //模板id
} ;
} ,
mounted ( ) {
} ,
methods : {
} ,
} ) ;
< / script >
< style lang = "less" >
. publish _modal {
. publish _page {
overflow - y : auto ;
height : 100 % ;
& . publish _page : : - webkit - scrollbar { display : none ; }
}
. publish _content {
display : flex ;
flex - direction : column ;
height : 100 % ;
2024-10-03 14:16:23 +08:00
}
: deep ( . ant - tag ) {
// position: absolute;
// left: 10px;
// top: 50%;
// transform: translateY(-50%);
}
2024-10-04 11:29:50 +08:00
// .publidh_content_item_tag{
// position: relative;
// .ant-tag{
// position: absolute;
// left: 10px;
// top: 50%;
// transform: translateY(-50%);
// }
// }
2024-05-16 09:41:16 +08:00
. publish _content _bottom {
-- border - color : # c4c4c4 ;
display : flex ;
justify - content : space - between ;
flex : 1 ;
2024-06-17 09:39:01 +08:00
height : calc ( 100 % - 10 rem ) ;
2024-10-08 00:44:17 +08:00
. publidh _content _item _tagList , . publidh _content _item _tag {
// height: 4rem;
border - radius : 1 rem ;
display : flex ;
align - items : center ;
flex - wrap : wrap ;
}
. publidh _content _item _tagList {
margin - top : 1 rem ;
. ant - tag {
cursor : pointer ;
margin - bottom : 8 px ;
}
}
2024-05-16 09:41:16 +08:00
. publidh _left , . publidh _right {
display : flex ;
flex - direction : column ;
}
. publidh _content _item {
margin - bottom : 2 rem ;
. publidh _content _item _title {
font - weight : 600 ;
font - size : 1.8 rem ;
margin - bottom : 1 rem ;
2024-10-03 14:16:23 +08:00
2024-10-04 11:29:50 +08:00
}
. publidh _content _item _tagList , . publidh _content _item _tag {
// height: 4rem;
border - radius : 1 rem ;
display : flex ;
align - items : center ;
flex - wrap : wrap ;
}
. publidh _content _item _tagList {
margin - top : 1 rem ;
. ant - tag {
cursor : pointer ;
margin - bottom : 8 px ;
}
}
. publidh _content _item _tag {
border : .2 rem solid var ( -- border - color ) ;
// height: 4rem;
padding : 2 rem ;
padding - right : 0 rem ;
. ant - tag {
cursor : pointer ;
margin - bottom : 8 px ;
}
2024-05-16 09:41:16 +08:00
}
2024-10-08 00:44:17 +08:00
2024-05-16 09:41:16 +08:00
. publidh _content _item _intro {
font - size : 1.4 rem ;
}
input {
width : 100 % ;
border - radius : 1 rem ;
height : 4 rem ;
padding - left : 2 rem ;
font - size : 2 rem ;
border : .2 rem solid var ( -- border - color ) ;
}
textarea {
flex : 1 ;
margin - top : var ( -- padding ) ;
width : 100 % ! important ;
height : 10 rem ! important ;
border - radius : 1 rem ;
border : .2 rem solid var ( -- border - color ) ;
font - size : 1.8 rem ;
padding : 1 rem ;
color : # 575757 ;
outline : none ; /* 清除默认焦点样式 */
}
textarea : focus {
border : .2 rem solid var ( -- border - color ) ;
outline : none ; /* 清除默认焦点样式 */
}
}
. publidh _content _item : last - child {
margin - bottom : 0 ;
}
. publidh _left {
width : 45 % ;
2024-06-17 09:39:01 +08:00
. publidh _content _item {
height : 100 % ;
}
2024-05-16 09:41:16 +08:00
. publish _content _shrink {
width : 100 % ;
2024-06-17 09:39:01 +08:00
height : calc ( 100 % - 4 rem ) ;
2024-05-16 09:41:16 +08:00
img {
width : 100 % ;
object - fit : contain ;
2024-06-17 09:39:01 +08:00
// object-fit: cover;
// max-height: 30rem;
max - height : 100 % ;
2024-05-16 09:41:16 +08:00
}
}
. publidh _left _thubnai {
flex : 1 ;
. publidh _left _thubnail _list {
display : flex ;
overflow - x : auto ;
height : 24 rem ;
img {
2024-05-16 17:14:22 +08:00
cursor : pointer ;
2024-05-16 09:41:16 +08:00
height : 100 % ;
margin - right : 1 rem ;
}
img : last - child {
margin - right : 0 ;
}
}
}
}
. publidh _right {
width : 45 % ;
2024-05-16 17:14:22 +08:00
. publidh _right _zhuyi {
2024-05-16 09:41:16 +08:00
margin - top : auto ;
2024-05-16 17:14:22 +08:00
}
. publidh _right _btn {
2024-05-16 09:41:16 +08:00
display : flex ;
align - items : center ;
justify - content : flex - end ;
> div : nth - child ( 1 ) {
margin - right : auto ;
}
> div : nth - child ( 2 ) {
margin - right : 1 rem ;
}
}
2024-06-17 09:39:01 +08:00
. publidh _right _detail {
display : flex ;
flex - direction : column ;
label {
display : flex ;
}
}
2024-05-16 09:41:16 +08:00
}
}
}
< / style >