浏览代码

feat:删除

jinx 2 年之前
父节点
当前提交
89fb457a9f

+ 4 - 4
src/assets/scss/_base-vars.scss

@@ -1,12 +1,12 @@
 
 :root {
   --colors-primary-fill: 255, 255, 255;
-  --colors-primary-base-fill: 0, 200, 175;
+  --colors-primary-base-fill:0, 118, 246;
   --colors-primary-base: rgb(var(--colors-primary-base-fill));
-  --colors-primary-hover: #4DD8C7;
+  --colors-primary-hover: #0076F6;
   // --colors-primary-hover: #008B7A;
-  --colors-primary-active: #008B7A;
-  --colors-primary-click: #005046;
+  --colors-primary-active:#0076F6;
+  --colors-primary-click: #0076F6;
   --colors-warn: #FA3F48;
   // --colors-color: #999;
   --colors-color: rgba(255, 255, 255, 0.7);

+ 2 - 2
src/assets/scss/components/_button.scss

@@ -69,8 +69,8 @@
     // &:active,
     &:hover {
         // opacity: 0.8;
-        // background: var(--colors-primary-hover) !important;
-        background: #4DD8C7 !important;
+        background: var(--colors-primary-hover) !important;
+        // background: #4DD8C7 !important;
     }
     &:active {
         background-color: var(--colors-primary-active) !important;

+ 47 - 0
src/components/button/index.vue

@@ -0,0 +1,47 @@
+<template>
+    <button class="ui-button" :class="className" :style="style">
+        <!-- <UIIcon :type="icon" v-if="icon" class="ui-button-icon" /> -->
+        <slot></slot>
+    </button>
+</template>
+
+<script setup>
+import { defineProps, computed } from 'vue'
+import { normalizeUnitToStyle } from '@/utils/dom.js'
+// import UIIcon from '../icon'
+
+const props = defineProps({
+    type: {
+        type: String,
+        default: 'normal',
+    },
+    color: {
+        type: String,
+    },
+    width: {
+        type: [String, Number],
+    },
+    icon: {
+        type: String,
+    },
+})
+
+const custom = `customize`
+const className = computed(() => (props.color ? custom : props.type))
+
+const style = computed(() => {
+    const style = {
+        width: normalizeUnitToStyle(props.width),
+    }
+
+    if (className.value === custom) {
+        style['--color'] = props.color
+    }
+    return style
+})
+</script>
+
+<script>
+export default { name: 'ui-button' }
+</script>
+

+ 14 - 5
src/components/dialog/Confirm.vue

@@ -17,9 +17,12 @@
     </ui-dialog>
 </template>
 <script>
-import { defineComponent } from 'vue'
+import { defineComponent, defineEmits } from 'vue'
 import { isFunction, omit } from '../../utils'
-
+import UiDialog from './Dialog.vue'
+import UiButton from '../button/index.vue'
+// console.error(UiDialog)
+const emits = defineEmits(['ok', 'no'])
 export default defineComponent({
     name: 'ui-confirm',
     props: {
@@ -49,15 +52,21 @@ export default defineComponent({
     },
     setup: function (props, ctx) {
         const close = result => {
-            if (isFunction(props.func) && props.func(result) === false) {
-                return
+            if (result == 'ok') {
+                ctx.emit('ok', 'ok')
+            } else {
+                ctx.emit('no', 'no')
             }
-            isFunction(props.destroy) && props.destroy()
+            // if (isFunction(props.func) && props.func(result) === false) {
+            //     return
+            // }
+            // isFunction(props.destroy) && props.destroy()
         }
         return {
             ...omit(props, 'destroy', 'func'),
             close,
         }
     },
+    components: { UiDialog, UiButton },
 })
 </script>

+ 1 - 1
src/components/files/TagView.vue

@@ -56,7 +56,7 @@ onMounted(() => {
         })
     } else if (window.laser) {
         window.laser.then(sdk => {
-            let pos = notify.value.tag.position
+            let pos = notify.value.position
             sdk.scene.comeToTag(new THREE.Vector3(pos.x, pos.y, pos.z))
         })
     }

+ 1 - 1
src/components/files/content/Comment.vue

@@ -191,7 +191,7 @@ onMounted(() => {
         })
     } else if (window.laser) {
         window.laser.then(sdk => {
-            let pos = notify.value.tag.position
+            let pos = notify.value.position
             sdk.scene.comeToTag(new THREE.Vector3(pos.x, pos.y, pos.z))
         })
     }

+ 1 - 1
src/components/files/content/TagMsg.vue

@@ -142,7 +142,7 @@ onMounted(() => {
         })
     } else if (window.laser) {
         window.laser.then(sdk => {
-            let pos = notify.value.tag.position
+            let pos = notify.value.position
             sdk.scene.comeToTag(new THREE.Vector3(pos.x, pos.y, pos.z))
         })
     }

+ 30 - 12
src/components/files/index.vue

@@ -33,18 +33,45 @@
             <button type="submit" @click="onAddConfirm">确定</button>
         </div>
     </transition>
+    <ui-confirm v-if="delComfirm" @ok="handlerDel" @no="handlerDel">
+        <template #content>
+            <div>确定要删除资料吗?</div>
+        </template>
+    </ui-confirm>
 </template>
 <script setup>
 import { ref, inject, watchEffect, onMounted, nextTick } from 'vue'
 import { http } from '@/utils/request'
-
+import UiConfirm from '@/components/dialog/Confirm.vue'
 let editTag = null
 let tempTag = null
 const exit$ = ref(null)
 const add$ = ref(null)
 const props = defineProps(['show'])
 const emits = defineEmits(['add', 'exit'])
-
+const handlerDel = status => {
+    if (status == 'ok') {
+        http.post(`smart-site/marking/del`, {
+            markingId: delComfirm.value.id,
+        }).then(response => {
+            if (response.success) {
+                console.log(delComfirm.value)
+                let index = tags.value.findIndex(item => item.sid == delComfirm.value.sid)
+                if (index != -1) {
+                    tags.value.splice(index, 1)
+                }
+                if (notify.value && notify.value.id == delComfirm.value.id) {
+                    notify.value = null
+                }
+            } else {
+            }
+            delComfirm.value = null
+        })
+    } else {
+        delComfirm.value = null
+    }
+}
+const delComfirm = ref(null)
 const showFiles = ref(false)
 const showToolbar = ref(false)
 const showMoreSid = ref('')
@@ -208,16 +235,7 @@ const onMoreHandler = (type, tag) => {
         }
         // window.kankan.TagManager.focusBeforeModify(editTag.sid)
     } else if (type == 'delete') {
-        http.post(`smart-site/marking/del`, {
-            markingId: tag.id,
-        }).then(response => {
-            if (response.success) {
-                let index = tags.value.findIndex(item => item.sid == tag.sid)
-                if (index != -1) {
-                    tags.value.splice(index, 1)
-                }
-            }
-        })
+        delComfirm.value = tag
     }
     showMoreSid.value = ''
 }