Skip to content
This repository was archived by the owner on Sep 21, 2023. It is now read-only.

Commit

Permalink
update post page
Browse files Browse the repository at this point in the history
  • Loading branch information
myvin committed Oct 17, 2018
1 parent ed62496 commit 02de605
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
3 changes: 3 additions & 0 deletions filter/filter.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ var strToNumArr = function (str) {

// 获取 hostname
var getUrlHostName = function (url) {
if (!url) {
return '';
}
var arrUrl = url.split('//');
var start = arrUrl[1] ? arrUrl[1].indexOf('/') : arrUrl[0].indexOf('/');
var relUrl = arrUrl[1] ? arrUrl[1].substring(0, start) : arrUrl[0].substring(0, start);
Expand Down
4 changes: 4 additions & 0 deletions pages/post/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Page({
data: {
postInfo: {},
auth: '',
t: '',
},
onLoad(query) {
let auth = utils.ifLogined()
Expand All @@ -13,6 +14,9 @@ Page({
})
let t = query.type
let id = query.id
this.setData({
t,
})
if (t === 'post') {
this.getDetailData(query.id, 1)
this.getDetailData(query.id, 2)
Expand Down
4 changes: 3 additions & 1 deletion pages/post/post.wxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<wxs module='filters' src='../../filter/filter.wxs'></wxs>
<import src="../../wxParse/wxParse.wxml"/>
<wxs module='filters' src='../../filter/filter.wxs'></wxs>
<view class='container'>
<image wx:if='{{postInfo.screenshot}}' style='width:100%;height:340rpx;' mode='aspectFill' src='{{postInfo.screenshot}}'></image>
<view class='content'>
Expand All @@ -16,6 +16,8 @@
</view>
</view>
<view class='title'>{{postInfo.title}}</view>
<view class='ori' wx:if='{{t === "post"}}'><text>原创</text> {{postInfo.user && postInfo.user.username}}</view>
<view class='href' wx:if='{{t !== "post"}}'>原文链接 <text>{{filters.getUrlHostName(postInfo.originalUrl)}}</text></view>
<template is="wxParse" data="{{wxParseData:article.nodes}}"/>
</view>
</view>
15 changes: 15 additions & 0 deletions pages/post/post.wxss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@
font-weight: 700;
line-height: 1.5;
}
.ori,
.href {
font-size: 22rpx;
color: #999;
}
.ori text {
line-height: 1em;
display: inline-block;
padding: 6rpx 12rpx;
border-radius: 4rpx;
border: 1rpx solid #999;
}
.href text {
color: #819dba;
}
.user {
display: flex;
align-items: center;
Expand Down

0 comments on commit 02de605

Please sign in to comment.