From 96d303af087ae6e14651447adeadf937746bcc31 Mon Sep 17 00:00:00 2001 From: ZhaoTongYao <531131322@qq.com> Date: Mon, 2 Nov 2020 17:43:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=B8=80=E9=94=AE=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=EF=BC=8C=E8=A7=A3=E7=A0=81=E9=94=A6=E6=B0=B4=E6=94=B9=E7=89=88?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 3 +- pages/indexNew/indexNew.js | 56 ++- subpages/oneKeyService/pages/index/index.js | 178 ++++--- subpages/oneKeyService/pages/index/index.json | 6 +- subpages/oneKeyService/pages/index/index.wxml | 12 +- .../components/newsList/newsList.js | 83 ++++ .../components/newsList/newsList.json | 3 + .../components/newsList/newsList.wxml | 51 ++ .../components/newsList/newsList.wxss | 159 ++++++ .../pages/moduleList/moduleList.js | 314 ++++++++++++ .../pages/moduleList/moduleList.json | 8 + .../pages/moduleList/moduleList.wxml | 128 +++++ .../pages/moduleList/moduleList.wxss | 467 ++++++++++++++++++ .../pages/noticeDetail/noticeDetail.js | 130 +++-- .../pages/noticeDetail/noticeDetail.json | 1 + .../pages/noticeDetail/noticeDetail.wxml | 32 +- .../pages/noticeDetail/noticeDetail.wxss | 139 +++++- .../pages/delicious/delicious.wxss | 3 + utils/api.js | 8 +- utils/config.js | 4 +- utils/understandJs.js | 8 +- 21 files changed, 1680 insertions(+), 113 deletions(-) create mode 100644 subpages/oneKeyService/pages/moduleList/components/newsList/newsList.js create mode 100644 subpages/oneKeyService/pages/moduleList/components/newsList/newsList.json create mode 100644 subpages/oneKeyService/pages/moduleList/components/newsList/newsList.wxml create mode 100644 subpages/oneKeyService/pages/moduleList/components/newsList/newsList.wxss create mode 100644 subpages/oneKeyService/pages/moduleList/moduleList.js create mode 100644 subpages/oneKeyService/pages/moduleList/moduleList.json create mode 100644 subpages/oneKeyService/pages/moduleList/moduleList.wxml create mode 100644 subpages/oneKeyService/pages/moduleList/moduleList.wxss diff --git a/app.json b/app.json index 30ced87..0025148 100644 --- a/app.json +++ b/app.json @@ -137,7 +137,8 @@ "pages/noticeDetail/noticeDetail", "pages/search/search", "pages/laobingzaixian/laobingzaixian", - "pages/laobingzaixianDict/laobingzaixianDict" + "pages/laobingzaixianDict/laobingzaixianDict", + "pages/moduleList/moduleList" ] } ], diff --git a/pages/indexNew/indexNew.js b/pages/indexNew/indexNew.js index 50abf54..8f171b5 100644 --- a/pages/indexNew/indexNew.js +++ b/pages/indexNew/indexNew.js @@ -80,7 +80,9 @@ Page({ visible: false, signMsg: '', signCode: 0, - isSignUp: 0 + isSignUp: 0, + yjfwPID: '', //一键服务pid + jmjsPID: '', //解码锦水pid }, onShow: function () { if (wx.getStorageSync("token") != "" && wx.getStorageSync("token") != undefined && wx.getStorageSync("token") != null) { @@ -184,6 +186,14 @@ Page({ that.setData({ zyzqnGridId:item.residentValue }) + } else if (item.residentType === 'module_category' && item.residentCode === 'module_category_yjfw') { + that.setData({ + yjfwPID:item.residentValue + }) + } else if (item.residentType === 'module_category' && item.residentCode === 'module_category_jmjs') { + that.setData({ + jmjsPID:item.residentValue + }) } }) } @@ -389,9 +399,10 @@ Page({ url: "/pages/heartNew/heartNew" }) } else if (that.data.sceneFrom == 'module_ma_code_lbzx') { - wx.navigateTo({ - url: "/subpages/oneKeyService/pages/laobingzaixian/laobingzaixian?modulecode=notice_yjfu_lbzx" - }) + // wx.navigateTo({ + // url: "/subpages/oneKeyService/pages/laobingzaixian/laobingzaixian?modulecode=notice_yjfu_lbzx" + // }) + that.toLaoBingZaiXian(1) } if (wx.getStorageSync("shareObj")) { const para = JSON.parse(wx.getStorageSync("shareObj")) @@ -446,7 +457,7 @@ Page({ //跳转到 一键服务页面(新) 2020.07.15 toOneKeyService () { wx.navigateTo({ - url: '/subpages/oneKeyService/pages/index/index' + url: `/subpages/oneKeyService/pages/index/index?pid=${this.data.yjfwPID}&title=一键服务` }) }, // 点击-更多,跳转通知列表 @@ -466,7 +477,7 @@ Page({ //了解锦水 toUnderstandJs (){ wx.navigateTo({ - url: "/subpages/understandJs/pages/index/index" + url: `/subpages/oneKeyService/pages/index/index?pid=${this.data.jmjsPID}&title=解码锦水` }) }, @@ -722,5 +733,38 @@ Page({ this.setData({ visible: false }); + }, + //跳转到新老兵在线2020.11.02 + toLaoBingZaiXian(page) { + let params = { + pageIndex: page, + pageSize: 10, + pid: this.data.yjfwPID + } + let op = {} + return new Promise((resolve, reject) => { + api.moduleCategory(params).then(res => { + // console.log('toLBZX',res.data) + res.data.forEach(item => { + if (item.categoryCode == 'notice_yjfu_lbzx') { + op = { ...item } + } + }) + if (Object.keys(op).length > 0) { + wx.navigateTo({ + url: `/subpages/oneKeyService/pages/moduleList/moduleList?pid=${op.id}&bannerflag=${op.bannerFlag}&categorycode=${op.categoryCode}&modulestyle=${op.moduleStyle}&categoryname=${op.categoryName}` + }) + } else { + if (res.data.length == 10) { + page++ + this.toLaoBingZaiXian(page) + } + } + resolve(true) + }).catch(err => { + console.log(err) + reject(false) + }) + }) } }) \ No newline at end of file diff --git a/subpages/oneKeyService/pages/index/index.js b/subpages/oneKeyService/pages/index/index.js index 91bd40e..73e3f56 100644 --- a/subpages/oneKeyService/pages/index/index.js +++ b/subpages/oneKeyService/pages/index/index.js @@ -5,83 +5,147 @@ Page({ * 页面的初始数据 */ data: { - moduleCategory: 'module_type_service', //module_type_jmjs (解码锦水) //module_type_service (一键服务) - modulelist: [] + pageIndex: 1, + pageSize: 10, + nodata: false, + loadMoreType: 'none', + loadMoreVisible: false, + isLoadMore: false, //是否显示load-more组件 + modulelist: [], + pid: '', //主页获取一键服务pid + // moduleCategory: 'module_type_service', //module_type_jmjs (解码锦水) //module_type_service (一键服务) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - this.modulelist() + // this.modulelist() + this.setData({ + pid: options.pid + }) + wx.setNavigationBarTitle({ + title: options.title + }) + this.getModuleCategory() }, - modulelist() { - let that = this; - api.modulelist(that.data.moduleCategory).then(function (res) { - that.setData({ - modulelist: res.data, + // modulelist() { + // let that = this; + // api.modulelist(that.data.moduleCategory).then(function (res) { + // that.setData({ + // modulelist: res.data, + // }) + // console.log(that.data.modulelist) + // }) + // }, + getModuleCategory() { + let params = { + pageIndex: this.data.pageIndex, + pageSize: this.data.pageSize, + pid: this.data.pid + } + api.moduleCategory(params).then(res => { + console.log(res.data) + this.setData({ + modulelist: this.data.modulelist.concat(res.data), + loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none', + loadMoreVisible: res.data.length === this.data.pageSize ? false : true + }) + if (this.data.modulelist.length == 0) {//没有值 + this.setData({ + nodata: true, + loadMoreType: 'none', + loadMoreVisible: false, + }) + } + }).catch(err => { + this.setData({ + modulelist: [], + nodata: true, + loadMoreType: 'none', + loadMoreVisible: false, }) + console.log(err) }) }, - /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - + this.setData({ + loadMoreVisible: true + }) + if (this.data.loadMoreType === 'loading') { + this.setData({ + pageIndex: this.data.pageIndex + 1, + pageSize: this.data.pageSize, + }) + this.getModuleCategory() + } }, - // wx.showToast({ - // title: '敬请期待', - // icon: 'none', - // duration: 1000 - // }) //政策、通知 /subpages/home/pages/noticeNew/noticeNew goDetails(e) {//模块编码(政策,通知,档案,警事,一键直通) - console.log(e.currentTarget.dataset.modulecode) - if (e.currentTarget.dataset.modulecode == 'notice_navigation_hot') { - wx.navigateTo({ - url: `../policyList/policyList?modulecode=${e.currentTarget.dataset.modulecode}` - }) - } else if (e.currentTarget.dataset.modulecode == 'notice_navigation_new') { - wx.navigateTo({ - url: `../policyList/policyList?modulecode=${e.currentTarget.dataset.modulecode}` - }) - } else if (e.currentTarget.dataset.modulecode == 'module_file') { - wx.navigateTo({ - url: '../archives/archives' - }) - } else if (e.currentTarget.dataset.modulecode == 'notice_warning') { - wx.navigateTo({ - url: `../warning/warning?modulecode=${e.currentTarget.dataset.modulecode}` - }) - } else if (e.currentTarget.dataset.modulecode == 'module_hardcore') { - wx.navigateTo({ - url: `../directTo/directTo?modulecode=${e.currentTarget.dataset.modulecode}` - }) - } else if (e.currentTarget.dataset.modulecode == 'notice_zcwsc') { - wx.navigateTo({ - url: `../warning/warning?modulecode=${e.currentTarget.dataset.modulecode}` - }) - } else if (e.currentTarget.dataset.modulecode == 'notice_aq') { + if (e.currentTarget.dataset.modulestyle == '4') { wx.navigateTo({ - url: `../warning/warning?modulecode=${e.currentTarget.dataset.modulecode}` - }) - } else if (e.currentTarget.dataset.modulecode == 'notice_cgjj') { - wx.navigateTo({ - url: `../warning/warning?modulecode=${e.currentTarget.dataset.modulecode}` - }) - } else if (e.currentTarget.dataset.modulecode == 'notice_jwgk') { - // wx.navigateTo({ - // url: `../warning/warning?modulecode=${e.currentTarget.dataset.modulecode}` - // }) - wx.navigateTo({ - url: `../laobingzaixian/laobingzaixian?modulecode=${e.currentTarget.dataset.modulecode}` - }) - } else if (e.currentTarget.dataset.modulecode == 'notice_yjfu_lbzx') { - wx.navigateTo({ - url: `../laobingzaixian/laobingzaixian?modulecode=${e.currentTarget.dataset.modulecode}` + url: `../noticeDetail/noticeDetail?pid=${e.currentTarget.dataset.pid}&bannerflag=${e.currentTarget.dataset.bannerflag}&categorycode=${e.currentTarget.dataset.categorycode}&modulestyle=${e.currentTarget.dataset.modulestyle}&categoryname=${e.currentTarget.dataset.categoryname}` }) + } else { + if (e.currentTarget.dataset.categorycode == 'module_hardcore') { + wx.navigateTo({ + url: `../directTo/directTo?modulecode=${e.currentTarget.dataset.categorycode}` + }) + } else if (e.currentTarget.dataset.categorycode == 'module_file') { + wx.navigateTo({ + url: '../archives/archives' + }) + } else { + wx.navigateTo({ + url: `../moduleList/moduleList?pid=${e.currentTarget.dataset.pid}&bannerflag=${e.currentTarget.dataset.bannerflag}&categorycode=${e.currentTarget.dataset.categorycode}&modulestyle=${e.currentTarget.dataset.modulestyle}&categoryname=${e.currentTarget.dataset.categoryname}` + }) + } } + + // if (e.currentTarget.dataset.modulecode == 'notice_navigation_hot') { + // wx.navigateTo({ + // url: `../policyList/policyList?modulecode=${e.currentTarget.dataset.modulecode}` + // }) + // } else if (e.currentTarget.dataset.modulecode == 'notice_navigation_new') { + // wx.navigateTo({ + // url: `../policyList/policyList?modulecode=${e.currentTarget.dataset.modulecode}` + // }) + // } else if (e.currentTarget.dataset.modulecode == 'module_file') { + // wx.navigateTo({ + // url: '../archives/archives' + // }) + // } else if (e.currentTarget.dataset.modulecode == 'notice_warning') { + // wx.navigateTo({ + // url: `../warning/warning?modulecode=${e.currentTarget.dataset.modulecode}` + // }) + // } else if (e.currentTarget.dataset.modulecode == 'module_hardcore') { + // wx.navigateTo({ + // url: `../directTo/directTo?modulecode=${e.currentTarget.dataset.modulecode}` + // }) + // } else if (e.currentTarget.dataset.modulecode == 'notice_zcwsc') { + // wx.navigateTo({ + // url: `../warning/warning?modulecode=${e.currentTarget.dataset.modulecode}` + // }) + // } else if (e.currentTarget.dataset.modulecode == 'notice_aq') { + // wx.navigateTo({ + // url: `../warning/warning?modulecode=${e.currentTarget.dataset.modulecode}` + // }) + // } else if (e.currentTarget.dataset.modulecode == 'notice_cgjj') { + // wx.navigateTo({ + // url: `../warning/warning?modulecode=${e.currentTarget.dataset.modulecode}` + // }) + // } else if (e.currentTarget.dataset.modulecode == 'notice_jwgk') { + // wx.navigateTo({ + // url: `../laobingzaixian/laobingzaixian?modulecode=${e.currentTarget.dataset.modulecode}` + // }) + // } else if (e.currentTarget.dataset.modulecode == 'notice_yjfu_lbzx') { + // wx.navigateTo({ + // url: `../laobingzaixian/laobingzaixian?modulecode=${e.currentTarget.dataset.modulecode}` + // }) + // } } }) \ No newline at end of file diff --git a/subpages/oneKeyService/pages/index/index.json b/subpages/oneKeyService/pages/index/index.json index c7b6a21..197cc6a 100644 --- a/subpages/oneKeyService/pages/index/index.json +++ b/subpages/oneKeyService/pages/index/index.json @@ -1,3 +1,7 @@ { - "navigationBarTitleText": "一键服务" + "navigationBarTitleText": "一键服务", + "usingComponents": { + "load-more": "../../../../components/loadMore/loadMore", + "no-data":"../../../../components/nodata/nodata" + } } \ No newline at end of file diff --git a/subpages/oneKeyService/pages/index/index.wxml b/subpages/oneKeyService/pages/index/index.wxml index 38e9d13..57ed1d8 100644 --- a/subpages/oneKeyService/pages/index/index.wxml +++ b/subpages/oneKeyService/pages/index/index.wxml @@ -5,9 +5,17 @@ wx:key="index" wx:for-index="index" wx:for="{{modulelist}}" - data-moduleCode="{{item.moduleCode}}"> + data-pid="{{item.id}}" + data-bannerFlag="{{item.bannerFlag}}" + data-categoryCode="{{item.categoryCode}}" + data-moduleStyle="{{item.moduleStyle}}" + data-categoryName="{{item.categoryName}}"> - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/subpages/oneKeyService/pages/moduleList/components/newsList/newsList.js b/subpages/oneKeyService/pages/moduleList/components/newsList/newsList.js new file mode 100644 index 0000000..c35c921 --- /dev/null +++ b/subpages/oneKeyService/pages/moduleList/components/newsList/newsList.js @@ -0,0 +1,83 @@ +Component({ + data: { + selectBarLeft: 0, + newsCategoryId: '' + }, + properties: { + newsCategoryList: { + type: Array, + value: [], + observer: function (value) { + if (value.length > 0) { + const _this = this + const query = wx.createSelectorQuery().in(this) + query.select('#item1').boundingClientRect() + query.exec(function(res){ + _this.setData({ + selectBarLeft: res[0].width/2 + }) + console.log(_this.data.selectBarLeft) + }) + } + } + }, + newsList: { + type: Array, + value: [] + }, + preloadVisible: { + type: Boolean, + value: true + } + }, + lifetimes: { + created () { + console.log('组件实例创建--created') + }, + attached () { + + }, + detached () { + console.log('从父组件中移除-detached') + } + }, + pageLifetimes: { + show () { + + }, + hide () { + console.log('页面隐藏') + } + }, + methods: { + // 分类导航切换 + onChangeClassifyTab (e) { + this.data.newsCategoryList.forEach((item, index) => { + if (index === e.currentTarget.dataset.tab) { + this.data.newsCategoryId = item.value + item.select = true + const _this = this + const query = wx.createSelectorQuery().in(this) + query.select(`#item${index + 1}`).boundingClientRect() + query.exec(function(res){ + _this.setData({ + selectBarLeft: res[0].width/2 + }) + console.log(_this.data.selectBarLeft) + }) + } else { + item.select = false + } + }) + this.setData({ + newsCategoryList: this.data.newsCategoryList + }) + this.triggerEvent('newsCategoryCallback', { newsCategoryId: this.data.newsCategoryId }) + }, + toDetail (e) { + wx.navigateTo({ + url: `/subpages/oneKeyService/pages/noticeDetail/noticeDetail?id=${e.currentTarget.dataset.id}&title=${e.currentTarget.dataset.title}` + }) + } + } +}) \ No newline at end of file diff --git a/subpages/oneKeyService/pages/moduleList/components/newsList/newsList.json b/subpages/oneKeyService/pages/moduleList/components/newsList/newsList.json new file mode 100644 index 0000000..32640e0 --- /dev/null +++ b/subpages/oneKeyService/pages/moduleList/components/newsList/newsList.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/subpages/oneKeyService/pages/moduleList/components/newsList/newsList.wxml b/subpages/oneKeyService/pages/moduleList/components/newsList/newsList.wxml new file mode 100644 index 0000000..e04e645 --- /dev/null +++ b/subpages/oneKeyService/pages/moduleList/components/newsList/newsList.wxml @@ -0,0 +1,51 @@ + + + + + {{item.label}} + + + + + + + + + {{item.noticeTitle}} + + {{common.getStr(item.noticeContent)}} + + + + + + + + + + + + + + + + + + + + + + + module.exports.cutTime = function(time) { return time.split(' ')[0] } + module.exports.getStr = function(content) { + return content.replace(getRegExp('<\/?.+?\/?>|[ ]','g'),'') + } + \ No newline at end of file diff --git a/subpages/oneKeyService/pages/moduleList/components/newsList/newsList.wxss b/subpages/oneKeyService/pages/moduleList/components/newsList/newsList.wxss new file mode 100644 index 0000000..c369258 --- /dev/null +++ b/subpages/oneKeyService/pages/moduleList/components/newsList/newsList.wxss @@ -0,0 +1,159 @@ +.news-module { + width: 100%; + background: #fff; + border-radius: 16rpx; + box-sizing: border-box; + padding: 0 20rpx; +} + +.classify-tab { + width: 100%; + height: 90rpx; + border-bottom: 1rpx solid #eaeaea; +} +::-webkit-scrollbar{ + width: 0; + height: 0; + color: transparent; + display:none; +} +.classify-tab .tab-list { + width: auto; + min-width: 100%; + height: 90rpx; + display: flex; +} +.tab-list .item { + height: 90rpx; + color: #ababab; + font-size: 30rpx; + margin: 0 20rpx; + line-height: 90rpx; + flex-shrink: 0; + position: relative; + width: 150rpx; + text-align: center; +} +.tab-list .item.select { + color: #FF4848; + font-size: 32rpx; + font-weight: bold; +} +.tab-list .item:first-child { + margin-left: 0; +} +.tab-list .item:last-child { + margin-right: 0; +} +.classify-tab .tab-list .item .select-bar { + width: 30rpx; + height: 8rpx; + border-radius: 4rpx; + background: #FF4848; + position: absolute; + bottom: 0; + left: 0; +} + +.news-list { + width: 100%; +} + +.news-list .preload-item { + width: 100%; + padding: 30rpx 0; + display: flex; + align-items: center; + justify-content: space-between; +} +.news-list .preload-item + .preload-item { + border-top: 1rpx solid #eaeaea; +} +.news-list .preload-item .left { + width: calc(100% - 260rpx); + height: 170rpx; + display: flex; + flex-direction: column; + justify-content: space-between; +} +.news-list .preload-item .left .top .title { + height: 30rpx; + width: 100%; + border-radius: 2rpx; + background: linear-gradient(90deg, #f2f2f2 25%, #e6e6e6 37%, #f2f2f2 63%); + animation: loading 1.4s ease infinite; + background-size: 400% 100%; + margin-top:10rpx; +} +.news-list .preload-item .left .top .time { + border-radius: 6rpx; + background: linear-gradient(90deg, #f2f2f2 25%, #e6e6e6 37%, #f2f2f2 63%); + animation: loading 1.4s ease infinite; + background-size: 400% 100%; + height: 20rpx; + width: 30%; + margin-top: 10rpx; +} +.news-list .preload-item .left .bottom { + height: 20rpx; + width: 50%; + border-radius: 2rpx; + background: linear-gradient(90deg, #f2f2f2 25%, #e6e6e6 37%, #f2f2f2 63%); + animation: loading 1.4s ease infinite; + background-size: 400% 100%; +} +.news-list .preload-item .right { + width: 240rpx; + height: 170rpx; + border-radius: 16rpx; + overflow: hidden; + background: linear-gradient(90deg, #f2f2f2 25%, #e6e6e6 37%, #f2f2f2 63%); + animation: loading 1.4s ease infinite; + background-size: 400% 100%; +} + +/* type-3 start */ +.type-3 .list-item { + width: 100%; + padding: 40rpx 28rpx; + margin-top: 16rpx; + background: #fff; + box-sizing: border-box; +} + +.type-3 .list-item .name { + font-size: 34rpx; + font-weight: 500; + color: rgba(51, 51, 51, 1); + line-height: 50rpx; +} + +.type-3 .list-item .info { + margin-top: 15rpx; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: rgba(153, 153, 153, 1); +} + +.type-3 .list-item .info .text { + line-height: 46rpx; + overflow: hidden; + text-overflow: ellipsis; + word-wrap: break-word; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + font-size: 30rpx; +} +/* type-3 end */ + +@keyframes loading { + 0% { + background-position: 100% 50% + } + + 100% { + background-position: 0 50% + } +} \ No newline at end of file diff --git a/subpages/oneKeyService/pages/moduleList/moduleList.js b/subpages/oneKeyService/pages/moduleList/moduleList.js new file mode 100644 index 0000000..295bb23 --- /dev/null +++ b/subpages/oneKeyService/pages/moduleList/moduleList.js @@ -0,0 +1,314 @@ +// subpages/understandJs/pages/archives/archives.js +const api = require('../../../../utils/understandJs') +Page({ + + /** + * 页面的初始数据 + */ + data: { + pageIndex: 1, + pageSize: 10, + modulelist: [], //module 接口 + noticelist: [], //notice 接口 + newsCategoryList: [], //type-8 tab list + nodata: false, + loadMoreType: 'none', + loadMoreVisible: false, + isLoadMore: false, //是否显示load-more组件 + swiperBannerList: [], + indicatorDots: false, //指示点 + autoplay: true, //true,//自动播放 + circular: true, //衔接滑动 + interval: 5000, //自动播放间隔时长(ms) + duration: 500, //幻灯片切换时长(ms) + currentSwiper: 0, + showTitle: true, //视频标题 + moduleInfo: {}, //pid, bannerflag, categorycode, modulestyle, categoryname + preloadVisible: true, //type-8 预加载 + lastPlayVideo: '', //正在播放的视频 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.data.moduleInfo = { ...options } + this.setData({ + moduleInfo: this.data.moduleInfo + }) + wx.setNavigationBarTitle({ + title: options.categoryname + }) + if (options.bannerflag == '1') { + this.getBannerList(options.categorycode) + } + if (this.data.moduleInfo.modulestyle == '1' || this.data.moduleInfo.modulestyle == '3' || this.data.moduleInfo.modulestyle == '5' || this.data.moduleInfo.modulestyle == '6') { + this.setData({ + isLoadMore: true + }) + this.getNoticelist() + } else if (options.modulestyle == '2') { + this.getModuleCategory() + } else if (options.modulestyle == '4') { + wx.navigateTo({ + url: `../noticeDetail/noticeDetail?pid=${this.data.moduleInfo.pid}&bannerflag=${this.data.moduleInfo.bannerflag}&categorycode=${this.data.moduleInfo.categorycode}&modulestyle=${this.data.moduleInfo.modulestyle}&categoryname=${this.data.moduleInfo.categoryname}` + }) + } else if (options.modulestyle == '7') { + this.setData({ + isLoadMore: true + }) + this.getNoticelist() + } else if (options.modulestyle == '8') { + this.getModuleCategoryList().then(() => { + this.getNoticelist(this.data.newsCategoryList[0].value) + }) + } + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + this.setData({ + loadMoreVisible: true + }) + if (this.data.loadMoreType === 'loading') { + this.setData({ + pageIndex: this.data.pageIndex + 1, + pageSize: this.data.pageSize, + }) + + if (this.data.moduleInfo.modulestyle == '1' || this.data.moduleInfo.modulestyle == '3' || this.data.moduleInfo.modulestyle == '5' || this.data.moduleInfo.modulestyle == '6') { + this.getNoticelist() + } else if (this.data.moduleInfo.modulestyle == '2') { + this.getModuleCategory() + } else if (this.data.moduleInfo.modulestyle == '7') { + this.getNoticelist() + } else if (this.data.moduleInfo.modulestyle == '8') { + this.getNoticelist(this.data.newsCategoryList[0].value) + } + } + }, + + //获取模块列表 + getModuleCategory() { + let params = { + pageIndex: this.data.pageIndex, + pageSize: this.data.pageSize, + pid: this.data.moduleInfo.pid + } + api.moduleCategory(params).then(res => { + this.setData({ + modulelist: this.data.modulelist.concat(res.data), + loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none', + loadMoreVisible: res.data.length === this.data.pageSize ? false : true + }) + if (this.data.modulelist.length == 0) { + this.setData({ + nodata: true, + loadMoreType: 'none', + loadMoreVisible: false, + }) + } + }).catch(err => { + this.setData({ + modulelist: [], + nodata: true, + loadMoreType: 'none', + loadMoreVisible: false, + }) + console.log(err) + }) + }, + //获取通知列表 + getNoticelist(categoryCode='') { + let that = this + let params = { + pageIndex: that.data.pageIndex, + pageSize: that.data.pageSize, + noticeCategory: categoryCode == '' ? that.data.moduleInfo.categorycode : categoryCode + } + + api.noticelist(params).then(res => { + let list = [ ...res.data ] + if (that.data.moduleInfo.modulestyle == '7') { + list = [] + res.data.forEach(item => { + if (item.noticeVideoUrl) { + item.showTitle = false + list.push(item) + } + }) + } + console.log(list) + that.setData({ + noticelist: that.data.noticelist.concat(list), + loadMoreType: res.data.length === that.data.pageSize ? 'loading' : 'none', + loadMoreVisible: res.data.length === that.data.pageSize ? false : true, + preloadVisible: false + }) + if (that.data.noticelist.length == 0) { + that.setData({ + nodata: true, + loadMoreType: 'none', + loadMoreVisible: false, + }) + } + }).catch(err => { + that.setData({ + noticelist: [], + nodata: true, + loadMoreType: 'none', + loadMoreVisible: false, + preloadVisible: false + }) + console.log(err) + }) + }, + + // 获取type-8 分类列表 + getModuleCategoryList () { + let params = { + pageIndex: this.data.pageIndex, + pageSize: this.data.pageSize, + pid: this.data.moduleInfo.pid + } + return new Promise((resolve, reject) => { + api.moduleCategory(params).then(res => { + console.log('获取分类列表', res) + // const newsCategoryList = [{ + // value: 'all', + // select: true, + // label: '全部' + // }] + const newsCategoryList = [] + res.data.forEach(item => { + newsCategoryList.push({ + value: item.categoryCode, + select: false, + label: item.categoryName + }) + }) + newsCategoryList[0].select = true + this.setData({ + newsCategoryList + }) + resolve(true) + }).catch(err => { + console.log(err) + reject(false) + }) + }) + }, + + //获取视频banner列表 + getBannerList: function(bannerNum) { + let that = this + api.bannerList(bannerNum).then(function(res) { + // console.log('res==', res.data) + that.setData({ + swiperBannerList: res.data + }) + }) + }, + swiperChange: function(e) { + wx.createVideoContext('video'+this.data.currentSwiper).pause() + this.setData({ + currentSwiper: e.detail.current, + autoplay: true + }) + }, + bindplay() { + this.setData({ + autoplay: false + }) + wx.getNetworkType({ + success (res) { + const networkType = res.networkType + if (res.networkType != 'wifi') { + wx.showToast({ + title: '当前为非WI-FI环境,请注意流量消耗', + icon: 'none', + duration: 3000 + }) + } + } + }) + }, + bindended() { + this.setData({ + autoplay: true + }) + }, + bindcontrolstoggle(e) { + this.setData({ + showTitle: e.detail.show + }) + }, + videoitemplay (e) { + wx.createVideoContext(this.data.lastPlayVideo).pause() + this.setData({ + lastPlayVideo: e.currentTarget.id + }) + wx.getNetworkType({ + success (res) { + const networkType = res.networkType + if (res.networkType != 'wifi') { + wx.showToast({ + title: '当前为非WI-FI环境,请注意流量消耗', + icon: 'none', + duration: 3000 + }) + } + } + }) + }, + videoitemtoggle (e) { + this.data.noticelist[e.currentTarget.dataset.index].showTitle = e.detail.show + this.setData({ + noticelist: this.data.noticelist + }) + }, + /** + * module 跳转模块页面 + */ + navigateToType (e) { + const info = e.currentTarget.dataset.info + wx.navigateTo({ + url: `./moduleList?pid=${info.id}&bannerflag=${info.bannerFlag}&categorycode=${info.categoryCode}&modulestyle=${info.moduleStyle}&categoryname=${info.categoryName}` + }) + }, + + //notice 跳转详情页面 + toDetail(e){ + const info = e.currentTarget.dataset + wx.navigateTo({ + url: `../noticeDetail/noticeDetail?id=${info.id}&title=${this.data.moduleInfo.categoryname}` + }) + }, + + //type-8 tab切换回调函数 + newsCategoryCallback (e) { + // if (e.detail.newsCategoryId === 'all') { + // this.data.newsCategoryId = '' + // } else { + // this.data.newsCategoryId = e.detail.newsCategoryId + // } + this.setData({ + pageIndex: 1, + noticelist: [], + loadMoreType: 'none', + loadMoreVisible: false, + preloadVisible: true, + nodata: false + }) + this.getNoticelist(e.detail.newsCategoryId) + } +}) \ No newline at end of file diff --git a/subpages/oneKeyService/pages/moduleList/moduleList.json b/subpages/oneKeyService/pages/moduleList/moduleList.json new file mode 100644 index 0000000..0963602 --- /dev/null +++ b/subpages/oneKeyService/pages/moduleList/moduleList.json @@ -0,0 +1,8 @@ +{ + "navigationBarTitleText": "", + "usingComponents": { + "load-more": "../../../../components/loadMore/loadMore", + "no-data":"../../../../components/nodata/nodata", + "news-list": "./components/newsList/newsList" + } +} \ No newline at end of file diff --git a/subpages/oneKeyService/pages/moduleList/moduleList.wxml b/subpages/oneKeyService/pages/moduleList/moduleList.wxml new file mode 100644 index 0000000..00ee35b --- /dev/null +++ b/subpages/oneKeyService/pages/moduleList/moduleList.wxml @@ -0,0 +1,128 @@ + + + + + + + + + {{item.noticeTitle}} + + + {{item.deptName}} + {{item.noticeTime}} + + + + + + + + + {{item.categoryName}} + + + + + + + + + {{item.noticeTitle}} + + {{common.getStr(item.noticeContent)}} + + + + + + + + + + + {{item.noticeTitle}} + + + {{item.deptName}} + {{filter.formatTime(item.noticeTime, 'yyyy-MM-dd')}} + + + + + + + + + + + {{item.noticeTitle}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + module.exports.getStr = function(content) { + return content.replace(getRegExp('<\/?.+?\/?>|[ ]','g'),'') + } + + diff --git a/subpages/oneKeyService/pages/moduleList/moduleList.wxss b/subpages/oneKeyService/pages/moduleList/moduleList.wxss new file mode 100644 index 0000000..7c12caa --- /dev/null +++ b/subpages/oneKeyService/pages/moduleList/moduleList.wxss @@ -0,0 +1,467 @@ +page { + background: #f7f7f7; + height: auto; +} + +/* 列表 */ +/* .dept-list { + display: grid; + grid-template-columns: 1fr; + place-items: center; + gap: 24rpx 0; + width: 690rpx; + padding: 20rpx 0; + margin: 0rpx auto; + position: relative; + z-index: 999; +} */ + + +/* 轮播图start */ +.altitle { + position: absolute; + width: 100%; + height: 66rpx; + background-color: black; + margin-top: 237rpx; + border-bottom-right-radius: 16rpx; + border-bottom-left-radius: 16rpx; + opacity: 0.5; + font-size: 22rpx; + font-weight: 500; + color: rgba(255, 255, 255, 1); +} + +.altitle-name { + margin: 10rpx 20rpx; +} + +.container { + width: 100vw; +} + +.page-body { + padding-top: 30rpx; + background: #fff; + height: 350rpx; +} + +.page-section { + width: 100%; + margin-bottom: 60rpx; +} + +.page-section_center { + display: flex; + flex-direction: column; + align-items: center; +} + +.page-section:last-child { + margin-bottom: 0; +} + +.page-section-gap { + box-sizing: border-box; + padding: 0 30rpx; +} + +.page-section-spacing { + box-sizing: border-box; + /* padding: 0 20rpx; */ + height: 350rpx; + background-color: #fff; +} + +.page-section-title { + font-size: 28rpx; + color: #999; + margin-bottom: 10rpx; + padding-left: 30rpx; + padding-right: 30rpx; +} + +.page-section-gap .page-section-title { + padding-left: 0; + padding-right: 0; +} + +.swiper-item { + display: block; + height: 350rpx; +} + +.banner { + overflow: hidden; + height: 350rpx; + display: flex; + width: 100%; + margin: 0 auto; + background-color: #FFF; + padding: 44rpx 0; +} + +.banner-item { + overflow: hidden; + height: 350rpx; + display: flex; + width: 100%; + border-radius: 16rpx; + margin-bottom: 8rpx; +} +.dots { + display: flex; + justify-content: center; + margin-top: -16rpx; + z-index: 999; + position: relative; +} + +.dots .dot { + width: 8rpx; + height: 8rpx; + border-radius: 8rpx; + margin-left: 10rpx; + background: #d2d5da; + transition: all 0.3s; +} + +.dots .dot.active { + width: 24rpx; + background: #fff; +} + +.page-section-title { + margin-top: 60rpx; + position: relative; +} + +swiper { + width: 710rpx; + height: 350rpx; + margin: 0 auto; + box-shadow: 0px 4px 29px 0px rgba(63, 63, 63, 0.1); + border-radius: 16rpx; + overflow: hidden; + -webkit-backface-visibility: hidden; + -webkit-transform: translate3d(0, 0, 0); +} + +.video-title { + width: 100%; + height: 50rpx; + line-height: 50rpx; + padding-left: 40rpx; + color: white; + background: linear-gradient(rgba(0,0,0,0.5),rgba(0,0,0,0)); + background: -webkit-linear-gradient(rgba(0,0,0,0.5),rgba(0,0,0,0)); + position: absolute; + top: 0; +} +/* 轮播图end */ + +/* type-1 start */ +.type-1 .list-li:first-child { + margin-top: 27rpx; +} + +.type-1 .list-li { + width: 100%; + background: #fff; + padding: 38rpx 30rpx; + margin-top: 16rpx; + box-sizing: border-box; +} + +.type-1 .list-li .item-name { + width: 100%; + font-size: 34rpx; + font-weight: 500; + color: rgba(51, 51, 51, 1); + line-height: 52rpx; +} + +.type-1 .list-li .item-info { + width: calc(100% - 60rpx); + height: 28rpx; + margin-top: 30rpx; + display: flex; + align-items: center; +} + +.type-1 .list-li .item-info image { + width: 28rpx; + height: 28rpx; +} + +.type-1 .list-li .item-info .street { + margin-left: 11rpx; + font-size: 24rpx; + font-weight: 500; + color: rgba(153, 153, 153, 1); +} + +.type-1 .list-li .item-info .time { + margin-left: 22rpx; + font-size: 24rpx; + font-weight: 500; + color: rgba(153, 153, 153, 1); +} +/* type-1 end */ + +/* type-2 start */ +.type-2 { + width: 690rpx; + margin: 40rpx auto; +} +.type-2 .list-item { + width: 100%; + height: 160rpx; + background: #fff; + display: flex; + justify-content: space-between; + align-items: center; + border-radius: 14rpx; + margin-top: 12rpx; +} + +.type-2 .list-item .list-name { + font-size:32rpx; + font-family:PingFang SC; + font-weight:bold; + color:rgba(51,51,51,1); + margin-left: 42rpx; + display: flex; + align-items: center; +} +.type-2 .list-item .list-arrow { + width: 16rpx; + height: 26rpx; + margin-right: 42rpx; +} +.type-2 .list-item .list-name .list-icon { + width: 106rpx; + height: 106rpx; + margin-right: 14rpx; +} +/* type-2 end */ + +/* type-3 start */ + +.type-3 .list-item { + width: 100%; + padding: 40rpx 28rpx; + margin-top: 16rpx; + background: #fff; + box-sizing: border-box; +} + +.type-3 .list-item .name { + /* width: calc(100% - 56rpx); */ + font-size: 34rpx; + font-weight: 500; + color: rgba(51, 51, 51, 1); + line-height: 50rpx; +} + +.type-3 .list-item .info { + /* margin-top: 15rpx; + width: calc(100% - 56rpx); + font-size: 28rpx; + font-weight: 500; + color: rgba(153, 153, 153, 1); + line-height: 44rpx; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; */ + + margin-top: 15rpx; + /* width: calc(100% - 56rpx); */ + /* height: 75rpx; */ + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: rgba(153, 153, 153, 1); +} + +.type-3 .list-item .info rich-text { + /* width:100%; */ + line-height: 44rpx; + display: -webkit-box; + overflow: hidden; + text-overflow: ellipsis; + word-wrap: break-word; + white-space: normal !important; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; +} + +.type-3 .list-item .info text { + line-height: 46rpx; + overflow: hidden; + text-overflow: ellipsis; + word-wrap: break-word; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + font-size: 30rpx; +} +/* type-3 end */ + +/* type-5 start */ + +.type-5 .list-all { + width: 100%; + background-color: #fff; +} + +.type-5 .list-all .list-item { + border-bottom: 1rpx solid #eaeaea; + margin-top: 16rpx; + padding: 40rpx 18rpx 30rpx 16rpx; + display: flex; +} + +.type-5 .list-all .list-item:first-child { + border-top: 1rpx solid #eaeaea; +} + +.type-5 .list-all .list-item:last-child { + border-bottom: none; +} + +.type-5 .list-all .list-item .item-info { + width: calc(100% - 220rpx); + height: 146rpx; + position: relative; +} + +.type-5 .list-all .list-item .item-info .item-info-name { + width: calc(100% - 47rpx); + font-size: 32rpx; + font-weight: 500; + color: rgba(63, 63, 63, 1); + line-height: 50rpx; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + margin: 0 auto; +} + +.type-5 .list-all .list-item .item-info .item-info-time { + width: calc(100% - 47rpx); + height: 22rpx; + position: absolute; + bottom: 5rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + left: 22rpx; +} + +.type-5 .list-all .list-item .item-info .item-info-time text { + font-size: 22rpx; + font-weight: 500; + color: rgba(170, 170, 170, 1); + line-height: 22rpx; +} + +.type-5 .list-all .list-item image { + width: 220rpx; + height: 146rpx; + border-radius: 10rpx; +} + +.type-5 .list-all .list-item .label { + position: absolute; + z-index: 999; + width: 34rpx; + height: 34rpx; + right: 45rpx; +} + +.type-5 .list-all .list-item .label image { + position: absolute; + width: 100%; + height: 100%; +} +/* type-5 end */ + +/* type-6 start */ +.type-6 .box { + background: #fff; + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; + border-top: 1rpx solid #F4F4F4; + padding: 50rpx 30rpx; +} + +.type-6 .box .item:first-child { + margin-top: 0rpx; +} + +.type-6 .box .item:nth-child(2) { + margin-top: 0rpx; +} + +.type-6 .box .item { + margin-top: 40rpx; + width: calc(50% - 10rpx); + height: 257rpx; +} + +.type-6 .box .item image { + width: 100%; + height: 206rpx; + border-radius: 10rpx; +} + +.type-6 .box .item .name { + width: 100%; + height: 51rpx; + line-height: 60.5rpx; + font-size: 32rpx; + font-weight: bold; + color: rgba(36, 36, 36, 1); + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; +} +/* type-6 end */ + +/* type-7 start */ +.type-7 .video-list { + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + background-color: #fff; +} +.type-7 .video-list .video-item { + height: 310rpx; + width: 690rpx; + border-radius: 16rpx; + margin: 30rpx; + position: relative; +} +.type-7 .video-list .video-line { + width: 702rpx; + height: 1px; + background: rgba(234, 234, 234, 0.95); +} +.type-7 .video-list .video-item video{ + height: 100%; + width: 100%; + border-radius: 16rpx; +} +.type-7 .video-title { + width: 650rpx; + border-radius: 16rpx; +} +.type-7 .video-list .video-line:last-child { + display: none; +} diff --git a/subpages/oneKeyService/pages/noticeDetail/noticeDetail.js b/subpages/oneKeyService/pages/noticeDetail/noticeDetail.js index 826083e..02ddf23 100644 --- a/subpages/oneKeyService/pages/noticeDetail/noticeDetail.js +++ b/subpages/oneKeyService/pages/noticeDetail/noticeDetail.js @@ -7,80 +7,130 @@ Page({ */ data: { noticeObj: {}, - noticeObjContent: '', + noticeObjContent: "", pageIndex:1, pageSize:10, - noticeCategory:'', - preloadVisible: true + categoryName:'', + preloadVisible: true, + isNeedBanner: false, + bannerList: [], + indicatorDots: false, //指示点 + autoplay: true, //true,//自动播放 + circular: true, //衔接滑动 + interval: 5000, //自动播放间隔时长(ms) + duration: 500, //幻灯片切换时长(ms) + currentSwiper: 0, + nodata: false, + showTitle: true }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - this.setData({ - noticeCategory:options.modulecode - }) - if(options.modulecode == 'notice_warning'){ - wx.setNavigationBarTitle({ - title: '锦水警事' - }) - this.noticeDetail(options.id) - } else if(options.modulecode == 'notice_zcwsc'){ + console.log(options) + if (options.id) { wx.setNavigationBarTitle({ - title: '众创卫生城' + title: options.title }) this.noticeDetail(options.id) - } else if(options.modulecode == 'notice_aq'){ - wx.setNavigationBarTitle({ - title: '安全365' + } else { + this.setData({ + categoryName:options.categorycode }) - this.noticeDetail(options.id) - } else if(options.modulecode == 'notice_cgjj'){ wx.setNavigationBarTitle({ - title: '城管聚焦' + title: options.categoryname }) - this.noticeDetail(options.id) - } else if(options.modulecode == 'notice_jwgk'){ - wx.setNavigationBarTitle({ - title: options.modulename - }) - this.noticeDetail(options.id) - } else if(options.modulecode == 'notice_yjfu_lbzx'){ - wx.setNavigationBarTitle({ - title: options.modulename - }) - this.noticeDetail(options.id) + if (options.bannerflag == '1') { + this.setData({ + isNeedBanner: true + }) + if (this.data.isNeedBanner) { + this.videoBannerList(options.categorycode) + } + } + this.noticelist() } }, - noticelist() { + swiperChange: function(e) { + wx.createVideoContext('video'+this.data.currentSwiper).pause() + this.setData({ + currentSwiper: e.detail.current, + autoplay: true + }) + }, + bindplay() { + this.setData({ + autoplay: false + }) + wx.getNetworkType({ + success (res) { + const networkType = res.networkType + if (res.networkType != 'wifi') { + wx.showToast({ + title: '当前为非WI-FI环境,请注意流量消耗', + icon: 'none', + duration: 3000 + }) + } + } + }) + }, + bindended() { + this.setData({ + autoplay: true + }) + }, + bindcontrolstoggle(e) { + this.setData({ + showTitle: e.detail.show + }) + }, + videoBannerList (code) { + api.videoBannerList(code).then( res => { + this.setData({ + bannerList: res.data + }) + }).catch(err => { + console.log(err) + }) + }, + noticelist () { let that = this; let params = { pageIndex: that.data.pageIndex, pageSize: that.data.pageSize, - noticeCategory: that.data.noticeCategory + noticeCategory: that.data.categoryName } - api.noticelist(params).then(function (res) { - that.noticeDetail(res.data[0].id) + api.noticelist(params).then(function (res) { + if (res.data.length == 0) { + that.setData({ + nodata: true + }) + } else { + that.setData({ + nodata: false + }) + that.noticeDetail(res.data[0].id) + } }).catch(err => { console.log(err) }) }, - noticeDetail(noticeId){ + noticeDetail (noticeId){ let that = this; - api.noticeDetail(noticeId).then(function (res) { + api.noticeDetail(noticeId).then(function (res) { that.setData({ noticeObj: res.data, noticeObjContent: util.formatRichText(res.data.noticeContent), preloadVisible: false }) - console.log(that.data.noticeObj) }).catch(err => { console.log(err) }) }, - + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -126,7 +176,7 @@ Page({ /** * 用户点击右上角分享 */ - // onShareAppMessage: function () { + onShareAppMessage: function () { - // } + } }) \ No newline at end of file diff --git a/subpages/oneKeyService/pages/noticeDetail/noticeDetail.json b/subpages/oneKeyService/pages/noticeDetail/noticeDetail.json index cc3da93..a93c426 100644 --- a/subpages/oneKeyService/pages/noticeDetail/noticeDetail.json +++ b/subpages/oneKeyService/pages/noticeDetail/noticeDetail.json @@ -1,5 +1,6 @@ { "usingComponents": { + "no-data": "../../../../components/nodata/nodata", "parser": "../../../../components/parser/parser" }, "navigationBarTitleText": "" diff --git a/subpages/oneKeyService/pages/noticeDetail/noticeDetail.wxml b/subpages/oneKeyService/pages/noticeDetail/noticeDetail.wxml index 41b2e8f..a5a9995 100644 --- a/subpages/oneKeyService/pages/noticeDetail/noticeDetail.wxml +++ b/subpages/oneKeyService/pages/noticeDetail/noticeDetail.wxml @@ -1,5 +1,33 @@ - +