牛奶 před 1 dnem
rodič
revize
9607725db4

+ 20 - 6
src/components/ProductCard/index.vue

@@ -1,12 +1,16 @@
 <template>
-  <div class="product-card" @click="onPath(`/item?id=${product.id}&productNo=${product.productNo}`)">
-    <div class="card-header" v-if="showCheckbox || showAction">
-      <el-checkbox v-if="showCheckbox" v-model="checked" @change="handleCheck" />
+<!--  -->
+  <div class="product-card" >
+    <div class="card-header" v-if="showCheckbox || showAction" @click="onCheckbox">
+      <div @click.stop="">
+        <el-checkbox v-if="showCheckbox" v-model="checked" @change="handleCheck" />
+      </div>
+
       <slot name="action">
-        <span v-if="actionText" class="action-btn" @click="$emit('action')">{{ actionText }}</span>
+        <span v-if="actionText" class="action-btn" @click.stop="$emit('action')">{{ actionText }}</span>
       </slot>
     </div>
-    <div class="product-image">
+    <div class="product-image" @click="onPath(`/item?id=${product.id}&productNo=${product.productNo}`)">
       <el-image :src="product.image" fit="contain">
         <template #error>
           <div class="image-placeholder">
@@ -16,7 +20,7 @@
       </el-image>
     </div>
     <div class="product-info">
-      <div class="product-name">{{ product.name }}</div>
+      <div class="product-name" @click="onPath(`/item?id=${product.id}&productNo=${product.productNo}`)">{{ product.name }}</div>
       <div class="product-price">
         <span v-if="product.tag" class="price-tag">{{ product.tag }}</span>
         <span class="current-price">¥{{ product.price }}</span>
@@ -70,6 +74,11 @@ watch(
 const handleCheck = (val: boolean | string | number) => {
   emit('update:modelValue', !!val);
 };
+
+const onCheckbox = () => {
+  checked.value = !checked.value;
+   emit('update:modelValue', checked.value);
+};
 </script>
 
 <style scoped lang="scss">
@@ -101,6 +110,7 @@ const handleCheck = (val: boolean | string | number) => {
     align-items: center;
     justify-content: center;
     padding: 10px;
+    cursor: pointer;
     .el-image {
       width: 100%;
       height: 100%;
@@ -127,6 +137,10 @@ const handleCheck = (val: boolean | string | number) => {
       -webkit-line-clamp: 2;
       -webkit-box-orient: vertical;
       margin-bottom: 8px;
+      cursor: pointer;
+      &:hover {
+        color: #e60012;
+      }
     }
     .product-price {
       display: flex;

+ 3 - 3
src/layout/components/workbench.vue

@@ -16,7 +16,7 @@
         </div>
         <div class="menu-item" v-show="openedMenus.includes(item1.path)">
           <div
-            @click="onPath(item2.path)"
+            @click.stop="onPath(item2.path)"
             v-for="(item2, index2) in item1.children"
             :key="index2"
             class="menu-box"
@@ -195,7 +195,7 @@ const toggleMenu = (path: string) => {
   const index = openedMenus.value.indexOf(path);
   if (index > -1) {
     // 如果已展开,则收起
-    // openedMenus.value.splice(index, 1);
+    openedMenus.value.splice(index, 1);
   } else {
     // 手风琴效果:先收起所有,再展开当前
     openedMenus.value = [path];
@@ -367,7 +367,7 @@ watch(
     padding-left: 4px;
     cursor: pointer;
     &:hover {
-      color: #e60012;
+      color: var(--el-color-primary);
     }
     &.popover-hig {
       background: #ffe8e8;