Silent 6 年 前
コミット
7d1741e095

+ 4 - 0
app/Http/Controllers/WeChat/ApiController.php

xqd
@@ -320,6 +320,10 @@ class ApiController extends Controller
             $list = Content::where('type', 4)->orderBy('sort')->offset($article_offset)->limit(15)->get();
         }
 
+        foreach($list as $item) {
+            $item->publish_date = substr($item->created_at, 0, 10);
+        }
+
         return response()->json(['status' => 'success', 'list' => $list, 'type' => $request->input('type')]);
     }
 

+ 2 - 1
wechat/pages/mycourse/mycourse.wxml

xqd
@@ -1,5 +1,6 @@
-<zan-panel title='{{ courseInfo.course_name }}'>
+<zan-panel>
   <zan-cell-group>
+    <zan-cell title="课程名称" value="{{ courseInfo.course_name }}"></zan-cell>
     <zan-cell title="主讲老师" value="{{ courseInfo.teacher_names }}"></zan-cell>
     <zan-cell title="报名日期" value="{{ courseInfo.apply_date }}"></zan-cell>
     <zan-cell title="课程截至日期">

+ 17 - 0
wechat/pages/rate/rate.js

xqd
@@ -34,6 +34,23 @@ Page({
   },
   formSubmit: function (e) {
     let data = e.detail.value;
+    for(var i in data) {
+      if(data[i] === null) {
+        wx.showModal({
+          title: '评价失败',
+          content: '评分不能为空',
+        })
+        return false;
+      }
+      data[i] = parseInt(data[i])
+      if (!(data[i] >= 0 && data[i] <= 10)) {
+        wx.showModal({
+          title: '评价失败',
+          content: '评分只能为0到10',
+        })
+        return false;
+      }
+    }
     data.student_id = wx.getStorageSync('pt_student').id
     wx.request({
       url: api.remarkTeacherUrl,

+ 2 - 4
wechat/pages/rate/rate.wxml

xqd xqd
@@ -5,7 +5,7 @@
         <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 placeholder="(满分10)" inputType="number" name="data[{{ out_item.id }}][{{ item.id }}]">
               </zan-field>
             </zan-cell>
           </view>
@@ -22,11 +22,9 @@
   <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 class='remark-title'>讲师姓名:{{ item.name }}<text class='remark-date'>{{ item.remark_time }}</text></view>
       </view>
       <view class='remark-body'>
-        <view class='remark-date'>{{ item.remark_time }}</view>
         <view class='remark-score-item'>平均分<text class='remark-score'>{{ item.average_score }}分</text>
         </view>
       </view>

+ 8 - 5
wechat/pages/rate/rate.wxss

xqd xqd
@@ -12,13 +12,13 @@
 
 .remark-box {
   background-color: white;
-  padding: 15rpx;
+  padding: 15rpx 0;
   color: grey;
 }
 
 .remark-header {
-  border-bottom: 1px solid gainsboro;
-  padding: 20rpx 0;
+  padding: 20rpx;
+  background-color: #f9f9f9;
 }
 
 .remark-score {
@@ -28,11 +28,14 @@
 }
 
 .remark-body {
-  padding: 20rpx 0;
-  border-bottom: 1px solid gainsboro;
+  padding: 0 20rpx;
   color: black;
 }
 
 .remark-score-item {
   margin-top: 15rpx;
+}
+.remark-date {
+  float: right;
+  font-size: 0.8rem;
 }