Silent 6 лет назад
Родитель
Сommit
e935560b6b

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

xqd
@@ -335,7 +335,7 @@ class ApiController extends Controller
         $list = Content::whereIn('type', [1])->orderBy('sort')->offset($offset)->limit(15)->get();
         foreach($list as $item) {
             $item->publish_date = substr($item->created_at, 0, 10);
-            $item->pic_url = url($item->pic_url);
+            $item->pic_url = empty($item->pic_url) ? null : url($item->pic_url);
         }
         return response()->json(['status' => 'success', 'list' => $list]);
     }

+ 1 - 0
wechat/pages/announce/announce.js

xqd
@@ -23,6 +23,7 @@ Page({
         'offset': that.data.list.length
       },
       success: res => {
+        console.log(res)
         if (res.data.list.length > 0) {
           var new_list = that.data.list.concat(res.data.list);
           that.setData({

+ 3 - 1
wechat/pages/announce/announce.wxml

xqd
@@ -4,7 +4,9 @@
     <view class='info-bg' catchtap='redirectToAnnounce' data-id='{{ item.id }}'>
       <view class="info-label">{{ item.title||'未命名' }}</view>
       <view class="info-date">{{ item.publish_date }}</view>
-      <view class="info-image">{{ item.publish_date }}</view>
+      <view class="info-image" wx:if="{{ item.pic_url }}">
+        <image src='{{ item.pic_url }}'></image>
+      </view>
     </view>
   </view>
 </view>