guhongwei 2 years ago
parent
commit
75d79dc757

+ 3 - 0
app.json

@@ -4,6 +4,9 @@
         "pages/register/index",
         "pages/school/index",
         "pages/smy/index",
+        "pages/sadmin/list",
+        "pages/scoach/list",
+        "pages/suser/list",
         "pages/club/index",
         "pages/match/index",
         "pages/other/agree",

+ 69 - 0
pages/sadmin/list.js

@@ -0,0 +1,69 @@
+const app = getApp()
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        frameStyle: { useTop: true, name: '管理用户', leftArrow: true, useBar: false },
+    },
+    // 返回
+    back: function () {
+        wx.navigateBack({ delta: 1 })
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+        const that = this;
+
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 6 - 0
pages/sadmin/list.json

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

+ 3 - 0
pages/sadmin/list.less

@@ -0,0 +1,3 @@
+.main {
+    background-color: var(--mainColor);
+}

+ 5 - 0
pages/sadmin/list.wxml

@@ -0,0 +1,5 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        管理用户
+    </view>
+</mobile-main>

+ 3 - 0
pages/sadmin/list.wxss

@@ -0,0 +1,3 @@
+.main {
+  background-color: var(--mainColor);
+}

+ 69 - 0
pages/scoach/list.js

@@ -0,0 +1,69 @@
+const app = getApp()
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        frameStyle: { useTop: true, name: '教练用户', leftArrow: true, useBar: false },
+    },
+    // 返回
+    back: function () {
+        wx.navigateBack({ delta: 1 })
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+        const that = this;
+
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 6 - 0
pages/scoach/list.json

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

+ 3 - 0
pages/scoach/list.less

@@ -0,0 +1,3 @@
+.main {
+    background-color: var(--mainColor);
+}

+ 5 - 0
pages/scoach/list.wxml

@@ -0,0 +1,5 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        教练用户
+    </view>
+</mobile-main>

+ 3 - 0
pages/scoach/list.wxss

@@ -0,0 +1,3 @@
+.main {
+  background-color: var(--mainColor);
+}

+ 80 - 13
pages/setting/basic.js

@@ -1,66 +1,133 @@
-// pages/setting/basic.js
+const app = getApp()
+import WxValidate from '../../utils/wxValidate'
+const { gender } = require('../../utils/dict')
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-
+        frameStyle: { useTop: true, name: '个人信息', leftArrow: true, useBar: false },
+        form: { icon: [] },
+        // 性别
+        genderList: gender,
+    },
+    initValidate() {
+        const rules = { icon: { required: true }, name: { required: true }, card: { required: true }, gender: { required: true }, phone: { required: true, tel: true } }
+        // 验证字段的提示信息,若不传则调用默认的信息
+        const messages = { icon: { required: '请选择头像', }, name: { required: '请输入用户姓名', }, card: { required: '请输入身份证号', }, gender: { required: '请选择性别', }, phone: { required: '请输入手机号', } };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
+    // 返回
+    back: function () {
+        wx.navigateBack({ delta: 1 })
+    },
+    imgUpl: function (e) {
+        const that = this;
+        let data = that.data.form.icon;
+        data.push(e.detail)
+        that.setData({ 'form.icon': data })
+    },
+    // 删除图片
+    imgDel: function (e) {
+        const that = this;
+        let list = that.data.form.icon;
+        let arr = list.filter((i, index) => index != e.detail.index)
+        that.setData({ 'form.icon': arr })
+    },
+    // 选择性别
+    genderChange: function (e) {
+        const that = this;
+        let data = that.data.genderList[e.detail.value];
+        if (data) that.setData({ 'form.gender': data.value });
+    },
+    // 提交登录
+    onSubmit: async function (e) {
+        const that = this;
+        const params = e.detail.value;
+        const form = that.data.form;
+        params.icon = form.icon;
+        if (!this.WxValidate.checkForm(params)) {
+            const error = this.WxValidate.errorList[0];
+            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+            return false
+        } else {
+            const arr = await app.$post(`/newCourt/api/user/${form._id}`, params);
+            if (arr.errcode == '0') { wx.showToast({ title: `维护信息完成`, icon: 'success', duration: 2000 }); that.back(); }
+            else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+        }
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad(options) {
-
+    onLoad: function (options) {
+        const that = this;
+        //验证规则函数
+        that.initValidate();
+        // 监听用户是否登录
+        that.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                that.setData({ form: res.data })
+                // const arr = await app.$get(`/newCourt/api/user/${res.data.openid}`);
+                // if (arr.errcode == '0') { that.setData({ form: arr.data }) }
+            },
+            fail: res => {
+                wx.redirectTo({ url: '/pages/index/index', })
+            }
+        })
     },
-
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady() {
+    onReady: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow() {
+    onShow: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面隐藏
      */
-    onHide() {
+    onHide: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面卸载
      */
-    onUnload() {
+    onUnload: function () {
 
     },
 
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh() {
+    onPullDownRefresh: function () {
 
     },
 
     /**
      * 页面上拉触底事件的处理函数
      */
-    onReachBottom() {
+    onReachBottom: function () {
 
     },
 
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage() {
+    onShareAppMessage: function () {
 
     }
 })

+ 5 - 1
pages/setting/basic.json

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

+ 30 - 0
pages/setting/basic.less

@@ -0,0 +1,30 @@
+.main {
+    background-color: var(--mainColor);
+
+    .one {
+        .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: 5vw 0 0 0;
+
+            button {
+                width: 40vw;
+                margin: 0 2vw;
+                padding: 1vw 0;
+            }
+        }
+    }
+}

+ 43 - 2
pages/setting/basic.wxml

@@ -1,2 +1,43 @@
-<!--pages/setting/basic.wxml-->
-<text>pages/setting/basic.wxml</text>
+<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">
+                        <upload list="{{form.icon}}" count="{{1}}" previewSize="{{30}}" bind:imgUpload="imgUpl" bind:imgDel="imgDel"></upload>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">用户名:</view>
+                    <view class="value">
+                        <input name="name" value="{{form.name}}" placeholder="请输入用户名" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">性别:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="genderChange" name="gender" value="{{form.gender}}" range="{{genderList}}" range-key="label">
+                            <view class="picker">{{form.gender=='0'?'男':form.gender=='1'?'女':form.gender=='2'?'未知':'请选择性别'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">身份证号:</view>
+                    <view class="value">
+                        <input name="card" value="{{form.card}}" placeholder="请输入身份证号" disabled />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">手机号:</view>
+                    <view class="value">
+                        <input name="phone" value="{{form.phone}}" placeholder="请输入手机号" />
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
+    </view>
+</mobile-main>

+ 23 - 1
pages/setting/basic.wxss

@@ -1 +1,23 @@
-/* pages/setting/basic.wxss */
+.main {
+  background-color: var(--mainColor);
+}
+.main .one .content {
+  display: flex;
+  flex-direction: row;
+  border-bottom: 1px dashed var(--f1Color);
+  padding: 2vw 0;
+  margin: 0 2vw 2vw 2vw;
+}
+.main .one .content .value {
+  flex-grow: 1;
+  color: var(--blackColor);
+}
+.main .one .btn {
+  text-align: center;
+  margin: 5vw 0 0 0;
+}
+.main .one .btn button {
+  width: 40vw;
+  margin: 0 2vw;
+  padding: 1vw 0;
+}

+ 15 - 12
pages/setting/contact.js

@@ -1,66 +1,69 @@
-// pages/setting/contact.js
+const app = getApp()
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-
+        frameStyle: { useTop: true, name: '联系我们', leftArrow: true, useBar: false },
+    },
+    // 返回
+    back: function () {
+        wx.navigateBack({ delta: 1 })
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad(options) {
+    onLoad: function (options) {
+        const that = this;
 
     },
-
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady() {
+    onReady: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow() {
+    onShow: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面隐藏
      */
-    onHide() {
+    onHide: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面卸载
      */
-    onUnload() {
+    onUnload: function () {
 
     },
 
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh() {
+    onPullDownRefresh: function () {
 
     },
 
     /**
      * 页面上拉触底事件的处理函数
      */
-    onReachBottom() {
+    onReachBottom: function () {
 
     },
 
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage() {
+    onShareAppMessage: function () {
 
     }
 })

+ 5 - 2
pages/setting/contact.json

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

+ 3 - 0
pages/setting/contact.less

@@ -0,0 +1,3 @@
+.main {
+    background-color: var(--mainColor);
+}

+ 5 - 2
pages/setting/contact.wxml

@@ -1,2 +1,5 @@
-<!--pages/setting/contact.wxml-->
-<text>pages/setting/contact.wxml</text>
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        联系我们
+    </view>
+</mobile-main>

+ 3 - 1
pages/setting/contact.wxss

@@ -1 +1,3 @@
-/* pages/setting/contact.wxss */
+.main {
+  background-color: var(--mainColor);
+}

+ 69 - 0
pages/suser/list.js

@@ -0,0 +1,69 @@
+const app = getApp()
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        frameStyle: { useTop: true, name: '普通用户', leftArrow: true, useBar: false },
+    },
+    // 返回
+    back: function () {
+        wx.navigateBack({ delta: 1 })
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+        const that = this;
+
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 6 - 0
pages/suser/list.json

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

+ 3 - 0
pages/suser/list.less

@@ -0,0 +1,3 @@
+.main {
+    background-color: var(--mainColor);
+}

+ 5 - 0
pages/suser/list.wxml

@@ -0,0 +1,5 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        普通用户
+    </view>
+</mobile-main>

+ 3 - 0
pages/suser/list.wxss

@@ -0,0 +1,3 @@
+.main {
+  background-color: var(--mainColor);
+}