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

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 11 - 3
icon/icon.wxss


+ 0 - 15
pages/register/index.js

@@ -5,11 +5,6 @@ Page({
     data: {
         frameStyle: { useTop: true, name: '注册', leftArrow: false, useBar: false },
         form: { icon: [] },
-        // 用户类型
-        typeList: [
-            { label: '普通用户', value: '0' },
-            { label: '学员用户', value: '3' },
-        ],
         // 性别
         genderList: gender,
         agree: false
@@ -39,16 +34,6 @@ Page({
         let data = that.data.genderList[e.detail.value];
         if (data) that.setData({ 'form.gender': data.value });
     },
-    // 选择用户类型
-    typeChange: function (e) {
-        const that = this;
-        let data = that.data.typeList[e.detail.value];
-        if (data) {
-            that.setData({ 'form.type': data.value });
-            that.setData({ 'form.type_name': data.label });
-
-        }
-    },
     // 公共跳转
     toCommon: function (e) {
         // 登录

+ 0 - 14
pages/register/index.wxml

@@ -28,20 +28,6 @@
                         <input type="text" name="phone" value="{{form.phone}}" placeholder="请输入手机号" />
                     </view>
                 </view>
-                <view class="content">
-                    <view class="label">用户类型:</view>
-                    <view class="value">
-                        <picker mode="selector" bindchange="typeChange" name="type" value="{{form.type}}" range="{{typeList}}" range-key="label">
-                            <view class="picker">{{form.type_name||'请选择用户类型'}}</view>
-                        </picker>
-                    </view>
-                </view>
-                <view class="content" wx:if="{{form.type=='3'}}">
-                    <view class="label">用户类型:</view>
-                    <view class="value">
-                        <input type="text" name="card" value="{{form.card}}" placeholder="请输入身份证号" />
-                    </view>
-                </view>
                 <view class="btn">
                     <button type="primary" size="mini" formType="submit">提交注册</button>
                     <button type="warn" size="mini">游客登录</button>

+ 1 - 1
pages/sadmin/list.js

@@ -5,7 +5,7 @@ Page({
      * 页面的初始数据
      */
     data: {
-        frameStyle: { useTop: true, name: '管理信息', leftArrow: true, useBar: false },
+        frameStyle: { useTop: true, name: '羽校信息', leftArrow: true, useBar: false },
     },
     // 返回
     back: function () {

+ 12 - 8
pages/scoach/list.js

@@ -25,22 +25,23 @@ Page({
     // 修改
     toEdit: function (e) {
         const that = this;
+        let { item } = e.currentTarget.dataset;
         that.setData({ skip: 0, page: 0, list: [] })
-        let { id } = e.currentTarget.dataset;
-        wx.navigateTo({ url: `/pages/scoach/add?id=${id}` })
+        wx.navigateTo({ url: `/pages/scoach/add?id=${item.id}` })
     },
     // 删除
     toDel: async function (e) {
         const that = this;
-        const { id } = e.currentTarget.dataset;
+        const { item } = e.currentTarget.dataset;
         wx.showModal({
             title: '提示',
             content: '是否确认删除该条数据?',
             async success(res) {
                 if (res.confirm) {
-                    const arr = await app.$delete(`/coach/${id}`);
+                    const arr = await app.$delete(`/coach/${item.id}`);
                     if (arr.errcode == '0') {
                         wx.showToast({ title: `删除信息成功`, icon: 'success', duration: 2000 })
+                        that.setData({ skip: 0, page: 0, list: [] })
                         that.watchLogin()
                     } else {
                         wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
@@ -49,6 +50,12 @@ Page({
             }
         })
     },
+    // 绑定账号
+    toBind: function (e) {
+        const that = this;
+        let { item } = e.currentTarget.dataset;
+        console.log(item);
+    },
     // 分页
     toPage: function () {
         const that = this;
@@ -67,10 +74,7 @@ Page({
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad: function (options) {
-        const that = this;
-
-    },
+    onLoad: function (options) { },
     /**
      * 生命周期函数--监听页面初次渲染完成
      */

+ 5 - 6
pages/scoach/list.less

@@ -44,7 +44,7 @@
                 display: flex;
                 flex-direction: row;
                 margin: 0 0 2vh 0;
-                border: 1px #fff dashed;
+                border: 1px dashed var(--whiteColor);
                 border-radius: 10px;
 
                 .icon {
@@ -67,13 +67,13 @@
                         font-weight: 700;
                         font-size: var(--font18Szie);
                         color: var(--whiteColor);
-                        margin: 1vh 0;
+                        margin: 1vw 0;
                     }
 
                     .other {
                         font-size: var(--font15Size);
                         color: var(--f9Color);
-                        margin: 0.5vh 0 1vh 0;
+                        margin: 0.5vw 0 1vw 0;
 
                         text {
                             color: var(--whiteColor);
@@ -82,7 +82,6 @@
                 }
             }
 
-
             .btn {
                 display: flex;
                 flex-direction: row;
@@ -91,12 +90,12 @@
                     width: 100%;
                     padding: 2vw;
                     font-size: var(--font14Size);
-                    color: #fff;
+                    color: var(--whiteColor);
                     border-radius: 50px;
                     margin: 0 5vw;
                     background-color: #35d4bd;
                     box-sizing: content-box;
-                    border: 1px #fff dashed;
+                    border: 1px dashed var(--whiteColor);
                 }
 
                 button:last-child {

+ 3 - 2
pages/scoach/list.wxml

@@ -25,8 +25,9 @@
                             </view>
                         </view>
                         <view class="btn">
-                            <button bindtap="toEdit" data-id="{{item._id}}">信息维护</button>
-                            <button bindtap="toDel" data-id="{{item._id}}">删除信息</button>
+                            <button bindtap="toEdit" data-item="{{item}}">信息维护</button>
+                            <button bindtap="toBind" data-item="{{item}}">绑定账号</button>
+                            <button bindtap="toDel" data-item="{{item}}">删除信息</button>
                         </view>
                     </view>
                 </view>

+ 5 - 5
pages/scoach/list.wxss

@@ -39,7 +39,7 @@
   display: flex;
   flex-direction: row;
   margin: 0 0 2vh 0;
-  border: 1px #fff dashed;
+  border: 1px dashed var(--whiteColor);
   border-radius: 10px;
 }
 .main .two .list .list_1 .icon {
@@ -60,12 +60,12 @@
   font-weight: 700;
   font-size: var(--font18Szie);
   color: var(--whiteColor);
-  margin: 1vh 0;
+  margin: 1vw 0;
 }
 .main .two .list .list_1 .content .other {
   font-size: var(--font15Size);
   color: var(--f9Color);
-  margin: 0.5vh 0 1vh 0;
+  margin: 0.5vw 0 1vw 0;
 }
 .main .two .list .list_1 .content .other text {
   color: var(--whiteColor);
@@ -78,12 +78,12 @@
   width: 100%;
   padding: 2vw;
   font-size: var(--font14Size);
-  color: #fff;
+  color: var(--whiteColor);
   border-radius: 50px;
   margin: 0 5vw;
   background-color: #35d4bd;
   box-sizing: content-box;
-  border: 1px #fff dashed;
+  border: 1px dashed var(--whiteColor);
 }
 .main .two .list .btn button:last-child {
   background-color: #f7783e;

+ 7 - 6
pages/suser/add.js

@@ -15,13 +15,15 @@ Page({
             { label: '普通用户', value: '0' },
             { label: '管理员', value: '1' },
             { label: '教练', value: '2' },
+            { label: '学员', value: '3' },
+            { label: '游客', value: '10' },
         ],
         genderList: gender
     },
     initValidate() {
-        const rules = { type: { required: true }, icon: { required: true }, name: { required: true }, card: { required: true }, gender: { required: true }, phone: { required: true, tel: true } }
+        const rules = { type: { required: true }, icon: { required: true }, name: { required: true }, gender: { required: true }, phone: { required: true, tel: true } }
         // 验证字段的提示信息,若不传则调用默认的信息
-        const messages = { type: { required: '请选择用户类型', }, icon: { required: '请选择头像', }, name: { required: '请输入用户姓名', }, card: { required: '请输入身份证号', }, gender: { required: '请选择性别', }, phone: { required: '请输入手机号', } };
+        const messages = { type: { required: '请选择用户类型', }, icon: { required: '请选择头像', }, name: { required: '请输入用户姓名', }, gender: { required: '请选择性别', }, phone: { required: '请输入手机号', } };
         this.WxValidate = new WxValidate(rules, messages)
     },
     // 返回
@@ -49,7 +51,6 @@ Page({
             that.setData({ 'form.type': data.value });
             that.setData({ 'form.type_name': data.label });
         }
-
     },
     // 选择性别
     genderChange: function (e) {
@@ -72,8 +73,8 @@ Page({
             return false
         } else {
             let arr;
-            if (that.data.id) arr = await app.$post(`/newCourt/api/user/${form._id}`, params);
-            else arr = await app.$post(`/newCourt/api/user`, params);
+            if (that.data.id) arr = await app.$post(`/user/${form._id}`, params);
+            else arr = await app.$post(`/user`, params);
             if (arr.errcode == '0') { wx.showToast({ title: `维护信息完成`, icon: 'success', duration: 2000 }); that.back(); }
             else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
         }
@@ -98,7 +99,7 @@ Page({
             success: async res => {
                 let arr;
                 if (that.data.id) {
-                    arr = await app.$get(`/newCourt/api/user/${that.data.id}`);
+                    arr = await app.$get(`/user/${that.data.id}`);
                     if (arr.errcode == '0') {
                         let type = that.data.typeList.find(i => i.value == arr.data.type);
                         if (type) arr.data.type_name = type.label;

+ 0 - 6
pages/suser/add.wxml

@@ -30,12 +30,6 @@
                         </picker>
                     </view>
                 </view>
-                <view class="content">
-                    <view class="label">身份证号:</view>
-                    <view class="value">
-                        <input name="card" value="{{form.card}}" placeholder="请输入身份证号" />
-                    </view>
-                </view>
                 <view class="content">
                     <view class="label">手机号:</view>
                     <view class="value">

+ 29 - 4
pages/suser/list.js

@@ -5,13 +5,19 @@ Page({
      * 页面的初始数据
      */
     data: {
-        frameStyle: { useTop: true, name: '用户管理', leftArrow: true, useBar: false },
+        frameStyle: { useTop: true, name: '账号管理', leftArrow: true, useBar: false },
         list: [],
+        total: 0,
+        page: 0,
+        skip: 0,
+        limit: 5,
         typeList: [
             { label: '超级管理员', value: '-1' },
             { label: '普通用户', value: '0' },
             { label: '管理员', value: '1' },
             { label: '教练', value: '2' },
+            { label: '学员', value: '3' },
+            { label: '游客', value: '10' },
         ]
     },
     // 返回
@@ -20,12 +26,14 @@ Page({
     },
     // 信息添加
     toAdd: function () {
+        that.setData({ skip: 0, page: 0, list: [] })
         wx.navigateTo({ url: `/pages/suser/add` })
     },
     // 信息维护
     toEdit: function (e) {
         const that = this;
         const { item } = e.currentTarget.dataset;
+        that.setData({ skip: 0, page: 0, list: [] })
         wx.navigateTo({ url: `/pages/suser/add?id=${item.id}` })
     },
     // 信息删除
@@ -37,7 +45,7 @@ Page({
             content: '是否确认删除该条数据?',
             async success(res) {
                 if (res.confirm) {
-                    const arr = await app.$delete(`/newCourt/api/user/${item._id}`);
+                    const arr = await app.$delete(`/user/${item._id}`);
                     if (arr.errcode == '0') {
                         wx.showToast({ title: `删除信息成功`, icon: 'success', duration: 2000 })
                         that.setData({ skip: 0, page: 0, list: [] })
@@ -49,6 +57,21 @@ Page({
             }
         })
     },
+    // 分页
+    toPage: function () {
+        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: page })
+            let skip = page * limit;
+            that.setData({ skip: skip })
+            that.watchLogin();
+            wx.hideLoading()
+        } else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
+    },
     /**
      * 生命周期函数--监听页面加载
      */
@@ -61,10 +84,12 @@ Page({
         wx.getStorage({
             key: 'user',
             success: async res => {
-                const arr = await app.$get(`/newCourt/api/user`);
+                let info = { skip: that.data.skip, limit: that.data.limit };
+                const arr = await app.$get(`/user`, { ...info });
                 if (arr.errcode == '0') {
                     for (const val of arr.data) { val.zHtype = this.searchType(val.type) }
-                    that.setData({ list: arr.data });
+                    that.setData({ list: [...that.data.list, ...arr.data] });
+                    that.setData({ total: arr.total })
                 }
                 else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }); }
             },

+ 1 - 1
pages/suser/list.less

@@ -1,5 +1,5 @@
 .main {
-    height: var(--thrHeight);
+    height: var(--twoHeight);
     background-color: var(--mainColor);
 
     .one {

+ 3 - 3
pages/suser/list.wxml

@@ -4,12 +4,12 @@
             <view class="one_1">
                 <input type="text" placeholder="请输入关键词" />
             </view>
-            <view class="one_2">
+            <!-- <view class="one_2">
                 <button type="primary" bindtap="toAdd">添加</button>
-            </view>
+            </view> -->
         </view>
         <view class="two">
-            <scroll-view scroll-y="true" class="scroll-view">
+            <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>

+ 1 - 1
pages/suser/list.wxss

@@ -1,5 +1,5 @@
 .main {
-  height: var(--thrHeight);
+  height: var(--twoHeight);
   background-color: var(--mainColor);
 }
 .main .one {

+ 3 - 4
pages/user/basic.js

@@ -30,10 +30,9 @@ Page({
         wx.getStorage({
             key: 'user',
             success: async res => {
-                that.setData({ form: res.data })
-                // const arr = await app.$get(`/newCourt/api/user/${res.data._id}`);
-                // if (arr.errcode == '0') { that.setData({ form: arr.data }) }
-                // else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }); }
+                const arr = await app.$get(`/user/${res.data._id}`);
+                if (arr.errcode == '0') { that.setData({ form: arr.data }) }
+                else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }); }
             },
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })

+ 0 - 12
pages/user/basic.wxml

@@ -14,12 +14,6 @@
                         <input type="text" name="name" value="{{form.name}}" placeholder="请输入姓名" disabled />
                     </view>
                 </view>
-                <view class="content">
-                    <view class="label">身份证号:</view>
-                    <view class="value">
-                        <input type="text" name="card" value="{{form.card}}" placeholder="请输入身份证号" disabled />
-                    </view>
-                </view>
                 <view class="content">
                     <view class="label">性别:</view>
                     <view class="value">
@@ -32,12 +26,6 @@
                         <input type="text" name="phone" value="{{form.phone}}" placeholder="请输入手机号" disabled />
                     </view>
                 </view>
-                <view class="content">
-                    <view class="label">用户类型:</view>
-                    <view class="value">
-                        {{form.type=='-1'?'超级管理员':form.type=='0'?'普通用户':form.type=='1'?'管理员':form.type=='2'?'教练用户':'暂无'}}
-                    </view>
-                </view>
             </form>
         </view>
     </view>

+ 30 - 4
utils/dict.js

@@ -32,13 +32,39 @@ export const school_menu = [
                 title: '用户管理',
                 icon: 'icon-yonghu',
                 btn: [
-                    { title: '用户管理', route: 'suser/list', icon: 'icon-putongyonghu' },
-                    { title: '管理信息', route: 'sadmin/list', icon: 'icon-xitongguanli-yonghuchaxun' },
+                    { title: '账号管理', route: 'suser/list', icon: 'icon-putongyonghu' },
+                    { title: '羽校信息', route: 'sadmin/list', icon: 'icon-xitongguanli-yonghuchaxun' },
                     { title: '教练信息', route: 'scoach/list', icon: 'icon-jiaolian1' },
                     { title: '学员信息', route: 'sstudent/list', icon: 'icon-zaiduxueyuan' },
-
+                ]
+            },
+            {
+                title: '系统设置',
+                icon: 'icon-shouye',
+                btn: [
+                    { title: '字典表管理', route: 'system/dictionary', icon: 'icon-zidianbiaoguanli' },
                 ]
             },
         ]
-    }
+    },
+    {
+        type: '0',
+        menu: []
+    },
+    {
+        type: '1',
+        menu: []
+    },
+    {
+        type: '2',
+        menu: []
+    },
+    {
+        type: '3',
+        menu: []
+    },
+    {
+        type: '10',
+        menu: []
+    },
 ]