Преглед на файлове

修复学分显示错误问题

赵启卫 преди 2 години
родител
ревизия
422313cd10
променени са 3 файла, в които са добавени 19 реда и са изтрити 8 реда
  1. 7 3
      application/wap/controller/My.php
  2. 10 4
      application/wap/view/first/my/credit.html
  3. 2 1
      application/wap/view/first/my/history.html

+ 7 - 3
application/wap/controller/My.php

xqd xqd
@@ -503,7 +503,11 @@ class My extends AuthController
      */
 
      public function credit(){
-        
+        $model = SpecialLog::alias('sl')->where('sl.mid', $this->uid);
+        $model = $model->join('Special s', 's.id = sl.sid');
+        $model = $model->join('specialSubject ss', 's.subject_id = ss.id');
+        $orderList = $model->order('sl.add_time DESC')->field('sum(s.xuefen) as xuefencount')->find();
+        //print_r($orderList);exit;
         return $this->fetch();
      }
 
@@ -531,13 +535,13 @@ class My extends AuthController
                     ->select();
                 if ($specialSourceId) $item['count'] = count($specialSourceId);
                 foreach ($specialSourceId as $v) {
-                    if ($v['percentage'] < 100) {
+                    if ($v['percentage'] < 96) {
                         $flag = 0;
                         break;
                     } 
                 }
                 if ($flag == 1){
-                   //关联试题
+                    //关联试题
                     //判断是否有考试
                     $join1 = [
                         ['ExaminationRecord er', 'er.test_id = r.relation_id and er.uid = ' . $this->uid, 'left'],

+ 10 - 4
application/wap/view/first/my/credit.html

xqd xqd xqd xqd
@@ -37,7 +37,7 @@
 <div v-cloak id="app">
     <div class="credit-title">
         <div class="title">我的学分</div>
-        <div class="credit">6</div>
+        <div class="credit">{{xuefencount}}</div>
     </div>
     <div class="credit-list">
         <br />
@@ -58,7 +58,7 @@
                             <div>{{ item.title }}</div>
                             <div>
                                 <span class="labelItem">{{ item.subject_name }}</span>
-                                <span class="creditinfo">3分</span>
+                                <span class="creditinfo">{{ item.xuefen }}分</span>
                             </div>
                             <div class="price-wrap">
                                 <div class="price">¥<span>{{ item.money }}</span></div>
@@ -88,6 +88,7 @@
                 activityList: [],
                 loading: false,
                 loadend: false,
+                xuefencount:0,
                 page: 1,
                 limit: 20,
                 loadTitle:''
@@ -119,13 +120,18 @@
                     if (that.loading) return;
                     if (that.loadend) return;
                     that.loading = true;
-                    store.baseGet($h.U({ c: 'my', a: 'special_log', p: { page: that.page, limit: that.limit, op:'list' } }), function (res) {
+                    that.activityList = [];
+                    store.baseGet($h.U({ c: 'my', a: 'history', p: { page: that.page, limit: 10000, op:'xuefenlist' } }), function (res) {
                         var list = res.data.data;
                         that.activityList.push.apply(that.activityList, list);
-                        that.loadend = list.length < that.limit;
+                        that.loadend = list.length < 10000;
                         that.loadTitle = that.loadend ? '已全部加载完' : '上拉加载更多';
                         that.page = that.page + 1;
                         that.loading = false;
+                        that.xuefencount = 0;
+                        for (let i in that.activityList) {
+                            that.xuefencount += that.activityList[i].xuefen;
+                        }
                         that.$set(this, 'activityList', that.activityList);
                     }, function (res) {
                         that.loadTitle = '上拉加载更多';

+ 2 - 1
application/wap/view/first/my/history.html

xqd xqd
@@ -320,6 +320,7 @@
                     if (that.loading) return;
                     if (that.loadend) return;
                     that.loading = true;
+                    that.activityList = [];
                     if (that.navActive == 3) {
                         store.basePost($h.U({
                             c: 'topic',
@@ -346,7 +347,7 @@
                         store.baseGet($h.U({ c: 'my', a: 'history', p: { page: that.page, limit: 10000,  op:'xuefenlist' } }), function (res) {
                             var list = res.data.data;
                             that.activityList.push.apply(that.activityList, list);
-                            that.loadend = list.length < that.limit;
+                            that.loadend = list.length < 10000;
                             that.loadTitle = that.loadend ? '已全部加载完' : '上拉加载更多';
                             that.page = that.page + 1;
                             that.loading = false;