Browse Source

Merge remote-tracking branch 'origin/master'

sys5923812@126.com 1 tháng trước cách đây
mục cha
commit
b4c3bb533d

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 690 - 896
src/views/xjc-integratedmachine/environment/university/university_details_video.vue


+ 16 - 2
src/views/xjc-integratedmachine/plan/aim/aim_management_index.vue

@@ -29,8 +29,22 @@ const router = useRouter();
 
 const headinfo = ref({});
 
-onMounted(() => {});
-
+onMounted(() => {
+  setHeadinfo();
+});
+// 用于控制页面离开的变量
+let pendingRouteCallback = null;
+function setHeadinfo() {
+  headinfo.value = {
+    title: "",
+    user: {
+      avatar: "头像路径",
+      nickName: "张三",
+    },
+    backUrl: "/xjc-integratedmachine/plan",
+    backUrlUse: true,
+  };
+}
 function jumpTo(path) {
   router.push({
     path: path,

+ 223 - 46
src/views/xjc-integratedmachine/plan/aim/aim_management_interaction.vue

@@ -95,14 +95,16 @@
           v-for="(option, index) in goalOptions"
           :key="'goal-option-' + index"
           class="goal-btn"
-          :class="{ dragging: isDragging && currentDragItem === option.text }"
+          :class="{
+            dragging: isDragging && currentDragItem === option.content,
+          }"
           draggable="true"
-          @dragstart="onDragStart($event, option.text)"
-          @touchstart="onTouchStart($event, option.text, option)"
+          @dragstart="onDragStart($event, option.content)"
+          @touchstart="onTouchStart($event, option.content, option)"
           @touchmove="onTouchMove($event)"
           @touchend="onTouchEnd($event, option)"
         >
-          {{ option.text }}
+          {{ option.content }}
         </div>
       </div>
 
@@ -211,6 +213,30 @@
           </span>
         </template>
       </el-dialog>
+      <el-dialog
+        v-model="centerDialogVisible4"
+        title=""
+        width="30%"
+        align-center
+        style="padding: 40px; top: 300px; border-radius: 20px"
+        class="custom-dialog"
+        :close-on-click-modal="false"
+        :close-on-press-escape="false"
+        :show-close="false"
+      >
+        <span>答案错误</span>
+        <template #footer>
+          <span class="dialog-footer" style="">
+            <el-button
+              style="margin-right: 0px !important"
+              class="button1"
+              @click="handleKnowExit"
+            >
+              我知道了
+            </el-button>
+          </span>
+        </template>
+      </el-dialog>
     </div>
   </div>
 </template>
@@ -219,17 +245,24 @@
 import headComponent from "@/views/xjc-integratedmachine/components/head_component.vue";
 import drag_component from "@/views/xjc-integratedmachine/components/drag_component.vue";
 import { onMounted, watch, nextTick } from "vue";
-
+import { getAimManagementMaterial } from "@/api/xjc-integratedmachine/plan/aim.js";
 const router = useRouter();
-
 const headinfo = ref({});
 const draggedItem = ref(null);
 const centerDialogVisible = ref(false);
 const centerDialogVisible1 = ref(false);
-const centerDialogVisible2 = ref(true);
+const centerDialogVisible2 = ref(false);
 const centerDialogVisible3 = ref(false);
+const centerDialogVisible4 = ref(false);
 // 移动端拖拽相关状态
 const isDragging = ref(false);
+const handleKnowExit = () => {
+  centerDialogVisible.value = false;
+  centerDialogVisible1.value = false;
+  centerDialogVisible2.value = false;
+  centerDialogVisible3.value = false;
+  centerDialogVisible4.value = false;
+};
 const currentDragItem = ref(null);
 const dragStartPos = ref({ x: 0, y: 0 });
 const currentDropTarget = ref(null);
@@ -256,7 +289,8 @@ function drop(event) {
     item.parentNode.insertBefore(item, target); // 将被拖拽的元素插入到目标元素之前
   }
 }
-
+// 用于控制页面离开的变量
+let pendingRouteCallback = null;
 function setHeadinfo() {
   headinfo.value = {
     title: "目标管理",
@@ -268,10 +302,53 @@ function setHeadinfo() {
     backUrlUse: true,
   };
 }
+// 继续体验按钮处理
+const handleContinue = () => {
+  centerDialogVisible.value = false;
+  if (pendingRouteCallback) {
+    pendingRouteCallback(false); // 阻止离开
+    pendingRouteCallback = null;
+  }
+}; // 确定退出按钮处理
+const handleConfirmExit = () => {
+  centerDialogVisible.value = false;
+  if (pendingRouteCallback) {
+    pendingRouteCallback(true); // 允许离开
+    pendingRouteCallback = null;
+  }
+};
+const totalData = ref([]);
 onMounted(() => {
   setHeadinfo();
+  getAimManagementMaterial({ pageNum: 100 })
+    .then((res) => {
+      console.log(res, 22222);
+      totalData.value = res;
+      goalOptions.value = totalData.value.children;
+    })
+    .catch((err) => {
+      console.log("error", err);
+      //loading.value = false; // 即使出错也要停止加载状态
+    });
+});
+onBeforeRouteLeave((to, from, next) => {
+  // 保存next回调函数
+  pendingRouteCallback = next;
+
+  if (goalOptions.value.length == 15) {
+    // 任务完成,显示完成对话框
+    //centerDialogVisible3.value = true;
+  } else {
+    // 任务未完成,显示确认对话框
+    centerDialogVisible.value = true;
+  }
+
+  // 不直接调用next(),等待用户在对话框中选择
 });
 
+onBeforeUnmount(() => {
+  console.log("组件即将卸载,可以清理定时器/事件监听等");
+});
 function jumpTo(path) {
   router.push({
     path: path,
@@ -286,39 +363,18 @@ const shortTermGoals = ref(["", "", "", ""]);
 const smallGoals = ref(["", "", "", "", "", "", "", ""]);
 
 // 目标选项数据
-const goalOptions = ref([
-  {
-    id: 1,
-    text: "考上国内双一流A类高校",
-    category: "education",
-  },
-  {
-    id: 2,
-    text: "健康生活模式",
-    category: "health",
-  },
-  {
-    id: 3,
-    text: "留学",
-    category: "education",
-  },
-  {
-    id: 4,
-    text: "创业成功",
-    category: "career",
-  },
-  {
-    id: 5,
-    text: "学会一门新技能",
-    category: "personal",
-  },
-  {
-    id: 6,
-    text: "财务自由",
-    category: "financial",
+const goalOptions = ref([]);
+
+watch(
+  smallGoals,
+  (newVal) => {
+    // 判断数组所有项是否都不是空字符串
+    if (newVal.every((item) => item.trim() !== "")) {
+      centerDialogVisible3.value = true; // 满足条件时显示对话框
+    }
   },
-]);
-
+  { deep: true } // 监听数组内部元素变化
+);
 // 桌面端拖拽
 const onDragStart = (event, goalText) => {
   event.dataTransfer.setData("text/plain", goalText);
@@ -378,7 +434,7 @@ const onTouchMove = (event) => {
 };
 
 const onTouchEnd = (event, obj) => {
-  console.log(obj, 22);
+  console.log(obj.isRight, event, 22);
   if (!isDragging.value) return;
 
   event.preventDefault();
@@ -394,7 +450,7 @@ const onTouchEnd = (event, obj) => {
 
   // 如果有有效的放置目标,执行放置逻辑
   if (currentDropTarget.value && currentDragItem.value) {
-    handleDrop(currentDropTarget.value, currentDragItem.value);
+    handleDrop(currentDropTarget.value, currentDragItem.value, obj);
   }
 
   // 重置状态
@@ -402,9 +458,35 @@ const onTouchEnd = (event, obj) => {
   currentDragItem.value = null;
   currentDropTarget.value = null;
 };
-
-const handleDrop = (target, goalText) => {
-  console.log(target, goalText, "mobile drop");
+// 兼容数组 / 单对象 / ref / reactive 的查找
+function findNodeById(tree, id) {
+  // 取出真实根值(兼容 Vue 的 ref/reactive)
+  const root =
+    tree && typeof tree === "object" && "value" in tree ? tree.value : tree;
+  if (!root) return null;
+
+  // 统一成待遍历栈
+  const stack = Array.isArray(root) ? root.slice() : [root];
+  const targetId = String(id);
+
+  while (stack.length) {
+    const node = stack.pop();
+    if (node && String(node.id) === targetId) return node;
+
+    const children = node && Array.isArray(node.children) ? node.children : [];
+    // 压入子节点
+    for (let i = 0; i < children.length; i++) {
+      stack.push(children[i]);
+    }
+  }
+  return null;
+}
+function checkArray(arr) {
+  console.log(arr, 133);
+  // 判断是否有空项(只包含空字符串或全是空格的也算空)
+  return !arr.some((item) => item.trim() === "");
+}
+function steam(target, goalText) {
   switch (target) {
     case "longTerm":
       longTermGoal.value = goalText;
@@ -452,9 +534,103 @@ const handleDrop = (target, goalText) => {
   console.log("中期目标:", midTermGoals.value);
   console.log("短期目标:", shortTermGoals.value);
   console.log("小目标:", smallGoals.value);
+}
+let newArrtotalDeep2 = [];
+let newArrtotalDeep3 = [];
+let newArrtotalDeep4 = [];
+const handleDrop = (target, goalText, obj) => {
+  console.log(target, goalText, obj, "mobile drop");
+  if (!obj.isRight) {
+    centerDialogVisible4.value = true;
+    return;
+  }
+  if (obj.deep == 1) {
+    if (target != "longTerm") {
+      centerDialogVisible2.value = true;
+      return;
+    }
+    let newArr = findNodeById(totalData.value, obj.id);
+    console.log(newArr, 88);
+    goalOptions.value = newArr.children;
+    steam(target, goalText);
+  }
+  if (obj.deep == 2) {
+    //判断是否拖进中期目标
+    if (!(target == "midTerm1" || target == "midTerm2")) {
+      centerDialogVisible2.value = true;
+      return;
+    }
+    console.log(!checkArray(midTermGoals.value), midTermGoals, 777);
+    steam(target, goalText);
+    //判断中期目标是否都已拖拽完毕
+    if (!checkArray(midTermGoals.value)) {
+      let newArr = findNodeById(totalData.value, obj.id);
+      newArrtotalDeep2.push(...newArr.children);
+    } else {
+      let newArr = findNodeById(totalData.value, obj.id);
+      newArrtotalDeep2.push(...newArr.children);
+      console.log(newArrtotalDeep2, 88);
+      goalOptions.value = newArrtotalDeep2;
+    }
+  }
+  if (obj.deep == 3) {
+    //判断是否拖进中期目标
+    if (
+      !(
+        target == "shortTerm1" ||
+        target == "shortTerm2" ||
+        target == "shortTerm3" ||
+        target == "shortTerm4"
+      )
+    ) {
+      centerDialogVisible2.value = true;
+      return;
+    }
+    console.log(!checkArray(shortTermGoals.value), shortTermGoals, 777);
+    steam(target, goalText);
+    //判断短期目标是否都已拖拽完毕
+    if (!checkArray(shortTermGoals.value)) {
+      let newArr = findNodeById(totalData.value, obj.id);
+      newArrtotalDeep3.push(...newArr.children);
+    } else {
+      let newArr = findNodeById(totalData.value, obj.id);
+      newArrtotalDeep3.push(...newArr.children);
+      console.log(newArrtotalDeep3, 88);
+      goalOptions.value = newArrtotalDeep3;
+    }
+  }
+  if (obj.deep == 4) {
+    //判断是否拖进中期目标
+    if (
+      !(
+        target == "small1" ||
+        target == "small2" ||
+        target == "small3" ||
+        target == "small4" ||
+        target == "small5" ||
+        target == "small6" ||
+        target == "small7" ||
+        target == "small8"
+      )
+    ) {
+      centerDialogVisible2.value = true;
+      return;
+    }
+    console.log(!checkArray(smallGoals.value), smallGoals, 777);
+    steam(target, goalText);
+    //判断短期目标是否都已拖拽完毕
+    if (!checkArray(smallGoals.value)) {
+    } else {
+      let newArr = findNodeById(totalData.value, obj.id);
+      console.log(newArr, 88);
+      goalOptions.value = newArr.children;
+    }
+  }
+  console.log(smallGoals, 7776);
 };
 
 const onDrop = (target, event) => {
+  console.log(target, event, 999);
   const goalText = event.dataTransfer.getData("text/plain");
   handleDrop(target, goalText);
 }; // 我知道了按钮处理
@@ -981,12 +1157,13 @@ body {
 .goal-btn {
   flex: 0 0 calc(33.33% - 13.33px); // 每行3个,减去gap平均值
   min-width: 200px; // 保持最小宽度
-  padding: 60px 25px;
+  padding: 10px 25px;
   border: 4px solid #95a5a6;
   border-radius: 40px;
   background: #fff;
   color: #95a5a6;
   font-size: 22px;
+  height: 80px;
   text-align: center;
   cursor: grab;
   box-sizing: border-box;

+ 16 - 2
src/views/xjc-integratedmachine/plan/time/time_management_4d_index.vue

@@ -33,8 +33,22 @@ const router = useRouter();
 
 const headinfo = ref({});
 
-onMounted(() => {});
-
+onMounted(() => {
+  setHeadinfo();
+});
+// 用于控制页面离开的变量
+let pendingRouteCallback = null;
+function setHeadinfo() {
+  headinfo.value = {
+    title: "",
+    user: {
+      avatar: "",
+      nickName: "张三",
+    },
+    backUrl: "/xjc-integratedmachine/plan/time/time_management_menu",
+    backUrlUse: true,
+  };
+}
 function jumpTo(path) {
   router.push({
     path: path,

+ 16 - 2
src/views/xjc-integratedmachine/plan/time/time_management_assessment_index.vue

@@ -33,8 +33,22 @@ const router = useRouter();
 
 const headinfo = ref({});
 
-onMounted(() => {});
-
+onMounted(() => {
+  setHeadinfo();
+});
+// 用于控制页面离开的变量
+let pendingRouteCallback = null;
+function setHeadinfo() {
+  headinfo.value = {
+    title: "",
+    user: {
+      avatar: "",
+      nickName: "张三",
+    },
+    backUrl: "/xjc-integratedmachine/plan/time/time_management_menu",
+    backUrlUse: true,
+  };
+}
 function jumpTo(path) {
   router.push({
     path: path,

+ 14 - 2
src/views/xjc-integratedmachine/plan/time/time_management_menu.vue

@@ -30,8 +30,20 @@ const router = useRouter();
 
 const headinfo = ref({});
 
-onMounted(() => {});
-
+onMounted(() => {
+  setHeadinfo();
+});
+function setHeadinfo() {
+  headinfo.value = {
+    title: "时间管理评测",
+    user: {
+      avatar: "头像路径",
+      nickName: "张三",
+    },
+    backUrl: "/xjc-integratedmachine/plan",
+    backUrlUse: true,
+  };
+}
 function jumpTo(path) {
   router.push({
     path: path,