resource
This commit is contained in:
parent
1931c2cbf6
commit
5ae1687061
1
app.json
1
app.json
@ -2,6 +2,7 @@
|
||||
"pages": [
|
||||
"pages/index/index",
|
||||
"pages/travel/travel",
|
||||
"pages/resource/resource",
|
||||
"pages/template/template",
|
||||
"pages/train/train",
|
||||
"pages/cultureMap/cultureMap",
|
||||
|
@ -210,6 +210,11 @@ Page({
|
||||
url: '../travel/travel',
|
||||
})
|
||||
},
|
||||
goResource: function () {
|
||||
wx.navigateTo({
|
||||
url: '../resource/resource',
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
|
@ -42,6 +42,10 @@
|
||||
<image src="../../images/tab6.png"></image>
|
||||
<view class="tab-title">文化旅游</view>
|
||||
</view>
|
||||
<view class="tab-box" bindtap="goResource">
|
||||
<image src="../../images/tab4.png"></image>
|
||||
<view class="tab-title">数图资源</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="recommend">
|
||||
<view class="public-title">
|
||||
|
136
pages/resource/resource.js
Normal file
136
pages/resource/resource.js
Normal file
@ -0,0 +1,136 @@
|
||||
// pages/resource/resource.js
|
||||
const app = getApp()
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
newsUrl: app.newsUrl,
|
||||
directoriesParentId: '98c74389-2088-499b-a046-8611bdc57ea4',
|
||||
typeList: [],
|
||||
currentPage: 1,
|
||||
rows: 10,
|
||||
currentNewsDictionariesId: ''
|
||||
},
|
||||
getType: function () {
|
||||
var self = this
|
||||
app.restAjax.get(app.restAjax.path('{newsUrl}/app/newsdirectories/listnewsdirectoriesrelease', [app.newsUrl]), {
|
||||
directoriesParentId: self.data.directoriesParentId
|
||||
}, null, function (code, data) {
|
||||
self.setData({
|
||||
typeList: data
|
||||
})
|
||||
self.getList(1)
|
||||
})
|
||||
},
|
||||
changeType: function (e) {
|
||||
this.setData({
|
||||
currentNewsDictionariesId: e.currentTarget.dataset.newsDirectoriesId
|
||||
})
|
||||
this.getList(1)
|
||||
},
|
||||
getList: function (page) {
|
||||
var self = this
|
||||
app.dialog.loading('正在加载');
|
||||
var info = {
|
||||
newsDirectoriesParentId: self.data.directoriesParentId,
|
||||
newsDirectoriesId: self.data.currentNewsDictionariesId ? self.data.currentNewsDictionariesId : '',
|
||||
page: page,
|
||||
rows: self.data.rows
|
||||
}
|
||||
app.restAjax.get(app.restAjax.path('{newsUrl}/app/newscontent/listpagenewscontentrelease', [app.newsUrl]), info, null, function (code, data) {
|
||||
var newsArray;
|
||||
for (var i = 0; i < data.rows.length; i++) {
|
||||
data.rows[i].newsContentCoverList = data.rows[i].newsContentCoverList[0].contentCoverId
|
||||
}
|
||||
if(page <= 1) {
|
||||
newsArray = data.rows;
|
||||
} else {
|
||||
newsArray = self.data.news.newsList;
|
||||
newsArray = newsArray.concat(data.rows);
|
||||
}
|
||||
self.setData({
|
||||
currentPage: page,
|
||||
trainList: newsArray
|
||||
})
|
||||
if(data.rows.length == 0) {
|
||||
app.dialog.msg('暂无数据');
|
||||
return;
|
||||
}
|
||||
}, function(code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
wx.stopPullDownRefresh();
|
||||
wx.hideLoading();
|
||||
})
|
||||
},
|
||||
goNewsDetail: function (e) {
|
||||
var url = e.currentTarget.dataset.templateRecordUrl
|
||||
var link = e.currentTarget.dataset.contentLink
|
||||
if (link) {
|
||||
wx.navigateTo({
|
||||
url: '../template/template?link=' + link,
|
||||
})
|
||||
} else {
|
||||
wx.navigateTo({
|
||||
url: '../template/template?url=' + url,
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.getType()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
this.getList(1);
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
this.getList(this.data.currentPage + 1);
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
3
pages/resource/resource.json
Normal file
3
pages/resource/resource.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
25
pages/resource/resource.wxml
Normal file
25
pages/resource/resource.wxml
Normal file
@ -0,0 +1,25 @@
|
||||
<view class="top-tab">
|
||||
<view class="type">
|
||||
<view class="tab-box {{!currentNewsDictionariesId ? 'active' : ''}}" bindtap="doClearCurrentNewsDictionariesId">
|
||||
<image src="../../images/selected-l.png" class="selected-l"></image>
|
||||
全部
|
||||
<image src="../../images/selected-r.png" class="selected-r"></image>
|
||||
</view>
|
||||
<view class="tab-box {{item.newsDirectoriesId == currentNewsDictionariesId ? 'active' : ''}}" wx:for="{{typeList}}" wx:key="index" bindtap="changeType" data-news-directories-id="{{item.newsDirectoriesId}}">
|
||||
<image src="../../images/selected-l.png" class="selected-l"></image>
|
||||
{{item.directoriesName}}
|
||||
<image src="../../images/selected-r.png" class="selected-r"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="news">
|
||||
<view class="news-box" bindtap="goNewsDetail" data-template-record-url="{{item.templateRecordUrl}}" data-content-link="{{item.newsContentLink}}" wx:for="{{trainList}}" wx:key="index">
|
||||
<view class="news-title">{{item.newsContentTitle}}</view>
|
||||
<view class="news-small-pic">
|
||||
<image src="{{newsUrl}}/route/file/downloadfile/true/{{item.newsContentCoverList}}"></image>
|
||||
</view>
|
||||
<view class="news-info">
|
||||
<text>{{item.newsContentPublishTime}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
141
pages/resource/resource.wxss
Normal file
141
pages/resource/resource.wxss
Normal file
@ -0,0 +1,141 @@
|
||||
.top-tab{
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: #fff;
|
||||
overflow-x: auto;
|
||||
}
|
||||
.type{
|
||||
display: flex;
|
||||
}
|
||||
.tab-box{
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 30%;
|
||||
position: relative;
|
||||
height: 90rpx;
|
||||
font-size: 30rpx;
|
||||
color: #242424;
|
||||
flex-shrink: 0;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
.tab-box.active{
|
||||
color: #9F1512;
|
||||
}
|
||||
.tab-box image{
|
||||
position: absolute;
|
||||
width: 15rpx;
|
||||
height: 40rpx;
|
||||
top: 50%;
|
||||
margin-top: -20rpx;
|
||||
display: none;
|
||||
}
|
||||
.tab-box.active image{
|
||||
display: block;
|
||||
}
|
||||
.tab-box image.selected-l{
|
||||
left: 10rpx;
|
||||
}
|
||||
.tab-box image.selected-r{
|
||||
right: 10rpx;
|
||||
}
|
||||
.area{
|
||||
overflow-x: auto;
|
||||
white-space: nowrap;
|
||||
position: fixed;
|
||||
top: 90rpx;
|
||||
left: 0;
|
||||
right: 0;
|
||||
border-bottom: 1px solid #DDD;
|
||||
background: #fff;
|
||||
}
|
||||
.area-box{
|
||||
display: inline-flex;
|
||||
width: 30%;
|
||||
height: 90rpx;
|
||||
/* line-height: 90rpx;
|
||||
text-align: center; */
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 20px;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.area-box.active{
|
||||
color: #9F1512;
|
||||
}
|
||||
.area-box image{
|
||||
position: absolute;
|
||||
width: 15rpx;
|
||||
height: 40rpx;
|
||||
top: 50%;
|
||||
margin-top: -20rpx;
|
||||
display: none;
|
||||
}
|
||||
.area-box.active image{
|
||||
display: block;
|
||||
}
|
||||
.area-box image.selected-l{
|
||||
left: 20rpx;
|
||||
}
|
||||
.area-box image.selected-r{
|
||||
right: 20rpx;
|
||||
}
|
||||
.news{
|
||||
padding: 0 30rpx;
|
||||
border-bottom: 5px solid #FBFBFB;
|
||||
margin-top: 90rpx;
|
||||
}
|
||||
.news-box{
|
||||
padding: 30rpx 0;
|
||||
border-bottom: 1px solid #EBEBEB;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.news-box:first-child{
|
||||
padding-top: 0;
|
||||
}
|
||||
.news-title{
|
||||
color: #242424;
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.news-info{
|
||||
color: #949494;
|
||||
margin-top: 15rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.news-info text{
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.news-big-pic, .news-small-pic{
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.news-big-pic image{
|
||||
width: 100%;
|
||||
}
|
||||
.news-small-pic image{
|
||||
width: 100%;
|
||||
height: 400rpx;
|
||||
}
|
||||
.transverse-news{
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.news-row-img{
|
||||
width: 30%;
|
||||
height: 150rpx;
|
||||
}
|
||||
.news-row-img image{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.news-row-info{
|
||||
width: 68%;
|
||||
}
|
@ -13,11 +13,36 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
console.log(options)
|
||||
this.setData({
|
||||
url: options.url
|
||||
if (options.link) {
|
||||
var type = options.link.split('.')
|
||||
if (type[type.length-1] == 'pdf') {
|
||||
wx.downloadFile({
|
||||
url: options.link,
|
||||
success: function (res) {
|
||||
const filePath = res.tempFilePath
|
||||
console.log(res)
|
||||
wx.openDocument({
|
||||
filePath: filePath,
|
||||
fileType: 'pdf',
|
||||
success: function (res) {
|
||||
console.log(res)
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: function (error) {
|
||||
console.log(error)
|
||||
}
|
||||
})
|
||||
}
|
||||
// this.setData({
|
||||
// url: options.link
|
||||
// })
|
||||
} else {
|
||||
this.setData({
|
||||
url: 'https://www.wgink.ink/' + options.url
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
|
@ -1 +1 @@
|
||||
<web-view src="https://www.wgink.ink/{{url}}" wx:if="{{url}}"></web-view>
|
||||
<web-view src="{{url}}" wx:if="{{url}}"></web-view>
|
Loading…
Reference in New Issue
Block a user