linwenxin 1 yıl önce
ebeveyn
işleme
60e019f8a8
3 değiştirilmiş dosya ile 114 ekleme ve 58 silme
  1. BIN
      src/assets/head8.png
  2. 52 58
      src/components/head.vue
  3. 62 0
      src/utils/util.js

BIN
src/assets/head8.png


+ 52 - 58
src/components/head.vue

@@ -1,21 +1,20 @@
 <template>
   <div class="headview">
-    <div class="asleft">
-      <dv-scroll-board
-        ref="scrollBoard"
-        :config="config"
-        style="width: 100%; height: 100%"
-      />
+    <div class="dierjibie">
+      <img :src="[img0, img1, img2][swindex]" alt="" srcset="" />
+      <div class="asleft">
+      </div>
+      <div class="aszhongjian">
+        {{userInfo.companyWechatId ? userInfo.companyName : "售修宝运营平台"}}
+      </div>
+      <div class="asright">{{ timeStr }}</div>
     </div>
-    <img :src="[img0, img1, img2][swindex]" alt="" srcset="" />
-    <div class="asright">{{ timeStr }}</div>
   </div>
 </template>
 
 <script>
-import { dateFormat } from '@/utils/tool.js';
-import { tq } from '@/api/bigView.js';
-import img0 from '@/assets/head0.png';
+import { dateFormat2 } from '@/utils/util.js';
+import img0 from '@/assets/head8.png';
 import img1 from '@/assets/head1.png';
 import img2 from '@/assets/head2.png';
 export default {
@@ -33,55 +32,26 @@ export default {
       timeStr: '',
       timeId: null,
       info: {},
-      config: {
-        rowNum: 1,
-        carousel: 'page',
-        data: [],
-        waitTime: 3000,
-      },
     };
   },
+  computed: {
+    // 用户信息
+    userInfo() {
+      return JSON.parse(localStorage.getItem('greemall_user'))
+    },
+  },
   mounted() {
-    this.gettq();
-    this.timeId2 = setInterval(this.gettq, 60000 * 60 * 8);
-    this.timeId = setInterval(() => {
-      let date = new Date();
-      this.timeStr = dateFormat('YYYY-mm-dd HH:MM:SS WWW', date);
-    }, 1000);
+    this.jishikaishi()
   },
   beforeUnmount() {
     this.timeId && clearInterval(this.timeId);
-    this.timeId2 && clearInterval(this.timeId2);
   },
   methods: {
-    gettq() {
-      Promise.all([
-        tq('广州市'),
-        tq('清远市'),
-        tq('韶关市'),
-        tq('佛山市'),
-        tq('肇庆市'),
-        tq('云浮市'),
-      ])
-        .then((reslist) => {
-          var atrlist = reslist.map((item2) => {
-            var item = item2.data;
-            return [
-              `<div class="jajajaj">${
-                item.result.city
-                  ? `${item.result.city} :${item.result.weather || ''} ${
-                      item.result.templow || ''
-                    }℃ ~${item.result.temphigh || ''}℃`
-                  : ''
-              }</div>`,
-            ];
-          });
-          this.$refs['scrollBoard'].updateRows(atrlist);
-        })
-        .catch((err) => {
-          console.log(err);
-        });
-    },
+    jishikaishi(){
+      let date = new Date();
+      this.timeStr = dateFormat2('YYYY-mm-dd HH:MM:SS WWW', date);
+      this.timeId = setTimeout(this.jishikaishi,1000);
+    }
   },
 };
 </script>
@@ -109,19 +79,43 @@ export default {
   height: 100%;
   position: relative;
   overflow: hidden;
+  .dierjibie{
+    width: 100%;
+    min-width: 1600px;
+    height: 100%;
+    position: absolute;
+    top: 0;
+    left: 50%;
+    transform: translateX(-50%);
+  }
   img {
     position: absolute;
     bottom: 0;
-    width: 1920;
+    width: 100%;
+    min-width: 1600px;
     height: 58px;
   }
+  .aszhongjian {
+    font-family: Source Han Sans CN;
+    font-weight: 500;
+    font-size: 36px;
+    color: #FFFFFF;
+    line-height: 35px;
+    background: linear-gradient(0deg, #FFFFFF 0%, #B0D7FF 100%);
+    -webkit-background-clip: text;
+    -webkit-text-fill-color: transparent;
+    position: absolute;
+    bottom: 12px;
+    left: 50%;
+    transform: translateX(-50%);
+    text-align: center;
+  }
   .asleft {
-    width: 500px;
     height: 24px;
     overflow: hidden;
     position: absolute;
-    bottom: 10px;
-    left: 67px;
+    bottom: 12px;
+    left: 160px;
   }
   .asright {
     font-size: 20px;
@@ -130,8 +124,8 @@ export default {
     text-align: left;
     color: #34c7ff;
     position: absolute;
-    bottom: 10px;
-    right: 67px;
+    bottom: 12px;
+    right: 160px;
   }
 }
 </style>

+ 62 - 0
src/utils/util.js

@@ -2,6 +2,68 @@ import axios from 'axios'
 import FileSaver from 'file-saver'
 import { getToken } from '@/utils/auth'
 
+export function dateFormat2(format, date) {
+  if (typeof date === 'string') {
+    date = new Date(date);
+  }
+  const we = date.getDay(); // 星期
+  const qut = Math.floor((date.getMonth() + 3) / 3).toString(); // 季度
+  const opt = {
+    'Y+': date.getFullYear().toString(), // 年
+    'm+': (date.getMonth() + 1).toString(), // 月(月份从0开始,要+1)
+    'd+': date.getDate().toString(), // 日
+    'H+': date.getHours().toString(), // 时
+    'M+': date.getMinutes().toString(), // 分
+    'S+': date.getSeconds().toString(), // 秒
+    'q+': qut, // 季度
+  };
+  const week = {
+    // 中文数字 (星期)
+    0: '日',
+    1: '一',
+    2: '二',
+    3: '三',
+    4: '四',
+    5: '五',
+    6: '六',
+  };
+  const quarter = {
+    // 中文数字(季度)
+    1: '一',
+    2: '二',
+    3: '三',
+    4: '四',
+  };
+  if (/(W+)/.test(format)) {
+    format = format.replace(
+      RegExp.$1,
+      RegExp.$1.length > 1
+        ? RegExp.$1.length > 2
+          ? '星期' + week[we]
+          : '周' + week[we]
+        : week[we]
+    );
+  }
+  if (/(Q+)/.test(format)) {
+    // 输入一个Q,只输出一个中文数字,输入4个Q,则拼接上字符串
+    format = format.replace(
+      RegExp.$1,
+      RegExp.$1.length === 4 ? '第' + quarter[qut] + '季度' : quarter[qut]
+    );
+  }
+  for (const k in opt) {
+    const r = new RegExp('(' + k + ')').exec(format);
+    if (r) {
+      // 若输入的长度不为1,则前面补零
+      format = format.replace(
+        r[1],
+        RegExp.$1.length === 1 ? opt[k] : opt[k].padStart(RegExp.$1.length, '0')
+      );
+    }
+  }
+  return format;
+}
+
 // 定义一个函数将树形数据转换为列表
 export function treeToList(tree, key = "children", list = []) {
   // 将当前节点添加到列表中