HRead小程序修改记录

HRead小程序修改记录

将Pro版template/articleList/leftThumbnailArticle.wxss对应开源版templates/common-list ,用leftThumbnailArticle 样式表替换common-list的样式,

        post-list = left-common-list

        post-item = left-list-item

        post-img = left-list-item image.cover{}

        post-desc = left-content-right

        post-title = left-content-title

        post-data = left-content-popularity

删除/pages/list/wxml里的<view class="topic-content-brief">里的text

将Pro版的pages/cate/cate.wxml作为参考修改开源版/pages/topic/topic.wxml

class="cateRight" 替换 class="topic-list clearfix"

{
    flex: 1;
    height: 100%;
    padding: 40rpx 40rpx 0;
    overflow: auto;
    background: #f5f7f7;
}

class="list-item" 替换 class="list-item"

{
    position: relative;
    overflow: hidden;
    margin-bottom: 40rpx;
    background: #fff;
    border-radius: 10rpx;
    box-shadow: 2px 2px 10px #eee;
}

list-item image.cover 替换 topic-img

{
    width: 100%;
    height: 260rpx;
    display: block;
}

content-title 替换 topic-name-box

{
    padding: 20rpx 30rpx 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    <!--align-items: center;-->
}

新增

.topic-name  text 
{
  font-size: 15px;
  line-height: 1;
  font-weight: 500;
  color: #333;
}

content-subscribe 替换 btn-box

{
    padding: 0 30rpx 30rpx;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #959595;
}

.content-subscribe > image 替换 .btn-box image

{
    width: 98rpx;
    height: 52rpx;
    display: block;
}

全局将#118fff 替换为 #576B95

用自定义栏目字段作为缩略图,先在主题function.php里增加

// https://devework.com/wordpress-rest-api-dynamic-output.html
function dw_rest_prepare_post( $data, $post, $request ) {

    $_data = $data->data;

    $params = $request->get_params();

    $thumb =  get_post_meta( $post->ID, 'cao_thumbnail' );

        if($thumb){

            $_data['thumb_image'] = $thumb;

        }   

    $data->data = $_data;

    return $data;

}

add_filter( 'rest_prepare_post', 'dw_rest_prepare_post', 10, 3 );

在小程序将/templates/common-list.wxml里将

<image src="{{item.post_medium_image}}" 

替换为

<image src="{{item.thumb_image}}" 

Leave a Reply