zs 1 tahun lalu
induk
melakukan
80b881a363

+ 0 - 1
pagesCommon/login/index.js

@@ -23,7 +23,6 @@ Page({
     },
     // 提交登录
     onSubmit: async function (e) {
-        const that = this;
         const params = e.detail.value;
         if (!this.WxValidate.checkForm(params)) {
             const error = this.WxValidate.errorList[0];

+ 43 - 43
pagesHome/home/index.js

@@ -35,43 +35,6 @@ Page({
         that.clearPage();
         that.search()
     },
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    async onLoad(options) {
-        const that = this;
-        wx.showLoading({ title: '加载中', mask: true })
-        await that.searchUser()
-        await that.searchOther()
-        await that.search()
-        wx.hideLoading()
-    },
-    async searchUser() {
-        const that = this;
-        wx.getStorage({
-            key: 'token',
-            async success(res) {
-                that.setData({ user: res.data })
-            },
-            fail(err) {
-                console.log(err);
-            }
-        })
-    },
-    // 查询通知
-    async search() {
-        const that = this;
-        let info = { skip: that.data.skip, limit: that.data.limit, status: '2' };
-        let res = await app.$api('match', 'GET', { ...info, ...that.data.searchInfo })
-        if (res.errcode == '0') {
-            let list = [...that.data.list, ...res.data]
-            for (const val of list) {
-                val.status_name = that.getDict(val.status, 'status')
-            }
-            that.setData({ list })
-            that.setData({ total: res.total })
-        }
-    },
     // 分页-触底
     toLower() {
         const that = this;
@@ -104,6 +67,37 @@ Page({
             }
         }
     },
+    // 清空列表
+    clearPage() {
+        const that = this;
+        that.setData({ list: [] })
+        that.setData({ skip: 0 })
+        that.setData({ limit: 5 })
+        that.setData({ total: 0 })
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    async onLoad(options) {
+        const that = this;
+        wx.showLoading({ title: '加载中', mask: true })
+        await that.searchUser()
+        await that.searchOther()
+        await that.search()
+        wx.hideLoading()
+    },
+    async searchUser() {
+        const that = this;
+        wx.getStorage({
+            key: 'token',
+            async success(res) {
+                that.setData({ user: res.data })
+            },
+            fail(err) {
+                console.log(err);
+            }
+        })
+    },
     // 查询其他信息
     async searchOther() {
         const that = this;
@@ -111,13 +105,19 @@ Page({
         res = await app.$api('dictData', 'GET', { type: 'match_status', is_use: '0' })
         if (res.errcode == '0') that.setData({ statusList: res.data })
     },
-    // 清空列表
-    clearPage() {
+    // 查询通知
+    async search() {
         const that = this;
-        that.setData({ list: [] })
-        that.setData({ skip: 0 })
-        that.setData({ limit: 5 })
-        that.setData({ total: 0 })
+        let info = { skip: that.data.skip, limit: that.data.limit, status: '2' };
+        let res = await app.$api('match', 'GET', { ...info, ...that.data.searchInfo })
+        if (res.errcode == '0') {
+            let list = [...that.data.list, ...res.data]
+            for (const val of list) {
+                val.status_name = that.getDict(val.status, 'status')
+            }
+            that.setData({ list })
+            that.setData({ total: res.total })
+        }
     },
     /**
      * 生命周期函数--监听页面初次渲染完成

+ 1 - 6
pagesMatch/apply/index.js

@@ -1,5 +1,4 @@
 const app = getApp()
-const moment = require("../../utils/moment.min");
 Page({
     data: {
         id: "",
@@ -11,11 +10,7 @@ Page({
     // 报名
     async toAdd() {
         const that = this;
-        if (that.data.user._id) {
-            wx.navigateTo({ url: '/pagesMatch/enroll/index?match=' + that.data.info._id })
-        } else {
-            wx.navigateTo({ url: '/pagesCommon/login/index' })
-        }
+        if (that.data.user._id) wx.navigateTo({ url: '/pagesMatch/enroll/index?match=' + that.data.info._id }); else wx.navigateTo({ url: '/pagesCommon/login/index' })
     },
     // 排名
     toRank() {

+ 44 - 44
pagesMatch/enroll/index.js

@@ -19,50 +19,6 @@ Page({
         member: '',
         memberList: []
     },
-    initValidate() {
-        const rules = { match_name: { required: true }, team_name: { required: true } }
-        const messages = { match_name: { required: '请输入比赛名称' }, team_name: { required: '请输入团队名称' } };
-        this.WxValidate = new WxValidate(rules, messages)
-    },
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    async onLoad(options) {
-        const that = this;
-        if (options.id) that.setData({ disabled: true });
-        that.setData({ match_id: options.match, id: options.id });
-        wx.showLoading({ title: '加载中', mask: true })
-        //验证规则函数
-        that.initValidate();
-        await that.searchOther()
-        await that.search()
-        wx.hideLoading()
-    },
-    search() {
-        const that = this;
-        wx.getStorage({
-            key: 'token',
-            async success(res) {
-                that.setData({ user: res.data })
-                if (that.data.id) {
-                    let arr = await app.$api(`application/${that.data.id}`, 'GET', {})
-                    if (arr.errcode == '0') {
-                        let data = that.data.teamList.find(i => i._id == arr.data.team_id);
-                        if (data) that.setData({ userList: data.member })
-                        that.setData({ form: arr.data, memberList: arr.data.user_id })
-                    }
-                } else {
-                    let aee = await app.$api(`match/${that.data.match_id}`, 'GET', {})
-                    if (aee.errcode == '0') {
-                        that.setData({ 'form.match_id': aee.data._id, 'form.match_name': aee.data.name })
-                    }
-                }
-            },
-            fail(err) {
-                console.log(err);
-            }
-        })
-    },
     // 过滤字典表
     getDict(value, model) {
         const that = this;
@@ -136,6 +92,25 @@ Page({
             }
         }
     },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    async onLoad(options) {
+        const that = this;
+        if (options.id) that.setData({ disabled: true });
+        that.setData({ match_id: options.match, id: options.id });
+        wx.showLoading({ title: '加载中', mask: true })
+        //验证规则函数
+        that.initValidate();
+        await that.searchOther()
+        await that.search()
+        wx.hideLoading()
+    },
+    initValidate() {
+        const rules = { match_name: { required: true }, team_name: { required: true } }
+        const messages = { match_name: { required: '请输入比赛名称' }, team_name: { required: '请输入团队名称' } };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
     // 查询其他信息
     async searchOther() {
         const that = this;
@@ -144,6 +119,31 @@ Page({
         res = await app.$api('team', 'GET', { administrator: that.data.user._id, status: '1' })
         if (res.errcode == '0') that.setData({ teamList: res.data })
     },
+    search() {
+        const that = this;
+        wx.getStorage({
+            key: 'token',
+            async success(res) {
+                that.setData({ user: res.data })
+                if (that.data.id) {
+                    let arr = await app.$api(`application/${that.data.id}`, 'GET', {})
+                    if (arr.errcode == '0') {
+                        let data = that.data.teamList.find(i => i._id == arr.data.team_id);
+                        if (data) that.setData({ userList: data.member })
+                        that.setData({ form: arr.data, memberList: arr.data.user_id })
+                    }
+                } else {
+                    let aee = await app.$api(`match/${that.data.match_id}`, 'GET', {})
+                    if (aee.errcode == '0') {
+                        that.setData({ 'form.match_id': aee.data._id, 'form.match_name': aee.data.name })
+                    }
+                }
+            },
+            fail(err) {
+                console.log(err);
+            }
+        })
+    },
 
     /**
      * 生命周期函数--监听页面初次渲染完成

+ 46 - 46
pagesMatch/home/index.js

@@ -55,46 +55,6 @@ Page({
         that.clearPage();
         that.search()
     },
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    async onLoad(options) {
-        const that = this;
-        wx.showLoading({ title: '加载中', mask: true })
-        await that.searchUser()
-        await that.searchOther()
-        await that.search()
-        wx.hideLoading()
-    },
-    async searchUser() {
-        const that = this;
-        wx.getStorage({
-            key: 'token',
-            async success(res) {
-                that.setData({ user: res.data })
-            },
-            fail(err) {
-                console.log(err);
-            }
-        })
-    },
-    // 查询通知
-    async search() {
-        const that = this;
-        let status = ''
-        if (that.data.active == 3) status = '-1'
-        else status = that.data.active
-        let info = { skip: that.data.skip, limit: that.data.limit, status: status };
-        let res = await app.$api('match', 'GET', { ...info, ...that.data.searchInfo })
-        if (res.errcode == '0') {
-            let list = [...that.data.list, ...res.data]
-            for (const val of list) {
-                val.status_name = that.getDict(val.status, 'status')
-            }
-            that.setData({ list })
-            that.setData({ total: res.total })
-        }
-    },
     // 分页-触底
     toLower() {
         const that = this;
@@ -127,6 +87,37 @@ Page({
             }
         }
     },
+    // 清空列表
+    clearPage() {
+        const that = this;
+        that.setData({ list: [] })
+        that.setData({ skip: 0 })
+        that.setData({ limit: 5 })
+        that.setData({ total: 0 })
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    async onLoad(options) {
+        const that = this;
+        wx.showLoading({ title: '加载中', mask: true })
+        await that.searchUser()
+        await that.searchOther()
+        await that.search()
+        wx.hideLoading()
+    },
+    async searchUser() {
+        const that = this;
+        wx.getStorage({
+            key: 'token',
+            async success(res) {
+                that.setData({ user: res.data })
+            },
+            fail(err) {
+                console.log(err);
+            }
+        })
+    },
     // 查询其他信息
     async searchOther() {
         const that = this;
@@ -134,13 +125,22 @@ Page({
         res = await app.$api('dictData', 'GET', { type: 'match_status', is_use: '0' })
         if (res.errcode == '0') that.setData({ statusList: res.data })
     },
-    // 清空列表
-    clearPage() {
+    // 查询通知
+    async search() {
         const that = this;
-        that.setData({ list: [] })
-        that.setData({ skip: 0 })
-        that.setData({ limit: 5 })
-        that.setData({ total: 0 })
+        let status = ''
+        if (that.data.active == 3) status = '-1'
+        else status = that.data.active
+        let info = { skip: that.data.skip, limit: that.data.limit, status: status };
+        let res = await app.$api('match', 'GET', { ...info, ...that.data.searchInfo })
+        if (res.errcode == '0') {
+            let list = [...that.data.list, ...res.data]
+            for (const val of list) {
+                val.status_name = that.getDict(val.status, 'status')
+            }
+            that.setData({ list })
+            that.setData({ total: res.total })
+        }
     },
     /**
      * 生命周期函数--监听页面初次渲染完成

+ 49 - 49
pagesMy/apply/index.js

@@ -58,6 +58,46 @@ Page({
         that.clearPage();
         that.search()
     },
+    // 分页-触底
+    toLower() {
+        const that = this;
+        let list = that.data.list;
+        let limit = that.data.limit;
+        if (that.data.total > list.length) {
+            wx.showLoading({ title: '加载中', mask: true })
+            let page = that.data.page + 1;
+            that.setData({ page })
+            let skip = page * limit
+            that.setData({ skip })
+            that.search()
+            wx.hideLoading()
+        } else {
+            wx.showToast({ title: `到底了没数据了`, icon: 'none' });
+        }
+    },
+    // 分页-滚动
+    toScroll() {
+        // console.log('滚动');
+    },
+    // 字典
+    getDict(value, model) {
+        const that = this;
+        if (model == 'status') {
+            if (value) {
+                let data = that.data.statusList.find(i => i.value == value)
+                if (data) return data.label
+                else return '暂无'
+            }
+        }
+    },
+    // 清空列表
+    clearPage() {
+        const that = this;
+        that.setData({ list: [] })
+        that.setData({ skip: 0 })
+        that.setData({ limit: 5 })
+        that.setData({ total: 0 })
+    },
     /**
      * 生命周期函数--监听页面加载
      */
@@ -85,6 +125,15 @@ Page({
                 console.log(err);
             }
         })
+    },
+     // 查询其他信息
+     async searchOther() {
+        const that = this;
+        let res;
+        res = await app.$api('dictData', 'GET', { type: 'status', is_use: '0' })
+        if (res.errcode == '0') that.setData({ statusList: res.data })
+        res = await app.$api('dictData', 'GET', { type: 'gender', is_use: '0' })
+        if (res.errcode == '0') that.setData({ genderList: res.data })
     },
     // 查询通知
     async search() {
@@ -106,55 +155,6 @@ Page({
             that.setData({ total: res.total })
         }
     },
-    // 分页-触底
-    toLower() {
-        const that = this;
-        let list = that.data.list;
-        let limit = that.data.limit;
-        if (that.data.total > list.length) {
-            wx.showLoading({ title: '加载中', mask: true })
-            let page = that.data.page + 1;
-            that.setData({ page })
-            let skip = page * limit
-            that.setData({ skip })
-            that.search()
-            wx.hideLoading()
-        } else {
-            wx.showToast({ title: `到底了没数据了`, icon: 'none' });
-        }
-    },
-    // 分页-滚动
-    toScroll() {
-        // console.log('滚动');
-    },
-    // 字典
-    getDict(value, model) {
-        const that = this;
-        if (model == 'status') {
-            if (value) {
-                let data = that.data.statusList.find(i => i.value == value)
-                if (data) return data.label
-                else return '暂无'
-            }
-        }
-    },
-    // 查询其他信息
-    async searchOther() {
-        const that = this;
-        let res;
-        res = await app.$api('dictData', 'GET', { type: 'status', is_use: '0' })
-        if (res.errcode == '0') that.setData({ statusList: res.data })
-        res = await app.$api('dictData', 'GET', { type: 'gender', is_use: '0' })
-        if (res.errcode == '0') that.setData({ genderList: res.data })
-    },
-    // 清空列表
-    clearPage() {
-        const that = this;
-        that.setData({ list: [] })
-        that.setData({ skip: 0 })
-        that.setData({ limit: 5 })
-        that.setData({ total: 0 })
-    },
     /**
      * 生命周期函数--监听页面初次渲染完成
      */

+ 43 - 43
pagesMy/basic/index.js

@@ -12,48 +12,6 @@ Page({
         // 类别
         typeList: [],
     },
-    initValidate() {
-        const rules = { name: { required: true }, phone: { required: true, tel: true }, gender: { required: true }, age: { required: true } }
-        const messages = { name: { required: '请输入姓名' }, phone: { required: '请输入手机号' }, gender: { required: '请选择性别' }, age: { required: '请输入年龄' } };
-        this.WxValidate = new WxValidate(rules, messages)
-    },
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    async onLoad(options) {
-        const that = this;
-        wx.showLoading({ title: '加载中', mask: true })
-        //验证规则函数
-        that.initValidate();
-        await that.searchOther()
-        await that.search()
-        wx.hideLoading()
-    },
-    search() {
-        const that = this;
-        wx.getStorage({
-            key: 'token',
-            async success(res) {
-                let form = {}
-                let aee = await app.$api(`user/${res.data._id}`, 'GET', {})
-                if (aee.errcode == '0') {
-                    form = aee.data;
-                    if (form && form._id) {
-                        // 性别
-                        if (form.gender) form.gender_name = that.getDict(form.gender, 'gender')
-                        // 工作状态
-                        if (form.type) form.type_name = that.getDict(form.type, 'type')
-                    }
-                } else {
-                    wx.showToast({ title: `${aee.errmsg}`, icon: 'error' });
-                }
-                that.setData({ form })
-            },
-            fail(err) {
-                console.log(err);
-            }
-        })
-    },
     // 过滤字典表
     getDict(value, model) {
         const that = this;
@@ -106,6 +64,24 @@ Page({
             }
         }
     },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    async onLoad(options) {
+        const that = this;
+        wx.showLoading({ title: '加载中', mask: true })
+        //验证规则函数
+        await that.initValidate();
+        await that.searchOther()
+        await that.search()
+        wx.hideLoading()
+    },
+    initValidate() {
+        const rules = { name: { required: true }, phone: { required: true, tel: true }, gender: { required: true }, age: { required: true } }
+        const messages = { name: { required: '请输入姓名' }, phone: { required: '请输入手机号' }, gender: { required: '请选择性别' }, age: { required: '请输入年龄' } };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
     // 查询其他信息
     async searchOther() {
         const that = this;
@@ -117,7 +93,31 @@ Page({
         res = await app.$api('dictData', 'GET', { type: 'type', is_use: '0' })
         if (res.errcode == '0') that.setData({ typeList: res.data })
     },
-
+    search() {
+        const that = this;
+        wx.getStorage({
+            key: 'token',
+            async success(res) {
+                let form = {}
+                let aee = await app.$api(`user/${res.data._id}`, 'GET', {})
+                if (aee.errcode == '0') {
+                    form = aee.data;
+                    if (form && form._id) {
+                        // 性别
+                        if (form.gender) form.gender_name = that.getDict(form.gender, 'gender')
+                        // 工作状态
+                        if (form.type) form.type_name = that.getDict(form.type, 'type')
+                    }
+                } else {
+                    wx.showToast({ title: `${aee.errmsg}`, icon: 'error' });
+                }
+                that.setData({ form })
+            },
+            fail(err) {
+                console.log(err);
+            }
+        })
+    },
     /**
      * 生命周期函数--监听页面初次渲染完成
      */

+ 51 - 49
pagesMy/course/index.js

@@ -12,10 +12,50 @@ Page({
         statusList: []
     },
     // 上传比分
-    async toUpload(e) { 
+    async toUpload(e) {
         let item = e.currentTarget.dataset.item
         wx.navigateTo({ url: '/pagesMy/score/index?id=' + item._id })
     },
+    // 分页-触底
+    toLower() {
+        const that = this;
+        let list = that.data.list;
+        let limit = that.data.limit;
+        if (that.data.total > list.length) {
+            wx.showLoading({ title: '加载中', mask: true })
+            let page = that.data.page + 1;
+            that.setData({ page })
+            let skip = page * limit
+            that.setData({ skip })
+            that.search()
+            wx.hideLoading()
+        } else {
+            wx.showToast({ title: `到底了没数据了`, icon: 'none' });
+        }
+    },
+    // 分页-滚动
+    toScroll() {
+        // console.log('滚动');
+    },
+    // 字典
+    getDict(value, model) {
+        const that = this;
+        if (model == 'status') {
+            if (value) {
+                let data = that.data.statusList.find(i => i.value == value)
+                if (data) return data.label
+                else return '暂无'
+            }
+        }
+    },
+    // 清空列表
+    clearPage() {
+        const that = this;
+        that.setData({ list: [] })
+        that.setData({ skip: 0 })
+        that.setData({ limit: 5 })
+        that.setData({ total: 0 })
+    },
     /**
      * 生命周期函数--监听页面加载
      */
@@ -47,12 +87,21 @@ Page({
             }
         })
     },
+    // 查询其他信息
+    async searchOther() {
+        const that = this;
+        let res;
+        res = await app.$api('dictData', 'GET', { type: 'course_status', is_use: '0' })
+        if (res.errcode == '0') that.setData({ statusList: res.data })
+        // 查分数
+        res = await app.$api('course/ranking', 'GET', { match_id: that.data.id })
+    },
     // 查询通知
     async search() {
         const that = this;
         let info = { skip: that.data.skip, limit: that.data.limit };
         info.match_id = that.data.id
-        let res = await app.$api('course', 'GET', { ...info})
+        let res = await app.$api('course', 'GET', { ...info })
         if (res.errcode == '0') {
             let list = [...that.data.list, ...res.data]
             for (const val of list) {
@@ -62,53 +111,6 @@ Page({
             that.setData({ total: res.total })
         }
     },
-    // 分页-触底
-    toLower() {
-        const that = this;
-        let list = that.data.list;
-        let limit = that.data.limit;
-        if (that.data.total > list.length) {
-            wx.showLoading({ title: '加载中', mask: true })
-            let page = that.data.page + 1;
-            that.setData({ page })
-            let skip = page * limit
-            that.setData({ skip })
-            that.search()
-            wx.hideLoading()
-        } else {
-            wx.showToast({ title: `到底了没数据了`, icon: 'none' });
-        }
-    },
-    // 分页-滚动
-    toScroll() {
-        // console.log('滚动');
-    },
-    // 字典
-    getDict(value, model) {
-        const that = this;
-        if (model == 'status') {
-            if (value) {
-                let data = that.data.statusList.find(i => i.value == value)
-                if (data) return data.label
-                else return '暂无'
-            }
-        }
-    },
-    // 查询其他信息
-    async searchOther() {
-        const that = this;
-        let res;
-        res = await app.$api('dictData', 'GET', { type: 'course_status', is_use: '0' })
-        if (res.errcode == '0') that.setData({ statusList: res.data })
-    },
-    // 清空列表
-    clearPage() {
-        const that = this;
-        that.setData({ list: [] })
-        that.setData({ skip: 0 })
-        that.setData({ limit: 5 })
-        that.setData({ total: 0 })
-    },
     /**
      * 生命周期函数--监听页面初次渲染完成
      */

+ 1 - 1
pagesMy/course/index.wxml

@@ -16,7 +16,7 @@
                     <text class="color{{item.status}}">({{item.status_name}})</text>
                 </view>
                 <view class="button">
-                    <button wx:if="{{item.status=='1'}}" class="btn" type="primary" size="mini" data-item="{{item}}" bindtap="toUpload">
+                    <button wx:if="{{item.status=='1'&&user.type=='1'}}" class="btn" type="primary" size="mini" data-item="{{item}}" bindtap="toUpload">
                         上传比分
                     </button>
                 </view>

+ 20 - 20
pagesMy/home/index.js

@@ -66,14 +66,24 @@ Page({
             wx.navigateTo({ url: '/pagesCommon/login/index' })
         }
     },
+    // 过滤字典表
+    getDict(value, model) {
+        const that = this;
+        if (value) {
+            let list = that.data.statusList
+            let data = list.find(i => i.value == value);
+            if (data) return data.label
+            else return '暂无'
+        }
+    },
     /**
      * 生命周期函数--监听页面加载
      */
     async onLoad(options) {
         const that = this;
         wx.showLoading({ title: '加载中', mask: true })
-        await that.searchOther();
         await that.searchConfig();
+        await that.searchOther();
         await that.search()
         wx.hideLoading()
     },
@@ -93,6 +103,14 @@ Page({
             }
         })
     },
+    // 查询其他信息
+    async searchOther() {
+        const that = this;
+        let res;
+        // 状态
+        res = await app.$api(`dictData`, 'GET', { type: 'status', is_use: '0' });
+        if (res.errcode == '0') that.setData({ statusList: res.data })
+    },
     async search() {
         const that = this;
         wx.getStorage({
@@ -114,28 +132,10 @@ Page({
                 }
             },
             fail(err) {
-               console.log(err);
+                console.log(err);
             }
         })
     },
-    // 过滤字典表
-    getDict(value, model) {
-        const that = this;
-        if (value) {
-            let list = that.data.statusList
-            let data = list.find(i => i.value == value);
-            if (data) return data.label
-            else return '暂无'
-        }
-    },
-    // 查询其他信息
-    async searchOther() {
-        const that = this;
-        let res;
-        // 状态
-        res = await app.$api(`dictData`, 'GET', { type: 'status', is_use: '0' });
-        if (res.errcode == '0') that.setData({ statusList: res.data })
-    },
 
     /**
      * 生命周期函数--监听页面初次渲染完成

+ 47 - 47
pagesMy/match/index.js

@@ -37,6 +37,46 @@ Page({
     toEdit(e) {
         let item = e.currentTarget.dataset.item
         wx.navigateTo({ url: '/pagesMatch/enroll/index?id=' + item._id })
+    },
+      // 分页-触底
+      toLower() {
+        const that = this;
+        let list = that.data.list;
+        let limit = that.data.limit;
+        if (that.data.total > list.length) {
+            wx.showLoading({ title: '加载中', mask: true })
+            let page = that.data.page + 1;
+            that.setData({ page })
+            let skip = page * limit
+            that.setData({ skip })
+            that.search()
+            wx.hideLoading()
+        } else {
+            wx.showToast({ title: `到底了没数据了`, icon: 'none' });
+        }
+    },
+    // 分页-滚动
+    toScroll() {
+        // console.log('滚动');
+    },
+    // 字典
+    getDict(value, model) {
+        const that = this;
+        if (model == 'status') {
+            if (value) {
+                let data = that.data.statusList.find(i => i.value == value)
+                if (data) return data.label
+                else return '暂无'
+            }
+        }
+    },
+    // 清空列表
+    clearPage() {
+        const that = this;
+        that.setData({ list: [] })
+        that.setData({ skip: 0 })
+        that.setData({ limit: 5 })
+        that.setData({ total: 0 })
     },
     /**
      * 生命周期函数--监听页面加载
@@ -68,6 +108,13 @@ Page({
             }
         })
     },
+    // 查询其他信息
+    async searchOther() {
+        const that = this;
+        let res;
+        res = await app.$api('dictData', 'GET', { type: 'status', is_use: '0' })
+        if (res.errcode == '0') that.setData({ statusList: res.data })
+    },
     // 查询通知
     async search() {
         const that = this;
@@ -83,53 +130,6 @@ Page({
             that.setData({ total: res.total })
         }
     },
-    // 分页-触底
-    toLower() {
-        const that = this;
-        let list = that.data.list;
-        let limit = that.data.limit;
-        if (that.data.total > list.length) {
-            wx.showLoading({ title: '加载中', mask: true })
-            let page = that.data.page + 1;
-            that.setData({ page })
-            let skip = page * limit
-            that.setData({ skip })
-            that.search()
-            wx.hideLoading()
-        } else {
-            wx.showToast({ title: `到底了没数据了`, icon: 'none' });
-        }
-    },
-    // 分页-滚动
-    toScroll() {
-        // console.log('滚动');
-    },
-    // 字典
-    getDict(value, model) {
-        const that = this;
-        if (model == 'status') {
-            if (value) {
-                let data = that.data.statusList.find(i => i.value == value)
-                if (data) return data.label
-                else return '暂无'
-            }
-        }
-    },
-    // 查询其他信息
-    async searchOther() {
-        const that = this;
-        let res;
-        res = await app.$api('dictData', 'GET', { type: 'status', is_use: '0' })
-        if (res.errcode == '0') that.setData({ statusList: res.data })
-    },
-    // 清空列表
-    clearPage() {
-        const that = this;
-        that.setData({ list: [] })
-        that.setData({ skip: 0 })
-        that.setData({ limit: 5 })
-        that.setData({ total: 0 })
-    },
     /**
      * 生命周期函数--监听页面初次渲染完成
      */

+ 2 - 1
pagesMy/ranking/index.wxml

@@ -3,7 +3,8 @@
         <scroll-view class="scroll-view" scroll-y="true">
             <view class="list" wx:for="{{list}}" wx:key="index" wx:for-item="item">
                 <view class="list_1">
-                    <view class="left textOver">{{item.name||'暂无团队名称'}} </view>
+                    <view class="left textOver">{{index + 1}}</view>
+                    <view class="center textOver">{{item.name||'暂无团队名称'}} </view>
                     <view class="right textOver">{{item.score||'暂无分数'}}分</view>
                 </view>
             </view>

+ 10 - 1
pagesMy/ranking/index.wxss

@@ -22,6 +22,7 @@
 .main .one .list .list_1 {
     display: flex;
     justify-content: space-between;
+    align-items: center;
     padding: 1vw 0;
     font-weight: bold;
     font-size: 18px;
@@ -30,7 +31,15 @@
 }
 
 .main .one .list .list_1 .left {
-    padding: 0 2vw;
+    margin: 0 2vw;
+    padding: 0.5vw 2vw;
+    border: 2px solid var(--rgb3AB);
+    border-radius: 100rpx;
+    font-size: 16px;
+}
+
+.main .one .list .list_1 .center {
+    flex-grow: 1;
 }
 
 .main .one .list .list_1 .right {

+ 77 - 49
pagesMy/score/index.js

@@ -6,62 +6,41 @@ Page({
      * 页面的初始数据
      */
     data: {
-        id: {},
+        id: '',
         form: {},
-        // 性别
-        genderList: [],
+        // 胜者
+        winnerList: [],
         // 状态
         statusList: [],
+        userList: []
     },
-    initValidate() {
-        const rules = { red_score: { required: true }, blue_score: { required: true }, status: { required: true } }
-        const messages = { red_score: { required: '请输入红方比分' }, blue_score: { required: '请输入蓝方比分' }, status: { required: '请选择状态' } };
-        this.WxValidate = new WxValidate(rules, messages)
-    },
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    async onLoad(options) {
+    // 选择胜者
+    winnerChange(e) {
         const that = this;
-        that.setData({ id: options.id });
-        wx.showLoading({ title: '加载中', mask: true })
-        //验证规则函数
-        that.initValidate();
-        await that.searchOther()
-        await that.search()
-        wx.hideLoading()
-    },
-    search() {
-        const that = this;
-        wx.getStorage({
-            key: 'token',
-            async success(res) {
-                let form = {}
-                let aee = await app.$api(`course/${that.data.id}`, 'GET', {})
-                if (aee.errcode == '0') {
-                    form = aee.data;
-                    if (form && form._id) {
-                        // 状态
-                        if (form.status) form.status_name = that.getDict(form.status, 'status')
-                    }
-                } else {
-                    wx.showToast({ title: `${aee.errmsg}`, icon: 'error' });
-                }
-                that.setData({ form })
-            },
-            fail(err) {
-                console.log(err);
-            }
-        })
+        const index = e.detail.value;
+        let data = that.data.winnerList[index];
+        if (data) {
+            that.setData({ 'form.winner': data._id })
+            that.setData({ 'form.winner_name': data.name })
+        }
     },
     // 过滤字典表
     getDict(value, model) {
         const that = this;
-        if (value) {
-            let list = that.data[model + 'List']
-            let data = list.find(i => i.value == value);
-            if (data) return data.label
-            else return '暂无'
+        if (model == 'winner') {
+            if (value) {
+                let list = that.data[model + 'List']
+                let data = list.find(i => i._id == value);
+                if (data) return data.name
+                else return '暂无'
+            }
+        } else {
+            if (value) {
+                let list = that.data[model + 'List']
+                let data = list.find(i => i.value == value);
+                if (data) return data.label
+                else return '暂无'
+            }
         }
     },
     // 选择状态
@@ -96,15 +75,64 @@ Page({
             }
         }
     },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    async onLoad(options) {
+        const that = this;
+        that.setData({ id: options.id });
+        wx.showLoading({ title: '加载中', mask: true })
+        //验证规则函数
+        that.initValidate();
+        await that.searchOther()
+        await that.search()
+        wx.hideLoading()
+    },
+    initValidate() {
+        const rules = { red_score: { required: true }, blue_score: { required: true }, status: { required: true } }
+        const messages = { red_score: { required: '请输入红方比分' }, blue_score: { required: '请输入蓝方比分' }, status: { required: '请选择状态' } };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
     // 查询其他信息
     async searchOther() {
         const that = this;
         let res;
-        // 性别
+        // 状态
         res = await app.$api('dictData', 'GET', { type: 'course_status', is_use: '0' })
         if (res.errcode == '0') that.setData({ statusList: res.data })
+        // 团队
+        res = await app.$api('team', 'GET', { status: '1' })
+        if (res.errcode == '0') that.setData({ userList: res.data })
+    },
+    search() {
+        const that = this;
+        wx.getStorage({
+            key: 'token',
+            async success(res) {
+                let form = {}
+                let aee = await app.$api(`course/${that.data.id}`, 'GET', {})
+                if (aee.errcode == '0') {
+                    form = aee.data;
+                    if (form && form._id) {
+                        const red = that.data.userList.filter(i => i._id == form.red_team_id)
+                        const blue = that.data.userList.filter(i => i._id == form.blue_team_id)
+                        that.setData({ winnerList: [...red, ...blue] })
+                        // 状态
+                        if (form.status) form.status_name = that.getDict(form.status, 'status')
+                        // 胜者
+                        if (form.winner) form.winner_name = that.getDict(form.winner, 'winner')
+                    }
+                } else {
+                    wx.showToast({ title: `${aee.errmsg}`, icon: 'error' });
+                }
+                that.setData({ form })
+            },
+            fail(err) {
+                console.log(err);
+            }
+        })
     },
-
     /**
      * 生命周期函数--监听页面初次渲染完成
      */

+ 12 - 0
pagesMy/score/index.wxml

@@ -34,6 +34,18 @@
                         <input value="{{form.blue_score}}" name="blue_score" type="text" placeholder="" />
                     </view>
                 </view>
+                <view class="info_1">
+                    <view class="label">
+                        胜者:
+                    </view>
+                    <view class="value">
+                        <picker bindchange="winnerChange" value="{{form.winner}}" name="winner" range="{{winnerList}}" range-key='name'>
+                            <view class="picker">
+                                {{form.winner_name||''}}
+                            </view>
+                        </picker>
+                    </view>
+                </view>
                 <view class="info_1">
                     <view class="label">
                         状态:

+ 47 - 47
pagesMy/team/index.js

@@ -37,6 +37,46 @@ Page({
         let item = e.currentTarget.dataset.item
         wx.navigateTo({ url: '/pagesMy/teamCreate/index?id=' + item._id })
     },
+    // 分页-触底
+    toLower() {
+        const that = this;
+        let list = that.data.list;
+        let limit = that.data.limit;
+        if (that.data.total > list.length) {
+            wx.showLoading({ title: '加载中', mask: true })
+            let page = that.data.page + 1;
+            that.setData({ page })
+            let skip = page * limit
+            that.setData({ skip })
+            that.search()
+            wx.hideLoading()
+        } else {
+            wx.showToast({ title: `到底了没数据了`, icon: 'none' });
+        }
+    },
+    // 分页-滚动
+    toScroll() {
+        // console.log('滚动');
+    },
+    // 字典
+    getDict(value, model) {
+        const that = this;
+        if (model == 'status') {
+            if (value) {
+                let data = that.data.statusList.find(i => i.value == value)
+                if (data) return data.label
+                else return '暂无'
+            }
+        }
+    },
+    // 清空列表
+    clearPage() {
+        const that = this;
+        that.setData({ list: [] })
+        that.setData({ skip: 0 })
+        that.setData({ limit: 5 })
+        that.setData({ total: 0 })
+    },
     /**
      * 生命周期函数--监听页面加载
      */
@@ -67,6 +107,13 @@ Page({
             }
         })
     },
+    // 查询其他信息
+    async searchOther() {
+        const that = this;
+        let res;
+        res = await app.$api('dictData', 'GET', { type: 'status', is_use: '0' })
+        if (res.errcode == '0') that.setData({ statusList: res.data })
+    },
     // 查询通知
     async search() {
         const that = this;
@@ -83,53 +130,6 @@ Page({
             that.setData({ total: res.total })
         }
     },
-    // 分页-触底
-    toLower() {
-        const that = this;
-        let list = that.data.list;
-        let limit = that.data.limit;
-        if (that.data.total > list.length) {
-            wx.showLoading({ title: '加载中', mask: true })
-            let page = that.data.page + 1;
-            that.setData({ page })
-            let skip = page * limit
-            that.setData({ skip })
-            that.search()
-            wx.hideLoading()
-        } else {
-            wx.showToast({ title: `到底了没数据了`, icon: 'none' });
-        }
-    },
-    // 分页-滚动
-    toScroll() {
-        // console.log('滚动');
-    },
-    // 字典
-    getDict(value, model) {
-        const that = this;
-        if (model == 'status') {
-            if (value) {
-                let data = that.data.statusList.find(i => i.value == value)
-                if (data) return data.label
-                else return '暂无'
-            }
-        }
-    },
-    // 查询其他信息
-    async searchOther() {
-        const that = this;
-        let res;
-        res = await app.$api('dictData', 'GET', { type: 'status', is_use: '0' })
-        if (res.errcode == '0') that.setData({ statusList: res.data })
-    },
-    // 清空列表
-    clearPage() {
-        const that = this;
-        that.setData({ list: [] })
-        that.setData({ skip: 0 })
-        that.setData({ limit: 5 })
-        that.setData({ total: 0 })
-    },
     /**
      * 生命周期函数--监听页面初次渲染完成
      */

+ 33 - 45
pagesMy/update/index.js

@@ -9,41 +9,6 @@ Page({
     data: {
         form: {},
     },
-    initValidate() {
-        const rules = { password: { required: true }, is_password: { required: true } }
-        const messages = { password: { required: '请输入新密码' }, is_password: { required: '请确认新密码' } };
-        this.WxValidate = new WxValidate(rules, messages)
-    },
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    async onLoad(options) {
-        const that = this;
-        wx.showLoading({ title: '加载中', mask: true })
-        //验证规则函数
-        that.initValidate();
-        that.search()
-        wx.hideLoading()
-    },
-    search() {
-        const that = this;
-        wx.getStorage({
-            key: 'token',
-            async success(res) {
-                let form = {}
-                let aee = await app.$api(`user/${res.data._id}`, 'GET', {})
-                if (aee.errcode == '0') {
-                    form = aee.data;
-                } else {
-                    wx.showToast({ title: `${aee.errmsg}`, icon: 'error' });
-                }
-                that.setData({ form })
-            },
-            fail(err) {
-                console.log(err);
-            }
-        })
-    },
     // 提交保存
     async toSave(e) {
         const that = this;
@@ -76,18 +41,41 @@ Page({
             }
         }
     },
-    // 查询其他信息
-    async searchOther() {
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    async onLoad(options) {
         const that = this;
-        let res;
-        // 性别
-        res = await app.$api('dictData', 'GET', { type: 'gender', is_use: '0' })
-        if (res.errcode == '0') that.setData({ genderList: res.data })
-        // 类别
-        res = await app.$api('dictData', 'GET', { type: 'type', is_use: '0' })
-        if (res.errcode == '0') that.setData({ typeList: res.data })
+        wx.showLoading({ title: '加载中', mask: true })
+        //验证规则函数
+        that.initValidate();
+        that.search()
+        wx.hideLoading()
+    },
+    initValidate() {
+        const rules = { password: { required: true }, is_password: { required: true } }
+        const messages = { password: { required: '请输入新密码' }, is_password: { required: '请确认新密码' } };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
+    search() {
+        const that = this;
+        wx.getStorage({
+            key: 'token',
+            async success(res) {
+                let form = {}
+                let aee = await app.$api(`user/${res.data._id}`, 'GET', {})
+                if (aee.errcode == '0') {
+                    form = aee.data;
+                } else {
+                    wx.showToast({ title: `${aee.errmsg}`, icon: 'error' });
+                }
+                that.setData({ form })
+            },
+            fail(err) {
+                console.log(err);
+            }
+        })
     },
-
     /**
      * 生命周期函数--监听页面初次渲染完成
      */