Silent преди 6 години
родител
ревизия
cb644018cd

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

xqd xqd
@@ -307,6 +307,7 @@ class ApiController extends Controller
             $article_list = Content::where('type', 4)->orderBy('sort')->offset($article_offset)->limit(15)->get();
             foreach($article_list as $item) {
                 $item->publish_date = substr($item->updated_at, 0, 10);
+                $item->pic_url = empty($item->pic_url) ? null : url($item->pic_url);
             }
             return response()->json(['status' => 'success', 'video_list' => $video_list, 'article_list' => $article_list, 'type' => $request->input('type')]);
         } else if($request->input('type') == 'video') {
@@ -323,6 +324,7 @@ 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->updated_at, 0, 10);
+                $item->pic_url = empty($item->pic_url) ? null : url($item->pic_url);
             }
         }
 

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

xqd
@@ -23,7 +23,6 @@ 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({

+ 17 - 9
wechat/pages/announce/announce.wxss

xqd
@@ -11,16 +11,24 @@
   height: 100%;
 }
 
-.info-content .info-label,
-.info-content .info-date {
-  display: inline;
-  line-height: 100rpx;
-  padding: 0 24rpx;
-  white-space: nowrap;
-  text-overflow: ellipsis;
-  overflow: hidden;
+.info-content .info-label {
+  width: 75%;
+  display: inline-block;
+  line-height: 80rpx;
   font-weight: bold;
+  margin-left: 10rpx;
 }
 .info-content .info-date {
-  float: right;
+  display: inline-block;
+  line-height: 80rpx;
+  font-weight: bold;
+  font-size: 0.8rem;
+  color: grey;
+}
+.info-image {
+  padding: 0;
+  margin: 0;
+}
+.info-image image {
+  width: 100%;
 }

+ 3 - 0
wechat/pages/article/article.wxml

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

+ 8 - 0
wechat/pages/article/article.wxss

xqd
@@ -77,6 +77,14 @@
   color: grey;
 }
 
+.info-image {
+  padding: 0;
+  margin: 0;
+}
+.info-image image {
+  width: 100%;
+}
+
 .modal {
   position: fixed;
   top: 0;