فهرست منبع

Merge branch 'master' of http://git.cc-lotus.info/ball-court/ball-applet

guhongwei 2 سال پیش
والد
کامیت
d9889f3029

+ 1 - 1
app.json

@@ -99,7 +99,7 @@
             "pages": [
                 "system/index",
                 "matchAdmin/referee/list",
-                "matchAdmin/referee/add",
+                "matchAdmin/referee/info",
                 "matchAdmin/profit/list",
                 "matchAdmin/match/list",
                 "matchAdmin/match/add",

+ 4 - 1
pagesMatch/matchAdmin/match/add.js

@@ -5,6 +5,8 @@ Page({
     data: {
         frameStyle: { useTop: true, name: '比赛信息', leftArrow: true, useBar: false },
         id: '',
+        // 所属id
+        belong_id: '',
         form: { logo: [] },
         // 状态列表
         statusList: [],
@@ -71,7 +73,7 @@ Page({
         const form = that.data.form;
         let params = e.detail.value;
         const { start_time, end_time, sign_time, logo, regular } = form
-        params = { ...params, start_time, end_time, sign_time, logo, regular }
+        params = { ...params, start_time, end_time, sign_time, logo, regular, belong_id: that.data.belong_id }
         if (!this.WxValidate.checkForm(params)) {
             const error = this.WxValidate.errorList[0];
             wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
@@ -111,6 +113,7 @@ Page({
         wx.getStorage({
             key: 'raceuser',
             success: async res => {
+                that.setData({ belong_id: res.data._id })
                 if (that.data.id) {
                     const arr = await app.$get(`/match/${that.data.id}`, {}, 'race');
                     if (arr.errcode == '0') {

+ 1 - 3
pagesMatch/matchAdmin/match/list.js

@@ -97,9 +97,7 @@ Page({
         wx.getStorage({
             key: 'raceuser',
             success: async res => {
-                const aee = await app.$get(`/dict`, { code: "match_status" });
-                if (aee.errcode == '0' && aee.total > 0) that.setData({ statusList: aee.data[0].list });
-                let info = { skip: that.data.skip, limit: that.data.limit };
+                let info = { skip: that.data.skip, limit: that.data.limit, belong_id: res.data._id };
                 const arr = await app.$get(`/match`, { ...info }, 'race');
                 if (arr.errcode == '0') {
                     for (const val of arr.data) {

+ 0 - 95
pagesMatch/matchAdmin/referee/add.js

@@ -1,95 +0,0 @@
-const app = getApp();
-import WxValidate from '../../../utils/wxValidate';
-import dateTimePicker from '../../../utils/dateTimePicker';
-Page({
-    data: {
-        frameStyle: { useTop: true, name: '信息维护', leftArrow: true, useBar: false },
-        id: '',
-        form: {},
-        dateTimeArray1: null,
-        dateTime1: null,
-        startYear: null,
-        endYear: null,
-    },
-    initValidate() {
-        const rules = { name: { required: true }, phone: { required: true } }
-        // 验证字段的提示信息,若不传则调用默认的信息
-        const messages = { name: { required: '用户姓名', }, phone: { required: '联系电话', } };
-        this.WxValidate = new WxValidate(rules, messages)
-    },
-    // 返回
-    back: function () { wx.navigateBack({ delta: 1 }) },
-
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad: function (options) {
-        const that = this;
-        that.setData({ id: options.id || '' });
-        //验证规则函数
-        that.initValidate();
-        // 监听用户是否登录
-        that.watchLogin();
-        that.searchOther()
-    },
-    watchLogin: async function () {
-        const that = this;
-        wx.getStorage({
-            key: 'user',
-            success: async res => {
-                if (that.data.id) {
-                    console.log('信息维护');
-                } else {
-                    console.log('信息添加');
-                }
-            },
-            fail: async res => {
-                wx.redirectTo({ url: '/pages/index/index' })
-            }
-        })
-    },
-    // 其他信息
-    searchOther: function () {
-        // 获取完整的年月日 时分秒,以及默认显示的数组
-        var obj = dateTimePicker.dateTimePicker(this.data.startYear, this.data.endYear);
-        this.setData({ dateTimeArray1: obj.dateTimeArray });
-    },
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady: function () { },
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow: function () { },
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide: function () {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload: function () {
-
-    },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh: function () {
-
-    },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage: function () {
-
-    }
-})

+ 0 - 6
pagesMatch/matchAdmin/referee/add.json

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

+ 0 - 17
pagesMatch/matchAdmin/referee/add.wxml

@@ -1,17 +0,0 @@
-<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
-    <view slot="info" class="container main">
-        <view class="one">
-            <form catchsubmit="onSubmit">
-                <view class="content">
-                    <view class="label">用户名:</view>
-                    <view class="value">
-                        <input name="name" value="{{form.name}}" placeholder="请输入用户名" />
-                    </view>
-                </view>
-                <view class="btn">
-                    <button type="primary" size="mini" formType="submit">提交保存</button>
-                </view>
-            </form>
-        </view>
-    </view>
-</mobile-main>

+ 100 - 0
pagesMatch/matchAdmin/referee/info.js

@@ -0,0 +1,100 @@
+const app = getApp()
+const moment = require("../../../utils/moment.min")
+Page({
+    data: {
+        frameStyle: { useTop: true, name: '详细信息', leftArrow: true, useBar: false },
+        id: '',
+        info: {},
+        // 性别
+        genderList: [],
+    },
+    // 跳转菜单
+    back(e) {
+        wx.navigateBack({ delta: 1 })
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: async function (options) {
+        const that = this;
+        await that.setData({ id: options.id || '' })
+        // 查询其他信息
+        await that.searchOther();
+        // 监听用户是否登录
+        await that.watchLogin();
+    },
+    searchOther: async function () {
+        const that = this;
+        let arr;
+        // 性别
+        arr = await app.$get(`/dict`, { code: "gender" });
+        if (arr.errcode == '0' && arr.total > 0) that.setData({ genderList: arr.data[0].list });
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                that.setData({ user: res.data })
+                if (that.data.id) {
+                    const arr = await app.$get(`/user/${that.data.id}`, {}, 'race');
+                    if (arr.errcode == '0') {
+                        const aee = await app.$get(`/user/${arr.data.user_id}`);
+                        if (aee.errcode == '0') {
+                            // 性别
+                            let gender = that.data.genderList.find(i => i.value == aee.data.gender)
+                            if (gender) aee.data.zhGender = gender.label;
+                            that.setData({ info: aee.data })
+                        }
+                    }
+                    else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
+                }
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () { },
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 7 - 0
pagesMatch/matchAdmin/referee/info.json

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

+ 6 - 8
pagesMatch/matchAdmin/referee/add.less

@@ -4,6 +4,7 @@
     background-color: var(--mainColor);
 
     .one {
+
         .content {
             display: flex;
             flex-direction: row;
@@ -14,17 +15,14 @@
             .value {
                 flex-grow: 1;
                 color: var(--blackColor);
-
             }
-        }
 
-        .btn {
-            text-align: center;
-            margin: 3vw 0;
-
-            button {
-                margin: 0 2vw;
+            image {
+                width: 80px;
+                height: 80px;
             }
         }
     }
+
+
 }

+ 24 - 0
pagesMatch/matchAdmin/referee/info.wxml

@@ -0,0 +1,24 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <view class="content">
+                <view class="label">头像:</view>
+                <view class="value">
+                    <image class="icon" src="{{info.icon&&user.icon.length>0?user.icon[0].url:''}}"></image>
+                </view>
+            </view>
+            <view class="content">
+                <view class="label">姓名:</view>
+                <view class="value">{{info.name}} </view>
+            </view>
+            <view class="content">
+                <view class="label">性别:</view>
+                <view class="value">{{info.zhGender}}</view>
+            </view>
+            <view class="content">
+                <view class="label">联系电话:</view>
+                <view class="value">{{info.phone}}</view>
+            </view>
+        </view>
+    </view>
+</mobile-main>

+ 3 - 6
pagesMatch/matchAdmin/referee/add.wxss

@@ -13,10 +13,7 @@
   flex-grow: 1;
   color: var(--blackColor);
 }
-.main .one .btn {
-  text-align: center;
-  margin: 3vw 0;
-}
-.main .one .btn button {
-  margin: 0 2vw;
+.main .one .content image {
+  width: 80px;
+  height: 80px;
 }

+ 62 - 12
pagesMatch/matchAdmin/referee/list.js

@@ -1,5 +1,7 @@
 const app = getApp();
 import WxValidate from '../../../utils/wxValidate';
+import QRCode from '../../../utils/weapp-qrcode.js';
+
 Page({
     data: {
         frameStyle: { useTop: true, name: '裁判信息', leftArrow: true, useBar: false },
@@ -58,12 +60,50 @@ Page({
     coachChange: function (e) {
         const that = this;
         let data = that.data.coachList[e.detail.value];
-        if (data) that.setData({ 'form.caoch_id': data.coach_id, 'form.coach_id_name': data.coach_id_name, 'form.school_id': data.school_id })
+        if (data) that.setData({ 'form.coach_id': data.coach_id, 'form.coach_id_name': data.coach_id_name })
+    },
+    onSubmit: async function (e) {
+        const that = this;
+        let params = e.detail.value;
+        if (!this.WxValidate.checkForm(params)) {
+            const error = this.WxValidate.errorList[0];
+            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+            return false
+        } else {
+            let arr;
+            arr = await app.$post(`/user/ctbj`, params, 'race');
+            if (arr.errcode == '0') { wx.showToast({ title: `维护信息成功`, icon: 'success', duration: 2000 }); that.back() }
+            else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
+        }
     },
     // 添加裁判
-    toAdd: function () {
-        console.log('2');
+    toAdd: async function (e) {
+        const that = this;
+        // 生成二维码
+        that.makeQRCode();
+        that.setData({ dialog: { title: '账号绑定', show: true, type: '2' } })
+    },
+    makeQRCode(template = 0) {
+        const that = this;
+        const url = `${that.data.form.id}&&2`;
+        var qrcode = new QRCode(`myQrcode`, {
+            text: url,
+            width: 110,
+            height: 110,
+            padding: 3,
+            colorDark: "#000000",
+            colorLight: "#ffffff",
+            correctLevel: QRCode.CorrectLevel.L,
+        });
     },
+    // 关闭弹窗
+    toClose: function () {
+        const that = this;
+        that.setData({ 'form.coach_id': '' })
+        that.setData({ 'form.coach_id_name': '' })
+        that.setData({ dialog: { titl: '教练', show: false, type: '2' } })
+    },
+
     // 分页
     toPage: function () {
         const that = this;
@@ -92,6 +132,8 @@ Page({
      */
     onShow: async function () {
         const that = this;
+        //验证规则函数
+        that.initValidate();
         // 查询其他信息
         await that.searchOther();
         // 监听用户是否登录
@@ -109,16 +151,24 @@ Page({
     watchLogin: async function () {
         const that = this;
         wx.getStorage({
-            key: 'user',
+            key: 'raceuser',
             success: async res => {
-                // referee
-                // let info = { skip: that.data.skip, limit: that.data.limit };
-                // const arr = await app.$get(`/user`, { ...info });
-                // if (arr.errcode == '0') {
-                //     that.setData({ list: [...that.data.list, ...arr.data] });
-                //     that.setData({ total: arr.total })
-                // }
-                // else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }); }
+                let arr;
+                // 查询当前用户学校,学校id存比赛系统user中的_id,查询当前用户学校与教练的关系表
+                arr = await app.$get(`/school`, { user_id: res.data.user_id._id })
+                if (arr.errcode == '0' && arr.total > 0) {
+                    let school = arr.data[0];
+                    that.setData({ 'form.parent_id': res.data._id })
+                    const aee = await app.$get(`/rcs`, { school_id: school._id })
+                    if (aee.errcode == '0') {
+                        that.setData({ coachList: aee.data })
+                    }
+                }
+                let info = { skip: that.data.skip, limit: that.data.limit, parent_id: res.data._id, type: '2' };
+                const aee = await app.$get(`/user`, { ...info }, 'race')
+                if (aee.errcode == '0') {
+                    that.setData({ list: aee.data })
+                }
             },
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })

+ 45 - 0
pagesMatch/matchAdmin/referee/list.less

@@ -88,4 +88,49 @@
         display: flex;
         flex-direction: column;
     }
+}
+
+.dialog_1 {
+    .content {
+        display: flex;
+        flex-direction: row;
+        border-bottom: 1px dashed var(--f1Color);
+        padding: 2vw 0;
+        margin: 0 2vw 2vw 2vw;
+
+        .value {
+            flex-grow: 1;
+            color: var(--blackColor);
+
+        }
+    }
+
+    .btn {
+        text-align: center;
+        margin: 3vw 0;
+
+        button {
+            margin: 0 2vw;
+        }
+    }
+}
+
+.dialog_2 {
+    .image {
+        text-align: center;
+        height: 18vh;
+        overflow: hidden;
+
+        .qrcode {
+            height: 22vh;
+            position: absolute;
+            left: 32vw;
+        }
+    }
+
+    .remark {
+        text-align: center;
+        font-size: 15px;
+        margin: 0 0 4vw 0;
+    }
 }

+ 8 - 5
pagesMatch/matchAdmin/referee/list.wxml

@@ -13,15 +13,15 @@
             <scroll-view scroll-y="true" class="scroll-view" bindscrolltolower="toPage">
                 <view class="list-scroll-view">
                     <view class="list" wx:for="{{list}}" wx:key="index">
-                        <view class="name">{{item.name}}</view>
+                        <view class="name">{{item.user_id.name}}</view>
                         <view class="other">
                             <view class="other_1">
                                 <text>联系电话:</text>
-                                <text>{{item.phone}}</text>
+                                <text>{{item.user_id.phone}}</text>
                             </view>
                         </view>
                         <view class="btn">
-                            <button type="primary" size="mini" bindtap="toCommon" data-item="{{item}}" data-route="matchAdmin/referee/add">信息维护</button>
+                            <button type="primary" size="mini" bindtap="toCommon" data-item="{{item}}" data-route="matchAdmin/referee/info">详细信息</button>
                             <button type="warn" size="mini" bindtap="toDel" data-item="{{item}}">信息删除</button>
                         </view>
                     </view>
@@ -37,7 +37,7 @@
                 <view class="content">
                     <view class="label">学校id:</view>
                     <view class="value">
-                        <input name="school_id" value="{{form.school_id}}" placeholder="请输入学校id" />
+                        <input name="parent_id" value="{{form.parent_id}}" placeholder="请输入学校id" />
                     </view>
                 </view>
                 <view class="content">
@@ -54,7 +54,10 @@
             </form>
         </view>
         <view class="dialog_2" wx:elif="{{dialog.type=='2'}}">
-            添加教练
+            <view class="image">
+                <canvas class="qrcode" canvas-id="myQrcode"></canvas>
+            </view>
+            <view class="remark">用户可扫描二维码进行账号绑定</view>
         </view>
     </view>
 </dialog>

+ 33 - 0
pagesMatch/matchAdmin/referee/list.wxss

@@ -73,3 +73,36 @@
   display: flex;
   flex-direction: column;
 }
+.dialog_1 .content {
+  display: flex;
+  flex-direction: row;
+  border-bottom: 1px dashed var(--f1Color);
+  padding: 2vw 0;
+  margin: 0 2vw 2vw 2vw;
+}
+.dialog_1 .content .value {
+  flex-grow: 1;
+  color: var(--blackColor);
+}
+.dialog_1 .btn {
+  text-align: center;
+  margin: 3vw 0;
+}
+.dialog_1 .btn button {
+  margin: 0 2vw;
+}
+.dialog_2 .image {
+  text-align: center;
+  height: 18vh;
+  overflow: hidden;
+}
+.dialog_2 .image .qrcode {
+  height: 22vh;
+  position: absolute;
+  left: 32vw;
+}
+.dialog_2 .remark {
+  text-align: center;
+  font-size: 15px;
+  margin: 0 0 4vw 0;
+}