feat: move project
This commit is contained in:
commit
4a940f28ba
97 changed files with 5047 additions and 0 deletions
33
pages/detail/detail.js
Normal file
33
pages/detail/detail.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import R from '../../utils/request';
|
||||
import C from '../../utils/constant';
|
||||
Page({
|
||||
|
||||
data: {
|
||||
cdnHost: C.cdnHost,
|
||||
detail: {},
|
||||
user: {},
|
||||
},
|
||||
onLoad(options) {
|
||||
const { id } = options;
|
||||
R.get('/index.php/api/v1/news_detail', { id }).then(({ model }) => {
|
||||
this.setData({
|
||||
detail: {
|
||||
...model.detail,
|
||||
content: (model.detail.content||'').replace(/src\="\/uploads/g, 'src="'+C.cdnHost + '/uploads'),
|
||||
imgs: (model.detail.imgs || '').split(',').filter(o=>!!o),
|
||||
video: model.detail.video ? model.detail.video : '',
|
||||
},
|
||||
user: {
|
||||
...model.user,
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
videoErrorCallback(e) {
|
||||
console.log('视频错误信息:')
|
||||
console.log(e.detail.errMsg)
|
||||
},
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
||||
8
pages/detail/detail.json
Normal file
8
pages/detail/detail.json
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"navigationBarTitleText": "详情",
|
||||
"backgroundTextStyle": "light",
|
||||
"usingComponents": {
|
||||
"t-icon": "tdesign-miniprogram/icon/icon",
|
||||
"t-image": "tdesign-miniprogram/image/image"
|
||||
}
|
||||
}
|
||||
14
pages/detail/detail.wxml
Normal file
14
pages/detail/detail.wxml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<view>
|
||||
<view class="title">{{detail.title}}</view>
|
||||
<view class="info">
|
||||
<view class="time">{{detail.create_time}}</view>
|
||||
<view class="viewcnt">
|
||||
<t-icon name="browse" size="28rpx" color="#b3b5b9"></t-icon>
|
||||
{{detail.view_cnt}}
|
||||
</view>
|
||||
</view>
|
||||
<rich-text class="desc" nodes="{{detail.content}}"></rich-text>
|
||||
<t-image mode="aspectFill" wx:for="{{detail.imgs}}" src="{{cdnHost + item}}" wx:key="item" class="img" shape="round" />
|
||||
<video class="video" wx:if="{{detail.video}}" id="myVideo" src="{{cdnHost + detail.video}}" binderror="videoErrorCallback" show-center-play-btn='{{false}}' show-play-btn="{{true}}" controls></video>
|
||||
<view class="source">来源: {{user.real_name || '三鲤'}}</view>
|
||||
</view>
|
||||
57
pages/detail/detail.wxss
Normal file
57
pages/detail/detail.wxss
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
page {
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
padding: 0 20rpx;
|
||||
padding-top: 20rpx;
|
||||
padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx);
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 34rpx;
|
||||
list-style: square;
|
||||
margin-bottom: 20rpx;
|
||||
color: #363a44;
|
||||
}
|
||||
|
||||
.info {
|
||||
display: flex;
|
||||
font-size: 28rpx;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 60rpx;
|
||||
color: #b3b5b9;
|
||||
}
|
||||
|
||||
.info .viewcnt {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.info .viewcnt .t-icon {
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.content {
|
||||
word-break: break-all;
|
||||
line-height: 46rpx;
|
||||
font-size: 26rpx;
|
||||
color: #363a44;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 100%;
|
||||
margin: 20rpx auto;
|
||||
}
|
||||
|
||||
.video {
|
||||
width: 100%;
|
||||
margin: 20rpx auto;
|
||||
}
|
||||
|
||||
.source {
|
||||
font-size: 24rpx;
|
||||
color: #b3b5b9;
|
||||
text-align: left;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue