|
@@ -8,115 +8,49 @@ 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
|
|
|
+ searchInfo: {},
|
|
|
+ list: []
|
|
|
},
|
|
|
// 跳转菜单
|
|
|
tabPath(e) {
|
|
|
let { route } = e.detail.detail;
|
|
|
if (route) wx.redirectTo({ url: `/${route}` })
|
|
|
},
|
|
|
- //搜索
|
|
|
- onSearch() {
|
|
|
- console.log("搜索");
|
|
|
- },
|
|
|
- //按钮类型
|
|
|
- btnChange: function (e) {
|
|
|
+ // 查询
|
|
|
+ search: function (e) {
|
|
|
const that = this;
|
|
|
- const { value } = e.currentTarget.dataset;
|
|
|
- that.setData({ btntype: value })
|
|
|
-
|
|
|
- },
|
|
|
- //显示弹框
|
|
|
- showPopup() {
|
|
|
- this.setData({ show: true });
|
|
|
+ that.setData({ 'searchInfo.name': e.detail.value });
|
|
|
+ that.watchLogin()
|
|
|
},
|
|
|
- //关闭弹框
|
|
|
- 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 }); }
|
|
|
+ toView: function (e) {
|
|
|
+ const { item } = e.currentTarget.dataset;
|
|
|
+ wx.navigateTo({ url: `/pages/matchInfo/index?id=${item._id}` })
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
const that = this;
|
|
|
-
|
|
|
+ that.watchLogin()
|
|
|
+ },
|
|
|
+ watchLogin: function () {
|
|
|
+ const that = this;
|
|
|
+ let searchInfo = that.data.searchInfo;
|
|
|
+ wx.getStorage({
|
|
|
+ key: 'user',
|
|
|
+ success: async (res) => {
|
|
|
+ let info = {};
|
|
|
+ if (searchInfo && searchInfo.name) info.name = searchInfo.name;
|
|
|
+ const arr = await app.$get(`/newCourt/api/match`, { ...info });
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ 11
|
|
|
+ that.setData({ list: arr.data })
|
|
|
+ } else { wx.showToast({ title: `${res.errMsg}`, icon: 'fail', duration: 2000 }); }
|
|
|
+ },
|
|
|
+ fail: async (res) => {
|
|
|
+ wx.redirectTo({ url: '/pages/index/index' });
|
|
|
+ },
|
|
|
+ });
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|