Browse Source

1、公出修改增加开始时间和结束时间限制;2、小程序更新设置为强制更新

dev01 22 hours ago
parent
commit
24f255f2ca
2 changed files with 22 additions and 9 deletions
  1. 1 0
      src/app.jsx
  2. 21 9
      src/pages/egressDetails/publicContent.jsx

+ 1 - 0
src/app.jsx

@@ -29,6 +29,7 @@ class App extends Component {
       Taro.showModal({
         title: '更新提示',
         content: '新版本已经准备好,是否重启应用?',
+        showCancel: false,
         success(res) {
           if (res.confirm) {
             // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启

+ 21 - 9
src/pages/egressDetails/publicContent.jsx

@@ -741,19 +741,31 @@ class PublicContent extends Component {
               isPartition
               pickerShow={this.state.isPickerRender}
               onconditionaljudgment={(v) => {
-                let a = dayjs(
-                  dayjs(v.detail.endTime)
-                    .second(0)
-                    .format("YYYY-MM-DD HH:mm:ss")
-                );
-                let b = dayjs(dayjs().second(0).format("YYYY-MM-DD HH:mm:ss"));
-                if (a.isBefore(b)) {
+                const { startTime, endTime, setLv } = v.detail
+                let startTimeD =  dayjs(dayjs(startTime).second(0).format("YYYY-MM-DD HH:mm:ss"))
+                let endTimeD = dayjs(dayjs(endTime).second(0).format("YYYY-MM-DD HH:mm:ss"))
+                let currTimeD = dayjs(dayjs().second(0).format("YYYY-MM-DD HH:mm:ss"))
+
+                console.log(dayjs(startTime).format("YYYY-MM-DD HH:mm:ss"))
+                if (dayjs(startTime).format("YYYY-MM-DD HH:mm:ss") != this.state.rangeStartMinuteVal) {
+                  // 如果修改了开始时间,则需要判断开始时间不能小于当前时间
+                  if (startTimeD.isBefore(currTimeD)) {
+                    Taro.showToast({
+                      title: "开始时间不能小于当前时间",
+                      icon: "none",
+                    });
+                    setLv(false);
+                  } 
+                }
+
+                if (endTimeD.isBefore(startTimeD)) {
                   Taro.showToast({
-                    title: "结束时间不能小于当前时间",
+                    title: "结束时间不能小于开始时间",
                     icon: "none",
                   });
-                  v.detail.setLv(false);
+                  setLv(false);
                 }
+
               }}
               onhidepicker={() => {
                 this.onPickerHide();