This commit is contained in:
dong_bo0602 2022-11-09 16:17:14 +08:00
parent d4bb4f1c78
commit a7d42ebaf3
13 changed files with 351 additions and 78 deletions

41
app.js
View File

@ -2,20 +2,35 @@
var restAjax = require('utils/restAjax.js');
var dialog = require('utils/dialog.js');
App({
loginUrl: 'https://www.xzszwhy.cn/usercenter',
usercenterUrl: 'https://www.xzszwhy.cn/usercenter',
newsUrl: 'https://www.xzszwhy.cn/news',
newsContentUrl: 'https://www.xzszwhy.cn',
libraryUrl: 'https://www.xzszwhy.cn/library',
venueUrl: 'https://www.xzszwhy.cn/venuebooking',
activityUrl: 'https://www.xzszwhy.cn/culturalactivity',
volunteerUrl: 'https://www.xzszwhy.cn/volunteer',
activityUrl: 'https://www.xzszwhy.cn/culturalactivity',
volunteerUrl: 'https://www.xzszwhy.cn/volunteer',
liveUrl: 'https://www.xzszwhy.cn/live',
// loginUrl: 'https://www.xzszwhy.cn/usercenter',
// usercenterUrl: 'https://www.xzszwhy.cn/usercenter',
// newsUrl: 'https://www.xzszwhy.cn/news',
// newsContentUrl: 'https://www.xzszwhy.cn',
// libraryUrl: 'https://www.xzszwhy.cn/library',
// venueUrl: 'https://www.xzszwhy.cn/venuebooking',
// activityUrl: 'https://www.xzszwhy.cn/culturalactivity',
// volunteerUrl: 'https://www.xzszwhy.cn/volunteer',
// activityUrl: 'https://www.xzszwhy.cn/culturalactivity',
// volunteerUrl: 'https://www.xzszwhy.cn/volunteer',
// liveUrl: 'https://www.xzszwhy.cn/live',
// liveRecordUrl: 'https://www.xzszwhy.cn.ink',
// socialUrl: 'https://www.xzszwhy.cn/social',
// settingUrl: 'https://www.xzszwhy.cn/miniapp',
loginUrl: 'http://219.159.20.131:8081/usercenter',
usercenterUrl: 'http://219.159.20.131:8081/usercenter',
newsUrl: 'http://219.159.20.131:8081/news',
newsContentUrl: 'http://219.159.20.131:8081',
libraryUrl: 'http://219.159.20.131:8081/library',
venueUrl: 'http://219.159.20.131:8081/venuebooking',
activityUrl: 'http://219.159.20.131:8081/culturalactivity',
volunteerUrl: 'http://219.159.20.131:8081/volunteer',
activityUrl: 'http://219.159.20.131:8081/culturalactivity',
volunteerUrl: 'http://219.159.20.131:8081/volunteer',
liveUrl: 'http://219.159.20.131:8081/live',
liveRecordUrl: 'https://www.xzszwhy.cn.ink',
socialUrl: 'https://www.xzszwhy.cn/social',
settingUrl: 'https://www.xzszwhy.cn/miniapp',
socialUrl: 'http://219.159.20.131:8081/social',
settingUrl: 'http://219.159.20.131:8081/miniapp',
restAjax: restAjax,
dialog: dialog,
onLaunch: function () {

View File

@ -1,6 +1,7 @@
{
"pages": [
"pages/index/index",
"pages/newsPage/newsPage",
"pages/travel/travel",
"pages/resource/resource",
"pages/template/template",

View File

@ -16,7 +16,7 @@ Page({
},
getAreaList: function () {
var self = this;
app.restAjax.get(app.restAjax.path(app.usercenterUrl + '/app/dataarea/listareabyparentidrelease/640675', []),
app.restAjax.get(app.restAjax.path(app.usercenterUrl + '/app/dataarea/listareabyparentidrelease/110889', []),
self.data.pages, null, function (code, data) {
if (code == '200') {
self.setData({

View File

@ -39,7 +39,7 @@ Page({
var num = Math.random()
app.restAjax.get(app.restAjax.path('{settingUrl}/nav-setting.json?v=' + num, [app.settingUrl]), {}, null, function(code, data) {
self.setData({
navList: data.nav,
// navList: data.nav,
showLive: data.showLive
})
}, function(code, data) {
@ -47,21 +47,28 @@ Page({
});
},
goNav: function (e) {
var type = e.currentTarget.dataset.type
var url = e.currentTarget.dataset.url
if (type == '0') {
wx.navigateTo({
url: '../' + url + '/' + url,
})
} else if (type == '1' || type == '2') {
wx.navigateTo({
url: '../newsList/newsList?type=' + type,
})
} else {
var id = e.currentTarget.dataset.id
if (id == 'c131dd1d-83c6-46c0-b535-76dc089f2637') {
wx.switchTab({
url: '../' + url + '/' + url,
url: '../heritage/heritage',
})
return
}
// if (id == '1a140370-3e61-41d8-a2ef-72f600902460') {
// wx.navigateTo({
// url: '../travel/travel',
// })
// return
// }
if (id == '1ab9fcab-4d7e-4305-9d57-abe71cfd539a') {
wx.switchTab({
url: '../activity/activity',
})
return
}
wx.navigateTo({
url: '../newsPage/newsPage?id=' + id,
})
},
doLogin: function () {
var self = this;
@ -137,7 +144,7 @@ Page({
doGetNewsList: function() {
var self = this;
app.restAjax.get(app.restAjax.path('{newsUrl}/app/newscontent/listpagenewscontentrelease', [self.data.news.newsUrl]), {
newsDirectoriesParentId: 'f497904b-7727-4832-891c-604c36ae4167',
newsDirectoriesId: '1e494b7f-d0e4-4baa-acfe-57268247e0e4',
page: 1,
rows: 5
}, null, function(code, data) {
@ -252,11 +259,29 @@ Page({
url: '../resource/resource',
})
},
getNav: function () {
var self = this
app.restAjax.get(app.restAjax.path('{usercenterUrl}/app/newsdirectories/listnewsdirectoriesrelease', ['http://219.159.20.131:8081/news']), {
directoriesParentId: '213f660a-1660-48da-b244-56de7cf5c27e'
}, {
headers: {
token: self.data.token
}
}, function (code, data) {
console.log(data)
self.setData({
navList: data
})
}, function (code, data) {
app.dialog.msg(data.msg);
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var self = this;
self.getNav();
self.doLogin();
self.doGetBanner();
self.doGetNewsList();

View File

@ -7,50 +7,10 @@
</swiper>
</view>
<view class="tab">
<view class="tab-box" data-type="{{item.type}}" wx:for="{{navList}}" data-url="{{item.url}}" bindtap="goNav" wx:key="index" wx:if="{{item.isShow}}">
<image src="{{item.icon}}"></image>
<view class="tab-title">{{item.title}}</view>
<view class="tab-box" data-id="{{item.newsDirectoriesId}}" wx:for="{{navList}}" bindtap="goNav" wx:key="index">
<image src="{{news.newsUrl + '/route/file/downloadfile/true/' + item.directoriesPhoto}}"></image>
<view class="tab-title">{{item.directoriesName}}</view>
</view>
<!-- <view class="tab-box" bindtap="goNewsList" data-type="2">
<image src="../../images/tab6.png"></image>
<view class="tab-title">展览展示</view>
</view>
<view class="tab-box" bindtap="goNewsList" data-type="1">
<image src="../../images/tab7.png"></image>
<view class="tab-title">文化动态</view>
</view>
<view class="tab-box" bindtap="goVolunteer">
<image src="../../images/tab1.png"></image>
<view class="tab-title">志愿者服务</view>
</view>
<view class="tab-box" bindtap="goActivity">
<image src="../../images/tab2.png"></image>
<view class="tab-title">精彩活动</view>
</view>
<view class="tab-box" bindtap="goVenue">
<image src="../../images/tab3.png"></image>
<view class="tab-title">场馆导航</view>
</view>
<view class="tab-box" bindtap="goHeritage">
<image src="../../images/tab4.png"></image>
<view class="tab-title">非遗文化</view>
</view>
<view class="tab-box" bindtap="goBroadcast">
<image src="../../images/tab5.png"></image>
<view class="tab-title">直播点播</view>
</view>
<view class="tab-box" bindtap="goTrain">
<image src="../../images/tab5.png"></image>
<view class="tab-title">在线培训</view>
</view>
<view class="tab-box" bindtap="goTravel">
<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">
@ -81,7 +41,7 @@
<view class="news">
<view class="public-title">
<view class="title-text">
文化动态
政务信息
</view>
</view>
<view wx:for="{{news.newsList}}" wx:for-index="idx" wx:for-item="item" wx:key="newsList">
@ -157,7 +117,7 @@
</view>
</view>
</view>
<view class="broadcast" wx:if="{{showLive}}">
<!-- <view class="broadcast" wx:if="{{showLive}}">
<view class="public-title">
<view class="title-text">
直播专区
@ -176,5 +136,5 @@
<view class="broadcast-text">{{item.livePlanName}}</view>
</view>
</view>
</view>
</view> -->
</view>

View File

@ -18,8 +18,8 @@
width: 25%;
}
.tab-box image{
width: 100rpx;
height: 100rpx;
width: 60rpx;
height: 60rpx;
}
.tab-title{
font-size: 28rpx;
@ -77,6 +77,7 @@
border-bottom: 1px solid #EBEBEB;
display: flex;
flex-direction: column;
background-color: #fff;
}
.news-title{
color: #242424;

195
pages/newsPage/newsPage.js Normal file
View File

@ -0,0 +1,195 @@
// pages/newsPage/newsPage.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
newsUrl: app.newsUrl,
pageId: '',
areaList: [],
typeList: [],
newsList: [],
curType: '',
curArea: '',
page: {
page: 1,
rows: 10,
newsDirectoriesId: '',
county: ''
}
},
getAreaList: function () {
var self = this;
app.restAjax.get(app.restAjax.path(app.usercenterUrl + '/app/dataarea/listareabyparentidrelease/110889', []), {}, null, function (code, data) {
if (code == '200') {
self.setData({
areaList: data
})
}
}
)
},
changeArea: function (e) {
var item = this.data.page
var lv = parseInt(e.currentTarget.dataset.lv) + 1
lv = 'area' + lv
item.page = 1
item.county = e.currentTarget.dataset.area
item[lv] = e.currentTarget.dataset.area
this.setData({
page: item
})
console.log(this.data.page)
this.getNewsList()
},
getTypeList: function () {
var self = this
app.restAjax.get(app.restAjax.path(app.newsUrl + '/app/newsdirectories/listnewsdirectoriesrelease', []),
{
directoriesParentId: self.data.pageId
}, null, function (code, data) {
if (code == '200') {
self.setData({
typeList: data,
curType: data[0].newsDirectoriesId,
['page.newsDirectoriesId']: data[0].newsDirectoriesId,
})
self.getNewsList()
}
}
)
},
changeType: function (e) {
var self = this
self.setData({
curType: e.currentTarget.dataset.id,
['page.newsDirectoriesId']: e.currentTarget.dataset.id,
['page.page']: 1
})
self.getNewsList()
},
getNewsList: function () {
var self = this
app.restAjax.get(app.restAjax.path(app.newsUrl + '/app/newscontent/listpagenewscontentrelease', []),
self.data.page, null, function (code, data) {
if (code == '200') {
if (self.data.page.page == 1) {
for (let i = 0; i < data.rows.length; i++) {
data.rows[i].newsContentCoverList = data.rows[i].newsContentCoverList[0].contentCoverId
}
self.setData({
newsList: data.rows
})
} else {
if (data.rows.length > 0) {
var arr = self.data.newsList
for (let i = 0; i < data.rows.length; i++) {
data.rows[i].newsContentCoverList = data.rows[i].newsContentCoverList[0].contentCoverId
arr.push(data.rows[i])
}
self.setData({
newsList: arr
})
} else {
self.setData({
['page.page']: self.data.page.page - 1
})
wx.showToast({
title: '暂无更多',
icon: 'none'
})
}
}
}
}
)
},
loadAll: function () {
var item = {
page: 1,
rows: 10,
newsDirectoriesId: this.data.curType,
county: ''
}
this.setData({
page: item
})
this.getNewsList()
},
goNewsDetail: function (event) {
if (event.currentTarget.dataset.type == '6') {
wx.navigateTo({
url: '../newsDetail/newsDetail?content='+ event.currentTarget.dataset.content,
})
} else {
wx.navigateTo({
url: '../newsDetail/newsDetail?templateRecordUrl='+ event.currentTarget.dataset.templateRecordUrl,
})
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
pageId: options.id,
})
this.getAreaList()
this.getTypeList()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
var self = this
this.setData({
['page.page']: self.data.page.page + 1
})
this.getNewsList()
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,13 @@
<view class="area type">
<view class="area-box {{curType == item.newsDirectoriesId? 'active': ''}}" bindtap="changeType" wx:for="{{typeList}}" wx:key="index" data-id="{{item.newsDirectoriesId}}">{{item.directoriesName}}</view>
</view>
<view class="area">
<view class="area-box {{'' == page.county?'active': ''}}" bindtap="loadAll">全部</view>
<view class="area-box {{item.areaId == page.county?'active': ''}}" wx:for="{{areaList}}" wx:key="index" data-area="{{item.areaId}}" data-lv="{{item.areaLevel}}" bindtap="changeArea">{{item.areaName}}</view>
</view>
<view class="news">
<view class="news-box" wx:for="{{newsList}}" wx:key="index" bindtap="goNewsDetail" data-template-record-url="{{item.templateRecordUrl}}" data-type="{{item.newsContentType}}" data-content="{{item.newsContentContent}}">
<image src="{{newsUrl + '/route/file/downloadfile/true/' + item.newsContentCoverList}}" alt=""/>
<view class="news-title">{{item.newsContentTitle}}</view>
</view>
</view>

View File

@ -0,0 +1,53 @@
page{
background-color: #fafafa;
}
.area{
position: fixed;
top: 80rpx;
left: 0;
right: 0;
height: 80rpx;
white-space: nowrap;
overflow-x: auto;
background: #FFF;
z-index: 100;
}
.type{
top: 0;
}
.area-box{
display: inline-block;
width: 25%;
line-height: 80rpx;
text-align: center;
font-size: 30rpx;
white-space: nowrap;
overflow: hidden;
text-overflow:ellipsis;
}
.area-box.active{
color: #125CE1;
}
.news{
margin-top: 160rpx;
padding: 20rpx;
}
.news-box{
margin-bottom: 20rpx;
border-radius: 10rpx;
overflow: hidden;
background-color: #fff;
font-size: 0;
}
.news-box image{
width: 100%;
height: 350rpx;
}
.news-title{
padding: 20rpx;
font-weight: bold;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 32rpx;
}

View File

@ -134,7 +134,7 @@ Page({
// 获取地区列表
getAreaList: function () {
var self = this;
app.restAjax.get(app.restAjax.path(app.usercenterUrl + '/app/dataarea/listareabyparentidrelease/640675', []),
app.restAjax.get(app.restAjax.path(app.usercenterUrl + '/app/dataarea/listareabyparentidrelease/110889', []),
self.data.pages, null, function (code, data) {
if (code == '200') {
self.setData({

View File

@ -3,7 +3,7 @@
<view class="venue-top-name">{{venuesDetail.venueName}}</view>
<view class="venue-top-info">营业时间:{{venuesDetail.businessHours}}</view>
<view class="venue-top-info">联系方式:{{venuesDetail.venueTelephone}}</view>
<view class="venue-top-tip">温馨提示:{{venuesDetail.bookingTips}}</view>
<!-- <view class="venue-top-tip">温馨提示:{{venuesDetail.bookingTips}}</view> -->
<view class="swiper-box">
<swiper autoplay="{{autoplay}}" >
<swiper-item class="swiper-item" wx:for="{{swiperImg}}" wx:key="index">

View File

@ -0,0 +1,7 @@
{
"projectname": "xz_mini",
"setting": {
"compileHotReLoad": true
},
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html"
}