Browse Source

Signed-off-by: yukangzhe <382985154@qq.com>

yukangzhe 3 năm trước cách đây
mục cha
commit
2197a2c3e1

+ 17 - 4
pages/editMyself/editMyself.js

@@ -6,8 +6,8 @@ Page({
    */
   data: {
     index: 0,
-    array:['女','男'],
-    src:'/images/head.png'
+    array:['未知','男','女'],
+   
   },
 
   changeHead:function(){
@@ -28,7 +28,20 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-
+    const sex = wx.getStorageSync('student').sex.substring(29,wx.getStorageSync('student').sex.length)
+    let index = 0
+    if( sex == 'bf7'){
+      index = 0
+    } else if( sex == 'fbc' ){
+      index = 1
+    } else if( sex == '098' ){
+      index =2
+    }
+    this.setData({
+      index,
+      name: wx.getStorageSync('student').name,
+      src: wx.getStorageSync('student').headImg
+    })
   },
 
   /**
@@ -42,7 +55,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-
+   
   },
 
   /**

+ 2 - 2
pages/editMyself/editMyself.wxml

@@ -6,11 +6,11 @@
     </view>
     <view class="title">姓名</view>
     <view class="input-name">
-      <input value="刘德华"/>
+      <input disabled value="{{name}}"/>
     </view>
     <view class="title">性别</view>
     <view class="sex-select">
-      <picker bindchange="bindPickerChange" value="{{index}}" range="{{array}}">
+      <picker bindchange="bindPickerChange" disabled="true" value="{{index}}" range="{{array}}">
           <view class="picker">
             {{array[index]}}
           </view>

+ 1 - 0
pages/editMyself/editMyself.wxss

@@ -35,4 +35,5 @@ page{
 .headImg image{
   width: 80rpx;
   height: 80rpx;
+  border-radius: 50rpx;
 }

+ 140 - 36
pages/index/index.js

@@ -11,20 +11,65 @@ Page({
     array: ['艾克斯郎校区1', '艾克斯郎校区2', '艾克斯郎校区3', '艾克斯郎校区4'],
     index: 0,
     curStu: {},
-    classList: [
-      { img: '/images/kc.png', title: '今日课程', num: '0', url: "/pages/schedule/schedule" },
-      { img: '/images/jtzy.png', title: '今日作业', num: '0',url: "/pages/task/task" },
-      { img: '/images/cq.png', title: '出勤率', num: '0%',url:"/pages/classTotalList/classTotalList" },
+    classList: [{
+        img: '/images/kc.png',
+        title: '今日课程',
+        num: '0',
+        url: "/pages/schedule/schedule"
+      },
+      {
+        img: '/images/jtzy.png',
+        title: '今日作业',
+        num: '0',
+        url: "/pages/task/task"
+      },
+      {
+        img: '/images/cq.png',
+        title: '出勤率',
+        num: '0%',
+        url: "/pages/classTotalList/classTotalList"
+      },
     ],
-    appList: [
-      { img: '/images/kb.png', title: '我的课表',url:"/pages/schedule/schedule" },
-      { img: '/images/zy.png', title: '提交作业',url:"/pages/task/task" },
-      { img: '/images/dp.png', title: '课堂点评', url:"/pages/evaluation/evaluation"},
-      { img: '/images/zj.png', title: '成长足迹', url:"/pages/growUp/growUp"},
-      { img: '/images/qj.png', title: '请假',url:"/pages/leave/leave" },
-      { img: '/images/bk.png', title: '补课',url:"/pages/lessons/lessons" },
-      { img: '/images/jk.png', title: '加课' ,url: "/pages/addClass/addClass"},
-      { img: '/images/dk.png', title: '调课' ,url: "/pages/theClasses/theClasses"},
+    appList: [{
+        img: '/images/kb.png',
+        title: '我的课表',
+        url: "/pages/schedule/schedule"
+      },
+      {
+        img: '/images/zy.png',
+        title: '提交作业',
+        url: "/pages/task/task"
+      },
+      {
+        img: '/images/dp.png',
+        title: '课堂点评',
+        url: "/pages/evaluation/evaluation"
+      },
+      {
+        img: '/images/zj.png',
+        title: '成长足迹',
+        url: "/pages/growUp/growUp"
+      },
+      {
+        img: '/images/qj.png',
+        title: '请假',
+        url: "/pages/leave/leave"
+      },
+      {
+        img: '/images/bk.png',
+        title: '补课',
+        url: "/pages/lessons/lessons"
+      },
+      {
+        img: '/images/jk.png',
+        title: '加课',
+        url: "/pages/addClass/addClass"
+      },
+      {
+        img: '/images/dk.png',
+        title: '调课',
+        url: "/pages/theClasses/theClasses"
+      },
     ],
     bannerList: [],
     userList: [],
@@ -50,7 +95,9 @@ Page({
     })
     console.log('切换用户 : ' + sid);
     const urls = urlDef.urls;
-    util.apiPost(urls.change_user, { targetId: sid }).then(rs => {
+    util.apiPost(urls.change_user, {
+      targetId: sid
+    }).then(rs => {
       wx.hideLoading();
       if (rs === 1) {
         console.log('切换成功');
@@ -76,7 +123,6 @@ Page({
     let targetId = this.data.orgItems[i].orgId;
     console.log('切换校区 ' + targetId);
     this.data.userItems.some(u => {
-      console.log('用户: ' + JSON.stringify(u));
       if (u.orgId === targetId) {
         this.doChangeUser(u.studentId);
         this.setData({
@@ -88,7 +134,7 @@ Page({
   },
 
   toPage: function (e) {
-    if(typeof e.currentTarget.dataset.url == 'undefined'){
+    if (typeof e.currentTarget.dataset.url == 'undefined') {
       return
     }
     wx.navigateTo({
@@ -96,7 +142,7 @@ Page({
     })
   },
 
-  getMoreShow:function(){
+  getMoreShow: function () {
     wx.navigateTo({
       url: '/pages/showVideoList/showVideoList',
     })
@@ -167,10 +213,14 @@ Page({
         v.imgUrl = rs.img
         v.playUrl = rs.url
         if (personType == 0) {
-          this.setData({ 'stuShowList': videos })
+          this.setData({
+            'stuShowList': videos
+          })
         }
         if (personType == 1) {
-          this.setData({ 'teaShowList': videos })
+          this.setData({
+            'teaShowList': videos
+          })
         }
       });
     });
@@ -178,7 +228,13 @@ Page({
   queryVideoShow: function (personType) {
     const urls = urlDef.urls;
     //获取登录用户数据, 并加载首页数据
-    util.apiPost(urls.person_video_list, { 'q.orgId': this.data.curStu.orgId, 'q.doPersonId': this.data.curStu.studentId, 'q.personType': personType, 'q.sortBy': 'rand', 'q.limit4': 'true' }).then(rs => {
+    util.apiPost(urls.person_video_list, {
+      'q.orgId': this.data.curStu.orgId,
+      'q.doPersonId': this.data.curStu.studentId,
+      'q.personType': personType,
+      'q.sortBy': 'rand',
+      'q.limit4': 'true'
+    }).then(rs => {
       this.loadVideoInfo(rs, personType)
     })
   },
@@ -195,6 +251,7 @@ Page({
       // console.log(JSON.stringify(rs));
       let userItems = rs.attr.others
       let orgItems = []
+      let student = {}
       userItems.forEach(u => {
         let exists = false;
         orgItems.some(o => {
@@ -204,11 +261,24 @@ Page({
           }
         })
         if (!exists) {
-          orgItems.push({ orgId: u.orgId, orgName: u.orgName })
+          orgItems.push({
+            orgId: u.orgId,
+            orgName: u.orgName
+          })
         }
         if (u.id === rs.id) { // 当前用户
-          let student = { studentId: u.studentId, orgId: u.orgId }
-          this.setData({ 'curStu': student })
+          const headImg = u.imageUrl ? urls.oss_file + 'image/' + u.imageUrl : '/images/head.png';
+          student = {
+            studentId: u.studentId,
+            orgId: u.orgId,
+            name: u.studentName,
+            sex: u.sex,
+            headImg: headImg
+          }
+          this.setData({
+            'curStu': student
+          })
+
           // 放入 strong中
           wx.setStorageSync('student', student);
         }
@@ -219,7 +289,10 @@ Page({
         }
       })
 
-      this.setData({ 'userItems': userItems, 'orgItems': orgItems })
+      this.setData({
+        'userItems': userItems,
+        'orgItems': orgItems
+      })
 
 
       let personId = rs.attr.personId
@@ -227,27 +300,47 @@ Page({
       let today = util.curTime().substring(0, 10).replace(/\//g, '-')
 
       // banner 图片
-      util.apiPost(urls.get_advert, { '&q.use': 1, 'q.orgId': orgId, 'q.exceptStatus': 2 }).then(r => {
+      util.apiPost(urls.get_advert, {
+        '&q.use': 1,
+        'q.orgId': orgId,
+        'q.exceptStatus': 2
+      }).then(r => {
         // console.log('banner : ' + JSON.stringify(r));
-        this.setData({ 'bannerList': r })
+        this.setData({
+          'bannerList': r
+        })
       });
 
       // 今日课程
-      util.apiPost(urls.leave_get_classes_date, { 'q.studentId': personId, 'q.attenceDate': today }).then(r => {
+      util.apiPost(urls.leave_get_classes_date, {
+        'q.studentId': personId,
+        'q.attenceDate': today
+      }).then(r => {
         // console.log('今日课程 : ' + JSON.stringify(r));
-        this.setData({ 'classList[0].num': (r ? r.length : 0) })
+        this.setData({
+          'classList[0].num': (r ? r.length : 0)
+        })
       })
 
       // 作业未提交
-      util.apiPost(urls.my_homework, { 'q.studentId': personId, 'q.status': 0 }).then(r => {
+      util.apiPost(urls.my_homework, {
+        'q.studentId': personId,
+        'q.status': 0
+      }).then(r => {
         // console.log('作业未提交 : ' + JSON.stringify(r));
-        this.setData({ 'classList[1].num': (r ? r.length : 0) })
+        this.setData({
+          'classList[1].num': (r ? r.length : 0)
+        })
       });
 
       // 出勤率
-      util.apiPost(urls.get_attendance_rate, { 'q.studentId': personId }).then(r => {
+      util.apiPost(urls.get_attendance_rate, {
+        'q.studentId': personId
+      }).then(r => {
         // console.log('出勤率 : ' + JSON.stringify(r));
-        let attendRate = 0, alreadyCount = 0, shouldCount = 0;
+        let attendRate = 0,
+          alreadyCount = 0,
+          shouldCount = 0;
         if (r != null) {
           r.forEach(it => {
             if (it.isAttend === '1') {
@@ -261,7 +354,9 @@ Page({
         if (t > 0) {
           attendRate = alreadyCount * 100 / t
         }
-        this.setData({ 'classList[2].num': attendRate.toFixed(2) + '%' })
+        this.setData({
+          'classList[2].num': attendRate.toFixed(2) + '%'
+        })
       })
       this.queryVideoShow(0)
       this.queryVideoShow(1)
@@ -272,7 +367,12 @@ Page({
     let pid = this.data.curStu.studentId;
     let pt = o.detail.personType;
     let vid = o.detail.videoId;
-    let entity = { videoId: vid, personId: pid, personType: pt, actionType: 1 };
+    let entity = {
+      videoId: vid,
+      personId: pid,
+      personType: pt,
+      actionType: 1
+    };
     util.apiPost(urls.person_video_view_save, entity, 'application/json').then(rs => {
       if (pt == 0) {
         this.data.stuShowList.map(o => {
@@ -280,7 +380,9 @@ Page({
             o.goodCount += 1
           }
         })
-        this.setData({ 'stuShowList': this.data.stuShowList })
+        this.setData({
+          'stuShowList': this.data.stuShowList
+        })
       }
       if (pt == 1) {
         this.data.teaShowList.map(o => {
@@ -288,7 +390,9 @@ Page({
             o.goodCount += 1
           }
         })
-        this.setData({ 'teaShowList': this.data.teaShowList })
+        this.setData({
+          'teaShowList': this.data.teaShowList
+        })
       }
     }).catch(e => {
       console.log(e);

+ 5 - 6
pages/login/login.js

@@ -95,12 +95,12 @@ Page({
         wx.showToast({
           title: '登录成功',
         })
-        // wx.switchTab({
-        //   url: '/pages/index/index'
-        // })
-        wx.navigateTo({
-          url: '/pages/doTask/doTask',
+        wx.switchTab({
+          url: '/pages/index/index'
         })
+        // wx.navigateTo({
+        //   url: '/pages/doTask/doTask',
+        // })
       } else {
         wx.showToast({
           title: rs.errMsg,
@@ -109,7 +109,6 @@ Page({
         })
       }
     })
-
   },
 
 

+ 7 - 1
pages/makePiano/makePiano.wxss

@@ -3,6 +3,10 @@
   margin: 0;
 }
 
+page{
+  background: #f1f1f1;
+}
+
 /* 筛选按钮 */
 .select-view {
   height: 60rpx;
@@ -97,7 +101,8 @@
 /* 日期选择 */
 .week-view{
    width: 700rpx;
-   margin: 25rpx;
+   padding: 25rpx;
+   background: #FFF;
 }
 .week-list{
   width: 700rpx;
@@ -124,6 +129,7 @@
   .school-box{
     padding: 25rpx;
     border-bottom: 20rpx solid #eee;
+    background: #FFF;
   }
   .school-title,.school-dis,.school-addr,.school-tel,.class-box,.class-get-view{
     display: flex;

+ 4 - 1
pages/myself/myself.js

@@ -40,7 +40,10 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-
+    this.setData({
+      userAvatar: wx.getStorageSync('student').headImg,
+      userName: wx.getStorageSync('student').name
+    })
   },
 
   /**

+ 2 - 2
pages/myself/myself.wxml

@@ -2,9 +2,9 @@
   <view>
 		<navTop title="{{childTitle}}" btnShow="{{false}}"></navTop>
 		<view class="top">
-			<open-data class="avatar" type="userAvatarUrl" wx:if="{{!userAvatar}}"></open-data>
+			<!-- <open-data class="avatar" type="userAvatarUrl" wx:if="{{!userAvatar}}"></open-data> -->
 			<image lazy-load class="avatar" mode="aspectFill" src="{{userAvatar}}" wx:if="{{userAvatar}}"></image>
-			<open-data type="userNickName" wx:if="{{!userName}}"></open-data>
+			<!-- <open-data type="userNickName" wx:if="{{!userName}}"></open-data> -->
 			<text wx:if="{{userName}}">{{userName}}</text>
 		</view>
 		<view class="list">