|
@@ -150,15 +150,35 @@ const frontColor = ref<string>('')
|
|
/** background-color */
|
|
/** background-color */
|
|
const backgroundColor = ref<string>('')
|
|
const backgroundColor = ref<string>('')
|
|
|
|
|
|
|
|
+const saveMarkSet = () => {
|
|
|
|
+ if (fullPath && !!sessionStorage.get('LOGIN_RESULT')) {
|
|
|
|
+ mainStore.setUserMarkConfig({
|
|
|
|
+ [fullPath]: {
|
|
|
|
+ center: center.value,
|
|
|
|
+ ratio: ratio.value,
|
|
|
|
+ rotate: rotate.value,
|
|
|
|
+ frontColor: frontColor.value,
|
|
|
|
+ backgroundColor: backgroundColor.value,
|
|
|
|
+ },
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
watch(center, () => emitEvent('center', center.value))
|
|
watch(center, () => emitEvent('center', center.value))
|
|
|
|
|
|
watch(ratio, () => emitEvent('scale-change', ratio.value))
|
|
watch(ratio, () => emitEvent('scale-change', ratio.value))
|
|
|
|
|
|
watch(rotate, () => emitEvent('rotate', rotate.value))
|
|
watch(rotate, () => emitEvent('rotate', rotate.value))
|
|
|
|
|
|
-watch(frontColor, () => emitEvent('front-color', frontColor.value))
|
|
|
|
|
|
+watch(frontColor, () => {
|
|
|
|
+ emitEvent('front-color', frontColor.value)
|
|
|
|
+ saveMarkSet()
|
|
|
|
+})
|
|
|
|
|
|
-watch(backgroundColor, () => emitEvent('background-color', backgroundColor.value))
|
|
|
|
|
|
+watch(backgroundColor, () => {
|
|
|
|
+ emitEvent('background-color', backgroundColor.value)
|
|
|
|
+ saveMarkSet()
|
|
|
|
+})
|
|
|
|
|
|
const validVal = (val: number, max: number, min: number) => {
|
|
const validVal = (val: number, max: number, min: number) => {
|
|
return Math.min(max, Math.max(val, min))
|
|
return Math.min(max, Math.max(val, min))
|
|
@@ -171,18 +191,23 @@ const onOperationClick = (button: HeaderButton) => {
|
|
switch (button.type) {
|
|
switch (button.type) {
|
|
case 'scale-up':
|
|
case 'scale-up':
|
|
ratio.value = validVal(add(ratio.value, 0.1), 2, 0.5)
|
|
ratio.value = validVal(add(ratio.value, 0.1), 2, 0.5)
|
|
|
|
+ saveMarkSet()
|
|
break
|
|
break
|
|
case 'scale-down':
|
|
case 'scale-down':
|
|
ratio.value = validVal(minus(ratio.value, 0.1), 2, 0.5)
|
|
ratio.value = validVal(minus(ratio.value, 0.1), 2, 0.5)
|
|
|
|
+ saveMarkSet()
|
|
break
|
|
break
|
|
case 'rotate':
|
|
case 'rotate':
|
|
rotate.value = (rotate.value + 90) % 360
|
|
rotate.value = (rotate.value + 90) % 360
|
|
|
|
+ saveMarkSet()
|
|
break
|
|
break
|
|
case 'center':
|
|
case 'center':
|
|
center.value = !center.value
|
|
center.value = !center.value
|
|
|
|
+ saveMarkSet()
|
|
break
|
|
break
|
|
default:
|
|
default:
|
|
emitEvent(button.type)
|
|
emitEvent(button.type)
|
|
|
|
+ saveMarkSet()
|
|
break
|
|
break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -233,19 +258,19 @@ const willLogout = async () => {
|
|
logout()
|
|
logout()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-onUnmounted(() => {
|
|
|
|
- if (fullPath && !!sessionStorage.get('LOGIN_RESULT')) {
|
|
|
|
- mainStore.setUserMarkConfig({
|
|
|
|
- [fullPath]: {
|
|
|
|
- center: center.value,
|
|
|
|
- ratio: ratio.value,
|
|
|
|
- rotate: rotate.value,
|
|
|
|
- frontColor: frontColor.value,
|
|
|
|
- backgroundColor: backgroundColor.value,
|
|
|
|
- },
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
-})
|
|
|
|
|
|
+// onUnmounted(() => {
|
|
|
|
+// if (fullPath && !!sessionStorage.get('LOGIN_RESULT')) {
|
|
|
|
+// mainStore.setUserMarkConfig({
|
|
|
|
+// [fullPath]: {
|
|
|
|
+// center: center.value,
|
|
|
|
+// ratio: ratio.value,
|
|
|
|
+// rotate: rotate.value,
|
|
|
|
+// frontColor: frontColor.value,
|
|
|
|
+// backgroundColor: backgroundColor.value,
|
|
|
|
+// },
|
|
|
|
+// })
|
|
|
|
+// }
|
|
|
|
+// })
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|