guhongwei 2 years ago
parent
commit
bae6585574
3 changed files with 26 additions and 28 deletions
  1. 24 9
      commpents/datetime-picker/index.js
  2. 2 1
      pages/test/index.js
  3. 0 18
      pagesMatch/matchAdmin/referee/add.wxml

+ 24 - 9
commpents/datetime-picker/index.js

@@ -15,7 +15,10 @@ Component({
     ready: function () { },
     ready: function () { },
     pageLifetimes: {
     pageLifetimes: {
         // 组件所在页面的生命周期函数
         // 组件所在页面的生命周期函数
-        show: function () { },
+        show: function () {
+            const that = this;
+            that.search();
+        },
         hide: function () { },
         hide: function () { },
         resize: function () { },
         resize: function () { },
     },
     },
@@ -23,14 +26,7 @@ Component({
      * 组件的初始数据
      * 组件的初始数据
      */
      */
     data: {
     data: {
-        dateTimeArray: [
-            ['2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010'],
-            ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'],
-            ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'],
-            ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'],
-            ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59'],
-            ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59'],
-        ],
+        dateTimeArray: [],
         // 计算日期
         // 计算日期
         year: '',
         year: '',
         moneh: '',
         moneh: '',
@@ -39,6 +35,25 @@ Component({
      * 组件的方法列表
      * 组件的方法列表
      */
      */
     methods: {
     methods: {
+        // 查询时间
+        search: function () {
+            const that = this;
+            // 计算年份
+            let year = [];
+            let startYear = moment().format('YYYY');
+            let endYear = Number(startYear) + 100;
+            for (var i = startYear; i <= endYear; i++) { year.push(String(i)) }
+            // 数组数据, 年, 月, 日, 时, 分, 秒;
+            let dateTimeArray = [
+                [...year],
+                ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'],
+                ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'],
+                ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'],
+                ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59'],
+                ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59'],
+            ]
+            that.setData({ dateTimeArray })
+        },
         // 确认选择
         // 确认选择
         change: function (e) {
         change: function (e) {
             const that = this;
             const that = this;

+ 2 - 1
pages/test/index.js

@@ -63,7 +63,8 @@ Page({
     toSubmit: function (e) {
     toSubmit: function (e) {
         const that = this;
         const that = this;
         const params = e.detail.value;
         const params = e.detail.value;
-        console.log(params);
+        const form = that.data.form;
+        params.start_time = form.start_time;
         if (!this.WxValidate.checkForm(params)) {
         if (!this.WxValidate.checkForm(params)) {
             const error = this.WxValidate.errorList[0];
             const error = this.WxValidate.errorList[0];
             wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
             wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })

+ 0 - 18
pagesMatch/matchAdmin/referee/add.wxml

@@ -8,24 +8,6 @@
                         <input name="name" value="{{form.name}}" placeholder="请输入用户名" />
                         <input name="name" value="{{form.name}}" placeholder="请输入用户名" />
                     </view>
                     </view>
                 </view>
                 </view>
-                <view class="content">
-                    <view class="label">联系电话:</view>
-                    <view class="value">
-                        <input name="phone" value="{{form.phone}}" placeholder="请输入联系电话" />
-                    </view>
-                </view>
-                <view class="content">
-                    <view class="label">
-                        日期时间:
-                    </view>
-                    <view class="value">
-                        <picker mode="multiSelector" value="{{dateTime1}}" bindchange="changeDateTime1" bindcolumnchange="changeDateTimeColumn1" range="{{dateTimeArray1}}">
-                            <view class="text">
-                                {{dateTimeArray1[0][dateTime1[0]]}}-{{dateTimeArray1[1][dateTime1[1]]}}-{{dateTimeArray1[2][dateTime1[2]]}} {{dateTimeArray1[3][dateTime1[3]]}}:{{dateTimeArray1[4][dateTime1[4]]}}:{{dateTimeArray1[5][dateTime1[5]]}}
-                            </view>
-                        </picker>
-                    </view>
-                </view>
                 <view class="btn">
                 <view class="btn">
                     <button type="primary" size="mini" formType="submit">提交保存</button>
                     <button type="primary" size="mini" formType="submit">提交保存</button>
                 </view>
                 </view>