首页新闻功能

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

View File

@ -226,6 +226,27 @@
"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": {

View File

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

View File

@ -2,7 +2,7 @@
<view class="page">
<view class="content">
<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="item-box">
<view class="item-title">报名类型</view>
@ -279,6 +279,9 @@
title: "报名成功",
success() {
setTimeout(function() {
let pages = getCurrentPages(); //
let beforePage = pages[pages.length - 2]; //
beforePage.$vm.isRefresh = true;
uni.navigateBack()
}, 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 => {
uni.hideLoading()

View File

@ -66,7 +66,7 @@
</image>
</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>
</view>
</view>
@ -75,7 +75,7 @@
<view class="item-title">视频</view>
<view class="item-content-bg" style="background: #ffffff;">
<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>
<view v-else>
<video :src="videoSrc"></video>
@ -139,7 +139,9 @@
onShow() {
if (this.isRefresh) {
this.isRefresh = false;
this.showPageLoading = true;
this.showPageLoading = true;
_self.videoId = ""
_self.videoSrc = ""
this.getDetailData();
}
},

View File

@ -5,16 +5,18 @@
<scroller @init="initScroller" @down="refreshData" @up="getData" :up="optUp"
@scroll="navFloatShow(scroller)" :fixed="false">
<!-- 搜索框 -->
<view class="search">
<view class="search-content">
<image src="../../static/images/ic_search.png" class="icon" mode="scaleToFill"></image>
<input @input="onSearchInput" placeholder="请输入关键字搜索" />
<view :class="fixedSearch? 'fixed-box':'nofixed-box'">
<view class="search">
<view class="search-content">
<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 class="btn" @click="doSearch">搜索</view>
</view>
<!-- 轮播图 -->
<swiper v-if="slider.length > 0" class="swiper" :indicator-dots="true" :autoplay="true"
indicator-color="#E4E4E4" indicator-active-color="#009749" :circular="true">
<swiper class="swiper" :indicator-dots="true" :autoplay="true" indicator-color="#E4E4E4"
indicator-active-color="#009749" :circular="true">
<swiper-item v-for="(item, index) in slider" :key="index">
<navigator class="swiper-item" hover-class="none"
:url="'/pages/news/newsdetail?url='+item.templateRecordUrl">
@ -23,6 +25,21 @@
</navigator>
</swiper-item>
</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" />
</scroller>
@ -77,10 +94,12 @@
token: "",
searchContent: "",
baseurl: this.$api.common.baseUrl,
imgUrl: this.$api.common.imgUrl,
upgradeType: 'pkg', //pkg wgt
upgradeContent: '', //
upgradeUrl: '', //
funcList: [],
fixedSearch: false,
};
},
onShow() {
@ -119,6 +138,7 @@
this.getAppVersion()
// #endif
this.getBannerList();
this.getMainFunc();
},
onPullDownRefresh() {
@ -153,6 +173,8 @@
});
this.scroller.resetUpScroll();
this.getBannerList();
this.funcList = [];
this.getMainFunc();
},
/*加载数据*/
@ -249,16 +271,17 @@
/*滚动时导航栏浮动*/
navFloatShow(scroller) {
if (scroller) {
if (scroller.scrollTop > 60) {
if (!this.showNavFloat) {
this.showNavFloat = true;
}
} else {
if (this.showNavFloat) {
this.showNavFloat = false;
}
if (scroller.scrollTop > 40) {
if (!this.fixedSearch) {
this.fixedSearch = true;
}
} else {
if (this.fixedSearch) {
this.fixedSearch = false;
}
}
}
}
},
/*菜单框展示*/
menuShow(value) {
@ -345,6 +368,44 @@
this.$alert("请输入关键字");
}
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;
}
}
.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>

View File

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

View File

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