Explorar el Código

feat: 大屏公告修改

superHD hace 7 meses
padre
commit
c789c61fef
Se han modificado 1 ficheros con 73 adiciones y 13 borrados
  1. 73 13
      cokingCoal/js/humanResources.js

+ 73 - 13
cokingCoal/js/humanResources.js

@@ -89,6 +89,7 @@ let app = new Vue({
       ],
       treeIndex: 0,
       rollFlag: true,
+      currentFlag: null,
       config1: {
         waitTime: 7000,
         header: ["双选单位", "双选岗位", "双选人数", "报名人数", "发布时间"],
@@ -473,7 +474,7 @@ let app = new Vue({
       noteListIndex: 0,
 
       mianBiTime: null,
-      scrollType: true,
+      scrollType: 0,
       scrollType2: true,
     };
   },
@@ -548,7 +549,35 @@ let app = new Vue({
     });
     this.keyDown();
   },
+  directives: {
+    resize: {
+      bind (el, binding) {
+        let width = ''
+        let height = ''
+        function isResize() {
+          const style = document.defaultView.getComputedStyle(el)
+          if (width !== style.width || height !== style.height) {
+            binding.value({ width: style.width, height: style.height }) // 关键(这传入的是函数,所以执行此函数)
+          }
+          width = style.width
+          height = style.height
+        }
+        el.__vueSetInterval__ = setInterval(isResize, 300)
+      },
+      unbind(el) {
+        // console.log(el, '解绑')
+        clearInterval(el.__vueSetInterval__)
+      }
+    }
+  },
   watch: {
+    '$refs.displayNone.innerText': function (newVal, oldVal) {
+      console.log(newVal, oldVal)
+      this.$nextTick(() => {
+        // 在DOM更新后获取高度
+        this.height = this.$refs.content.offsetHeight;
+      });
+    },
     imageIndex() {
       let that = this;
       if (this.imageIndex == this.imageList.length) {
@@ -574,17 +603,29 @@ let app = new Vue({
   mounted() {
     let that = this;
     this.$nextTick(() => {
+      // setInterval(() => {
+      //   const timer = setTimeout(() => {
+      //     clearTimeout(timer)
+      //     console.log(that.$refs.displayNone.offsetHeight, '--')
+      //     if ( that.$refs.displayNone?.offsetHeight + 30 > that.$refs.father?.offsetHeight ) {
+      //       that.scrollType = false;
+      //     } else {
+      //       that.scrollType = true;
+      //     }
+      //   }, 0);
+      // }, that.config1.waitTime)
       // 判断是否轮播
       setTimeout(() => {
+        console.log(that.$refs.father?.offsetHeight, that.$refs.father?.offsetWidth)
+        //  if (
+        //   that.$refs.child?.offsetHeight + 30 >
+        //   that.$refs.father?.offsetHeight
+        // ) {
+        //   that.scrollType = false;
+        // }
         if (
-          that.$refs.child.offsetHeight + 30 >
-          that.$refs.father.offsetHeight
-        ) {
-          that.scrollType = false;
-        }
-        if (
-          that.$refs.child2.offsetHeight + 30 >
-          that.$refs.father2.offsetHeight
+          that.$refs.child2?.offsetHeight + 30 >
+          that.$refs.father2?.offsetHeight
         ) {
           that.scrollType2 = false;
         }
@@ -680,6 +721,11 @@ let app = new Vue({
     }, 5000);
   },
   methods: {
+    handleResize (data) {
+      console.log('handleResize', Number(data.height.slice(0, -2)) + 30)
+      const fatherHeight = this.$refs.father?.offsetHeight
+      this.scrollType = fatherHeight > Number(data.height.slice(0, -2)) + 30 ? 1 : 2
+    },
     handleClickIcon(item, index) {
       let that = this;
       if (index == 1) {
@@ -1024,7 +1070,8 @@ let app = new Vue({
         loopSeries: true,
       });
     },
-    scrollChange(index) {
+    scrollChange (index) {
+      this.scrollType = 1
       let that = this;
       (this.itemClass = "item_content_6"), (this.rollFlag = false);
 
@@ -2606,7 +2653,8 @@ let app = new Vue({
           if (res) {
             if (res.data.length != 0) {
               res.data.forEach((item, index) => {
-                list.push([item[0], item[1], item[2], item[3], item[4]]);
+                // list.push([item[0], item[1], item[2], item[3], item[4]]);
+                list.push(item)
                 a[index] = [];
                 let arr = item[5].split("&");
                 if (arr[0].length == 2) {
@@ -2690,7 +2738,7 @@ let app = new Vue({
     handleBR(item) {
       return item;
     },
-    funChangeList(idnex) {
+    funChangeList (idnex) {
       this.rollFlag = false
       let listIndex = idnex;
       // this.address = this.config1.data[listIndex][0] + "。"
@@ -3358,7 +3406,7 @@ let app = new Vue({
         "/ierp/kapi/v2/mdnb/mdnb_control/PositionAll",
         data
       ).then((res) => {
-        if (res.data) {
+        if (res?.data) {
           res.data.sort((a, b) => b[1] - a[1]);
         }
         setTimeout(() => {
@@ -3531,4 +3579,16 @@ let app = new Vue({
       }
     },
   },
+  computed: {
+    config3 () {
+      const data = this.config1.data.map(el => {
+        return el.slice(0, 5)
+      })
+      return {
+        ...this.config1,
+        data
+      }
+    }
+  },
+  
 });