Browse Source

了解锦水

master
zhaoyongnian 6 years ago
parent
commit
c189070089
  1. 3
      app.json
  2. 60
      subpages/understandJs/pages/delicious/delicious.js
  3. 6
      subpages/understandJs/pages/delicious/delicious.json
  4. 29
      subpages/understandJs/pages/delicious/delicious.wxml
  5. 4
      subpages/understandJs/pages/delicious/delicious.wxss
  6. BIN
      subpages/understandJs/pages/images/ic_yueduliang.png
  7. 62
      subpages/understandJs/pages/impression/impression.js
  8. 6
      subpages/understandJs/pages/impression/impression.json
  9. 18
      subpages/understandJs/pages/impression/impression.wxml
  10. 32
      subpages/understandJs/pages/impression/impression.wxss
  11. 42
      subpages/understandJs/pages/index/index.js
  12. 33
      subpages/understandJs/pages/index/index.wxml
  13. 80
      subpages/understandJs/pages/noticeDetail/noticeDetail.js
  14. 4
      subpages/understandJs/pages/noticeDetail/noticeDetail.json
  15. 21
      subpages/understandJs/pages/noticeDetail/noticeDetail.wxml
  16. 88
      subpages/understandJs/pages/noticeDetail/noticeDetail.wxss
  17. 70
      subpages/understandJs/pages/sclerotia/sclerotia.js
  18. 6
      subpages/understandJs/pages/sclerotia/sclerotia.json
  19. 35
      subpages/understandJs/pages/sclerotia/sclerotia.wxml
  20. 17
      utils/understandJs.js

3
app.json

@ -105,7 +105,8 @@
"pages/impression/impression",
"pages/delicious/delicious",
"pages/sclerotia/sclerotia",
"pages/archives/archives"
"pages/archives/archives",
"pages/noticeDetail/noticeDetail"
]
}
],

60
subpages/understandJs/pages/delicious/delicious.js

@ -1,20 +1,57 @@
// subpages/understandJs/pages/delicious/delicious.js
const api = require('../../../../utils/understandJs')
Page({
/**
* 页面的初始数据
*/
data: {
pageIndex: 1,
pageSize: 10,
noticelist: [],
nodata: false,
loadMoreType: 'none',
loadMoreVisible: false,
noticeCategory: '2',//模块编码(0-政策导航,1-印象,2-味道)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.noticelist();
},
noticelist() {
let that = this;
let params = {
pageIndex: that.data.pageIndex,
pageSize: that.data.pageSize,
noticeCategory: that.data.noticeCategory
}
api.noticelist(params).then(function (res) { //了解锦水-模块管理接口
console.log(JSON.stringify(res))
that.setData({
noticelist: that.data.noticelist.concat(res.data),
loadMoreType: res.data.length === that.data.pageSize ? 'loading' : 'none',
loadMoreVisible: res.data.length === that.data.pageSize ? false : true
})
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,
})
console.log(err)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
@ -54,7 +91,16 @@ Page({
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.setData({
loadMoreVisible: true
})
if (this.data.loadMoreType === 'loading') {
this.setData({
pageIndex: this.data.pageIndex + 1,
pageSize: this.data.pageSize,
})
this.deptinfolist();
}
},
/**
@ -62,5 +108,11 @@ Page({
*/
onShareAppMessage: function () {
},
//跳转倒详情页面
toDetail(e){
wx.navigateTo({
url: '../noticeDetail/noticeDetail?id=' + e.currentTarget.dataset.id
})
}
})

6
subpages/understandJs/pages/delicious/delicious.json

@ -1,3 +1,7 @@
{
"navigationBarTitleText": "锦水味道"
"navigationBarTitleText": "锦水味道",
"usingComponents": {
"load-more": "../../../../components/loadMore/loadMore",
"no-data":"../../../../components/nodata/nodata"
}
}

29
subpages/understandJs/pages/delicious/delicious.wxml

@ -1,20 +1,19 @@
<view class="box">
<view class="item">
<view class="box" wx:if="{{noticelist.length > 0}}">
<view class="item"
wx:for-index="index"
wx:for-item="item"
wx:key="index"
wx:for="{{noticelist}}"
bindtap="toDetail"
data-id="{{item.id}}">
<image src="../../images/test.jpg"></image>
<view class="name">
锦水美食
</view>
</view>
<view class="item">
<image src="../../images/test.jpg"></image>
<view class="name">
锦水美食
</view>
</view>
<view class="item">
<image src="../../images/test.jpg"></image>
<view class="name">
锦水美食
{{item.noticeTitle}}
</view>
</view>
</view>
<!--加载更多提示-->
<load-more loadMoreType="{{loadMoreType}}" loadMoreVisible="{{loadMoreVisible}}"></load-more>
<no-data isShow="{{nodata}}"></no-data>

4
subpages/understandJs/pages/delicious/delicious.wxss

@ -1,4 +1,8 @@
page{
background: #f7f7f7;
}
.box {
background: #fff;
display: flex;
align-items: center;
justify-content: space-between;

BIN
subpages/understandJs/pages/images/ic_yueduliang.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

62
subpages/understandJs/pages/impression/impression.js

@ -1,20 +1,57 @@
// subpages/understandJs/pages/impression/impression.js
// subpages/understandJs/pages/delicious/delicious.js
const api = require('../../../../utils/understandJs')
Page({
/**
* 页面的初始数据
*/
data: {
pageIndex: 1,
pageSize: 10,
noticelist: [],
nodata: false,
loadMoreType: 'none',
loadMoreVisible: false,
noticeCategory: '1',//模块编码(0-政策导航,1-印象,2-味道)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.noticelist();
},
noticelist() {
let that = this;
let params = {
pageIndex: that.data.pageIndex,
pageSize: that.data.pageSize,
noticeCategory: that.data.noticeCategory
}
api.noticelist(params).then(function (res) { //了解锦水-模块管理接口
console.log(JSON.stringify(res))
that.setData({
noticelist: that.data.noticelist.concat(res.data),
loadMoreType: res.data.length === that.data.pageSize ? 'loading' : 'none',
loadMoreVisible: res.data.length === that.data.pageSize ? false : true
})
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,
})
console.log(err)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
@ -54,7 +91,16 @@ Page({
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.setData({
loadMoreVisible: true
})
if (this.data.loadMoreType === 'loading') {
this.setData({
pageIndex: this.data.pageIndex + 1,
pageSize: this.data.pageSize,
})
this.deptinfolist();
}
},
/**
@ -62,5 +108,11 @@ Page({
*/
onShareAppMessage: function () {
},
//跳转倒详情页面
toDetail(e){
wx.navigateTo({
url: '../noticeDetail/noticeDetail?id=' + e.currentTarget.dataset.id
})
}
})

6
subpages/understandJs/pages/impression/impression.json

@ -1,3 +1,7 @@
{
"navigationBarTitleText": "锦水印象"
"navigationBarTitleText": "锦水印象",
"usingComponents": {
"load-more": "../../../../components/loadMore/loadMore",
"no-data":"../../../../components/nodata/nodata"
}
}

18
subpages/understandJs/pages/impression/impression.wxml

@ -1,3 +1,17 @@
<view class="" hover-class="none" hover-stop-propagation="false">
锦水印象
<view class="list-item"
wx:if="{{noticelist.length > 0}}"
wx:for-index="index"
wx:for-item="item"
wx:key="index"
wx:for="{{noticelist}}"
bindtap="toDetail"
data-id="{{item.id}}">
<view class="name">{{item.noticeTitle}}</view>
<view class="info">我们城市建设在转变城市功能的同时,更加关注于群众的生活质量的提升,给予百姓以更多的关心和方便我们城市建设在转变城市功能的同时,更加关注于群众的生活质量的提升,给予百姓以更多的关心和方便</view>
</view>
<!--加载更多提示-->
<load-more loadMoreType="{{loadMoreType}}" loadMoreVisible="{{loadMoreVisible}}"></load-more>
<no-data isShow="{{nodata}}"></no-data>

32
subpages/understandJs/pages/impression/impression.wxss

@ -1 +1,31 @@
/* subpages/understandJs/pages/impression/impression.wxss */
page {
background: #f7f7f7;
}
.list-item {
width: 100%;
padding: 40rpx 28rpx;
margin-top: 16rpx;
background: #fff;
}
.list-item .name {
width: calc(100% - 56rpx);
font-size: 34rpx;
font-weight: 500;
color: rgba(51, 51, 51, 1);
line-height: 50rpx;
}
.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;
}

42
subpages/understandJs/pages/index/index.js

@ -1,20 +1,27 @@
// subpages/understandJs/pages/index/index.js
const api = require('../../../../utils/understandJs')
Page({
/**
* 页面的初始数据
*/
data: {
modulelist: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.modulelist()
},
modulelist() {
let that = this;
api.modulelist().then(function (res) { //了解锦水-模块管理接口
that.setData({
modulelist: res.data,
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
@ -63,24 +70,31 @@ Page({
onShareAppMessage: function () {
},
goImpression(){
goDetails(e) {//模块编码(0-政策导航,1-印象,2-味道,3-硬核,4-档案)
console.log(JSON.stringify(e.currentTarget.dataset) + e.currentTarget.dataset.modulecode)
if (e.currentTarget.dataset.modulecode == '0') {
} else if (e.currentTarget.dataset.modulecode == '1') {
wx.navigateTo({
url: '../impression/impression'
})
},
goDeliDcious(){
} else if (e.currentTarget.dataset.modulecode == '2') {
wx.navigateTo({
url: '../delicious/delicious'
})
},
goArchives(){
wx.navigateTo({
url: '../archives/archives'
})
},
goSclerotia(){
} else if (e.currentTarget.dataset.modulecode == '3') {
wx.navigateTo({
url: '../sclerotia/sclerotia'
})
} else if (e.currentTarget.dataset.modulecode == '4') {
wx.showToast({
title: '敬请期待',
icon: 'none',
duration: 1000
})
// wx.navigateTo({
// url: '../archives/archives'
// })
}
}
})

33
subpages/understandJs/pages/index/index.wxml

@ -1,24 +1,13 @@
<button class="index top" hover-class="hover-btn" bindtap="goImpression">
<image class="img-bj" src="../../images/test.jpg"></image>
<view class="shadow">
<button class="index top"
hover-class="hover-btn"
bindtap="goDetails"
wx:for-item="item"
wx:key="index"
wx:for-index="index"
wx:for="{{modulelist}}"
data-moduleCode="{{item.moduleCode}}">
<image class="img-bj" src="{{item.imgUrl}}"></image>
<!-- <view class="shadow">
<image class="img-name" src="../../images/jsyx.png"></image>
</view>
</button>
<button class="index" hover-class="hover-btn" bindtap="goDeliDcious">
<image class="img-bj" src="../../images/test.jpg"></image>
<view class="shadow">
<image class="img-name" src="../../images/jswd.png"></image>
</view>
</button>
<button class="index" hover-class="hover-btn" bindtap="goArchives">
<image class="img-bj" src="../../images/test.jpg"></image>
<view class="shadow">
<image class="img-name" src="../../images/jsda.png"></image>
</view>
</button>
<button class="index" hover-class="hover-btn" bindtap="goSclerotia">
<image class="img-bj" src="../../images/test.jpg"></image>
<view class="shadow">
<image class="img-name" src="../../images/jsyh.png"></image>
</view>
</view> -->
</button>

80
subpages/understandJs/pages/noticeDetail/noticeDetail.js

@ -0,0 +1,80 @@
const api = require('../../../../utils/understandJs')
import util from '../../../../utils/util'
Page({
/**
* 页面的初始数据
*/
data: {
noticeObj: {},
noticeObjContent: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.noticeDetail(options.id)
},
noticeDetail(noticeId){
let that = this;
api.noticeDetail(noticeId).then(function (res) { //了解锦水-模块管理接口
that.setData({
noticeObj: res.data,
noticeObjContent: util.formatRichText(res.data.noticeContent)
})
console.log(that.data.noticeObj)
}).catch(err => {
console.log(err)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

4
subpages/understandJs/pages/noticeDetail/noticeDetail.json

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "详情"
}

21
subpages/understandJs/pages/noticeDetail/noticeDetail.wxml

@ -0,0 +1,21 @@
<wxs module="filter" src="../../../../utils/filter.wxs"></wxs>
<view class="notice-detail">
<view class="selfContent">
<view class="detail-title">{{noticeObj.noticeTitle}}</view>
<view class="detail-subtitle">
<view class="left">
<span>{{noticeObj.deptName}}</span>
<span>{{filter.formatTime(noticeObj.newsStartTime, 'yyyy-MM-dd')}}</span>
</view>
<view class="right">
<view class="readNum">
<image src="../images/ic_yueduliang.png" />
</view>
<view class="num">{{noticeObj.readingAmount}}</view>
</view>
</view>
<view class="richContent">
<rich-text nodes="{{noticeObjContent}}"></rich-text>
</view>
</view>
</view>

88
subpages/understandJs/pages/noticeDetail/noticeDetail.wxss

@ -0,0 +1,88 @@
.notice-detail {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 20rpx;
background: #f7f7f7;
}
.richContent img{
width: 100%!important;
height: auto;
}
.selfContent {
width: 100%;
display: table;
background: #ffffff;
border-radius: 16rpx;
box-sizing: border-box;
padding: 0 25rpx 38rpx;
}
.detail-title {
font-family: PingFang-SC-Bold;
font-size: 48rpx;
font-weight: bold;
line-height: 68rpx;
color: #333333;
padding-top: 40rpx;
}
.detail-subtitle {
display: flex;
width: 100%;
justify-content: space-between;
font-size: 22rpx;
color: #999999;
margin-top:45rpx;
}
.detail-subtitle .left span:nth-child(1){
margin-right: 32rpx;
}
.detail-subtitle .right{
display: flex;
height: 32rpx;
line-height: 32rpx;
}
.detail-subtitle .right .readNum {
/* display: inline-block; */
width: 32rpx;
height: 32rpx;
margin-right: 10rpx;
}
.detail-subtitle .right .readNum image{
width: 100%;
height: 100%;
float:left;
object-fit: cover;
}
.banner {
width: 100%;
height: 400rpx;
margin: 39rpx 0 19rpx 0;
}
.banner image{
width: 100%;
height: 100%;
float:left;
object-fit: cover;
border-radius: 16rpx;
overflow: hidden;
}
.paragraph {
font-size: 38rpx;
line-height: 58rpx;
color: #333333;
text-indent: 76rpx;
margin-top:22rpx;
}
.default {
border: 1px solid #eaeaea;
}
.default span {
color: #999999;
}
.active {
border: 1px solid #ffab00;
}
.active span {
color: #ffb700;
}

70
subpages/understandJs/pages/sclerotia/sclerotia.js

@ -1,20 +1,73 @@
// subpages/understandJs/pages/sclerotia/sclerotia.js
const api = require('../../../../utils/understandJs')
Page({
/**
* 页面的初始数据
*/
data: {
pageIndex: 1,
pageSize: 10,
deptinfolist: [],
nodata: false,
loadMoreType: 'none',
loadMoreVisible: false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.deptinfolist()
},
//了解锦水-硬核管理接口
deptinfolist() {
let that = this;
let params = {
pageIndex: that.data.pageIndex,
pageSize: that.data.pageSize,
}
api.deptinfolist(params).then(function (res) { //了解锦水-模块管理接口
that.setData({
deptinfolist: that.data.deptinfolist.concat(res.data),
loadMoreType: res.data.length === that.data.pageSize ? 'loading' : 'none',
loadMoreVisible: res.data.length === that.data.pageSize ? false : true
})
if (that.data.deptinfolist.length == 0) {//没有值
that.setData({
nodata: true,
loadMoreType: 'none',
loadMoreVisible: false,
})
}
}).catch(err => {
that.setData({
deptinfolist: [],
nodata: true,
loadMoreType: 'none',
loadMoreVisible: false,
})
console.log(err)
})
},
mobile(e) {
wx.showModal({
title: '拨打电话',
content: `您确定拨打${e.currentTarget.dataset.mobile}`,
cancelColor: '#29B9A5',
confirmColor: '#29B9A5',
success: (res) => {
if (res.confirm) {
console.log('用户点击确定')
wx.makePhoneCall({
phoneNumber: e.currentTarget.dataset.mobile
})
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
@ -54,7 +107,16 @@ Page({
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.setData({
loadMoreVisible: true
})
if (this.data.loadMoreType === 'loading') {
this.setData({
pageIndex: this.data.pageIndex + 1,
pageSize: this.data.pageSize,
})
this.deptinfolist();
}
},
/**

6
subpages/understandJs/pages/sclerotia/sclerotia.json

@ -1,3 +1,7 @@
{
"navigationBarTitleText": "硬核锦水"
"navigationBarTitleText": "硬核锦水",
"usingComponents": {
"load-more": "../../../../components/loadMore/loadMore",
"no-data":"../../../../components/nodata/nodata"
}
}

35
subpages/understandJs/pages/sclerotia/sclerotia.wxml

@ -1,29 +1,24 @@
<view class="list-item" hover-class="none" hover-stop-propagation="false">
<view class="list-item"
hover-class="none"
hover-stop-propagation="false"
wx:if="{{deptinfolist.length > 0}}"
wx:for-index="index"
wx:for-item="item"
wx:key="index"
wx:for="{{deptinfolist}}">
<view class="top" hover-class="none" hover-stop-propagation="false">
玫瑰社区
{{item.deptName}}
</view>
<view class="bottom" hover-class="none" hover-stop-propagation="false">
<view class="name">
0531-88888888
{{item.mobile}}
</view>
<image class="" src="../../images/phone.png">
</image>
<image bindtap="mobile"
data-mobile="{{item.mobile}}" class="" src="../../images/phone.png" />
</view>
</view>
<!--加载更多提示-->
<load-more loadMoreType="{{loadMoreType}}" loadMoreVisible="{{loadMoreVisible}}"></load-more>
<view class="list-item" hover-class="none" hover-stop-propagation="false">
<view class="top" hover-class="none" hover-stop-propagation="false">
玫瑰社区
</view>
<view class="bottom" hover-class="none" hover-stop-propagation="false">
<view class="name">
0531-88888888
</view>
<image class="" src="../../images/phone.png">
</image>
</view>
</view>
<no-data isShow="{{nodata}}"></no-data>

17
utils/understandJs.js

@ -1,8 +1,23 @@
var fly = require('./request.js')
module.exports = {
noticelist: noticelist
modulelist: modulelist,
deptinfolist:deptinfolist,
noticelist: noticelist,
noticeDetail:noticeDetail
}
// 了解锦水-模块管理接口
function modulelist() {
return fly.get('custom/module/list')
}
//了解锦水-硬核管理接口
function deptinfolist(params) {
return fly.get('custom/deptinfo/list',params)
}
// 通知列表(通)
function noticelist(params) {
return fly.get('news/v2/notice/list', params)
}
// 通知详情
function noticeDetail(noticeId) {
return fly.get(`news/notice/detail/${noticeId}`)
}
Loading…
Cancel
Save