Silent há 7 anos atrás
pai
commit
bc1c077afc

+ 1 - 1
app/Http/Controllers/WeChat/ApiController.php

xqd
@@ -451,7 +451,7 @@ class ApiController extends Controller
         }
 
         $is_new = $student->getIsNew();
-        if(!$is_new) {
+        if($is_new) {
             $titles = RemarkTitle::where('status', 2)->get();
             return response()->json(['status' => 'success', 'titles' => $titles, 'teachers' => $teachers, 'is_new' => $is_new]);
         }

+ 2 - 2
wechat/app.json

xqd
@@ -7,13 +7,13 @@
     "pages/article-detail/index",
     "pages/userinfo/userinfo",
     "pages/mycourse/mycourse",
-    "pages/rate/rate",
     "pages/rate-review/rate-review",
     "pages/my-log/my-log",
     "pages/apply-leave/apply-leave",
     "pages/login/index",
     "pages/bind-phone/index",
-    "pages/form/index"
+    "pages/form/index",
+    "pages/rate/rate"
   ],
   "window": {
     "backgroundTextStyle": "light",

+ 8 - 7
wechat/pages/rate/rate.js

xqd xqd
@@ -7,7 +7,8 @@ Page({
     titles: [],
     course_name: '',
     teacher: '',
-    teachers: []
+    teachers: [],
+    is_new: true
   },
   onLoad: function (options) {
     let that = this;
@@ -22,12 +23,12 @@ Page({
       },
       method: 'GET',
       success: res => {
-        if (res.data.status == 'success') {
-          that.setData({
-            titles: res.data.titles,
-            teachers: res.data.teachers
-          })
-        }
+        console.log(res)
+        that.setData({
+          is_new: res.data.is_new,
+          titles: res.data.titles,
+          teachers: res.data.teachers
+        })
       }
     })
   },

+ 34 - 15
wechat/pages/rate/rate.wxml

xqd
@@ -1,18 +1,37 @@
-<form bindsubmit="formSubmit">
-  <view wx:for="{{ teachers }}" wx:for-item="out_item">
-    <zan-panel title='课程名称:{{ course_name }}\n讲师姓名:{{ out_item.name }}'>
-      <view>
-        <view wx:for="{{ titles }}">
-          <zan-cell title="{{ item.name }}">
-            <zan-field placeholder="(满分10.0)" type="digit" name="data[{{ out_item.id }}][{{ item.id }}]">
-            </zan-field>
-          </zan-cell>
+<view wx:if="{{ is_new }}">
+  <form bindsubmit="formSubmit">
+    <view wx:for="{{ teachers }}" wx:for-item="out_item">
+      <zan-panel title='课程名称:{{ course_name }}\n讲师姓名:{{ out_item.name }}'>
+        <view>
+          <view wx:for="{{ titles }}">
+            <zan-cell title="{{ item.name }}">
+              <zan-field placeholder="(满分10.0)" type="digit" name="data[{{ out_item.id }}][{{ item.id }}]">
+              </zan-field>
+            </zan-cell>
+          </view>
         </view>
+      </zan-panel>
+    </view>
+    <zan-button-group>
+      <!-- <zan-button type="primary" bindtap="onSubmit">提交</zan-button> -->
+      <button formType="submit" type='primary' class='submit-btn'>提交</button>
+    </zan-button-group>
+  </form>
+</view>
+<view wx:else>
+  <view wx:for="{{ teachers }}">
+    <view class='remark-box'>
+      <view class='remark-header'>
+        <view class='remark-title'>课程名称:{{ course_name }}</view>
+        <view class='remark-title'>讲师姓名:{{ item.name }}</view>
       </view>
-    </zan-panel>
+      <view class='remark-body'>
+        <view class='remark-date'>{{ item.remark_date }}</view>
+        <view class='remark-score-item'>
+          平均分
+          <view class='remark-score'>{{ item.average_score }}</view>
+        </view>
+      </view>
+    </view>
   </view>
-  <zan-button-group>
-    <!-- <zan-button type="primary" bindtap="onSubmit">提交</zan-button> -->
-    <button formType="submit" type='primary' class='submit-btn'>提交</button>
-  </zan-button-group>
-</form>
+</view>

+ 4 - 0
wechat/pages/rate/rate.wxss

xqd
@@ -6,4 +6,8 @@
 }
 .zan-field {
   border-bottom: 1px solid #9a9a9a;
+}
+.remark-box {
+  background-color: white;
+  padding: 10rpx;
 }