首页新闻功能

This commit is contained in:
itgaojian 2023-02-27 11:21:31 +08:00
parent 2ce844099e
commit 57b4d1df94
16 changed files with 323 additions and 82 deletions

View File

@ -18,7 +18,9 @@ let api = {
"app/newscontent/listpagenewscontentrelease", //获取新闻列表 newsDirectoriesId "app/newscontent/listpagenewscontentrelease", //获取新闻列表 newsDirectoriesId
NEWS_MAIN_ID: "cadef8e1-1baf-4aec-a1b4-f002bd5e99f5", //新闻类型ID NEWS_MAIN_ID: "cadef8e1-1baf-4aec-a1b4-f002bd5e99f5", //新闻类型ID
NEWS_BANNER_ID: "cb7cd502-ff00-4d58-83c1-c54c57add14c", NEWS_BANNER_ID: "cb7cd502-ff00-4d58-83c1-c54c57add14c",
NEWS_MAIN_FUNC: "f367f74b-3778-4801-a0c5-b85377a12a0b",
imgUrl: apiRoot + clinetNews + "route/file/download/true/", imgUrl: apiRoot + clinetNews + "route/file/download/true/",
getMainFunc: apiRoot + clinetNews + "app/newsdirectories/listnewsdirectoriesrelease", //获取首页功能
}, },
duty: { duty: {
@ -35,9 +37,9 @@ let api = {
getUnitSignInfo: apiRoot + clinetDuty + "app/activity-join-company/get/", getUnitSignInfo: apiRoot + clinetDuty + "app/activity-join-company/get/",
getMineSignInfo: apiRoot + clinetDuty + "app/activity-join/get/", getMineSignInfo: apiRoot + clinetDuty + "app/activity-join/get/",
getMineReportList: apiRoot + clinetDuty + 'app/activity-report/listpage', getMineReportList: apiRoot + clinetDuty + 'app/activity-report/listpage',
doSaveActivityReport: apiRoot + clinetDuty + 'app/activity-report/save', doSaveActivityReport: apiRoot + clinetDuty + 'app/activity-report/save',
doEditActivityReport: apiRoot + clinetDuty + 'app/activity-report/updateactivityreport/', doEditActivityReport: apiRoot + clinetDuty + 'app/activity-report/updateactivityreport/',
getActivityReportDetail: apiRoot + clinetDuty + 'app/activity-report/get/', getActivityReportDetail: apiRoot + clinetDuty + 'app/activity-report/get/',
doDelActivityReport: apiRoot + clinetDuty + 'app/activity-report/remove/', doDelActivityReport: apiRoot + clinetDuty + 'app/activity-report/remove/',
}, },
article: { article: {

View File

@ -226,6 +226,27 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, {
"path": "pages/news/oldtrees",
"style": {
"navigationBarTitleText": "古树名木",
"enablePullDownRefresh": false
}
}, {
"path": "pages/news/newsList",
"style": {
"navigationBarTitleText": "新闻",
"enablePullDownRefresh": false
}
}, {
"path": "pages/news/newsweb",
"style": {
"navigationBarTitleText": "新闻",
"enablePullDownRefresh": false
}
} }
], ],
"globalStyle": { "globalStyle": {

View File

@ -10,7 +10,7 @@
<view class="title-status">{{bean.status}}</view> <view class="title-status">{{bean.status}}</view>
<text>{{bean.name}}</text> <text>{{bean.name}}</text>
</view> </view>
<rich-text class="title-content" :nodes="bean.introduce"></rich-text> <!-- <rich-text class="title-content" :nodes="bean.introduce"></rich-text> -->
<view class="count-btn"> <view class="count-btn">
<view>参加人数:{{bean.joinedCount}}/{{bean.joinCount}}</view> <view>参加人数:{{bean.joinedCount}}/{{bean.joinCount}}</view>
<block v-if="canJoin"> <block v-if="canJoin">
@ -95,13 +95,13 @@
</view> </view>
<view>{{bean.startTime}}</view> <view>{{bean.startTime}}</view>
</view> </view>
<view class="options"> <!-- <view class="options">
<view class="op-title"> <view class="op-title">
<view class="point"></view> <view class="point"></view>
<view class="op-content">项目建设内容</view> <view class="op-content">项目建设内容</view>
</view> </view>
<rich-text :nodes="bean.constructionContent"></rich-text> <rich-text :nodes="bean.constructionContent"></rich-text>
</view> </view> -->
<view class="options-box"> <view class="options-box">
<view class="options-title">()</view> <view class="options-title">()</view>
<view class="options-content">活动时间:{{bean.startTime}}</view> <view class="options-content">活动时间:{{bean.startTime}}</view>
@ -120,23 +120,29 @@
<view class="options-title">()</view> <view class="options-title">()</view>
<view class="options-content">活动主题:{{bean.theme}}</view> <view class="options-content">活动主题:{{bean.theme}}</view>
</view> </view>
<view class="options-box-c"> <!-- <view class="options-box-c">
<view class="options-title-c">()要求</view> <view class="options-title-c">()要求</view>
<view class="options-content-c">{{bean.ask}}</view> <view class="options-content-c">{{bean.ask}}</view>
</view> </view> -->
<view class="options-box-c"> <!-- <view class="options-box-c">
<view>()活动声明</view> <view>()活动声明</view>
<rich-text :nodes="bean.statement"></rich-text> <rich-text :nodes="bean.statement"></rich-text>
</view> </view> -->
<view class="options-box-c"> <view class="options-box-c">
<view>()宣传内容</view> <view>()宣传内容</view>
<view class="img-box"> <view class="img-box">
<view v-if="bean.photo" v-for="(item,index) in bean.photoList" :key="index"> <rich-text :nodes="bean.content"></rich-text>
<image :src="imgUrl+item" mode="aspectFill"></image> <block v-if="bean.photo">
</view> <view v-for="(item,idx) in bean.photoList" :key="idx">
<view v-if="bean.videos" v-for="(item,index) in bean.videoList" :key="index"> <image :src="imgUrl+item" mode="scaleToFill" @click="showImg(item)"></image>
<video :src="imgUrl+item"></video> </view>
</view> </block>
<block v-if="bean.videos">
<view v-for="(it,index) in bean.videoList" :key="index">
<video :src="imgUrl+it" style="width: 100%;"></video>
</view>
</block>
</view> </view>
</view> </view>
</view> </view>
@ -165,7 +171,8 @@
canJoin: false, canJoin: false,
token: '', token: '',
mineSignInfo: {}, mineSignInfo: {},
uniSignInfo: {} uniSignInfo: {},
isRefresh: false,
} }
}, },
onLoad(res) { onLoad(res) {
@ -190,6 +197,12 @@
} }
}, },
onShow() {
if (this.isRefresh) {
this.isRefresh = false;
this.getActivityDetail()
}
},
methods: { methods: {
closePage() { closePage() {
uni.navigateBack() uni.navigateBack()
@ -216,13 +229,15 @@
var mark = { var mark = {
latitude: this.bean.latitude, latitude: this.bean.latitude,
longitude: this.bean.longitude, longitude: this.bean.longitude,
iconPath: '/static/images/ic_location_mark.png' iconPath: '/static/images/ic_location_marker.png'
}; };
this.latitude = this.bean.latitude;
this.longitude = this.bean.longitude;
this.canJoin = '已发布' == this.bean.status || '报名中' == this.bean.status; this.canJoin = '已发布' == this.bean.status || '报名中' == this.bean.status;
this.covers.push(mark); this.covers.push(mark);
this.covers = this.covers; this.covers = this.covers;
} }
console.log(this.bean) console.log(this.covers)
}, },
fail: res => { fail: res => {
this.showPageLoading = false this.showPageLoading = false
@ -314,6 +329,12 @@
uni.hideLoading() uni.hideLoading()
} }
}); });
},
showImg(url) {
var u = this.imgUrl + url;
uni.previewImage({
urls: [u]
})
} }
} }
} }

View File

@ -2,7 +2,7 @@
<view class="page"> <view class="page">
<view class="content"> <view class="content">
<scroll-view scroll-y="true" style="height: 95%;padding-bottom: 150rpx;margin-bottom: 150rpx;"> <scroll-view scroll-y="true" style="height: 95%;padding-bottom: 150rpx;margin-bottom: 150rpx;">
<view class="base-person"> <view class="base-person">
<view class="thick-divider"></view> <view class="thick-divider"></view>
<view class="item-box"> <view class="item-box">
<view class="item-title">报名类型</view> <view class="item-title">报名类型</view>
@ -279,6 +279,9 @@
title: "报名成功", title: "报名成功",
success() { success() {
setTimeout(function() { setTimeout(function() {
let pages = getCurrentPages(); //
let beforePage = pages[pages.length - 2]; //
beforePage.$vm.isRefresh = true;
uni.navigateBack() uni.navigateBack()
}, 1000) }, 1000)
} }
@ -287,8 +290,19 @@
} }
} }
}, },
fail: res => { fail: res => {
console.log(res)
if (res.data) {
uni.showToast({
icon: 'error',
title: res.data.msg
})
} else {
uni.showToast({
icon: 'error',
title: '网络错误'
})
}
}, },
complete: res => { complete: res => {
uni.hideLoading() uni.hideLoading()

View File

@ -66,7 +66,7 @@
</image> </image>
</block> </block>
</block> </block>
<image src="../../static/images/ic_empty_data.png" mode="scaleToFill" v-else> <image style="width: 100rpx;height: 100rpx;align-self: center;" src="../../static/images/ic_empty_data.png" mode="scaleToFill" v-else>
</image> </image>
</view> </view>
</view> </view>
@ -75,7 +75,7 @@
<view class="item-title">视频</view> <view class="item-title">视频</view>
<view class="item-content-bg" style="background: #ffffff;"> <view class="item-content-bg" style="background: #ffffff;">
<image src="/static/images/ic_empty_data.png" mode="scaleToFill" v-if="videoSrc==''" <image src="/static/images/ic_empty_data.png" mode="scaleToFill" v-if="videoSrc==''"
style="width: 120rpx;height: 120rpx;align-self: center;"> style="width: 120rpx;height: 120rpx;">
</image> </image>
<view v-else> <view v-else>
<video :src="videoSrc"></video> <video :src="videoSrc"></video>
@ -139,7 +139,9 @@
onShow() { onShow() {
if (this.isRefresh) { if (this.isRefresh) {
this.isRefresh = false; this.isRefresh = false;
this.showPageLoading = true; this.showPageLoading = true;
_self.videoId = ""
_self.videoSrc = ""
this.getDetailData(); this.getDetailData();
} }
}, },

View File

@ -5,16 +5,18 @@
<scroller @init="initScroller" @down="refreshData" @up="getData" :up="optUp" <scroller @init="initScroller" @down="refreshData" @up="getData" :up="optUp"
@scroll="navFloatShow(scroller)" :fixed="false"> @scroll="navFloatShow(scroller)" :fixed="false">
<!-- 搜索框 --> <!-- 搜索框 -->
<view class="search"> <view :class="fixedSearch? 'fixed-box':'nofixed-box'">
<view class="search-content"> <view class="search">
<image src="../../static/images/ic_search.png" class="icon" mode="scaleToFill"></image> <view class="search-content">
<input @input="onSearchInput" placeholder="请输入关键字搜索" /> <image src="../../static/images/ic_search.png" class="icon" mode="scaleToFill"></image>
<input @input="onSearchInput" placeholder="请输入关键字搜索" />
</view>
<view class="btn" @click="doSearch">搜索</view>
</view> </view>
<view class="btn" @click="doSearch">搜索</view>
</view> </view>
<!-- 轮播图 --> <!-- 轮播图 -->
<swiper v-if="slider.length > 0" class="swiper" :indicator-dots="true" :autoplay="true" <swiper class="swiper" :indicator-dots="true" :autoplay="true" indicator-color="#E4E4E4"
indicator-color="#E4E4E4" indicator-active-color="#009749" :circular="true"> indicator-active-color="#009749" :circular="true">
<swiper-item v-for="(item, index) in slider" :key="index"> <swiper-item v-for="(item, index) in slider" :key="index">
<navigator class="swiper-item" hover-class="none" <navigator class="swiper-item" hover-class="none"
:url="'/pages/news/newsdetail?url='+item.templateRecordUrl"> :url="'/pages/news/newsdetail?url='+item.templateRecordUrl">
@ -23,6 +25,21 @@
</navigator> </navigator>
</swiper-item> </swiper-item>
</swiper> </swiper>
<!-- 功能按钮 -->
<scroll-view scroll-x="true" style="white-space: nowrap;margin-top: 10rpx;height: 140rpx;">
<view class="func-item" @click="openTrees">
<image src="../../static/images/ic_old_tree_icon.png" mode="scaleToFill"></image>
<view class="txt">古树名木</view>
</view>
<block v-for="(item,index) in funcList" :key="index">
<view class="func-item" @click="openOther(item)">
<image
:src="item.directoriesPhoto=='' ? '/static/images/ic_old_tree_icon.png':imgUrl+item.directoriesPhoto"
mode="scaleToFill"></image>
<view class="txt">{{item.directoriesName}}</view>
</view>
</block>
</scroll-view>
<!-- 新闻列表 --> <!-- 新闻列表 -->
<articleList :list="list" /> <articleList :list="list" />
</scroller> </scroller>
@ -77,10 +94,12 @@
token: "", token: "",
searchContent: "", searchContent: "",
baseurl: this.$api.common.baseUrl, baseurl: this.$api.common.baseUrl,
imgUrl: this.$api.common.imgUrl,
upgradeType: 'pkg', //pkg wgt upgradeType: 'pkg', //pkg wgt
upgradeContent: '', // upgradeContent: '', //
upgradeUrl: '', // upgradeUrl: '', //
funcList: [],
fixedSearch: false,
}; };
}, },
onShow() { onShow() {
@ -119,6 +138,7 @@
this.getAppVersion() this.getAppVersion()
// #endif // #endif
this.getBannerList(); this.getBannerList();
this.getMainFunc();
}, },
onPullDownRefresh() { onPullDownRefresh() {
@ -153,6 +173,8 @@
}); });
this.scroller.resetUpScroll(); this.scroller.resetUpScroll();
this.getBannerList(); this.getBannerList();
this.funcList = [];
this.getMainFunc();
}, },
/*加载数据*/ /*加载数据*/
@ -249,16 +271,17 @@
/*滚动时导航栏浮动*/ /*滚动时导航栏浮动*/
navFloatShow(scroller) { navFloatShow(scroller) {
if (scroller) { if (scroller) {
if (scroller.scrollTop > 60) { if (scroller.scrollTop > 40) {
if (!this.showNavFloat) { if (!this.fixedSearch) {
this.showNavFloat = true; this.fixedSearch = true;
} }
} else { } else {
if (this.showNavFloat) { if (this.fixedSearch) {
this.showNavFloat = false; this.fixedSearch = false;
} }
} }
} }
}, },
/*菜单框展示*/ /*菜单框展示*/
menuShow(value) { menuShow(value) {
@ -345,6 +368,44 @@
this.$alert("请输入关键字"); this.$alert("请输入关键字");
} }
this.refreshData() this.refreshData()
},
getMainFunc() {
//
var _self = this;
uni.request({
url: _self.$api.news.getMainFunc,
data: {
directoriesParentId: _self.$api.news.NEWS_MAIN_FUNC
},
success(res) {
if (res.statusCode == 200) {
_self.funcList = res.data
}
},
fail(error) {}
})
},
//
openTrees() {
uni.navigateTo({
url: '/pages/news/oldtrees'
})
},
//
openOther(item) {
//
if ('0' == item.directoriesView) {
uni.navigateTo({
url: '/pages/news/newsweb?url=' + item.directoriesTarget2 + '&title=' + item
.directoriesName
})
} else {
uni.navigateTo({
url: '/pages/news/newsList?nId=' + item.newsDirectoriesId + '&title=' + item
.directoriesName
})
}
} }
} }
}; };
@ -643,4 +704,53 @@
color: #b3b3b3; color: #b3b3b3;
} }
} }
.func-box {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
height: 80rpx;
width: 100%;
white-space: nowrap;
}
.func-item {
display: inline-block;
text-align: center;
width: 160rpx;
height: 186rpx;
margin-right: 21rpx;
&:last-child {
margin-right: 0rpx;
}
image {
width: 60rpx;
height: 60rpx;
}
.txt {
font-size: 28rpx;
color: #262626;
}
}
.fixed-box {
position: fixed;
top: 0;
left: 0;
width: 100%;
padding-top: 40rpx;
background: #ffffff;
z-index: 10;
padding-bottom: 10rpx;
}
.nofixed-box {
position: static;
}
</style> </style>

View File

@ -89,7 +89,8 @@
showNoData: false, showNoData: false,
showPageLoading: true, showPageLoading: true,
showNavFloat: false, showNavFloat: false,
navBarHeight: '' navBarHeight: '',
newsId: ''
}; };
}, },
onShow() { onShow() {
@ -123,6 +124,10 @@
this.category_index = e.category_index; this.category_index = e.category_index;
} }
// #endif // #endif
this.newsId = e.nId
uni.setNavigationBarTitle({
title: e.title
})
this.getCategory(); this.getCategory();
}, },
onPullDownRefresh() { onPullDownRefresh() {
@ -160,7 +165,7 @@
url: this.$api.news.getMainFun, url: this.$api.news.getMainFun,
method: 'GET', method: 'GET',
data: { data: {
'directoriesParentId': this.$api.news.NEWS_MAIN_TAB 'directoriesParentId': this.newsId
}, },
dataType: 'json', dataType: 'json',
success: res => { success: res => {
@ -171,6 +176,7 @@
nextIndex = nextIndex <= 0 ? 0 : nextIndex; nextIndex = nextIndex <= 0 ? 0 : nextIndex;
this.scroll_category_id = `category_id-${nextIndex}`; //, this.scroll_category_id = `category_id-${nextIndex}`; //,
} }
console.log(this.scroll_category_id)
} else { } else {
this.$alert(res.msg); this.$alert(res.msg);
} }
@ -181,39 +187,37 @@
/*获取数据*/ /*获取数据*/
getData() { getData() {
// this.$app.request({ this.$app.request({
// url: this.$api.article.index, url: this.$api.news.getNewsList,
// data: { data: {
// category_id: this.category_id, newsDirectoriesId: this.category_id,
// page_index: this.scroller.num, page: this.scroller.num,
// page_size: this.scroller.size rows: this.scroller.size,
// }, keywords: this.searchContent
// method: 'POST', },
// dataType: 'json', method: 'GET',
// success: res => { dataType: 'json',
// if (res.code == 0) { success: res => {
// if (this.scroller.num == 1) { if (res.rows != undefined) {
// this.list = []; if (this.scroller.num == 1) {
// } this.list = [];
// if (this.slider.length == 0) { }
// this.slider = res.data.slider; this.list = this.list.concat(res.rows);
// } this.scroller.endBySize(res.rows.length, res.rows.total);
// this.list = this.list.concat(res.data.list); this.showPageLoading = false;
// this.scroller.endByPage(res.data.list.length, res.data.page); } else {
// this.showPageLoading = false; this.scroller.endSuccess();
// } else { this.$alert(res.msg);
// this.scroller.endSuccess(); }
// this.$alert(res.msg); },
// } fail: res => {
// }, this.scroller.endErr();
// fail: res => { },
// this.scroller.endErr(); complete: res => {
// }, uni.stopPullDownRefresh();
// complete: res => { uni.hideLoading();
// uni.stopPullDownRefresh(); }
// uni.hideLoading(); });
// }
// });
}, },
/*切换导航*/ /*切换导航*/

28
pages/news/newsweb.vue Normal file
View File

@ -0,0 +1,28 @@
<template>
<view>
<web-view :src="pageUrl"></web-view>
</view>
</template>
<script>
export default {
data() {
return {
pageUrl: ''
}
},
onLoad(res) {
this.pageUrl = res.url;
uni.setNavigationBarTitle({
title:res.title
})
},
methods: {
}
}
</script>
<style>
</style>

43
pages/news/oldtrees.vue Normal file
View File

@ -0,0 +1,43 @@
<template>
<view class="page">
<image src="/static/images/ic_static_1.jpg" mode="widthFix"></image>
<image src="/static/images/ic_static_2.png" mode="widthFix"></image>
<image src="/static/images/ic_static_3.png" mode="widthFix"></image>
<image src="/static/images/ic_static_4.jpg" mode="widthFix"></image>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
page {
height: 100%;
}
.page {
display: flex;
flex: 1;
flex-direction: column;
align-items: center;
justify-content: flex-start;
overflow: auto;
overflow-x: auto;
height: auto;
}
image {
width: 100%;
height: auto;
}
</style>

View File

@ -257,7 +257,6 @@
'token': _self.token 'token': _self.token
}, },
success(res) { success(res) {
console.log(res)
if (res) { if (res) {
getApp().globalData.userInfo = res; getApp().globalData.userInfo = res;
_self.userInfo = res _self.userInfo = res
@ -322,7 +321,6 @@
}, },
dataType: 'json', dataType: 'json',
success: res => { success: res => {
console.log(res)
if (res.total != undefined) { if (res.total != undefined) {
this.certifNum = res.total this.certifNum = res.total
} }

View File

@ -18,8 +18,6 @@
</view> </view>
<view class="button" hover-class="button-hover" @tap="bindLogin"><text>登录</text></view> <view class="button" hover-class="button-hover" @tap="bindLogin"><text>登录</text></view>
<view class="other"> <view class="other">
<navigator url="forget" open-type="navigate">忘记密码</navigator>
<text>|</text>
<navigator url="register" open-type="navigate">注册账户</navigator> <navigator url="register" open-type="navigate">注册账户</navigator>
</view> </view>
</view> </view>

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
static/images/ic_static_1.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
static/images/ic_static_2.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 KiB

BIN
static/images/ic_static_3.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 KiB

BIN
static/images/ic_static_4.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB