|
@@ -2,7 +2,7 @@
|
|
|
<div class="hotspot-icon-personalized-tag">
|
|
|
<div class="line-show-setting switcher-wrap">
|
|
|
<span class="label">{{$i18n.t('hotspot.if_show_marking_line')}}</span>
|
|
|
- <Switcher :value="isShowLine" @change="onSwitcherChange"></Switcher>
|
|
|
+ <Switcher :value="hotspot.personalizedTagInfo.isShowLine" @change="onSwitcherChange"></Switcher>
|
|
|
</div>
|
|
|
|
|
|
<div class="svg-wrapper"></div>
|
|
@@ -10,26 +10,26 @@
|
|
|
<div class="remark-highlight">{{ $i18n.t('hotspot.hotspot_title') }}</div>
|
|
|
<div class="title-input-wrapper">
|
|
|
<input
|
|
|
- v-model.trim="hotspotTitle"
|
|
|
+ v-model.trim="hotspot.hotspotTitle"
|
|
|
type="text" maxlength="15"
|
|
|
:placeholder="$i18n.t('hotspot.title_placeholder')"
|
|
|
/>
|
|
|
- <span class="count">{{ hotspotTitle.length }}/15</span>
|
|
|
+ <span class="count">{{ hotspot.hotspotTitle.length }}/15</span>
|
|
|
</div>
|
|
|
|
|
|
<div class="remark">{{ $i18n.t('hotspot.hotspot_title') }}</div>
|
|
|
<div
|
|
|
class="color-picker-wrap"
|
|
|
>
|
|
|
- <div class="color-value">{{ fillColor }}</div>
|
|
|
+ <div class="color-value">{{ hotspot.personalizedTagInfo.fillColor }}</div>
|
|
|
<div
|
|
|
class="color-preview"
|
|
|
- :style="`background-color: ${fillColor};`"
|
|
|
+ :style="`background-color: ${hotspot.personalizedTagInfo.fillColor};`"
|
|
|
/>
|
|
|
<ColorPicker
|
|
|
show-alpha
|
|
|
:predefine="predefineColors"
|
|
|
- :value="fillColor"
|
|
|
+ :value="hotspot.personalizedTagInfo.fillColor"
|
|
|
@active-change="onFillColorActiveChange"
|
|
|
/>
|
|
|
</div>
|
|
@@ -38,15 +38,15 @@
|
|
|
<div
|
|
|
class="color-picker-wrap"
|
|
|
>
|
|
|
- <div class="color-value">{{ borderColor }}</div>
|
|
|
+ <div class="color-value">{{ hotspot.personalizedTagInfo.borderColor }}</div>
|
|
|
<div
|
|
|
class="color-preview"
|
|
|
- :style="`background-color: ${borderColor};`"
|
|
|
+ :style="`background-color: ${hotspot.personalizedTagInfo.borderColor};`"
|
|
|
/>
|
|
|
<ColorPicker
|
|
|
show-alpha
|
|
|
:predefine="predefineColors"
|
|
|
- :value="borderColor"
|
|
|
+ :value="hotspot.personalizedTagInfo.borderColor"
|
|
|
@active-change="onBorderColorActiveChange"
|
|
|
/>
|
|
|
</div>
|
|
@@ -55,15 +55,15 @@
|
|
|
<div
|
|
|
class="color-picker-wrap"
|
|
|
>
|
|
|
- <div class="color-value">{{ textColor }}</div>
|
|
|
+ <div class="color-value">{{ hotspot.personalizedTagInfo.textColor }}</div>
|
|
|
<div
|
|
|
class="color-preview"
|
|
|
- :style="`background-color: ${textColor};`"
|
|
|
+ :style="`background-color: ${hotspot.personalizedTagInfo.textColor};`"
|
|
|
/>
|
|
|
<ColorPicker
|
|
|
show-alpha
|
|
|
:predefine="predefineColors"
|
|
|
- :value="textColor"
|
|
|
+ :value="hotspot.personalizedTagInfo.textColor"
|
|
|
@active-change="onTextColorActiveChange"
|
|
|
/>
|
|
|
</div>
|
|
@@ -87,23 +87,23 @@
|
|
|
|
|
|
<div class="text-wrap-setting switcher-wrap">
|
|
|
<span class="label">{{ $i18n.t('hotspot.if_wrap') }}</span>
|
|
|
- <Switcher :value="isTextWrap" @change="onTextWrapChange"></Switcher>
|
|
|
+ <Switcher :value="hotspot.personalizedTagInfo.isTextWrap" @change="onTextWrapChange"></Switcher>
|
|
|
</div>
|
|
|
|
|
|
<div
|
|
|
class="text-num-per-line-wrap"
|
|
|
:class="{
|
|
|
- disable: !isTextWrap
|
|
|
+ disable: !hotspot.personalizedTagInfo.isTextWrap
|
|
|
}"
|
|
|
>
|
|
|
<div class="remark">{{ $i18n.t('hotspot.text_num_per_line') }}</div>
|
|
|
<div class="value-wrap">
|
|
|
<input
|
|
|
- v-model.trim.number="textNumPerLine"
|
|
|
+ v-model.trim.number="hotspot.personalizedTagInfo.textNumPerLine"
|
|
|
@blur="onTextNumPerLineInputBlur"
|
|
|
type="number"
|
|
|
min="1"
|
|
|
- :disabled="!isTextWrap"
|
|
|
+ :disabled="!hotspot.personalizedTagInfo.isTextWrap"
|
|
|
>
|
|
|
<span class="remark">{{ $i18n.t('hotspot.words') }}</span>
|
|
|
</div>
|
|
@@ -113,6 +113,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { mapGetters } from "vuex";
|
|
|
import * as d3 from "d3";
|
|
|
import { ColorPicker } from "element-ui";
|
|
|
import Switcher from "@/components/shared/Switcher.vue";
|
|
@@ -126,16 +127,6 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- isShowLine: true,
|
|
|
- lineDirection: '',
|
|
|
- hotspotTitle: '',
|
|
|
- fillColor: 'rgba(0, 0, 0, 1)',
|
|
|
- borderColor: 'rgba(0, 0, 0, 1)',
|
|
|
- textColor: 'rgba(0, 0, 0, 1)',
|
|
|
- textDirection: '',
|
|
|
- isTextWrap: false,
|
|
|
- textNumPerLine: 10,
|
|
|
-
|
|
|
svgNode: null,
|
|
|
|
|
|
endpointListForShow: [
|
|
@@ -260,8 +251,11 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
+ ...mapGetters({
|
|
|
+ hotspot: 'hotspot',
|
|
|
+ }),
|
|
|
currentTextDirectionIdx() {
|
|
|
- switch (this.textDirection) {
|
|
|
+ switch (this.hotspot.personalizedTagInfo.textDirection) {
|
|
|
case 'left-right':
|
|
|
return 0
|
|
|
case 'top-bottom':
|
|
@@ -273,46 +267,37 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
onSwitcherChange(v) {
|
|
|
- this.isShowLine = v
|
|
|
- },
|
|
|
- emit() {
|
|
|
- this.$emit('addHotspot', {
|
|
|
- type: 'personalized_tag',
|
|
|
- personalizedTagInfo: {
|
|
|
- isShowLine: this.isShowLine,
|
|
|
- lineDirection: this.lineDirection,
|
|
|
- }
|
|
|
- })
|
|
|
+ this.hotspot.personalizedTagInfo.isShowLine = v
|
|
|
},
|
|
|
onFillColorActiveChange(e) {
|
|
|
- this.fillColor = e
|
|
|
+ this.hotspot.personalizedTagInfo.fillColor = e
|
|
|
},
|
|
|
onBorderColorActiveChange(e) {
|
|
|
- this.borderColor = e
|
|
|
+ this.hotspot.personalizedTagInfo.borderColor = e
|
|
|
},
|
|
|
onTextColorActiveChange(e) {
|
|
|
- this.textColor = e
|
|
|
+ this.hotspot.personalizedTagInfo.textColor = e
|
|
|
},
|
|
|
onSelectTextDirection(idx) {
|
|
|
switch (idx) {
|
|
|
case 0:
|
|
|
- this.textDirection = 'left-right'
|
|
|
+ this.hotspot.personalizedTagInfo.textDirection = 'left-right'
|
|
|
break;
|
|
|
case 1:
|
|
|
- this.textDirection = 'top-bottom'
|
|
|
+ this.hotspot.personalizedTagInfo.textDirection = 'top-bottom'
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
},
|
|
|
onTextWrapChange(v) {
|
|
|
- this.isTextWrap = v
|
|
|
+ this.hotspot.personalizedTagInfo.isTextWrap = v
|
|
|
},
|
|
|
onTextNumPerLineInputBlur() {
|
|
|
- if (this.textNumPerLine < 1) {
|
|
|
- this.textNumPerLine = 1
|
|
|
+ if (this.hotspot.personalizedTagInfo.textNumPerLine < 1) {
|
|
|
+ this.hotspot.personalizedTagInfo.textNumPerLine = 1
|
|
|
} else {
|
|
|
- this.textNumPerLine = Math.round(this.textNumPerLine)
|
|
|
+ this.hotspot.personalizedTagInfo.textNumPerLine = Math.round(this.hotspot.personalizedTagInfo.textNumPerLine)
|
|
|
}
|
|
|
},
|
|
|
},
|
|
@@ -410,12 +395,12 @@ export default {
|
|
|
}).attr('fill', '#0076F6')
|
|
|
.attr('stroke', '#fff')
|
|
|
|
|
|
- this.lineDirection = datum.id
|
|
|
+ that.hotspot.personalizedTagInfo.lineDirection = datum.id
|
|
|
})
|
|
|
|
|
|
// 初始状态
|
|
|
this.svgNode.selectAll('rect.endpoint-for-click').filter((d) => {
|
|
|
- return d.id === 'left-top'
|
|
|
+ return d.id === that.hotspot.personalizedTagInfo.lineDirection
|
|
|
}).dispatch('click')
|
|
|
|
|
|
}, 100);
|