Funny 2 tahun lalu
induk
melakukan
a5e23f433e

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "liebao-web",
-  "version": "0.2.0",
+  "version": "2.0.1",
   "private": true,
   "author": "优巨引擎",
   "description": "有运力的地方,就有猎豹AI。",

+ 2 - 2
src/App.vue

@@ -78,13 +78,13 @@ export default {
     window.addEventListener("contextmenu", this.rightClick, false);
     // 进来准备关闭新订单提醒声音了
     bus.$on("closeGetSoundMsg", () => {
-      console.log("进来准备关闭新订单提醒声音了");
+      // console.log("进来准备关闭新订单提醒声音了");
       clearInterval(this.timer);
       this.timer = null;
     });
     // 进来准备开启新订单提醒声音了
     bus.$on("openGetSoundMsg", () => {
-      console.log("进来准备开启新订单提醒声音了");
+      // console.log("进来准备开启新订单提醒声音了");
       this.timer = setInterval(() => {
         this.getSoundMsg();
       }, 5000);

+ 5 - 0
src/api/setting.js

@@ -72,4 +72,9 @@ export const saveFeedback = (params) => {
 // 反馈列表 app/feedback/list
 export const getFeedbackList = (params) => {
   return get('app/feedback/list', params)
+}
+
+// 获取当前最新版本
+export const getVersion = (params) => {
+  return get('app/common/version', params)
 }

+ 18 - 1
src/components/Home.vue

@@ -53,7 +53,9 @@ import bus from "../common/bus.js";
 import sendOrderPopup from "./orderComponents/sendOrderPopup.vue";
 import OrderList from "./orderComponents/orderList.vue";
 import { getOrderList, getOrderMarker, getRefreshOrder } from "../api/order.js";
-import { getShopList } from "../api/shop";
+import { getShopList } from "../api/shop.js";
+import { getVersion } from "../api/setting.js";
+import config from "../../package.json";
 export default {
   name: "HomeIndex",
   data() {
@@ -118,6 +120,7 @@ export default {
       markerNum: "",
       clickBool: false,
       timer: null,
+      timer1: null,
       timer2: null,
       shopList: [],
     };
@@ -154,17 +157,31 @@ export default {
         this.getRefreshOrder();
       }
     }, 5000);
+    this.timer1 = setInterval(() => {
+      this.checkUpdate();
+    }, 10000);
   },
   mounted() {},
   beforeDestroy() {
     clearInterval(this.timer);
     this.timer = null;
+    clearInterval(this.timer1);
+    this.timer1 = null;
   },
   destroyed() {
     bus.$off("pullData");
     bus.$off("refreshData");
   },
   methods: {
+    checkUpdate() {
+      getVersion({ type: 3 }).then((res) => {
+        if (!res.data) return;
+        let version = res.data.name;
+        if (version !== config.version) {
+          window.location.reload();
+        }
+      });
+    },
     changeShopIds() {
       this.params.searchShopIdStr = String(this.searchShopIdStr);
       localStorage.setItem("searchShopIdStr", this.params.searchShopIdStr);

+ 118 - 43
src/components/settingComponents/print/greetingCardPrinter.vue

@@ -44,10 +44,10 @@
           </div>
           <div class="card-setting">
             <div class="card-left" :style="`max-height: ${params.cardHeight}mm;max-width: ${params.cardWidth}mm;`">
-              <i v-if="params.paddingTop > 0&&params.paddingLeft > 0" class="el-icon-arrow-down icon1" :style="`top:${params.paddingTop}mm;left:${params.paddingLeft}mm;`"></i>
-              <i v-if="params.paddingTop > 0&&params.paddingRight > 0" class="el-icon-arrow-down icon2" :style="`top:${params.paddingTop}mm;right:${params.paddingRight}mm;`"></i>
-              <i v-if="params.paddingBottom > 0&&params.paddingLeft > 0" class="el-icon-arrow-down icon3" :style="`bottom:${params.paddingBottom}mm;left:${params.paddingLeft}mm;`"></i>
-              <i v-if="params.paddingBottom > 0&&params.paddingRight > 0" class="el-icon-arrow-down icon4" :style="`bottom:${params.paddingBottom}mm;right:${params.paddingRight}mm;`"></i>
+              <i v-if="showArrow(1)" class="el-icon-arrow-down icon1" :style="`top:${directionPadding('top')}mm;left:${directionPadding('left')}mm;`"></i>
+              <i v-if="showArrow(2)" class="el-icon-arrow-down icon2" :style="`top:${directionPadding('top')}mm;right:${directionPadding('right')}mm;`"></i>
+              <i v-if="showArrow(3)" class="el-icon-arrow-down icon3" :style="`bottom:${directionPadding('bottom')}mm;left:${directionPadding('left')}mm;`"></i>
+              <i v-if="showArrow(4)" class="el-icon-arrow-down icon4" :style="`bottom:${directionPadding('bottom')}mm;right:${directionPadding('right')}mm;`"></i>
               <div v-html="cardHtml"></div>
             </div>
             <div class="card-right">
@@ -286,10 +286,10 @@ export default {
           name: "左中",
           value: 2,
         },
-        {
-          name: "左下",
-          value: 3,
-        },
+        // {
+        //   name: "左下",
+        //   value: 3,
+        // },
         {
           name: "中上",
           value: 4,
@@ -298,10 +298,10 @@ export default {
           name: "中",
           value: 5,
         },
-        {
-          name: "中下",
-          value: 6,
-        },
+        // {
+        //   name: "中下",
+        //   value: 6,
+        // },
         {
           name: "右上",
           value: 7,
@@ -310,10 +310,10 @@ export default {
           name: "右中",
           value: 8,
         },
-        {
-          name: "右下",
-          value: 9,
-        },
+        // {
+        //   name: "右下",
+        //   value: 9,
+        // },
       ],
       dialogVisible: false,
     };
@@ -344,10 +344,10 @@ export default {
                   ${this.contentStyle(this.params.direction)[0]}
                 }
                 .card-con {
-                  margin-top: ${this.params.paddingTop}mm;
-                  margin-right: ${this.params.paddingRight}mm;
-                  margin-bottom: ${this.params.paddingBottom}mm;
-                  margin-left: ${this.params.paddingLeft}mm;
+                  margin-top: ${this.directionPadding("top")}mm;
+                  margin-right: ${this.directionPadding("right")}mm;
+                  margin-bottom: ${this.directionPadding("bottom")}mm;
+                  margin-left: ${this.directionPadding("left")}mm;
                   font-size:35px;
                   font-family: ${this.params.fontFamily};
                   ${this.contentStyle(this.params.direction)[1]}
@@ -377,8 +377,106 @@ export default {
       deep: true,
     },
   },
+  // 生命周期 - 创建完成(可以访问当前this实例)
+  created() {
+    this.getNewShopList();
+    this.getCloudPrinterList();
+    this.getCloudConfigList();
+    this.getConfig();
+  },
+  // 生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {},
+  // 生命周期 - 创建之前
+  beforeCreate() {},
+  // 生命周期 - 挂载之前
+  beforeMount() {},
+  // 生命周期 - 更新之前
+  beforeUpdate() {},
+  // 生命周期 - 更新之后
+  updated() {},
+  // 生命周期 - 销毁之前
+  beforeDestroy() {},
+  // 生命周期 - 销毁完成
+  destroyed() {},
+  // 如果页面有keep-alive缓存功能,这个函数会触发
+  activated() {},
   // 方法集合
   methods: {
+    directionPadding(flag) {
+      let num = 0;
+      switch (flag) {
+        case "top":
+          num =
+            this.params.direction === 1
+              ? this.params.paddingTop
+              : this.params.paddingLeft;
+          break;
+        case "right":
+          num =
+            this.params.direction === 1
+              ? this.params.paddingRight
+              : this.params.paddingTop;
+          break;
+        case "bottom":
+          num =
+            this.params.direction === 1
+              ? this.params.paddingBottom
+              : this.params.paddingRight;
+          break;
+        case "left":
+          num =
+            this.params.direction === 1
+              ? this.params.paddingLeft
+              : this.params.paddingBottom;
+          break;
+        default:
+          break;
+      }
+      return num;
+    },
+    showArrow(flag) {
+      let isShow = false;
+      if (this.params.direction === 1) {
+        switch (flag) {
+          case 1:
+            isShow = this.params.paddingTop > 0 && this.params.paddingLeft > 0;
+            break;
+          case 2:
+            isShow = this.params.paddingTop > 0 && this.params.paddingRight > 0;
+            break;
+          case 3:
+            isShow =
+              this.params.paddingBottom > 0 && this.params.paddingLeft > 0;
+            break;
+          case 4:
+            isShow =
+              this.params.paddingBottom > 0 && this.params.paddingRight > 0;
+            break;
+          default:
+            break;
+        }
+      } else {
+        switch (flag) {
+          case 1:
+            isShow =
+              this.params.paddingLeft > 0 && this.params.paddingBottom > 0;
+            break;
+          case 2:
+            isShow = this.params.paddingLeft > 0 && this.params.paddingTop > 0;
+            break;
+          case 3:
+            isShow =
+              this.params.paddingRight > 0 && this.params.paddingBottom > 0;
+            break;
+          case 4:
+            isShow = this.params.paddingRight > 0 && this.params.paddingTop > 0;
+            break;
+          default:
+            break;
+        }
+      }
+      return isShow;
+    },
     ...mapMutations(["SET_USERINFO"]),
     checkCardWidth(e) {
       if (e < 195) {
@@ -763,29 +861,6 @@ export default {
       });
     },
   },
-  // 生命周期 - 创建完成(可以访问当前this实例)
-  created() {
-    this.getNewShopList();
-    this.getCloudPrinterList();
-    this.getCloudConfigList();
-    this.getConfig();
-  },
-  // 生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {},
-  // 生命周期 - 创建之前
-  beforeCreate() {},
-  // 生命周期 - 挂载之前
-  beforeMount() {},
-  // 生命周期 - 更新之前
-  beforeUpdate() {},
-  // 生命周期 - 更新之后
-  updated() {},
-  // 生命周期 - 销毁之前
-  beforeDestroy() {},
-  // 生命周期 - 销毁完成
-  destroyed() {},
-  // 如果页面有keep-alive缓存功能,这个函数会触发
-  activated() {},
 };
 </script>