2024-05-22 10:45:52 +08:00
|
|
|
<template>
|
|
|
|
|
<a-modal
|
|
|
|
|
class="habitSetStyle_modal generalModel"
|
|
|
|
|
v-model:visible="habitSetStyle"
|
|
|
|
|
:footer="null"
|
|
|
|
|
width="50%"
|
|
|
|
|
:maskClosable="false"
|
|
|
|
|
:centered="true"
|
|
|
|
|
:closable="false"
|
|
|
|
|
:mask="habitSetStyleMask"
|
|
|
|
|
:keyboard="false"
|
|
|
|
|
:destroyOnClose="true"
|
2024-06-17 09:39:01 +08:00
|
|
|
:zIndex="1050"
|
2024-05-22 10:45:52 +08:00
|
|
|
>
|
|
|
|
|
<div class="generalModel_btn">
|
|
|
|
|
<div class="generalModel_closeIcon" @click.stop="cancelDsign()">
|
|
|
|
|
<i class="fi fi-rr-cross-small"></i>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="habitSetStyle_content" v-hoverAnmi>
|
|
|
|
|
<div class="modal_title_text">
|
2024-06-21 10:30:09 +08:00
|
|
|
<div>{{ $t('Habit.Style') }}</div>
|
2024-05-22 10:45:52 +08:00
|
|
|
<div class="modal_title_text_intro"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="habitSetStyle_content_bottom">
|
|
|
|
|
<div class="content_bottom_item" v-for="item in styleList">
|
2024-06-17 09:39:01 +08:00
|
|
|
<div class="content_bottom_item_border" :class="{active:item.name == selectStyle.name}" @click="setItemSelect(item)">
|
2024-05-22 10:45:52 +08:00
|
|
|
{{ item.name}}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-06-20 10:36:45 +08:00
|
|
|
<div class="habitSetStyle_ok">
|
|
|
|
|
<div class="started_btn" @click="setClear()">
|
2024-06-21 10:30:09 +08:00
|
|
|
{{ $t('Habit.Clear') }}
|
2024-06-20 10:36:45 +08:00
|
|
|
</div>
|
2024-06-27 17:37:49 +08:00
|
|
|
<div class="started_btn" @click="setOk()">
|
|
|
|
|
OK
|
|
|
|
|
</div>
|
2024-05-22 10:45:52 +08:00
|
|
|
</div>
|
2024-06-20 10:36:45 +08:00
|
|
|
|
2024-05-22 10:45:52 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="mark_loading" v-show="isShowMark">
|
|
|
|
|
<a-spin size="large" />
|
|
|
|
|
</div>
|
|
|
|
|
</a-modal>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
|
import { defineComponent,watch,createVNode, h, ref ,toRefs,computed,reactive,triggerRef, nextTick} from "vue";
|
|
|
|
|
// import { getCookie } from "@/tool/cookie";
|
2024-06-20 10:36:45 +08:00
|
|
|
import { message,Modal } from "ant-design-vue";
|
|
|
|
|
import { LoadingOutlined ,ExclamationCircleOutlined} from "@ant-design/icons-vue";
|
|
|
|
|
|
2024-05-22 10:45:52 +08:00
|
|
|
import { Https } from "@/tool/https";
|
|
|
|
|
import { getCookie,setCookie } from "@/tool/cookie";
|
|
|
|
|
// import domTurnImg from '@/tool/domTurnImg'
|
|
|
|
|
import { downloadIamge } from "@/tool/util";
|
2024-06-21 10:30:09 +08:00
|
|
|
import { useI18n } from "vue-i18n";
|
2024-05-22 10:45:52 +08:00
|
|
|
export default defineComponent({
|
|
|
|
|
emits:['setParentData','setWorkspaceStyle'],
|
|
|
|
|
|
|
|
|
|
setup(props,{emit}) {
|
|
|
|
|
let habitSetStyle: any = ref(false);//弹窗
|
|
|
|
|
let habitSetStyleMask:any = ref(false)//弹窗遮罩
|
2024-06-20 10:36:45 +08:00
|
|
|
let oldDataId = ''
|
2024-05-22 10:45:52 +08:00
|
|
|
let habitSetStyleData:any = reactive({
|
|
|
|
|
styleList:[],
|
2024-06-17 09:39:01 +08:00
|
|
|
selectStyle:{
|
|
|
|
|
name:'',
|
|
|
|
|
id:'',
|
|
|
|
|
},
|
|
|
|
|
selectStyleName:'',
|
2024-05-22 10:45:52 +08:00
|
|
|
isShowMark:false,
|
|
|
|
|
})
|
2024-06-21 10:30:09 +08:00
|
|
|
const {t} = useI18n()
|
2024-05-22 10:45:52 +08:00
|
|
|
let getStyleList = ()=>{
|
|
|
|
|
habitSetStyleData.isShowMark = true
|
|
|
|
|
Https.axiosPost(Https.httpUrls.getStyleList, {}).then(
|
|
|
|
|
(rv) => {
|
|
|
|
|
habitSetStyleData.isShowMark = false
|
|
|
|
|
rv.forEach((item:any) => {
|
|
|
|
|
let name = item.value
|
|
|
|
|
item.value = item.name
|
|
|
|
|
item.name = name
|
|
|
|
|
});
|
|
|
|
|
habitSetStyleData.styleList = rv
|
|
|
|
|
}
|
|
|
|
|
).catch(res=>{
|
|
|
|
|
habitSetStyleData.isShowMark = false
|
|
|
|
|
});
|
|
|
|
|
}
|
2024-06-17 09:39:01 +08:00
|
|
|
let init = (data:any)=>{
|
2024-05-22 10:45:52 +08:00
|
|
|
habitSetStyle.value = true
|
|
|
|
|
if(habitSetStyleData.styleList.length == 0){
|
|
|
|
|
getStyleList()
|
|
|
|
|
}
|
2024-06-20 10:36:45 +08:00
|
|
|
oldDataId = data.styleId
|
2024-06-17 09:39:01 +08:00
|
|
|
habitSetStyleData.selectStyle.id = data.styleId
|
|
|
|
|
habitSetStyleData.selectStyle.name = data.styleName
|
2024-05-22 10:45:52 +08:00
|
|
|
// habitSetStyleData.selectStyleId = 'feng2'
|
|
|
|
|
}
|
|
|
|
|
let setCover = (item:any)=>{
|
|
|
|
|
habitSetStyleData.subPublishDate.coverId = item.designOutfitId
|
|
|
|
|
habitSetStyleData.selectDate.url = item.url
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
let cleardata = ()=>{
|
|
|
|
|
habitSetStyle.value = false
|
|
|
|
|
habitSetStyleData.isShowMark = false
|
2024-06-17 09:39:01 +08:00
|
|
|
// setParentData()
|
2024-05-22 10:45:52 +08:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
let setParentData = ()=>{
|
|
|
|
|
emit('setParentData')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let cancelDsign = ()=>{
|
|
|
|
|
cleardata()
|
|
|
|
|
}
|
|
|
|
|
let setOk= ()=>{
|
2024-06-20 10:36:45 +08:00
|
|
|
let data = {
|
|
|
|
|
id:habitSetStyleData.selectStyle.id,
|
|
|
|
|
name:habitSetStyleData.selectStyle.name,
|
2024-06-26 17:26:31 +08:00
|
|
|
value:habitSetStyleData.selectStyle.value,
|
2024-06-20 10:36:45 +08:00
|
|
|
isRevampModel:false,
|
|
|
|
|
}
|
|
|
|
|
if(oldDataId == data.id){
|
|
|
|
|
cleardata()
|
|
|
|
|
}else{
|
|
|
|
|
let _this = this
|
|
|
|
|
Modal.confirm({
|
2024-06-21 10:30:09 +08:00
|
|
|
title: t('Habit.jsContent3'),
|
2024-06-20 10:36:45 +08:00
|
|
|
icon: createVNode(ExclamationCircleOutlined),
|
|
|
|
|
okText: 'Yes',
|
|
|
|
|
cancelText: 'No',
|
|
|
|
|
mask:false,
|
|
|
|
|
centered:true,
|
|
|
|
|
zIndex:1050,
|
|
|
|
|
onOk() {
|
|
|
|
|
data.isRevampModel = true
|
|
|
|
|
emit('setWorkspaceStyle',data)
|
|
|
|
|
cleardata()
|
|
|
|
|
},
|
|
|
|
|
onCancel() {
|
|
|
|
|
emit('setWorkspaceStyle',data)
|
|
|
|
|
cleardata()
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let setClear = ()=>{
|
|
|
|
|
habitSetStyleData.selectStyle.id = ''
|
|
|
|
|
habitSetStyleData.selectStyle.name = ''
|
2024-06-26 17:26:31 +08:00
|
|
|
habitSetStyleData.selectStyle.value = ''
|
2024-05-22 10:45:52 +08:00
|
|
|
}
|
|
|
|
|
let setItemSelect = (item:any)=>{
|
2024-06-26 17:26:31 +08:00
|
|
|
habitSetStyleData.selectStyle = Object.assign({},item)
|
2024-05-22 10:45:52 +08:00
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
habitSetStyle,
|
|
|
|
|
habitSetStyleMask,
|
|
|
|
|
...toRefs(habitSetStyleData),
|
|
|
|
|
init,
|
|
|
|
|
setCover,
|
|
|
|
|
cancelDsign,
|
|
|
|
|
setItemSelect,
|
|
|
|
|
setOk,
|
2024-06-20 10:36:45 +08:00
|
|
|
setClear,
|
2024-05-22 10:45:52 +08:00
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
// moodTemplateId: "", //模板id
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
directives:{
|
|
|
|
|
hoverAnmi:{
|
|
|
|
|
updated (el) {
|
|
|
|
|
var elements = document.querySelectorAll(".habitSetStyle_modal .content_bottom_item");
|
|
|
|
|
el.addEventListener("mousemove", function (event:any) {
|
|
|
|
|
// 获取鼠标位置
|
|
|
|
|
var mouseX = event.pageX;
|
|
|
|
|
var mouseY = event.pageY;
|
|
|
|
|
|
|
|
|
|
// 遍历元素并输出距离鼠标的坐标
|
|
|
|
|
for (var i = 0; i < elements.length; i++) {
|
|
|
|
|
var element:any = elements[i];
|
|
|
|
|
var rect = element.getBoundingClientRect();
|
|
|
|
|
var elementX = rect.left + window.pageXOffset;
|
|
|
|
|
var elementY = rect.top + window.pageYOffset;
|
|
|
|
|
|
|
|
|
|
var distanceX = mouseX - elementX;
|
|
|
|
|
var distanceY = mouseY - elementY;
|
|
|
|
|
|
|
|
|
|
// 将距离值设置到每一个卡片元素上面
|
|
|
|
|
element.style.setProperty('--x', distanceX + 'px');
|
|
|
|
|
element.style.setProperty('--y', distanceY + 'px');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="less">
|
|
|
|
|
.habitSetStyle_modal {
|
2024-06-17 09:39:01 +08:00
|
|
|
&.generalModel{
|
|
|
|
|
.ant-modal-body {
|
|
|
|
|
height: calc(55rem*1.2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-22 10:45:52 +08:00
|
|
|
.habitSetStyle_content{
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
height: 100%;
|
|
|
|
|
.habitSetStyle_content_bottom{
|
|
|
|
|
--border-color: #c4c4c4;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex: 1;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
align-content: flex-start;
|
|
|
|
|
.content_bottom_item{
|
|
|
|
|
width: calc((100% / 4) - (.8 * 1rem));
|
|
|
|
|
// width: calc(100% / 4);
|
|
|
|
|
// padding: 0 1rem;
|
|
|
|
|
border-radius: 2rem;
|
|
|
|
|
margin-right: 1rem;
|
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
|
height: 10rem;
|
|
|
|
|
background: #f3f3f3;
|
|
|
|
|
position: relative;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
.content_bottom_item_border {
|
|
|
|
|
position: absolute;
|
|
|
|
|
inset: .2rem;
|
|
|
|
|
background: #f3f3f3;
|
|
|
|
|
border-radius: 2rem;
|
|
|
|
|
color: #595959;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
font-size: 2rem;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.content_bottom_item:nth-child(4n){
|
|
|
|
|
margin-right: 0rem;
|
|
|
|
|
}
|
|
|
|
|
.content_bottom_item::before {
|
|
|
|
|
content: '';
|
|
|
|
|
position: absolute;
|
|
|
|
|
width: calc(100% + .2rem);
|
|
|
|
|
height: calc(100% + .2rem);
|
|
|
|
|
top: 50%;
|
|
|
|
|
left: 50%;
|
|
|
|
|
border-radius: 2rem;
|
|
|
|
|
transform: translate(-50%, -50%);
|
|
|
|
|
background: radial-gradient(50px circle at var(--x) var(--y),#39215b 0,transparent 100%);;
|
|
|
|
|
}
|
|
|
|
|
.content_bottom_item .active{
|
|
|
|
|
background: #39215b;
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.habitSetStyle_ok{
|
|
|
|
|
width: 60%;
|
|
|
|
|
text-align: center;
|
|
|
|
|
margin: 0 auto;
|
2024-06-20 10:36:45 +08:00
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-around;
|
|
|
|
|
>div{
|
|
|
|
|
width: 40%;
|
|
|
|
|
}
|
2024-05-22 10:45:52 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
</style>
|