const db = wx.cloud.database(); const _ = db.command; Page({ data: { users: [], clientname: '', goods: '', hasError2: false, contact: '', hasError3: false, currentDate: '请选择预约时间', radio: '', dept: '', showDate: false, columns: [], currentPicker: '请选择计划员', currentPickerIndex: -1, showPicker: false }, onLoad(options) { this.setData({ clientname: options.clientname }) }, submit() { const goods = this.data.goods.trim(); const contact = this.data.contact.trim(); if (goods == '') { this.setData({ hasError2: true, hasError3: false }); } else if (contact == '') { this.setData({ hasError3: true, hasError2: false }); } else if (this.data.dept == '') { wx.showToast({ title: '请选择管理中心', icon: 'error' }) } else if (this.data.currentDate == '请选择预约时间') { wx.showToast({ title: '请选择预约时间', icon: 'error' }) } else if (this.data.radio == '') { wx.showToast({ title: '请选择上午下午', icon: 'error' }) } else if (this.data.currentPicker == '请选择计划员') { wx.showToast({ title: '请选择计划员', icon: 'error' }) } else { const that = this; db.collection('reserve').where({ date: new Date(that.data.currentDate), radio: that.data.radio, 'step1.people': that.data.currentPicker, }).count({ success: function (res) { if (res.total > 5 || (res.total > 3 && that.data.radio == '下午')) { wx.navigateTo({ url: "/pages/reserve/booking-fail/index" }); } else { let number = res.total + 1; if (that.data.radio == '下午') { number += 6; } db.collection('reserve').add({ data: { number: number, clientname: that.data.clientname, goods: goods, contact: contact, dept: that.data.dept, date: new Date(that.data.currentDate), radio: that.data.radio, step1: { people: that.data.currentPicker, peoplecontact: that.data.users[that.data.currentPickerIndex].contact }, sta: 0, flg: false }, success: function (res) { wx.redirectTo({ url: '/pages/service/start/index?id=' + res._id }); } }); } } }) } }, showDatePopup() { this.setData({ showDate: true }); }, onDateConfirm(event) { this.setData({ currentDate: this.formatDate(event.detail), showDate: false }); }, onDateCancel() { this.setData({ showDate: false }); }, formatDate(date) { date = new Date(date); return `${date.getFullYear()}-${(date.getMonth() + 1)}-${date.getDate()}`; }, showPickerPopup() { this.setData({ showPicker: true }); }, onPickerCancel() { this.setData({ showPicker: false }); }, onPickerConfirm(event) { this.setData({ showPicker: false, currentPicker: event.detail.value, currentPickerIndex: event.detail.index }); }, onRadioChange(event) { this.setData({ radio: event.detail }); }, onDeptChange(event) { const that = this; db.collection('users').where({ isdel: false, dept: event.detail, role: '计划科', username: _.neq('admin') }).get({ success: function (res) { const users = res.data; const columns = users.map(v => v.realname); that.setData({ users: users, columns: columns }); } }); this.setData({ currentPicker: '请选择计划员' }); this.setData({ dept: event.detail }); }, });
在真机测试1.0功能正常,发布成体验版后,安卓正常,但IOS不正常,是什么原因?在真机测试1.0功能正常,,发布成体验版后,安卓正常,但IOS不正常; 后来在真机测试2.0下IOS点按钮,无法跳转URL! submit IOS 无反应。 代码见后面跟贴。
2022-01-18