Ver código fonte

海报增加时间判断

谢杰标 3 anos atrás
pai
commit
2e5a6ab17d
1 arquivos alterados com 21 adições e 0 exclusões
  1. 21 0
      pages/bill/index.vue

+ 21 - 0
pages/bill/index.vue

@@ -71,6 +71,27 @@ export default {
   methods: {
   methods: {
     getSharePoster() {
     getSharePoster() {
       getSharePoster(this.options).then((res) => {
       getSharePoster(this.options).then((res) => {
+        let nowTime = Date.parse(new Date()) / 1000;
+        if (
+          res.status != 1 ||
+          nowTime < res.startTime ||
+          nowTime > res.endTime
+        ) {
+          uni.showModal({
+            title: "提示",
+            content:
+              res.status != 1
+                ? "活动已关闭"
+                : nowTime < res.startTime
+                ? "未到活动开启时间"
+                : "活动已过期",
+            showCancel: false,
+            success: (resst) => {
+              // uni.navigateBack();
+            },
+          });
+          return;
+        }
         this.billDetail = res;
         this.billDetail = res;
         let posterConfig = JSON.parse(res.posterConfig);
         let posterConfig = JSON.parse(res.posterConfig);
         this.posterConfig = this.changeData(posterConfig);
         this.posterConfig = this.changeData(posterConfig);