guhongwei 2 年 前
コミット
70535e2162

+ 3 - 1
app.json

@@ -4,9 +4,9 @@
         "pages/login/index",
         "pages/register/index",
         "pages/home/index",
+        "pages/search/index",
         "pages/match/info",
         "pages/addmatch/index",
-        "pages/search/index",
         "pages/matchadmin/index",
         "pages/matchadmin/edit",
         "pages/matchadmin/layout",
@@ -21,6 +21,8 @@
         "pages/updatepd/index",
         "pages/exammembers/index",
         "pages/teamapply/index",
+        "pages/matchteam/index",
+        "pages/matchteam/detail",
         "pages/administration/index",
         "pages/teamdismissteam/index",
         "pages/user/index",

+ 52 - 52
commpents/mobile-frame/foot.js

@@ -1,62 +1,62 @@
 const app = getApp();
 import { system } from '../../utils/dict';
 Component({
-  /**
-   * 组件的属性列表
-   */
-  options: { multipleSlots: true },
-  properties: {
-    tabSelectid: { type: 'string', value: '' }
-  },
+    /**
+     * 组件的属性列表
+     */
+    options: { multipleSlots: true },
+    properties: {
+        // tabSelectid: { type: 'string', value: '' }
+    },
 
-  // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
-  attached: function () { }, // 此处attached的声明会被lifetimes字段中的声明覆盖
-  ready: function () { },
-  pageLifetimes: {
-    // 组件所在页面的生命周期函数
-    show: function () { this.search() },
-    hide: function () { },
-    resize: function () { },
-  },
-  /**
-   * 组件的初始数据
-   */
-  data: {
-    // 菜单列表
-    menuList: [],
-    active: 0,
-  },
-  /**
-   * 组件的方法列表
-   */
-  methods: {
-    // 跳转
-    tabPath(e) {
-      const that = this;
-      this.setData({ active: e.detail })
-      let route = that.data.menuList[e.detail];
-      if (route) this.triggerEvent('tabPath', route);
+    // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
+    attached: function () { }, // 此处attached的声明会被lifetimes字段中的声明覆盖
+    ready: function () { },
+    pageLifetimes: {
+        // 组件所在页面的生命周期函数
+        show: function () { this.search() },
+        hide: function () { },
+        resize: function () { },
+    },
+    /**
+     * 组件的初始数据
+     */
+    data: {
+        // 菜单列表
+        menuList: [],
+        active: 0,
     },
-    search() {
-      const that = this;
-      wx.getStorage({
-        key: 'token',
-        success: res => {
-          let pages = getCurrentPages();
-          let currentPage = pages[pages.length - 1];
-          let menu = system.filter((i) => i.type.includes(res.data.type))
-          if (menu) {
-            that.setData({ menuList: menu })
-            // 默认显示的值
-            let index = menu.findIndex((i) => i.route == currentPage.route);
-            that.setData({ active: index })
-          }
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+        // 跳转
+        tabPath(e) {
+            const that = this;
+            this.setData({ active: e.detail })
+            let route = that.data.menuList[e.detail];
+            if (route) this.triggerEvent('tabPath', route);
         },
-        fail: res => {
-          wx.redirectTo({ url: '/pages/index/index', })
+        search() {
+            const that = this;
+            wx.getStorage({
+                key: 'token',
+                success: res => {
+                    let pages = getCurrentPages();
+                    let currentPage = pages[pages.length - 1];
+                    let menu = system.filter((i) => i.type.includes(res.data.type))
+                    if (menu) {
+                        that.setData({ menuList: menu })
+                        // 默认显示的值
+                        let index = menu.findIndex((i) => i.route == currentPage.route);
+                        that.setData({ active: index })
+                    }
+                },
+                fail: res => {
+                    wx.redirectTo({ url: '/pages/index/index', })
+                }
+            })
         }
-      })
     }
-  }
 })
 

+ 48 - 48
commpents/upload/index.js

@@ -1,57 +1,57 @@
 // commpents/mobile-frame/mobile-main.js
 const app = getApp()
 Component({
-  /**
-   * 组件的属性列表
-   */
-  options: { multipleSlots: true },
-  properties: {
-    list: { type: 'array', value: [] },
-    count: { type: Number, value: 1 },
-    previewSize: { type: String, value: '60' }
-  },
+    /**
+     * 组件的属性列表
+     */
+    options: { multipleSlots: true },
+    properties: {
+        list: { type: Array, value: [] },
+        count: { type: Number, value: 1 },
+        previewSize: { type: String, value: '60' }
+    },
 
-  // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
-  attached: function () { }, // 此处attached的声明会被lifetimes字段中的声明覆盖
-  ready: function () { },
-  pageLifetimes: {
-    // 组件所在页面的生命周期函数
-    show: function () { },
-    hide: function () { },
-    resize: function () { },
-  },
-  /**
-   * 组件的初始数据
-   */
-  data: {
+    // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
+    attached: function () { }, // 此处attached的声明会被lifetimes字段中的声明覆盖
+    ready: function () { },
+    pageLifetimes: {
+        // 组件所在页面的生命周期函数
+        show: function () { },
+        hide: function () { },
+        resize: function () { },
+    },
+    /**
+     * 组件的初始数据
+     */
+    data: {
 
-  },
-  /**
-   * 组件的方法列表
-   */
-  methods: {
-    // 图片上传
-    imgUpload(event) {
-      const { file } = event.detail;
-      wx.uploadFile({
-        url: `${app.globalData.imageUrl}/files/court/elimg/upload`,
-        filePath: file.url,
-        name: 'file',
-        formData: {},
-        success: (res) => {
-          let arr = JSON.parse(res.data);
-          if (res.statusCode == 200) {
-            this.triggerEvent('imgUpload', { name: arr.name, url: `${app.globalData.imageUrl}` + arr.uri, uri: arr.uri })
-          } else {
-            wx.showToast({ title: `${res.errMsg}`, icon: 'fail', duration: 2000 })
-          }
-        }
-      })
     },
-    // 图片删除
-    imgDel(e) {
-      this.triggerEvent('imgDel', { file: e.detail.file, index: e.detail.index })
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+        // 图片上传
+        imgUpload(event) {
+            const { file } = event.detail;
+            wx.uploadFile({
+                url: `${app.globalData.imageUrl}/files/court/elimg/upload`,
+                filePath: file.url,
+                name: 'file',
+                formData: {},
+                success: (res) => {
+                    let arr = JSON.parse(res.data);
+                    if (res.statusCode == 200) {
+                        this.triggerEvent('imgUpload', { name: arr.name, url: `${app.globalData.imageUrl}` + arr.uri, uri: arr.uri })
+                    } else {
+                        wx.showToast({ title: `${res.errMsg}`, icon: 'fail', duration: 2000 })
+                    }
+                }
+            })
+        },
+        // 图片删除
+        imgDel(e) {
+            this.triggerEvent('imgDel', { file: e.detail.file, index: e.detail.index })
+        }
     }
-  }
 })
 

+ 100 - 100
pages/home/index.js

@@ -1,121 +1,121 @@
 const app = getApp()
 Page({
 
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    frameStyle: { useTop: false, name: '首页', leftArrow: false, useBar: true },
-    // 主体高度
-    infoHeight: '',
-    // 首页背景
-    homeBg: '/image/home_1.png',
-    // 比赛列表
-    list: []
-  },
-  back: function () {
-    wx.navigateBack({ url: '/pages/home/index' })
-  },
-  tabPath: function (e) {
-    let { route } = e.detail.detail;
-    if (route) wx.redirectTo({ url: `/${route}` })
-  },
-  // 查看比赛详情
-  toView: function (e) {
-    const { id } = e.currentTarget.dataset;
-    console.log(id);
-  },
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    // 计算高度
-    this.searchHeight();
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        frameStyle: { useTop: false, name: '首页', leftArrow: false, useBar: true },
+        // 主体高度
+        infoHeight: '',
+        // 首页背景
+        homeBg: '/image/home_1.png',
+        // 比赛列表
+        list: []
+    },
+    back: function () {
+        wx.navigateBack({ url: '/pages/home/index' })
+    },
+    tabPath: function (e) {
+        let { route } = e.detail.detail;
+        if (route) wx.redirectTo({ url: `/${route}` })
+    },
+    // 查看比赛详情
+    toView: function (e) {
+        const { id } = e.currentTarget.dataset;
+        wx.navigateTo({ url: `/pages/match/info?id=${id}` })
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+        // 计算高度
+        this.searchHeight();
+        // 监听用户是否登录
+        this.watchLogin();
+    },
     // 监听用户是否登录
-    this.watchLogin();
-  },
-  // 监听用户是否登录
-  watchLogin: function () {
-    const that = this;
-    wx.getStorage({
-      key: 'token',
-      success: res => {
-        wx.request({
-          url: `${app.globalData.publicUrl}/courtAdmin/api/match`, //接口地址
-          method: 'get',
-          data: {},
-          success(res) {
-            if (res.data.errcode == 0) {
-              that.setData({ list: res.data.data })
-            } else {
-              wx.showToast({ title: res.data.errmsg, icon: 'error', duration: 2000 })
+    watchLogin: function () {
+        const that = this;
+        wx.getStorage({
+            key: 'token',
+            success: res => {
+                wx.request({
+                    url: `${app.globalData.publicUrl}/courtAdmin/api/match`, //接口地址
+                    method: 'get',
+                    data: {},
+                    success(res) {
+                        if (res.data.errcode == 0) {
+                            that.setData({ list: res.data.data })
+                        } else {
+                            wx.showToast({ title: res.data.errmsg, icon: 'error', duration: 2000 })
+                        }
+                    }
+                })
+            },
+            fail: res => {
+                wx.redirectTo({ url: '/pages/index/index', })
             }
-          }
         })
-      },
-      fail: res => {
-        wx.redirectTo({ url: '/pages/index/index', })
-      }
-    })
-  },
-  // 计算高度
-  searchHeight: function () {
-    let frameStyle = this.data.frameStyle;
-    let client = app.globalData.client;
-    let infoHeight = client.windowHeight;
-    // 是否去掉状态栏
-    if (frameStyle.useTop) infoHeight = infoHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
-    // 是否减去底部菜单
-    if (frameStyle.useBar) infoHeight = infoHeight - 50;
-    if (infoHeight) this.setData({ infoHeight: infoHeight })
-  },
+    },
+    // 计算高度
+    searchHeight: function () {
+        let frameStyle = this.data.frameStyle;
+        let client = app.globalData.client;
+        let infoHeight = client.windowHeight;
+        // 是否去掉状态栏
+        if (frameStyle.useTop) infoHeight = infoHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
+        // 是否减去底部菜单
+        if (frameStyle.useBar) infoHeight = infoHeight - 50;
+        if (infoHeight) this.setData({ infoHeight: infoHeight })
+    },
 
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
 
-  },
+    },
 
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
 
-  },
+    },
 
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
 
-  },
+    },
 
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
 
-  },
+    },
 
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
 
-  },
+    },
 
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
 
-  },
+    },
 
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
 
-  }
+    }
 })

+ 225 - 0
pages/matchteam/detail.js

@@ -0,0 +1,225 @@
+// pages/login/login.js
+import WxValidate from '../../utils/wxValidate';
+const moment = require("../../utils/moment.min")
+const app = getApp()
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        frameStyle: { useTop: true, name: '申请报名', leftArrow: true, useBar: false },
+        // 主体高度
+        infoHeight: '',
+        // 用户信息
+        user: {},
+        // 比赛信息
+        match_id: '629eb5f211f83364713232a1',
+        matchInfo: {},
+        // 团队信息
+        teamInfo: {},
+        // 弹框
+        dialog: { title: '选择赛制', show: false, type: '1' },
+        // 成员原列表
+        userList: [],
+        // 成员列表
+        members: [],
+        // 赛制信息
+        formatList: [],
+        format: [],
+    },
+    initValidate() {
+        const rules = { match_name: { required: true } }
+        // 验证字段的提示信息,若不传则调用默认的信息
+        const messages = { match_name: { required: '请输入比赛名称' } };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
+    back: function () {
+        wx.navigateBack({ url: '/pages/matchteam/index' })
+    },
+    // 选择成员
+    changeMem: function () {
+        const that = this;
+        that.setData({ dialog: { title: '成员列表', show: true, type: '2' } })
+    },
+    // 选择成员
+    onMemchange: function (e) {
+        const that = this;
+        let data = e.detail.value;
+        let user = that.data.userList;
+        let members = [];
+        for (const val of data) {
+            let arr = user.find((i) => i.user_id == val);
+            if (arr) members.push(arr)
+        }
+        that.setData({ 'form.match_num': members.length })
+        that.setData({ members: members })
+    },
+    // 删除成员
+    memDel: function (e) {
+        const that = this;
+        const { user_id } = e.currentTarget.dataset;
+        var members = that.data.members;
+        for (var i = 0; i < members.length; i++) {
+            if (members[i].user_id == user_id) members.splice(i, 1)
+        }
+        that.setData({ 'form.match_num': members.length })
+        this.setData({ members: members })
+    },
+    // 选择赛制
+    formatChange: function (e) {
+        const that = this;
+        const { value } = e.detail;
+        let format = that.data.format;
+        let data = that.data.formatList[value];
+        let list = [];
+        if (data) list = [...format, data]
+        that.setData({ format: list })
+    },
+    // 删除赛制
+    formatDel: function (e) {
+        const that = this;
+        let list = that.data.format;
+        const { index } = e.currentTarget.dataset;
+        list.splice(index, 1);
+        that.setData({ format: list });
+    },
+    // 关闭弹框
+    toClose: function () {
+        const that = this;
+        that.setData({ dialog: { title: '选择赛制', show: false } })
+    },
+    onSubmit: async function (e) {
+        const that = this;
+        const params = e.detail.value;
+        const format = that.data.format;
+        const members = that.data.members;
+        const data = that.data.form;
+        params.format = format;
+        params.members = members;
+        params.apply_time = moment().format('YYYY-MM-DD HH:mm:ss');
+        params.logo = data.logo;
+        if (!this.WxValidate.checkForm(params)) {
+            const error = this.WxValidate.errorList[0];
+            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+            return false
+        } else {
+            if (params.format.length > 0 && params.members.length > 0) {
+                const arr = await app.$post(`/courtAdmin/api/matchteam`, params);
+                if (arr.errcode == 0) { wx.showToast({ title: `报名成功`, icon: 'success', duration: 2000 }); that.back(); }
+                else wx.showToast({ title: arr.errmsg, icon: 'none', duration: 2000 })
+            } else {
+                wx.showToast({ title: `缺少必要信息`, icon: 'error', duration: 2000 })
+            }
+        }
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+        const that = this;
+        if (options && options.id) that.setData({ match_id: options.id })
+        //验证规则函数
+        this.initValidate();
+        // 计算高度
+        this.searchHeight();
+        // 监听用户是否登录
+        this.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: function () {
+        const that = this;
+        let match_id = that.data.match_id;
+        wx.getStorage({
+            key: 'token',
+            success: async res => {
+                that.setData({ user: res.data })
+                // 查询比赛信息
+                let arr = await app.$get(`/courtAdmin/api/match/${match_id}`);
+                if (arr.errcode == '0') that.setData({ matchInfo: arr.data });
+                that.setData({ formatList: arr.data.format })
+                // 查询团队信息
+                let aee = await app.$get(`/courtAdmin/api/team`, { create_id: res.data._id })
+                if (aee.errcode == '0') that.setData({ teamInfo: aee.data[0] });
+                // 表单赋值
+                let att = {
+                    // 比赛信息
+                    match_id: arr.data._id,
+                    match_name: arr.data.name,
+                    // 参赛团队信息
+                    team_id: aee.data[0]._id,
+                    team_name: aee.data[0].name,
+                    logo: aee.data[0].logo,
+                    create_id: aee.data[0].create_id,
+                    create_user: aee.data[0].create_user,
+                    create_time: aee.data[0].create_time,
+                }
+                that.setData({ userList: aee.data[0].members });
+                that.setData({ form: att })
+            },
+            fail: res => {
+                wx.redirectTo({ url: '/pages/index/index', })
+            }
+        })
+    },
+    // 计算高度
+    searchHeight: function () {
+        let frameStyle = this.data.frameStyle;
+        let client = app.globalData.client;
+        let infoHeight = client.windowHeight;
+        // 是否去掉状态栏
+        if (frameStyle.useTop) infoHeight = infoHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
+        // 是否减去底部菜单
+        if (frameStyle.useBar) infoHeight = infoHeight - 50;
+        if (infoHeight) this.setData({ infoHeight: infoHeight })
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 7 - 0
pages/matchteam/detail.json

@@ -0,0 +1,7 @@
+{
+    "component": true,
+    "usingComponents": {
+        "mobile-main": "/commpents/mobile-frame/mobile-main",
+        "e-dialog": "/commpents/dialog/index"
+    }
+}

+ 112 - 0
pages/matchteam/detail.wxml

@@ -0,0 +1,112 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="main" style="height:{{infoHeight}}px;">
+        <view class="one">
+            <form bindsubmit="onSubmit">
+                <view class="content" style="display: none;">
+                    <view class="label textOver">比赛id</view>
+                    <view class="value">
+                        <input type="text" name="match_id" value="{{form.match_id}}" placeholder="请输入比赛id" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label textOver">比赛名称</view>
+                    <view class="value">
+                        <input type="text" name="match_name" value="{{form.match_name}}" placeholder="请输入比赛名称" disabled />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label textOver">赛制</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="formatChange" name="format" value="{{form.format}}" range-key="value" range="{{formatList}}">
+                            <button class="formbtn" type="default" size="mini">选择赛制</button>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="format" wx:for="{{format}}" wx:key="item">
+                        <view class="label textOver">赛制信息</view>
+                        <view class="value">
+                            <text>{{item.value}}</text>
+                            <text class="icon iconfont icon-jianhao" bindtap="formatDel" data-index="{{index}}"></text>
+                        </view>
+                    </view>
+                </view>
+                <view class="content" style="display: none;">
+                    <view class="label textOver">团队id</view>
+                    <view class="value">
+                        <input type="text" name="team_id" value="{{form.team_id}}" placeholder="请输入参赛团队id" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label textOver">团队名称</view>
+                    <view class="value">
+                        <input type="text" name="team_name" value="{{form.team_name}}" placeholder="请输入参赛团队名称" disabled />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label textOver">团队logo</view>
+                    <view class="value">
+                        <image class="image" src="{{form.logo[0].url}}"></image>
+                    </view>
+                </view>
+                <view class="content" style="display: none;">
+                    <view class="label textOver">团队创建id</view>
+                    <view class="value">
+                        <input type="text" name="create_id" value="{{form.create_id}}" placeholder="请输入参赛团队创建id" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label textOver">团队创建人</view>
+                    <view class="value">
+                        <input type="text" name="create_user" value="{{form.create_user}}" placeholder="请输入参赛团队创建人" disabled />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label textOver">团队创建时间</view>
+                    <view class="value">
+                        <input type="text" name="create_time" value="{{form.create_time}}" placeholder="请输入参赛团队创建时间" disabled />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label textOver">团队人数</view>
+                    <view class="value">
+                        <input type="text" name="match_num" value="{{form.match_num}}" placeholder="请输入参赛团队人数" disabled />
+                    </view>
+                </view>
+                <view class="content members">
+                    <view class="members_1">
+                        <text>团队成员</text>
+                        <button class="formbtn" type="default" size="mini" bindtap="changeMem">选择成员</button>
+                    </view>
+                    <view class="members_2">
+                        <view class="membersList" wx:for="{{members}}" wx:key="item" bindtap="memDel" data-user_id="{{item.user_id}}">
+                            <image class="iamge" src="{{item.icon&&item.icon.length>0?item.icon[0].url:'/image/wodexiao-01.png'}}"></image>
+                            <view class="nickname textOver">{{item.nickname}}</view>
+                            <image class="del" src="/image/jianshao.png"></image>
+                        </view>
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
+    </view>
+</mobile-main>
+<e-dialog dialog="{{dialog}}" bind:toClose="toClose">
+    <view slot="info">
+        <view class="dialog_one" wx:if="{{dialog.type=='1'}}">
+            1
+        </view>
+        <view class="dialog_two" wx:elif="{{dialog.type=='2'}}">
+            <checkbox-group bindchange="onMemchange">
+                <view class="userList" wx:for="{{userList}}" wx:key="item">
+                    <label>
+                        <text>{{item.nickname}}</text>
+                        <checkbox value="{{item.user_id}}" checked="{{item.checked}}" />
+                    </label>
+                </view>
+            </checkbox-group>
+        </view>
+    </view>
+</e-dialog>

+ 166 - 0
pages/matchteam/detail.wxss

@@ -0,0 +1,166 @@
+.main {
+    position: relative;
+    width: 100%;
+    background-color: #ffffff;
+    overflow-y: auto;
+}
+
+.main .one {
+    float: left;
+    width: 94%;
+    padding: 0 10px;
+}
+
+.main .one .content {
+    float: left;
+    width: 100%;
+    border-bottom: 1px solid #ccc;
+    padding: 10px 0;
+}
+
+.main .one .content .label {
+    float: left;
+    width: 30%;
+}
+
+.main .one .content .value {
+    float: left;
+    width: 70%;
+    text-align: right;
+}
+
+.main .one .content .value .input {
+    color: #868686;
+}
+
+.main .one .content .value .image {
+    width: 60px;
+    height: 60px;
+    overflow: hidden;
+    border-radius: 90px;
+}
+
+.main .one .content .value .formbtn {
+    font-size: 14px;
+}
+
+.main .one .content .value .icon {
+    margin: 0 0 0 10px;
+}
+
+.main .one .content .format {
+    float: left;
+    width: 100%;
+    padding: 5px 0;
+    border-bottom: 1px dashed #f1f1f1;
+}
+
+.main .one .btn {
+    float: left;
+    width: 100%;
+    text-align: center;
+    margin: 10px 0 0 0;
+}
+
+.main .one .btn button {
+    width: 50%;
+    font-size: 14px;
+}
+
+
+.members {
+    float: left;
+    width: 100%;
+    margin: 5px 0;
+}
+
+.members .members_1 {
+    float: left;
+    width: 100%;
+    margin: 0 0 5px 0;
+}
+
+.members .members_1 text {
+    display: inline-block;
+    margin: 4px 0;
+}
+
+.members .members_1 button {
+    font-size: 14px;
+    float: right;
+}
+
+.members .members_2 {
+    float: left;
+    width: 100%;
+}
+
+.members .members_2 .membersList {
+    float: left;
+    width: 22%;
+    height: 80px;
+    border: 1px solid #ccc;
+    border-radius: 90px;
+    text-align: center;
+    margin: 0 10px 10px 0;
+    position: relative;
+}
+
+.members .members_2 .membersList:nth-child(4n) {
+    margin: 0 0 10px 0;
+}
+
+.members .members_2 .membersList .iamge {
+    width: 40px;
+    height: 40px;
+    overflow: hidden;
+    margin: 5px 0;
+    border-radius: 90px;
+}
+
+.members .members_2 .membersList .nickname {
+    font-size: 14px;
+}
+
+.members .members_2 .membersList .del {
+    position: absolute;
+    top: 0;
+    right: 0;
+    width: 20px;
+    height: 20px;
+}
+
+.dialog_two {
+    float: left;
+    width: 100%;
+}
+
+
+.dialog_two .userList {
+    float: left;
+    width: 93%;
+    padding: 10px;
+    border-bottom: 1px solid #ccc;
+}
+
+.dialog_two .userList text {
+    float: left;
+    text-align: left;
+    font-size: 14px;
+}
+
+.dialog_two .userList checkbox {
+    float: right;
+}
+
+.dialog_two .btn {
+    float: left;
+    width: 100%;
+    text-align: center;
+    margin: 5px 0;
+}
+
+.dialog_two .btn button {
+    padding: 0 10px;
+    font-size: 14px;
+}

+ 129 - 0
pages/matchteam/index.js

@@ -0,0 +1,129 @@
+// pages/login/login.js
+import WxValidate from '../../utils/wxValidate';
+import { match_status } from '../../utils/dict';
+const app = getApp()
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        frameStyle: { useTop: true, name: '查询比赛', leftArrow: true, useBar: true },
+        // 主体高度
+        infoHeight: '',
+        // 选项卡
+        tabs: { active: 'a', list: [{ title: '待申请', name: 'a' }, { title: '已申请', name: 'b' }] },
+        // 待参加,
+        aList: [],
+        statusList: match_status,
+        cstatusList: [{ label: '0', value: '待审核' }, { label: '1', value: '审核通过' }, { label: '-1', value: '审核拒绝' }]
+    },
+    back: function () {
+        wx.navigateBack({ url: '/pages/me/index' })
+    },
+    tabPath: function (e) {
+        let { route } = e.detail.detail;
+        if (route) wx.redirectTo({ url: `/${route}` });
+    },
+    // 选项卡
+    tabsChange: function (e) {
+        const that = this;
+        that.setData({ 'tabs.active': e.detail.name });
+        that.watchLogin();
+    },
+    // 查看
+    toView: function (e) {
+        const { id } = e.currentTarget.dataset;
+        wx.navigateTo({ url: `/pages/match/info?id=${id}` })
+    },
+    // 加入
+    toJoin: function (e) {
+        const { id } = e.currentTarget.dataset;
+        wx.navigateTo({ url: `/pages/matchteam/detail?id=${id}` })
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+        // 计算高度
+        this.searchHeight();
+        // 监听用户是否登录
+        this.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: function () {
+        const that = this;
+        const { active } = that.data.tabs;
+        wx.getStorage({
+            key: 'token',
+            success: async res => {
+                let arr;
+                if (active == 'a') arr = await app.$get(`/courtAdmin/api/match`, { status: '1' });
+                else if (active == 'b') arr = await app.$get(`/courtAdmin/api/matchteam`, { create_id: res.data._id });
+                if (arr.errcode == '0') that.setData({ aList: arr.data });
+            },
+            fail: res => {
+                wx.redirectTo({ url: '/pages/index/index', })
+            }
+        })
+    },
+    // 计算高度
+    searchHeight: function () {
+        let frameStyle = this.data.frameStyle;
+        let client = app.globalData.client;
+        let infoHeight = client.windowHeight;
+        // 是否去掉状态栏
+        if (frameStyle.useTop) infoHeight = infoHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
+        // 是否减去底部菜单
+        if (frameStyle.useBar) infoHeight = infoHeight - 50;
+        if (infoHeight) this.setData({ infoHeight: infoHeight })
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 7 - 0
pages/matchteam/index.json

@@ -0,0 +1,7 @@
+{
+    "component": true,
+    "usingComponents": {
+        "mobile-main": "/commpents/mobile-frame/mobile-main",
+        "e-tabs": "/commpents/tabs/index"
+    }
+}

+ 30 - 0
pages/matchteam/index.wxml

@@ -0,0 +1,30 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back" bind:tabPath="tabPath">
+    <view slot="info" class="main" style="height:{{infoHeight}}px;">
+        <view class="one">
+            <e-tabs tabs="{{tabs}}" bind:tabsChange="tabsChange"></e-tabs>
+            <view wx:if="{{tabs.active=='a'}}" class="a">
+                <view class="alist" wx:for="{{aList}}" wx:key="item">
+                    <view class="name textOver">{{item.name}}</view>
+                    <view class="other">
+                        <view class="otherInfo">比赛时间:<text>{{item.match_time}}</text></view>
+                        <view class="otherInfo">比赛地点:<text>{{item.address}}</text></view>
+                        <view class="otherInfo">状态:<text>{{statusList[item.status].value}}</text></view>
+                    </view>
+                    <view class="btn">
+                        <button type="default" size="mini" bindtap="toView" data-id="{{item._id}}">查看</button>
+                        <button type="primary" size="mini" bindtap="toJoin" data-id="{{item._id}}">报名</button>
+                    </view>
+                </view>
+            </view>
+            <view wx:elif="{{tabs.active=='b'}}" class="a">
+                <view class="alist" wx:for="{{aList}}" wx:key="item">
+                    <view class="name textOver">{{item.match_name}}</view>
+                    <view class="other">
+                        <view class="otherInfo">申请时间:<text>{{item.apply_time}}</text></view>
+                        <view class="otherInfo">状态:<text>{{cstatusList[item.status].value}}</text></view>
+                    </view>
+                </view>
+            </view>
+        </view>
+    </view>
+</mobile-main>

+ 63 - 0
pages/matchteam/index.wxss

@@ -0,0 +1,63 @@
+.main {
+    position: relative;
+    width: 100%;
+}
+
+.main .one {
+    float: left;
+    width: 100%;
+}
+
+.main .one .a {
+    float: left;
+    width: 95%;
+    padding: 10px;
+}
+
+.main .one .a .alist {
+    float: left;
+    width: 95%;
+    background-color: #ffffff;
+    padding: 10px;
+    margin: 0 0 10px 0;
+    border-radius: 5px;
+}
+
+.main .one .a .alist .name {
+    float: left;
+    width: 100%;
+    font-size: 16px;
+    font-weight: bold;
+    margin: 0 0 5px 0;
+}
+
+.main .one .a .alist .other {
+    float: left;
+    width: 100%;
+    margin: 0 0 5px 0;
+}
+
+.main .one .a .alist .other .otherInfo {
+    float: left;
+    width: 100%;
+    font-size: 14px;
+    color: #666;
+    margin: 0 0 5px 0;
+}
+
+.main .one .a .alist .other .otherInfo text {
+    color: #000;
+}
+
+.main .one .a .alist .btn {
+    float: left;
+    width: 100%;
+    text-align: center;
+}
+
+.main .one .a .alist .btn button {
+    font-size: 14px;
+    padding: 0 10px;
+    margin: 0 10px;
+}
+

+ 107 - 116
pages/search/index.js

@@ -1,136 +1,127 @@
+// pages/login/login.js
+import WxValidate from '../../utils/wxValidate';
+import { match_status } from '../../utils/dict';
 const app = getApp()
 Page({
 
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    frameStyle: { useTop: true, name: '查询比赛', leftArrow: false, useBar: true },
-    // 主体高度
-    infoHeight: '',
-    currentTab: 0,
-    list: []
-  },
-  back: function () {
-    wx.navigateBack({ url: '/pages/home/index' })
-  },
-  tabPath: function (e) {
-    let { route } = e.detail.detail;
-    if (route) wx.redirectTo({ url: `/${route}` })
-  },
-  //点击切换
-  clickTab: function (e) {
-    const that = this;
-    if (that.data.currentTab === e.target.dataset.current) return false;
-    else that.setData({ currentTab: e.target.dataset.current });
-    that.watchLogin();
-  },
-  // 开启左右滑动
-  bindchange: function (e) {
-    var that = this
-    const { current, source } = e.detail;
-    if (source) that.setData({ currentTab: current });
-    else return false;
-    that.watchLogin();
-  },
-  // 查看详情
-  toView: function (e) {
-    console.log(e);
-  },
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    // 计算高度
-    this.searchHeight();
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        frameStyle: { useTop: true, name: '查询比赛', leftArrow: false, useBar: true },
+        // 主体高度
+        infoHeight: '',
+        // 选项卡
+        tabs: { active: 'a', list: [{ title: '待参加', name: 'a' }, { title: '历史比赛', name: 'b' }] },
+        // 待参加,
+        aList: [],
+        // 历史比赛
+        bList: [],
+        statusList: match_status,
+    },
+    back: function () {
+        wx.navigateBack({ url: '/pages/home/index' })
+    },
+    tabPath: function (e) {
+        let { route } = e.detail.detail;
+        if (route) wx.redirectTo({ url: `/${route}` });
+    },
+    // 选项卡
+    tabsChange: function (e) {
+        const that = this;
+        that.setData({ 'tabs.active': e.detail.name });
+        that.watchLogin();
+    },
+    // 查看
+    toView: function (e) {
+        const { id } = e.currentTarget.dataset;
+        wx.navigateTo({ url: `/pages/match/info?id=${id}` })
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+        // 计算高度
+        this.searchHeight();
+        // 监听用户是否登录
+        this.watchLogin();
+    },
     // 监听用户是否登录
-    this.watchLogin();
-  },
-  // 监听用户是否登录
-  watchLogin: function () {
-    const that = this;
-    let type = that.data.currentTab;
-    let status = type == '0' ? 2 : 4;
-    wx.getStorage({
-      key: 'token',
-      success: res => {
-        wx.request({
-          url: `${app.globalData.publicUrl}/courtAdmin/api/match`, //接口地址
-          method: 'get',
-          // data: { status: status },
-          data: {},
-          success(res) {
-            if (res.data.errcode == 0) {
-              that.setData({ list: res.data.data })
-            } else {
-              wx.showToast({ title: res.data.errmsg, icon: 'error', duration: 2000 })
+    watchLogin: function () {
+        const that = this;
+        const { active } = that.data.tabs;
+        let status = active == 'a' ? '1' : '4';
+        wx.getStorage({
+            key: 'token',
+            success: async res => {
+                const arr = await app.$get(`/courtAdmin/api/match`, { status: status });
+                if (arr.errcode == '0') {
+                    if (active == 'a') that.setData({ aList: arr.data })
+                    else if (active == 'b') that.setData({ bList: arr.data })
+                }
+            },
+            fail: res => {
+                wx.redirectTo({ url: '/pages/index/index', })
             }
-          }
         })
-      },
-      fail: res => {
-        wx.redirectTo({ url: '/pages/index/index', })
-      }
-    })
-  },
-  // 计算高度
-  searchHeight: function () {
-    let frameStyle = this.data.frameStyle;
-    let client = app.globalData.client;
-    let infoHeight = client.windowHeight;
-    // 是否去掉状态栏
-    if (frameStyle.useTop) infoHeight = infoHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
-    // 是否减去底部菜单
-    if (frameStyle.useBar) infoHeight = infoHeight - 50;
-    if (infoHeight) this.setData({ infoHeight: infoHeight })
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
+    },
+    // 计算高度
+    searchHeight: function () {
+        let frameStyle = this.data.frameStyle;
+        let client = app.globalData.client;
+        let infoHeight = client.windowHeight;
+        // 是否去掉状态栏
+        if (frameStyle.useTop) infoHeight = infoHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
+        // 是否减去底部菜单
+        if (frameStyle.useBar) infoHeight = infoHeight - 50;
+        if (infoHeight) this.setData({ infoHeight: infoHeight })
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
 
-  },
+    },
 
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
 
-  },
+    },
 
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
 
-  },
+    },
 
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
 
-  },
+    },
 
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
 
-  },
+    },
 
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
 
-  },
+    },
 
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
 
-  }
+    }
 })

+ 5 - 4
pages/search/index.json

@@ -1,6 +1,7 @@
 {
-  "component": true,
-  "usingComponents": {
-    "mobile-main": "/commpents/mobile-frame/mobile-main"
-  }
+    "component": true,
+    "usingComponents": {
+        "mobile-main": "/commpents/mobile-frame/mobile-main",
+        "e-tabs": "/commpents/tabs/index"
+    }
 }

+ 22 - 35
pages/search/index.wxml

@@ -1,40 +1,27 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back" bind:tabPath="tabPath">
-  <view slot="info" class="main" style="height:{{infoHeight}}px;">
-    <view class="one">
-      <view class="swiper-tab">
-        <view class="swiper-tab-item {{currentTab==0?'active':''}}" data-current="0" bindtap="clickTab">待参加
-          <view class="border" wx:if="{{currentTab=='0'}}">—</view>
-        </view>
-        <view class="swiper-tab-item {{currentTab==1?'active':''}}" data-current="1" bindtap="clickTab">历史比赛
-          <view class="border" wx:if="{{currentTab=='1'}}">—</view>
-        </view>
-      </view>
-      <swiper current="{{currentTab}}" class="swiper" style="height:{{infoHeight-40}}px;" bindchange="bindchange">
-        <swiper-item class="swiper-items">
-          <scroll-view scroll-x="false" scroll-y="true" class='scroll-views'>
-            <view class="list" wx:for="{{list}}" wx:key="item">
-              <view class="list_1 textOver" bindtap="toView" data-id="{{item._id}}">
-                <text>{{item.name}}</text>
-                <text class="color{{item.status}}">{{item.status=='0'?'未开始':item.status=='1'?'报名中':item.status=='2'?'待比赛':item.status=='3'?'进行中':'已结束'}}</text>
-              </view>
-              <view class="list_2 textOver">{{item.match_time}}</view>
-              <view class="list_3 textOver">{{item.address}}</view>
+    <view slot="info" class="main" style="height:{{infoHeight}}px;">
+        <view class="one">
+            <e-tabs tabs="{{tabs}}" bind:tabsChange="tabsChange"></e-tabs>
+            <view wx:if="{{tabs.active=='a'}}" class="a">
+                <view class="alist" wx:for="{{aList}}" wx:key="item" bindtap="toView" data-id="{{item._id}}">
+                    <view class="name textOver">{{item.name}}</view>
+                    <view class="other">
+                        <view class="otherInfo">比赛时间:<text>{{item.match_time}}</text></view>
+                        <view class="otherInfo">比赛地点:<text>{{item.address}}</text></view>
+                        <view class="otherInfo">状态:<text>{{statusList[item.status].value}}</text></view>
+                    </view>
+                </view>
             </view>
-          </scroll-view>
-        </swiper-item>
-        <swiper-item class="swiper-items">
-          <scroll-view scroll-x="false" scroll-y="true" class='scroll-views'>
-            <view class="list" wx:for="{{list}}" wx:key="item">
-              <view class="list_1 textOver" bindtap="toView" data-id="{{item._id}}">
-                <text>{{item.name}}</text>
-                <text class="color{{item.status}}">{{item.status=='0'?'未开始':item.status=='1'?'报名中':item.status=='2'?'待比赛':item.status=='3'?'进行中':'已结束'}}</text>
-              </view>
-              <view class="list_2 textOver">{{item.match_time}}</view>
-              <view class="list_3 textOver">{{item.address}}</view>
+            <view wx:elif="{{tabs.active=='b'}}" class="a">
+                <view class="alist" wx:for="{{bList}}" wx:key="item" bindtap="toView" data-id="{{item._id}}">
+                    <view class="name textOver">{{item.name}}</view>
+                    <view class="other">
+                        <view class="otherInfo">比赛时间:<text>{{item.match_time}}</text></view>
+                        <view class="otherInfo">比赛地点:<text>{{item.address}}</text></view>
+                        <view class="otherInfo">状态:<text>{{statusList[item.status].value}}</text></view>
+                    </view>
+                </view>
             </view>
-          </scroll-view>
-        </swiper-item>
-      </swiper>
+        </view>
     </view>
-  </view>
 </mobile-main>

+ 33 - 83
pages/search/index.wxss

@@ -1,100 +1,50 @@
 .main {
-  position: relative;
-  width: 100%;
+    position: relative;
+    width: 100%;
 }
 
 .main .one {
-  float: left;
-  width: 100%;
+    float: left;
+    width: 100%;
 }
 
-.main .one .swiper-tab {
-  float: left;
-  width: 100%;
-  background-color: #ffffff;
+.main .one .a {
+    float: left;
+    width: 95%;
+    padding: 10px;
 }
 
-.main .one .swiper-tab-item {
-  float: left;
-  width: 50%;
-  height: 40px;
-  line-height: 25px;
-  text-align: center;
-  color: #666666;
+.main .one .a .alist {
+    float: left;
+    width: 95%;
+    background-color: #ffffff;
+    padding: 10px;
+    margin: 0 0 10px 0;
+    border-radius: 5px;
 }
 
-.main .one .active {
-  color: #000000;
-  font-weight: bold;
+.main .one .a .alist .name {
+    float: left;
+    width: 100%;
+    font-size: 16px;
+    font-weight: bold;
+    margin: 0 0 5px 0;
 }
 
-.main .one .active .border {
-  color: #0057a3;
-  font-weight: bolder;
+.main .one .a .alist .other {
+    float: left;
+    width: 100%;
+    margin: 0 0 5px 0;
 }
 
-.main .one .swiper {
-  float: left;
-  width: 100%;
+.main .one .a .alist .other .otherInfo {
+    float: left;
+    width: 100%;
+    font-size: 14px;
+    color: #666;
+    margin: 0 0 5px 0;
 }
 
-
-
-.main .one .swiper .list {
-  float: left;
-  width: 95%;
-  border-radius: 5px;
-  background-color: #ffffff;
-  margin: 0 0 10px 0;
-  padding: 10px;
-}
-
-.main .one .swiper .list .list_1 {
-  float: left;
-  width: 100%;
-  margin: 0 0 5px 0;
-}
-
-.main .one .swiper .list .list_1 text:nth-child(1) {
-  font-size: 16px;
-  font-weight: bold;
-  color: #263fa3;
-}
-
-.main .one .swiper .list .list_1 text:nth-child(2) {
-  display: inline-block;
-  background-color: #7b7b7b;
-  color: #fff;
-  padding: 3px 6px;
-  border-radius: 90px;
-  font-size: 12px;
-  margin: 0 0 0 10px;
-}
-
-.main .one .swiper .list .list_1 .color1 {
-  background-color: #57cd00 !important;
-}
-
-.main .one .swiper .list .list_1 .color2 {
-  background-color: #ff5a00 !important;
-}
-
-.main .one .swiper .list .list_1 .color3 {
-  background-color: #ffa200 !important;
-}
-
-.main .one .swiper .list .list_2 {
-  float: left;
-  width: 100%;
-  font-size: 14px;
-  color: #666;
-  margin: 0 0 5px 0;
-
-}
-
-.main .one .swiper .list .list_3 {
-  float: left;
-  width: 100%;
-  font-size: 14px;
-  color: #666;
+.main .one .a .alist .other .otherInfo text {
+    color: #000;
 }