123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- // pages/test/index.js
- const app = getApp()
- import dateTimePicker from '../../utils/dateTimePicker';
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- frameStyle: { useTop: true, name: '测试页面', leftArrow: true, useBar: true },
- // 主体高度
- infoHeight: '',
- // 图片
- img_url: [],
- // dialog弹框
- dialog: { title: '弹框标题', show: false, type: '1' },
- form: {}
- },
- // 跳转菜单
- tabPath(e) {
- let { route } = e.detail.detail;
- if (route) wx.redirectTo({ url: `/${route}` })
- },
- // 返回上一页
- back: function () {
- wx.navigateBack({ delta: 1 })
- },
- // 上传图片
- imgUpl: function (e) {
- const that = this;
- let data = that.data.img_url;
- data.push(e.detail)
- that.setData({ img_url: data })
- },
- // 删除图片
- imgDel: function (e) {
- const that = this;
- let list = that.data.img_url;
- let arr = list.filter((i, index) => index != e.detail.index)
- that.setData({ img_url: arr })
- },
- // 打开弹框
- toDialog: function () {
- const that = this;
- that.setData({ dialog: { title: '弹框标题', show: true, type: '1' } })
- },
- // 关闭弹框
- toClose: function () {
- const that = this;
- that.setData({ dialog: { title: '弹框标题', show: false, type: '1' } })
- },
- // 确认选择
- datetimeChange: function (e) {
- const that = this;
- that.setData({ [`form.${e.detail.fieldValue}`]: e.detail.datetime });
- console.log(that.data.form);
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: async function (options) {
- // 获取完整的年月日 时分秒,以及默认显示的数组
- var obj = dateTimePicker.dateTimePicker(this.data.startYear, this.data.endYear);
- var obj = dateTimePicker.dateTimePicker(this.data.startYear, this.data.endYear);
- // this.setData({ dateTimeArray: obj.dateTimeArray });
- // let start = moment('02').startOf('month').format('YYYY-MM-DD');
- // let end = moment('02').endOf('month').format('YYYY-MM-DD');
- // 01,03,05,07,08,10
- // 02
- // let days = moment('2001-02').daysInMonth();
- // console.log(start);
- // console.log(end);
- // console.log(days);
- const arr = await app.$get('/matchGroup', {}, 'race');
- console.log(arr);
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|