123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- const app = getApp()
- import { match_status } from '../../utils/dict';
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- frameStyle: { useTop: true, name: '首页', leftArrow: false, useBar: true },
- //查询条件
- searchInfo: {
- name: '',
- type: '',
- city_type: '',
- match_type: '',
- type_name: '',
- match_name: '',
- city_name: ''
- },
- //是否显示
- show: false,
- //按钮类型
- btntype: '',
- list: [
- { id: "1", src: "/image/ceshi.jpg", name: "2021南宁·LYB李永波全球业余羽毛球锦标赛-南宁分站赛", status: '0', time: '2021/10/12-2022/07/15', match_time: '2021/10/12-2022/07/15', address: '广西壮族自治区南宁市李宁体育园羽毛球馆' },
- { id: "2", src: "/image/ceshi.jpg", name: "李宁·谌龙杯羽毛球单打公开赛【厦门站团体赛】", status: '1', time: '2021/10/12-2022/07/15', match_time: '2021/10/12-2022/07/15', address: '福建省厦门市工人体育馆一楼羽毛球馆' },
- { id: "3", src: "/image/ceshi.jpg", name: "李宁·谌龙杯羽毛球单打公开赛【厦门站单项赛】", status: '2', time: '2021/10/12-2022/07/15', match_time: '2021/10/12-2022/07/15', address: '福建省厦门市工人体育馆一楼羽毛球馆' },
- { id: "3", src: "/image/ceshi.jpg", name: "李宁·谌龙杯羽毛球单打公开赛【厦门站单项赛】", status: '3', time: '2021/10/12-2022/07/15', match_time: '2021/10/12-2022/07/15', address: '福建省厦门市工人体育馆一楼羽毛球馆' },
- { id: "3", src: "/image/ceshi.jpg", name: "李宁·谌龙杯羽毛球单打公开赛【厦门站单项赛】", status: '4', time: '2021/10/12-2022/07/15', match_time: '2021/10/12-2022/07/15', address: '福建省厦门市工人体育馆一楼羽毛球馆' }
- ],
- typeList: [
- { label: '', value: '全部' },
- { label: '1', value: '羽毛球' },
- ],
- cityList: [
- { label: '0', value: '吉林省' },
- { label: '1', value: '长春市' },
- ],
- matchList: match_status
- },
- // 跳转菜单
- tabPath(e) {
- let { route } = e.detail.detail;
- if (route) wx.redirectTo({ url: `/${route}` })
- },
- //搜索
- onSearch() {
- console.log("搜索");
- },
- //按钮类型
- btnChange: function (e) {
- const that = this;
- const { value } = e.currentTarget.dataset;
- that.setData({ btntype: value })
- },
- //显示弹框
- showPopup() {
- this.setData({ show: true });
- },
- //关闭弹框
- onClose() {
- this.setData({ show: false });
- },
- //运动类型选择
- ontypeConfirm(event) {
- const that = this;
- const { value } = event.detail;
- that.setData({ "searchInfo.type_name": value.value })
- that.setData({ "searchInfo.type": '0' })
- this.setData({ show: false });
- },
- //城市选择
- oncityConfirm(event) {
- const that = this;
- const { value } = event.detail;
- that.setData({ "searchInfo.city_name": value.value })
- that.setData({ "searchInfo.city_type": '1' })
- this.setData({ show: false });
- },
- //比赛状态选择
- onmatchConfirm(event) {
- const that = this;
- const { value } = event.detail;
- that.setData({ "searchInfo.match_name": value.value })
- that.setData({ "searchInfo.match_type": '2' })
- this.setData({ show: false });
- },
- //取消类型选择
- onCancel() {
- const that = this;
- console.log('取消');
- that.setData({ btntype: '' })
- this.setData({ show: false });
- },
- searchChange: function (e) {
- const that = this;
- const { value } = e.currentTarget.dataset;
- that.setData({ searchType: value })
- },
- // 运动类型选择
- typeChange: function (e) {
- const that = this;
- let data = that.data.typeList.find((i) => i.label == e.detail.value);
- if (data) { that.setData({ 'searchInfo.type': data.label }); that.setData({ 'searchInfo.type_name': data.value }); }
- },
- // 城市選擇
- cityChange: function (e) {
- const that = this;
- let data = that.data.cityList.find((i) => i.label == e.detail.value);
- if (data) { that.setData({ 'searchInfo.city': data.label }); that.setData({ 'searchInfo.city_name': data.value }); }
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- const that = this;
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|