Browse Source

✨ feat(merchant):完成认证表单校验

liude 1 year ago
parent
commit
b7bc1afe2f

+ 1 - 1
src/pages/merchant/mine/index.vue

@@ -139,7 +139,7 @@
 
     onLoad() {
       // this.getHeight();
-      this.showAut = false;
+      this.showAut = true;
     },
 
     methods: {

+ 55 - 32
src/pages/merchant/mine/openStore/corporateInformation.vue

@@ -20,33 +20,35 @@
               <u--input placeholder="请选择性别" border="surround" v-model="legalInfo.sexName" />
             </view>
           </u-form-item>
+          <view class="icon-right-box">
+            <u-icon name="arrow-right" color="#c5c5c5" size="20"></u-icon>
+          </view>
         </view>
 
+
         <view class="content-item">
-          <u-form-item prop="idNumber" required label="证件号" right>
+          <u-form-item prop="documentType" required label="证件类型" right>
             <view class="item-r">
               <u--input
-                placeholder="请输入证件号"
+                placeholder="居民身份证"
                 border="surround"
-                v-model="legalInfo.idNumber"
+                v-model="legalInfo.documentType"
+                disabled
               ></u--input>
             </view>
           </u-form-item>
         </view>
-
         <view class="content-item">
-          <u-form-item prop="documentType" required label="证件类型" right>
+          <u-form-item prop="idNumber" required label="证件号" right>
             <view class="item-r">
               <u--input
-                placeholder="居民身份证"
+                placeholder="请输入证件号"
                 border="surround"
-                v-model="legalInfo.documentType"
-                disabled
+                v-model="legalInfo.idNumber"
               ></u--input>
             </view>
           </u-form-item>
         </view>
-
         <view class="content-item">
           <u-form-item prop="validity" required label="有效期" right @click="showPicker = true">
             <view class="item-r">
@@ -57,6 +59,9 @@
               ></u--input>
             </view>
           </u-form-item>
+          <view class="icon-right-box">
+            <u-icon name="arrow-right" color="#c5c5c5" size="20"></u-icon>
+          </view>
         </view>
       </view>
 
@@ -92,7 +97,7 @@
     <u-datetime-picker
       :show="showPicker"
       v-model="valueDate"
-      mode="datetime"
+      mode="date"
       @cancel="showPicker = false"
       @confirm="handleConfirm"
     ></u-datetime-picker>
@@ -101,6 +106,8 @@
 
 <script>
 import ImgsUpload from '@/pages/merchant/mine/openStore/components/ImgsUpload.vue';
+import { formatTime } from '@/utils/date';
+
 export default {
   components: {
     ImgsUpload,
@@ -146,41 +153,51 @@ export default {
           message: '请选择性别',
           trigger: ['blur', 'change'],
         },
-        idNumber: {
-          type: 'string',
-          required: true,
-          message: '请输入证件号',
-          trigger: ['blur', 'change'],
-        },
+        idNumber: [
+          {
+            required: true,
+            message: '请输入证件号',
+            trigger: ['blur', 'change'],
+          },
+          {
+            validator: (rule, value, callback) => {
+              return uni.$u.test.idCard(value);
+            },
+            message: '您输入的证件号不正确',
+            trigger: ['change', 'blur'],
+          },
+        ],
         validity: {
           type: 'string',
           required: true,
           message: '请输入证件有效期',
-          trigger: ['blur', 'change'],
+          trigger: ['change'],
         },
       },
     };
   },
+  onReady() {
+    //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
+    this.$refs.uForm.setRules(this.rules);
+  },
   methods: {
     // 跳转到4/4资质信息
     handlerSkipNext() {
-      this.$store.commit("SET_LEGALINFO", this.legalInfo)
-      setTimeout(() => {
-        uni.navigateTo({
-          url: '/pages/merchant/mine/openStore/qualificationInformation',
-        });
-      }, 1500);
-      console.log(this.legalInfo);
-    },
-    change(e) {
-      console.log('e:', e);
+      this.$refs.uForm.validate().then(res => {
+        this.$store.commit('SET_LEGALINFO', this.legalInfo);
+        setTimeout(() => {
+          uni.navigateTo({
+            url: '/pages/merchant/mine/openStore/qualificationInformation',
+          });
+        }, 1500);
+      });
     },
     sexSelect(e) {
-      // this.model1.userInfo.sex = e.name
-      // this.$refs.uForm.validateField('userInfo.sex')
+      this.legalInfo.sexName = e.name
+      this.$refs.uForm.validateField('userInfo.sex')
     },
-    handleConfirm(value) {
-      console.log(value);
+    handleConfirm(data) {
+      this.legalInfo.validity = formatTime(data.value, 'YYYY-MM-DD');
       this.showPicker = false;
     },
   },
@@ -206,10 +223,10 @@ export default {
     margin: 10rpx 0;
 
     .content-item {
+      position: relative;
       .item-r {
         background-color: #f7f7f7;
         border-radius: 20rpx;
-
         .data_select {
           width: 90%;
         }
@@ -222,6 +239,12 @@ export default {
           padding: 0;
         }
       }
+
+      .icon-right-box {
+        position: absolute;
+        right: 15rpx;
+        top: 40rpx;
+      }
     }
 
     .upload-text {

+ 53 - 29
src/pages/merchant/mine/openStore/qualificationInformation.vue

@@ -1,7 +1,6 @@
 <template>
   <view class="container">
-    <!-- <u-form :model="form" ref="uForm" labelPosition="left" labelWidth="80" :rules="rules"> -->
-    <u-form :model="aptitudeInfo" ref="uForm" labelPosition="left" labelWidth="80">
+    <u-form :model="aptitudeInfo" ref="uForm" labelPosition="left" labelWidth="80" :rules="rules">
       <!-- =====================证件类型===================== -->
       <view class="content-box">
         <view class="content-item">
@@ -28,7 +27,7 @@
             required
             label="有效期"
             right
-            @click="showPicker = true"
+            @click="handelShowPicker(1)"
           >
             <view class="item-r">
               <u--input
@@ -38,6 +37,10 @@
               />
             </view>
           </u-form-item>
+
+          <view class="icon-right-box">
+            <u-icon name="arrow-right" color="#c5c5c5" size="20"></u-icon>
+          </view>
         </view>
 
         <view class="content-item">
@@ -72,7 +75,7 @@
             required
             label="有效期"
             right
-            @click="showPicker = true"
+            @click="handelShowPicker(2)"
           >
             <view class="item-r">
               <u--input
@@ -82,6 +85,10 @@
               />
             </view>
           </u-form-item>
+
+          <view class="icon-right-box">
+            <u-icon name="arrow-right" color="#c5c5c5" size="20"></u-icon>
+          </view>
         </view>
 
         <view class="content-item">
@@ -92,13 +99,14 @@
         </view>
       </view>
     </u-form>
+
     <button class="btn" @click="handlerSkipNext">提交审核</button>
 
     <!-- 时间 -->
     <u-datetime-picker
       :show="showPicker"
       v-model="valueDate"
-      mode="datetime"
+      mode="date"
       @cancel="showPicker = false"
       @confirm="handleConfirm"
     ></u-datetime-picker>
@@ -108,12 +116,13 @@
 <script>
 import ImgsUpload from '@/pages/merchant/mine/openStore/components/ImgsUpload.vue';
 import { addMerchantAuth } from '@/api/merchant/merchantAuth';
-import { mapGetters } from 'vuex';
+import { formatTime } from '@/utils/date';
 
 export default {
   data() {
     return {
       filelist: [],
+      type: 1, // 1表示营业执照  2表示经营许可
       aptitudeInfo: {
         businessLicenseId: '',
         businessLicenseDate: '',
@@ -135,7 +144,7 @@ export default {
           type: 'string',
           required: true,
           message: '请输入证件有效期',
-          trigger: ['blur', 'change'],
+          trigger: ['change'],
         },
         businessLicenseNumberValid: {
           type: 'string',
@@ -147,41 +156,49 @@ export default {
           type: 'string',
           required: true,
           message: '请输入证件有效期',
-          trigger: ['blur', 'change'],
+          trigger: ['change'],
         },
       },
     };
   },
   components: { ImgsUpload },
-  computed: {
-    ...mapGetters(['storeInfo']),
+  onReady() {
+    //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
+    this.$refs.uForm.setRules(this.rules);
   },
   methods: {
+    handelShowPicker(data) {
+      this.type = data;
+      this.showPicker = true;
+    },
     // 跳转到提交成功页面
     handlerSkipNext() {
-      console.log(this, "EEE");
-      /* 发起认证 */
-      addMerchantAuth().then(res => {
-        console.log(res);
-
-        /* 将数据存储 */
-        this.$store.commit('SET_APTITUDEINFO', this.aptitudeInfo);
-
-        /* 路由跳转 */
-        setTimeout(() => {
-          uni.navigateTo({
-            url: '/pages/merchant/mine/openStore/messageSubmit',
-          });
-        }, 2000);
+      this.$refs.uForm.validate().then(res => {
+        /* 发起认证 */
+        addMerchantAuth().then(res => {
+          console.log(res);
+
+          /* 将数据存储 */
+          this.$store.commit('SET_APTITUDEINFO', this.aptitudeInfo);
+
+          /* 路由跳转 */
+          setTimeout(() => {
+            uni.navigateTo({
+              url: '/pages/merchant/mine/openStore/messageSubmit',
+            });
+          }, 2000);
+        });
       });
 
       console.log(this.aptitudeInfo);
     },
-    change(e) {
-      console.log('e:', e);
-    },
-    handleConfirm(value) {
-      console.log(value);
+
+    handleConfirm(data) {
+      if (this.type === 1) {
+        this.aptitudeInfo.businessLicenseDate = formatTime(data.value, 'YYYY-MM-DD');
+      } else if (this.type === 2) {
+        this.aptitudeInfo.businessLicenseExpirationDateValid = formatTime(data.value, 'YYYY-MM-DD');
+      }
       this.showPicker = false;
     },
   },
@@ -207,6 +224,7 @@ export default {
     margin: 10rpx 0;
 
     .content-item {
+      position: relative;
       .item-r {
         background-color: #f7f7f7;
         border-radius: 20rpx;
@@ -223,6 +241,12 @@ export default {
           padding: 0;
         }
       }
+
+      .icon-right-box {
+        position: absolute;
+        right: 15rpx;
+        top: 40rpx;
+      }
     }
 
     .upload-text {

+ 215 - 208
src/pages/merchant/mine/openStore/storeInformation.vue

@@ -9,22 +9,22 @@
         <view class="content-item">
           <u-form-item prop="name" required label="姓名" right>
             <view class="item-r">
-              <u--input
-                placeholder="请输入负责人名称"
-                border="surround"
-                v-model="storeInfo.name"
-              ></u--input>
+              <u--input placeholder="请输入负责人名称" border="surround" v-model="storeInfo.name"></u--input>
             </view>
           </u-form-item>
         </view>
         <view class="content-item">
           <u-form-item prop="mobileNumber" required label="手机号码" right>
             <view class="item-r">
-              <u--input
-                placeholder="请输入手机号码"
-                border="surround"
-                v-model="storeInfo.mobileNumber"
-              ></u--input>
+              <u--input placeholder="请输入手机号码" border="surround" v-model="storeInfo.mobileNumber"></u--input>
+            </view>
+          </u-form-item>
+        </view>
+
+        <view class="content-item">
+          <u-form-item prop="email" required label="电子邮箱" right>
+            <view class="item-r">
+              <u--input placeholder="请输入您的邮箱" border="surround" v-model="storeInfo.email"></u--input>
             </view>
           </u-form-item>
         </view>
@@ -33,34 +33,25 @@
         <view class="content-item">
           <u-form-item prop="storeName" required label="店铺名称" right>
             <view class="item-r">
-              <u--input
-                placeholder="请输入店铺名称"
-                border="surround"
-                v-model="storeInfo.storeName"
-              ></u--input>
+              <u--input placeholder="请输入店铺名称" border="surround" v-model="storeInfo.storeName"></u--input>
             </view>
           </u-form-item>
         </view>
         <view class="content-item">
           <u-form-item prop="area" required label="所在地区" right>
             <view class="item-r">
-              <u--input
-                placeholder="请选择所在地区"
-                border="surround"
-                v-model="storeInfo.area"
-                @focus="handlerChange"
-              ></u--input>
+              <u--input placeholder="请选择所在地区" border="surround" v-model="storeInfo.area"
+                @focus="handlerChange"></u--input>
+            </view>
+            <view class="icon-right-box">
+              <u-icon name="arrow-right" color="#c5c5c5" size="20"></u-icon>
             </view>
           </u-form-item>
         </view>
         <view class="content-item">
           <u-form-item prop="storeAddress" required label="详细地址" right>
             <view class="item-r">
-              <u--input
-                placeholder="请输入门店详细地址"
-                border="surround"
-                v-model="storeInfo.storeAddress"
-              ></u--input>
+              <u--input placeholder="请输入门店详细地址" border="surround" v-model="storeInfo.storeAddress"></u--input>
             </view>
           </u-form-item>
         </view>
@@ -83,221 +74,237 @@
     <button class="btn" @click="handlerSkipNext">下一步</button>
 
     <!-- 地区 -->
-    <u-picker
-      :show="show"
-      ref="uPicker"
-      :columns="cityList"
-      @confirm="confirm"
-      @change="changeHandler"
-      @cancel="show = false"
-    ></u-picker>
+    <u-picker :show="show" ref="uPicker" :columns="cityList" @confirm="confirm" @change="changeHandler"
+      @cancel="show = false"></u-picker>
   </view>
 </template>
 
 <script>
-import ImgsUpload from '@/pages/merchant/mine/openStore/components/ImgsUpload.vue';
-// 导入城市js文件
-import cityData from '@/utils/city';
-export default {
-  components: {
-    ImgsUpload,
-  },
-  data() {
-    return {
-      fileList: [],
-      storeInfo: {
-        area: '',
-        storeAddress: '',
-        name: '',
-        mobileNumber: '',
-        storeName: '',
-        shopFacade: '',
-        realFacade: '',
-      },
-      rules: {
-        name: {
-          type: 'string',
-          required: true,
-          message: '请输入负责人名称',
-          trigger: ['blur', 'change'],
-        },
-        storeName: {
-          type: 'string',
-          required: true,
-          message: '请输入店铺名',
-          trigger: ['blur', 'change'],
-        },
-        storeAddress: {
-          type: 'string',
-          required: true,
-          message: '请输入详细地址',
-          trigger: ['blur', 'change'],
+  import ImgsUpload from '@/pages/merchant/mine/openStore/components/ImgsUpload.vue';
+  // 导入城市js文件
+  import cityData from '@/utils/city';
+  export default {
+    components: {
+      ImgsUpload,
+    },
+    data() {
+      return {
+        fileList: [],
+        storeInfo: {
+          area: '',
+          storeAddress: '',
+          name: '',
+          mobileNumber: '',
+          storeName: '',
+          shopFacade: '',
+          realFacade: '',
         },
-        mobileNumber: [
-          {
+        rules: {
+          name: {
+            type: 'string',
             required: true,
-            message: '请输入手机号码',
+            message: '请输入负责人名称',
             trigger: ['blur', 'change'],
           },
-          {
-            validator: (rule, value, callback) => {
-              return uni.$u.test.mobile(value);
-            },
-            message: '手机号码不正确',
-            trigger: ['change', 'blur'],
+          storeName: {
+            type: 'string',
+            required: true,
+            message: '请输入店铺名',
+            trigger: ['blur', 'change'],
           },
-        ],
-        area: [
-          {
+          storeAddress: {
+            type: 'string',
             required: true,
-            message: '请选择所在地区',
-            trigger: ['change', 'blur'],
+            message: '请输入详细地址',
+            trigger: ['blur', 'change'],
           },
-        ],
-      },
-      show: false, //显示选择器
-      // 打开选择器显示默认城市
-      cityList: [],
-      cityLevel1: [],
-      cityLevel2: [],
-      cityLevel3: [],
-    };
-  },
-  onShow() {
-    this.initCityData();
-  },
-  methods: {
-    initCityData() {
-      // 遍历城市js
-      cityData.forEach((item1, index1) => {
-        let temp2 = [];
-        this.cityLevel1.push(item1.provinceName);
-
-        let temp4 = [];
-        let temp3 = [];
-        // 遍历市
-        item1.cities.forEach((item2, index2) => {
-          temp2.push(item2.cityName);
-          // 遍历区
-          item2.counties.forEach((item3, index3) => {
-            temp3.push(item3.countyName);
-          });
-          temp4[index2] = temp3;
-          temp3 = [];
-        });
-        this.cityLevel3[index1] = temp4;
-        this.cityLevel2[index1] = temp2;
-      });
-      // 选择器默认城市
-      this.cityList.push(this.cityLevel1, this.cityLevel2[0], this.cityLevel3[0][0]);
-    },
-    // 选中时执行
-    changeHandler(e) {
-      const {
-        columnIndex,
-        index,
-        indexs,
-        value,
-        values,
-        // 微信小程序无法将picker实例传出来,只能通过ref操作
-        picker = this.$refs.uPicker,
-      } = e;
-      if (columnIndex === 0) {
-        // 选择第一列数据时 设置第二列关联数据
-        picker.setColumnValues(1, this.cityLevel2[index]);
-        // 设置第三列关联数据
-        picker.setColumnValues(2, this.cityLevel3[index][columnIndex]);
-      } else if (columnIndex === 1) {
-        // 选择第二列数据时 设置第三列关联数据
-        picker.setColumnValues(2, this.cityLevel3[indexs[0]][index]);
-      }
+          mobileNumber: [{
+              required: true,
+              message: '请输入手机号码',
+              trigger: ['blur', 'change'],
+            },
+            {
+              validator: (rule, value, callback) => {
+                return uni.$u.test.mobile(value);
+              },
+              message: '手机号码不正确',
+              trigger: ['change', 'blur'],
+            },
+          ],
+          email: [{
+              required: true,
+              message: '请输入您的邮箱',
+              trigger: ['blur', 'change'],
+            },
+            {
+              validator: (rule, value, callback) => {
+                return uni.$u.test.email(value);
+              },
+              message: '您输入的邮箱不正确',
+              trigger: ['change', 'blur'],
+            },
+          ],
+          area: [{
+            required: true,
+            message: '请选择所在地区',
+            trigger: ['change'],
+          }, ],
+        },
+        show: false, //显示选择器
+        // 打开选择器显示默认城市
+        cityList: [],
+        cityLevel1: [],
+        cityLevel2: [],
+        cityLevel3: [],
+      };
     },
-    // 单击确认按钮时执行
-    confirm(e) {
-      this.storeInfo.area = e.value.join('');
-      // 隐藏城市选择器
-      this.show = false;
+    onReady() {
+      //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
+      this.$refs.uForm.setRules(this.rules);
     },
-    handlerChange() {
-      this.show = true;
+    onShow() {
+      this.initCityData();
     },
-    handlerSkipNext() {
-      this.$store.commit('SET_STOREINFO', this.storeInfo);
-      setTimeout(() => {
-        uni.navigateTo({
-          url: '/pages/merchant/mine/openStore/corporateInformation',
-        });
-      }, 1500);
+    methods: {
+      initCityData() {
+        // 遍历城市js
+        cityData.forEach((item1, index1) => {
+          let temp2 = [];
+          this.cityLevel1.push(item1.provinceName);
 
-      console.log(this.storeInfo, '@this.storeInfo');
+          let temp4 = [];
+          let temp3 = [];
+          // 遍历市
+          item1.cities.forEach((item2, index2) => {
+            temp2.push(item2.cityName);
+            // 遍历区
+            item2.counties.forEach((item3, index3) => {
+              temp3.push(item3.countyName);
+            });
+            temp4[index2] = temp3;
+            temp3 = [];
+          });
+          this.cityLevel3[index1] = temp4;
+          this.cityLevel2[index1] = temp2;
+        });
+        // 选择器默认城市
+        this.cityList.push(this.cityLevel1, this.cityLevel2[0], this.cityLevel3[0][0]);
+      },
+      // 选中时执行
+      changeHandler(e) {
+        const {
+          columnIndex,
+          index,
+          indexs,
+          value,
+          values,
+          // 微信小程序无法将picker实例传出来,只能通过ref操作
+          picker = this.$refs.uPicker,
+        } = e;
+        if (columnIndex === 0) {
+          // 选择第一列数据时 设置第二列关联数据
+          picker.setColumnValues(1, this.cityLevel2[index]);
+          // 设置第三列关联数据
+          picker.setColumnValues(2, this.cityLevel3[index][columnIndex]);
+        } else if (columnIndex === 1) {
+          // 选择第二列数据时 设置第三列关联数据
+          picker.setColumnValues(2, this.cityLevel3[indexs[0]][index]);
+        }
+      },
+      // 单击确认按钮时执行
+      confirm(e) {
+        this.storeInfo.area = e.value.join('');
+        // 隐藏城市选择器
+        this.show = false;
+      },
+      handlerChange() {
+        this.show = true;
+      },
+      handlerSkipNext() {
+        this.$refs.uForm.validate().then(res => {
+          this.$store.commit('SET_STOREINFO', this.storeInfo);
+          setTimeout(() => {
+            uni.navigateTo({
+              url: '/pages/merchant/mine/openStore/corporateInformation',
+            });
+          }, 1500);
+        });
+      },
     },
-  },
-};
+  };
 </script>
 
 <style lang="scss" scoped>
-.container {
-  background-color: #f7f7f7 !important;
-  padding-bottom: 40rpx;
+  .container {
+    background-color: #f7f7f7 !important;
+    padding-bottom: 40rpx;
 
-  .top-box {
-    color: #666666;
-    font-size: 26rpx;
-    text-align: center;
-    padding: 20rpx 40rpx;
-    background-color: #fff;
-  }
+    .top-box {
+      color: #666666;
+      font-size: 26rpx;
+      text-align: center;
+      padding: 20rpx 40rpx;
+      background-color: #fff;
+    }
 
-  .content-box {
-    padding: 20rpx 40rpx;
-    background-color: #fff;
-    margin: 10rpx 0;
+    .content-box {
+      padding: 20rpx 40rpx;
+      background-color: #fff;
+      margin: 10rpx 0;
 
-    .content-item {
-      .item-r {
-        background-color: #f7f7f7;
-        border-radius: 20rpx;
-        display: flex;
+      .content-item {
+        position: relative;
 
-        .data_select {
-          width: 90%;
-        }
+        .item-r {
+          background-color: #f7f7f7;
+          border-radius: 20rpx;
+          display: flex;
+
+          .data_select {
+            width: 90%;
+          }
+
+          ::v-deep .u-form-item {
+            width: 100%;
+          }
 
-        ::v-deep .u-form-item {
-          width: 100%;
+          ::v-deep .u-form-item__body {
+            padding: 0;
+          }
         }
 
-        ::v-deep .u-form-item__body {
-          padding: 0;
+        .icon-right-box {
+          position: absolute;
+          right: 15rpx;
+          top: 40rpx;
         }
       }
+
+      .upload-text {
+        text-align: center;
+        color: #666666;
+        font-size: 28rpx;
+        margin-top: 20rpx;
+      }
     }
 
-    .upload-text {
-      text-align: center;
-      color: #666666;
-      font-size: 28rpx;
-      margin-top: 20rpx;
+    .btn {
+      background-color: #5992bb !important;
+      color: #fff;
+      font-size: 32rpx;
+      border-radius: 40rpx;
+      margin-top: 100rpx;
+      margin-bottom: 100rpx;
+      width: 95%;
     }
   }
 
-  .btn {
-    background-color: #5992bb !important;
-    color: #fff;
-    font-size: 32rpx;
-    border-radius: 40rpx;
-    margin-top: 100rpx;
-    margin-bottom: 100rpx;
-    width: 95%;
+  ::v-deep .uni-select {
+    border: none !important;
   }
-}
-
-::v-deep .uni-select {
-  border: none !important;
-}
 
-::v-deep .uni-select__input-placeholder {
-  font-size: 28rpx !important;
-  color: #cbced4 !important;
-}
+  ::v-deep .uni-select__input-placeholder {
+    font-size: 28rpx !important;
+    color: #cbced4 !important;
+  }
 </style>

+ 9 - 11
src/utils/date.js

@@ -5,26 +5,24 @@
  * @returns 返回格式化后的时间字符串
  */
 
-function formatTime(daytime, format = "YYYY-MM-DD hh:mm:ss") {
+function formatTime(daytime, format = 'YYYY-MM-DD hh:mm:ss') {
   const date = new Date(daytime);
   const year = date.getFullYear();
-  const month = ("0" + (date.getMonth() + 1)).slice(-2);
-  const day = ("0" + date.getDate()).slice(-2);
-  const hours = ("0" + date.getHours()).slice(-2);
-  const minutes = ("0" + date.getMinutes()).slice(-2);
-  const seconds = ("0" + date.getSeconds()).slice(-2);
+  const month = ('0' + (date.getMonth() + 1)).slice(-2);
+  const day = ('0' + date.getDate()).slice(-2);
+  const hours = ('0' + date.getHours()).slice(-2);
+  const minutes = ('0' + date.getMinutes()).slice(-2);
+  const seconds = ('0' + date.getSeconds()).slice(-2);
   const map = {
     YYYY: String(year),
     MM: month,
     DD: day,
+    hh: hours,
     mm: minutes,
     ss: seconds,
   };
 
-  return format.replace(/YYYY|MM|DD|hh|mm|ss/g, (matched) => map[matched]);
+  return format.replace(/YYYY|MM|DD|hh|mm|ss/g, matched => map[matched]);
 }
 
-
-export {
-  formatTime
-};
+export { formatTime };

+ 2 - 2
src/utils/request.js

@@ -3,8 +3,8 @@ import {
 } from '@/utils/system';
 import store from '@/store';
 
-export const BASE_URL = 'http://192.168.68.77:11000';
-// const BASE_URL = 'http://192.168.43.175:11000';
+const BASE_URL = 'http://192.168.43.175:11000';
+// const BASE_URL = 'http://192.168.68.77:11000';
 // const BASE_URL = 'https://test.api.chelvc.com';