|
|
@@ -2,20 +2,24 @@
|
|
|
<div class="editing">
|
|
|
<ul class="rightbtn-area">
|
|
|
<li @click="save">
|
|
|
- <img :src="`${config.cdn_url}images/btn_concert.png`" alt="">
|
|
|
+ <img :src="`${config.cdn_url}images/btn_concert.png`" alt="" />
|
|
|
</li>
|
|
|
<li @click="mycomfirm">
|
|
|
- <img :src="`${config.cdn_url}images/btn_cancel.png`" alt="">
|
|
|
+ <img :src="`${config.cdn_url}images/btn_cancel.png`" alt="" />
|
|
|
</li>
|
|
|
</ul>
|
|
|
|
|
|
<div class="left-area">
|
|
|
- <img class="wuding" :src="`${config.cdn_url}images/wuding.png`" alt="">
|
|
|
+ <img class="wuding" :src="`${config.cdn_url}images/wuding.png`" alt="" />
|
|
|
<ul>
|
|
|
- <li @click="onClickLeft(item)" :class="{ active: item.id === currentActive.id }" v-for="item in list"
|
|
|
- :key="item.id">
|
|
|
+ <li
|
|
|
+ @click="onClickLeft(item)"
|
|
|
+ :class="{ active: item.id === currentActive.id }"
|
|
|
+ v-for="item in list"
|
|
|
+ :key="item.id"
|
|
|
+ >
|
|
|
<span>{{ item.name }}</span>
|
|
|
- <img :src="`${config.cdn_url}images/active.png`" alt="">
|
|
|
+ <img :src="`${config.cdn_url}images/active.png`" alt="" />
|
|
|
<div class="b-line"></div>
|
|
|
</li>
|
|
|
</ul>
|
|
|
@@ -24,32 +28,53 @@
|
|
|
<ul v-if="currentActive.id === -1" class="btm-area">
|
|
|
<li v-for="item in steps" :key="item.id">
|
|
|
<span>{{ item.name }}</span>
|
|
|
- <img :src="`${config.cdn_url}images/icon_next.png`" alt="">
|
|
|
+ <img :src="`${config.cdn_url}images/icon_next.png`" alt="" />
|
|
|
</li>
|
|
|
</ul>
|
|
|
|
|
|
<div v-else class="btm-bujian">
|
|
|
<div class="typecon">
|
|
|
- <img @click="blockTypeActive = 'block'"
|
|
|
- :src="`${config.cdn_url}images/icon_element_${blockTypeActive === 'block' ? 'active' : 'normal'}.png`" alt="">
|
|
|
- <img @click="blockTypeActive = 'color'"
|
|
|
- :src="`${config.cdn_url}images/icon_color_${blockTypeActive === 'color' ? 'active' : 'normal'}.png`" alt="">
|
|
|
+ <img
|
|
|
+ @click="blockTypeActive = 'block'"
|
|
|
+ :src="`${config.cdn_url}images/icon_element_${
|
|
|
+ blockTypeActive === 'block' ? 'active' : 'normal'
|
|
|
+ }.png`"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ <img
|
|
|
+ @click="blockTypeActive = 'color'"
|
|
|
+ :src="`${config.cdn_url}images/icon_color_${
|
|
|
+ blockTypeActive === 'color' ? 'active' : 'normal'
|
|
|
+ }.png`"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
</div>
|
|
|
|
|
|
<div class="line"></div>
|
|
|
|
|
|
<div class="b-list">
|
|
|
<ul v-if="blockTypeActive === 'block'">
|
|
|
- <li @click="elementActive = item.id" :class="{ active: item.id === elementActive }" v-for="item in activeBlock"
|
|
|
- :key="item.id">
|
|
|
- <img :src="`${config.cdn_url}images/${currentActive.floder}/${item.name}.png`" alt="">
|
|
|
+ <li
|
|
|
+ @click="elementActive = item.id"
|
|
|
+ :class="{ active: item.id === elementActive }"
|
|
|
+ v-for="item in activeBlock"
|
|
|
+ :key="item.id"
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ :src="`${config.cdn_url}images/${currentActive.floder}/${item.name}.png`"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
</li>
|
|
|
</ul>
|
|
|
|
|
|
<ul v-else>
|
|
|
- <li @click="colorActive = item.id" :class="{ colorActive: item.id === colorActive }"
|
|
|
- :style="{ background: item.color }" v-for="item in colorsList" :key="item.id">
|
|
|
- </li>
|
|
|
+ <li
|
|
|
+ @click="colorActive = item.id"
|
|
|
+ :class="{ colorActive: item.id === colorActive }"
|
|
|
+ :style="{ background: item.color }"
|
|
|
+ v-for="item in colorsList"
|
|
|
+ :key="item.id"
|
|
|
+ ></li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -57,91 +82,93 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, reactive, getCurrentInstance, unref, watch, onUnmounted } from "vue"
|
|
|
-import { useRouter } from 'vue-router'
|
|
|
-import list from '@/data'
|
|
|
-const router = useRouter()
|
|
|
-
|
|
|
-const instance = getCurrentInstance()
|
|
|
-const globalProperties = instance.appContext.config.globalProperties
|
|
|
+import {
|
|
|
+ ref,
|
|
|
+ reactive,
|
|
|
+ getCurrentInstance,
|
|
|
+ unref,
|
|
|
+ watch,
|
|
|
+ onUnmounted,
|
|
|
+} from "vue";
|
|
|
+import { useRouter } from "vue-router";
|
|
|
+import list from "@/data";
|
|
|
+const router = useRouter();
|
|
|
+
|
|
|
+const instance = getCurrentInstance();
|
|
|
+const globalProperties = instance.appContext.config.globalProperties;
|
|
|
|
|
|
const steps = [
|
|
|
{
|
|
|
id: 1,
|
|
|
- name: '步骤一:选择左侧各部分'
|
|
|
+ name: "步骤一:选择左侧各部分",
|
|
|
},
|
|
|
{
|
|
|
id: 3,
|
|
|
- name: '步骤二:搭建构件和上色'
|
|
|
+ name: "步骤二:搭建构件和上色",
|
|
|
},
|
|
|
{
|
|
|
id: 3,
|
|
|
- name: '步骤三:保存模型'
|
|
|
- }
|
|
|
-]
|
|
|
-
|
|
|
-let activeBlock = reactive([])
|
|
|
-
|
|
|
-
|
|
|
-let colorsList = reactive([{
|
|
|
- id: 0,
|
|
|
- color: '#BC8866'
|
|
|
-}, {
|
|
|
- id: 1,
|
|
|
- color: '#D6A98C'
|
|
|
-},
|
|
|
-{
|
|
|
- id: 2,
|
|
|
- color: '#9F7F6A'
|
|
|
-}
|
|
|
-])
|
|
|
-
|
|
|
-
|
|
|
-const currentActive = ref({ id: -1 })
|
|
|
-const blockTypeActive = ref('block')
|
|
|
+ name: "步骤三:保存模型",
|
|
|
+ },
|
|
|
+];
|
|
|
|
|
|
+let activeBlock = reactive([]);
|
|
|
|
|
|
-const elementActive = ref('')
|
|
|
+let colorsList = reactive([
|
|
|
+ {
|
|
|
+ id: 0,
|
|
|
+ color: "#BC8866",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ color: "#D6A98C",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 2,
|
|
|
+ color: "#9F7F6A",
|
|
|
+ },
|
|
|
+]);
|
|
|
|
|
|
-const colorActive = ref('')
|
|
|
+const currentActive = ref({ id: -1 });
|
|
|
+const blockTypeActive = ref("block");
|
|
|
|
|
|
+const elementActive = ref("");
|
|
|
|
|
|
+const colorActive = ref("");
|
|
|
|
|
|
-let ifrDom = document.querySelector('#ifr')
|
|
|
+let ifrDom = document.querySelector("#ifr");
|
|
|
|
|
|
const reset = () => {
|
|
|
- elementActive.value = ''
|
|
|
- colorActive.value = ''
|
|
|
- postMsg("clickTypeBtn", unref(blockTypeActive))
|
|
|
-}
|
|
|
+ elementActive.value = "";
|
|
|
+ colorActive.value = "";
|
|
|
+ postMsg("clickTypeBtn", unref(blockTypeActive));
|
|
|
+};
|
|
|
|
|
|
watch(currentActive, () => {
|
|
|
- postMsg("changeBlock", unref(currentActive.value.id))
|
|
|
- reset()
|
|
|
-})
|
|
|
-
|
|
|
+ postMsg("changeBlock", unref(currentActive.value.id));
|
|
|
+ reset();
|
|
|
+});
|
|
|
|
|
|
watch(blockTypeActive, () => {
|
|
|
- postMsg("clickTypeBtn", unref(blockTypeActive))
|
|
|
-})
|
|
|
+ postMsg("clickTypeBtn", unref(blockTypeActive));
|
|
|
+});
|
|
|
|
|
|
watch(elementActive, () => {
|
|
|
- if (elementActive.value !== '') {
|
|
|
- postMsg("clickItemBtn", unref(elementActive))
|
|
|
+ if (elementActive.value !== "") {
|
|
|
+ postMsg("clickItemBtn", unref(elementActive));
|
|
|
}
|
|
|
-})
|
|
|
+});
|
|
|
|
|
|
watch(colorActive, () => {
|
|
|
- if (colorActive.value !== '') {
|
|
|
- postMsg("clickItemBtn", unref(colorActive))
|
|
|
+ if (colorActive.value !== "") {
|
|
|
+ postMsg("clickItemBtn", unref(colorActive));
|
|
|
}
|
|
|
-})
|
|
|
+});
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
// 重置到预览
|
|
|
- postMsg("changeBlock", -1)
|
|
|
-})
|
|
|
-
|
|
|
+ postMsg("changeBlock", -1);
|
|
|
+});
|
|
|
|
|
|
const postMsg = (source, data) => {
|
|
|
ifrDom.contentWindow.postMessage(
|
|
|
@@ -151,33 +178,38 @@ const postMsg = (source, data) => {
|
|
|
},
|
|
|
"*"
|
|
|
);
|
|
|
-}
|
|
|
+};
|
|
|
+
|
|
|
+// 进页面 通信 编辑
|
|
|
+postMsg("OnClickEdit", "");
|
|
|
|
|
|
const onClickLeft = (item) => {
|
|
|
- console.log('result:', item);
|
|
|
- currentActive.value = item
|
|
|
+ console.log("result:", item);
|
|
|
+ currentActive.value = item;
|
|
|
if (item.id !== -1) {
|
|
|
- activeBlock = item.blockList
|
|
|
+ activeBlock = item.blockList;
|
|
|
|
|
|
- console.log('result:', activeBlock);
|
|
|
+ console.log("result:", activeBlock);
|
|
|
}
|
|
|
+};
|
|
|
|
|
|
-}
|
|
|
-
|
|
|
-const save = ()=>{
|
|
|
- postMsg("Save", '')
|
|
|
-}
|
|
|
+const save = () => {
|
|
|
+ postMsg("Save", "");
|
|
|
+};
|
|
|
|
|
|
const mycomfirm = () => {
|
|
|
globalProperties.$Dialog.confirm({
|
|
|
- content: '放弃编辑后,信息将不会保存',
|
|
|
- func: res => {
|
|
|
- postMsg("Cancel", '')
|
|
|
- router.push({ name: 'Courtyard' })
|
|
|
- }
|
|
|
- })
|
|
|
-}
|
|
|
+ content: "放弃编辑后,信息将不会保存",
|
|
|
+ func: (res) => {
|
|
|
+ console.log('-----------',res);
|
|
|
+ if(res==='ok'){
|
|
|
+ postMsg("Cancel", "");
|
|
|
+ router.push({ name: "Courtyard" });
|
|
|
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
@@ -195,11 +227,11 @@ const mycomfirm = () => {
|
|
|
flex-direction: column;
|
|
|
width: 16%;
|
|
|
|
|
|
- >li {
|
|
|
+ > li {
|
|
|
width: 100%;
|
|
|
margin: 16px 0;
|
|
|
|
|
|
- >img {
|
|
|
+ > img {
|
|
|
width: 100%;
|
|
|
}
|
|
|
}
|
|
|
@@ -220,14 +252,14 @@ const mycomfirm = () => {
|
|
|
width: 120%;
|
|
|
}
|
|
|
|
|
|
- >ul {
|
|
|
+ > ul {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
justify-content: space-around;
|
|
|
align-items: center;
|
|
|
height: 92%;
|
|
|
|
|
|
- >li {
|
|
|
+ > li {
|
|
|
color: #fff;
|
|
|
font-size: 18px;
|
|
|
font-weight: bold;
|
|
|
@@ -235,14 +267,19 @@ const mycomfirm = () => {
|
|
|
display: inline-block;
|
|
|
position: relative;
|
|
|
|
|
|
- >span {
|
|
|
+ > span {
|
|
|
display: inline-block;
|
|
|
width: 100%;
|
|
|
- text-align-last: justify
|
|
|
+ text-align-last: justify;
|
|
|
}
|
|
|
|
|
|
.b-line {
|
|
|
- background: linear-gradient(116deg, rgba(99, 84, 61, 0) 0%, rgba(99, 84, 61, 0.3) 50%, rgba(99, 84, 61, 0) 100%);
|
|
|
+ background: linear-gradient(
|
|
|
+ 116deg,
|
|
|
+ rgba(99, 84, 61, 0) 0%,
|
|
|
+ rgba(99, 84, 61, 0.3) 50%,
|
|
|
+ rgba(99, 84, 61, 0) 100%
|
|
|
+ );
|
|
|
width: 120%;
|
|
|
height: 1px;
|
|
|
position: absolute;
|
|
|
@@ -257,7 +294,7 @@ const mycomfirm = () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- >img {
|
|
|
+ > img {
|
|
|
opacity: 0;
|
|
|
display: none;
|
|
|
pointer-events: none;
|
|
|
@@ -267,7 +304,7 @@ const mycomfirm = () => {
|
|
|
position: relative;
|
|
|
color: $font-active-color;
|
|
|
|
|
|
- >img {
|
|
|
+ > img {
|
|
|
left: 50%;
|
|
|
top: 50%;
|
|
|
transform: translate(-50%, -50%);
|
|
|
@@ -287,7 +324,11 @@ const mycomfirm = () => {
|
|
|
right: 0;
|
|
|
width: 80%;
|
|
|
height: 40px;
|
|
|
- background: linear-gradient(270deg, rgba(193, 169, 122, 0.8) 0%, rgba(193, 169, 122, 0.3) 100%);
|
|
|
+ background: linear-gradient(
|
|
|
+ 270deg,
|
|
|
+ rgba(193, 169, 122, 0.8) 0%,
|
|
|
+ rgba(193, 169, 122, 0.3) 100%
|
|
|
+ );
|
|
|
backdrop-filter: blur(4px);
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
@@ -296,24 +337,22 @@ const mycomfirm = () => {
|
|
|
font-size: 12px;
|
|
|
font-weight: bold;
|
|
|
|
|
|
- >li {
|
|
|
+ > li {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
|
|
|
- >img {
|
|
|
+ > img {
|
|
|
width: 20px;
|
|
|
margin: 0 20px;
|
|
|
}
|
|
|
|
|
|
&:last-of-type {
|
|
|
- >img {
|
|
|
+ > img {
|
|
|
display: none;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
.btm-bujian {
|
|
|
@@ -321,7 +360,11 @@ const mycomfirm = () => {
|
|
|
bottom: 0;
|
|
|
right: 0;
|
|
|
width: 80%;
|
|
|
- background: linear-gradient(270deg, rgba(193, 169, 122, 0.8) 0%, rgba(193, 169, 122, 0.3) 100%);
|
|
|
+ background: linear-gradient(
|
|
|
+ 270deg,
|
|
|
+ rgba(193, 169, 122, 0.8) 0%,
|
|
|
+ rgba(193, 169, 122, 0.3) 100%
|
|
|
+ );
|
|
|
backdrop-filter: blur(4px);
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
@@ -337,7 +380,7 @@ const mycomfirm = () => {
|
|
|
width: 20%;
|
|
|
justify-content: flex-end;
|
|
|
|
|
|
- >img {
|
|
|
+ > img {
|
|
|
margin: 0 10px;
|
|
|
}
|
|
|
}
|
|
|
@@ -346,7 +389,12 @@ const mycomfirm = () => {
|
|
|
width: 1px;
|
|
|
height: 50px;
|
|
|
margin: 0 10px;
|
|
|
- background: linear-gradient(116deg, rgba(99, 84, 61, 0) 0%, rgba(99, 84, 61, 0.49) 51%, rgba(99, 84, 61, 0) 100%);
|
|
|
+ background: linear-gradient(
|
|
|
+ 116deg,
|
|
|
+ rgba(99, 84, 61, 0) 0%,
|
|
|
+ rgba(99, 84, 61, 0.49) 51%,
|
|
|
+ rgba(99, 84, 61, 0) 100%
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
.b-list {
|
|
|
@@ -359,10 +407,10 @@ const mycomfirm = () => {
|
|
|
display: none;
|
|
|
}
|
|
|
|
|
|
- >ul {
|
|
|
+ > ul {
|
|
|
display: inline-block;
|
|
|
|
|
|
- >li {
|
|
|
+ > li {
|
|
|
display: inline-block;
|
|
|
width: 50px;
|
|
|
height: 50px;
|
|
|
@@ -370,7 +418,7 @@ const mycomfirm = () => {
|
|
|
background: #e8deca;
|
|
|
border-radius: 2px;
|
|
|
|
|
|
- >img {
|
|
|
+ > img {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
object-fit: contain;
|
|
|
@@ -384,10 +432,8 @@ const mycomfirm = () => {
|
|
|
border: 2px solid #961014;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
</style>
|