Silent 6 年之前
父節點
當前提交
7a23a6a230

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

xqd
@@ -324,7 +324,7 @@ class ApiController extends Controller
         if(empty($request->input('id')) || empty($item = Content::find($request->input('id')))) {
             return response()->json(['status' => 'fail', 'info' => '找不到文章']);
         }
-        $item->content = $this->replaceImageSrc($item->content);
+//        $item->content = $this->replaceImageSrc($item->content);
         return response()->json(['status' => 'success', 'article' => $item]);
     }
 

+ 1 - 0
wechat/app.json

xqd
@@ -2,6 +2,7 @@
   "pages": [
     "pages/index/index",
     "pages/announce/announce",
+    "pages/announce-detail/index",
     "pages/article/article",
     "pages/article-detail/index",
     "pages/userinfo/userinfo",

+ 78 - 0
wechat/pages/announce-detail/index.js

xqd
@@ -0,0 +1,78 @@
+// pages/announce-detail/index.js
+var api = require('../../utils/api.js');
+var WxParse = require('../../wxParse/wxParse.js');
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    var that = this;
+    wx.request({
+      url: api.getArticleContentUrl + '?id=' + options.id,
+      method: 'GET',
+      success: res => {
+        if (res.data.status == 'success') {
+          console.log(res.data.article)
+          WxParse.wxParse('article', 'html', res.data.article.content, that, 5);
+        }
+      }
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 5 - 0
wechat/pages/announce-detail/index.json

xqd
@@ -0,0 +1,5 @@
+{
+  "navigationBarBackgroundColor": "#000",
+  "navigationBarTextStyle": "white",
+  "navigationBarTitleText": "公告详情"
+}

+ 4 - 0
wechat/pages/announce-detail/index.wxml

xqd
@@ -0,0 +1,4 @@
+<!--pages/announce-detail/index.wxml-->
+<!--pages/article-detail/index.wxml-->
+<import src="/wxParse/wxParse.wxml"/>
+<template is="wxParse" data="{{wxParseData:article.nodes}}"/>

+ 2 - 0
wechat/pages/announce-detail/index.wxss

xqd
@@ -0,0 +1,2 @@
+/* pages/announce-detail/index.wxss */
+@import "/wxParse/wxParse.wxss";

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

xqd
@@ -34,5 +34,11 @@ Page({
         }
       }
     })
+  },
+  redirectToAnnounce: function(e) {
+    let id = e.currentTarget.dataset.id;
+    wx.navigateTo({
+      url: '/pages/announce-detail/index?id=' + id
+    })
   }
 })

+ 4 - 1
wechat/pages/announce/announce.json

xqd
@@ -1,5 +1,8 @@
 {
+  "navigationBarBackgroundColor": "#000",
+  "navigationBarTextStyle": "white",
   "usingComponents": {
     "zan-card": "../../bower_components/zanui-weapp/dist/card/index"
-  }
+  },
+  "navigationBarTitleText": "公告"
 }

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

xqd
@@ -1,6 +1,6 @@
 <view class='sg-container'>
   <view wx:for='{{ list }}' class='info-content'>
-    <view class='info-bg'>
+    <view class='info-bg' catchtap='redirectToAnnounce' data-id='{{ item.id }}'>
       <view class="info-label">{{ item.title||'未命名' }}</view>
     </view>
   </view>

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

xqd
@@ -1,5 +1,4 @@
 .info-content {
-    padding: 0 10rpx;
     width: 100%;
     display: inline-block;
     margin-bottom: 20rpx;

+ 5 - 1
wechat/pages/article-detail/index.json

xqd
@@ -1 +1,5 @@
-{}
+{
+  "navigationBarBackgroundColor": "#000",
+  "navigationBarTextStyle": "white",
+  "navigationBarTitleText": "文章详情"
+}