30 changed files with 489 additions and 407 deletions
@ -1,10 +1,36 @@ |
|||
import {HTTP, Method} from '../utils/http.js' |
|||
|
|||
const BaillConst = { |
|||
bail_list_url:'/api/content/getListByCode', |
|||
bail_tag_url: '/api/apicategory/childList', // 获取子分类和标题
|
|||
} |
|||
class BillboardModel extends HTTP { |
|||
constructor () { |
|||
super() |
|||
} |
|||
|
|||
// 根据不同的code获取 列表
|
|||
fetchBailList (code, page, success) { |
|||
const params = { |
|||
url: BaillConst.bail_list_url + '?pageNo=' + page, |
|||
method: Method.POST, |
|||
success: success, |
|||
data: { |
|||
typeCode: code |
|||
} |
|||
} |
|||
this.request(params) |
|||
} |
|||
fetchTagsByCode(code, success) { |
|||
const params = { |
|||
url: BaillConst.bail_tag_url, |
|||
success: success, |
|||
method: Method.POST, |
|||
data: { |
|||
code: code |
|||
} |
|||
} |
|||
this.request(params) |
|||
} |
|||
} |
|||
|
|||
export {BillboardModel} |
@ -0,0 +1,50 @@ |
|||
import { HTTP, Method } from '../utils/http.js' |
|||
|
|||
const PolicyConst = { |
|||
policy_tag_url: '/api/apicategory/childList', |
|||
policy_list_url: '/api/content/getListByCode', |
|||
policy_artice_url: '/api/content/getOneListByCode' |
|||
} |
|||
class PolicyModel extends HTTP { |
|||
constructor() { |
|||
super() |
|||
} |
|||
// 获取人才政策 Tags
|
|||
fetchPolicyTags(success) { |
|||
const params = { |
|||
url: PolicyConst.policy_tag_url, |
|||
success: success, |
|||
method: Method.POST, |
|||
data: { |
|||
code: 'sc-rczc' |
|||
} |
|||
} |
|||
this.request(params) |
|||
} |
|||
// 获取政策相关文章列表
|
|||
fetchPolicyList (page, title='', success) { |
|||
const params = { |
|||
url: PolicyConst.policy_list_url + '?pageNo=' + page, |
|||
success: success, |
|||
method: Method.POST, |
|||
data: { |
|||
typeCode: 'sc-rczc', |
|||
title: title |
|||
} |
|||
} |
|||
this.request(params) |
|||
} |
|||
fetchPolicyArtice (code, success) { |
|||
const params = { |
|||
url: PolicyConst.policy_artice_url, |
|||
success: success, |
|||
method: Method.POST, |
|||
data: { |
|||
typeCode: code |
|||
} |
|||
} |
|||
this.request(params) |
|||
} |
|||
} |
|||
|
|||
export { PolicyModel } |
@ -1,106 +1,77 @@ |
|||
// pages/article/index.js
|
|||
import {ArticeModel} from '../../models/artice.js' |
|||
import dayjs from '../../utils/dayjs/index.js' |
|||
let artice = new ArticeModel() |
|||
|
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
nodes: `<section class="_editor" data-support="96编辑器" data-style-id="24818">
|
|||
<section style="text-align: center;margin:10px 0px;"> |
|||
<section style="width:4px;height:24px;background-color:#ffc100;display:inline-block;vertical-align: middle;transform: rotatez(0deg);"></section> |
|||
<section style="margin-right: -2px; margin-left: -2px; border-style: solid; border-width: 1px; border-color: #000000; padding: 2px 10px; display: inline-block; vertical-align: middle;"> |
|||
<p style="letter-spacing: 2px;"> |
|||
便民举措<br/> |
|||
</p> |
|||
</section> |
|||
<section style="width:4px;height:24px;background-color:#ffc100;display:inline-block;vertical-align: middle;"></section> |
|||
</section> |
|||
</section> |
|||
<section class="_editor" data-support="96编辑器" data-style-id="24804"> |
|||
<section style="margin:10px 0px;"> |
|||
<section style="width: 12px; height: 12px; background-color: #ffc81c; border-radius: 50%; box-sizing: border-box;"></section> |
|||
<section style="margin-top: -12px; margin-left: auto; width: 12px; height: 12px; background-color: #ffc81c; border-radius: 50%; box-sizing: border-box;"></section> |
|||
<section style="margin:-6px 6px;border-style:solid;border-width:1px;border-color:#ffcc9c;background-color:#fefefe;padding:15px;display:inline-block;transform: rotateZ(0deg);-webkit-transform: rotateZ(0deg);-moz-transform: rotateZ(0deg);-ms-transform: rotateZ(0deg);-o-transform: rotateZ(0deg);"> |
|||
<p style="letter-spacing: 2px;"> |
|||
<span style="font-size: 14px;">当清晨的一缕阳光透过窗帘上的空隙映照在沉睡的脸庞时,微微张开的双眼朦胧地注视着周遭的一切,新的一天悄然而至。</span> |
|||
</p> |
|||
</section> |
|||
<section style="width: 12px; height: 12px; background-color: #ffc81c; border-radius: 50%; box-sizing: border-box;"></section> |
|||
<section style="margin-top: -12px; margin-left: auto; width: 12px; height: 12px; background-color: #ffc81c; border-radius: 50%; box-sizing: border-box;"></section> |
|||
</section> |
|||
</section> |
|||
<section class="_editor"> |
|||
<p> |
|||
<br/> |
|||
</p> |
|||
</section>`, |
|||
nodes: '', |
|||
isStar: true, // 是否
|
|||
showBtn: true, |
|||
aId: '', |
|||
title: '', |
|||
date: '', |
|||
origin: '', |
|||
unStar: '/images/common/star.png', |
|||
star: '/images/common/star_light.png', |
|||
isStar: true, |
|||
showBtn: true, |
|||
}, |
|||
onClickCollect () { |
|||
this.setData({ |
|||
isStar: !this.data.isStar |
|||
}) |
|||
// 收藏功能
|
|||
this.addOrRemoveCollectionApi() |
|||
}, |
|||
onlineSubmit () { |
|||
console.log('在线报名') |
|||
this.onlineSignApi() // 在线报名
|
|||
}, |
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide: function () { |
|||
|
|||
console.log(options) |
|||
const {id} = options |
|||
this.setData({ |
|||
aId: id |
|||
}) |
|||
this.fetchArticeApi() |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload: function () { |
|||
|
|||
fetchArticeApi () { |
|||
artice.getDetail(this.data.aId, (res) => { |
|||
console.log('artice detail') |
|||
console.log(res) |
|||
const data = res.result |
|||
const date = dayjs(data.createTime).format('MM月DD日') |
|||
this.setData({ |
|||
nodes: data.content, |
|||
title: data.title, |
|||
date: date, |
|||
origin: data.source, |
|||
isStar: data.isCollection ? true : false, |
|||
showBtn: data.typeFlag == 0 ? false : true |
|||
}) |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh: function () { |
|||
|
|||
addOrRemoveCollectionApi () { |
|||
artice.addOrRemoveCollect(this.data.aId, res => { |
|||
console.log(res) |
|||
this.setData({ |
|||
isStar: !this.data.isStar |
|||
}) |
|||
if (res.code == 200) { |
|||
wx.showToast({ |
|||
title: res.message, |
|||
icon: 'none' |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom: function () { |
|||
|
|||
onlineSignApi () { |
|||
artice.onlineSign(this.data.aId, res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage: function () { |
|||
|
|||
} |
|||
}) |
@ -1,78 +1,111 @@ |
|||
// pages/billboards/firm/index.js
|
|||
import { BillboardModel } from '../../../models/billboard.js' |
|||
let billboard = new BillboardModel() |
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
navs: [ |
|||
"千人计划", |
|||
"泰山学者", |
|||
"泰山学者", |
|||
"泰山学者", |
|||
"泰山学者", |
|||
"泰山学者", |
|||
] |
|||
list: [], |
|||
navs: [], |
|||
curCode: '', |
|||
currPage: 1, |
|||
tags: [], |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
|
|||
this.fetchTags() // 获取Tags
|
|||
}, |
|||
tapSegemnt (e) { |
|||
console.log(e.detail) |
|||
const {index} = e.detail |
|||
this.setData({ |
|||
curCode: this.data.tags[index].code, |
|||
currPage: 1, |
|||
}) |
|||
this.fetchList() |
|||
}, |
|||
clickCardItem(e) { |
|||
console.log(e.detail) |
|||
const { id } = e.detail |
|||
wx.navigateTo({ |
|||
url: `/pages/article/index?id=${id}`, |
|||
}) |
|||
}, |
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide: function () { |
|||
|
|||
fetchList() { |
|||
const { curCode } = this.data |
|||
const page = this.data.currPage |
|||
billboard.fetchBailList(curCode, page, res => { |
|||
console.log(res) |
|||
const datas = res.list |
|||
let tempDatas = [] |
|||
datas.forEach(item => { |
|||
tempDatas.push({ |
|||
id: item.id, |
|||
title: item.title, |
|||
image: item.titlePic |
|||
}) |
|||
}) |
|||
if (page == 1) { |
|||
this.setData({ |
|||
list: tempDatas |
|||
}) |
|||
} else { |
|||
if (tempDatas.length > 0) { |
|||
const list = [...this.data.list, ...tempDatas] |
|||
this.setData({ |
|||
list: list |
|||
}) |
|||
} else { |
|||
const page = this.data.currPage - 1 |
|||
this.setData({ |
|||
currPage: page |
|||
}) |
|||
wx.showToast({ |
|||
title: '已加载全部', |
|||
icon: 'none' |
|||
}) |
|||
} |
|||
} |
|||
wx.stopPullDownRefresh() |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload: function () { |
|||
|
|||
// 获取分类Tags
|
|||
fetchTags () { |
|||
billboard.fetchTagsByCode('sc-zdqy', res => { |
|||
console.log(res) |
|||
const tags = res.result.records |
|||
const navs = tags.map(item => item.name) |
|||
this.setData({ |
|||
navs: navs, |
|||
tags: tags, |
|||
curCode: tags.length > 0 ? tags[0].code : '' |
|||
}) |
|||
this.fetchList() |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh: function () { |
|||
|
|||
this.setData({ |
|||
currPage: 1 |
|||
}) |
|||
this.fetchList() |
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage: function () { |
|||
|
|||
const page = this.data.currPage + 1 |
|||
this.setData({ |
|||
currPage: page |
|||
}) |
|||
this.fetchList() |
|||
} |
|||
}) |
@ -1,6 +1,4 @@ |
|||
{ |
|||
"navigationBarTitleText": "平台载体", |
|||
"usingComponents": { |
|||
"e-card": "/components/card/index" |
|||
} |
|||
"usingComponents": {} |
|||
} |
@ -1,8 +1,7 @@ |
|||
<!--pages/billboards/park/index.wxml--> |
|||
<view class="container"> |
|||
<block wx:for="{{[1,3,4]}}" wx:key="*this"> |
|||
<e-card cId="{{index}}" |
|||
tag-class="e_card" |
|||
bind:clickCardItem="clickCardItem"/> |
|||
</block> |
|||
<image bindtap="onClickItem" data-code="park-cbd" class="billboard_item" src="/images/billboard/1.png"></image> |
|||
<image bindtap="onClickItem" data-code="park-bhxq" class="billboard_item" src="/images/billboard/2.png"></image> |
|||
<image bindtap="onClickItem" data-code="park-cxzy" class="billboard_item" src="/images/billboard/3.png"></image> |
|||
<image bindtap="onClickItem" data-code="park-lswh" class="billboard_item" src="/images/billboard/3.png"></image> |
|||
</view> |
|||
|
@ -1,12 +1,13 @@ |
|||
/* pages/billboards/park/index.wxss */ |
|||
.container { |
|||
padding: 0 3vw; |
|||
height: 100vh; |
|||
display: flex; |
|||
flex-direction: row; |
|||
justify-content: space-between; |
|||
flex-wrap: wrap; |
|||
flex-direction: column; |
|||
justify-content: center; |
|||
align-items: center; |
|||
} |
|||
.e_card { |
|||
width: 45vw; |
|||
margin-bottom: 13px; |
|||
.billboard_item { |
|||
margin-top: 15px; |
|||
width: 90%; |
|||
height: 100px; |
|||
} |
@ -0,0 +1,60 @@ |
|||
// pages/billboards/park/index.js
|
|||
import { BillboardModel } from '../../../../models/billboard.js' |
|||
let billboard = new BillboardModel() |
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
list: [], |
|||
curCode: '', |
|||
curPage:1, |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
const {code} = options |
|||
console.log(code) |
|||
this.setData({ |
|||
curCode: code |
|||
}) |
|||
this.fetchList() |
|||
}, |
|||
clickCardItem (e) { |
|||
console.log(e.detail) |
|||
const { id } = e.detail |
|||
wx.navigateTo({ |
|||
url: `/pages/article/index?id=${id}`, |
|||
}) |
|||
}, |
|||
fetchList () { |
|||
const {curCode} = this.data |
|||
const page = this.data.curPage |
|||
billboard.fetchBailList(curCode, page, res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh: function () { |
|||
this.setData({ |
|||
curPage: 1, |
|||
}) |
|||
this.fetchList() |
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom: function () { |
|||
const page = this.data.curPage + 1 |
|||
this.setData({ |
|||
curPage: page |
|||
}) |
|||
this.fetchList() |
|||
}, |
|||
}) |
@ -0,0 +1,7 @@ |
|||
{ |
|||
"navigationBarTitleText": "平台载体", |
|||
"enablePullDownRefresh": true, |
|||
"usingComponents": { |
|||
"e-card": "/components/card/index" |
|||
} |
|||
} |
@ -0,0 +1,9 @@ |
|||
<!--pages/billboards/park/index.wxml--> |
|||
<view class="container"> |
|||
<block wx:for="{{list}}" wx:key="park-list-{{index}}"> |
|||
<e-card cId="{{index}}" |
|||
tag-class="e_card" |
|||
bind:clickCardItem="clickCardItem"/> |
|||
</block> |
|||
<view wx:if="{{list.length <= 0}}" class="page_empty">暂无数据</view> |
|||
</view> |
@ -0,0 +1,20 @@ |
|||
/* pages/billboards/park/index.wxss */ |
|||
.container { |
|||
padding: 0 3vw; |
|||
display: flex; |
|||
flex-direction: row; |
|||
justify-content: space-between; |
|||
flex-wrap: wrap; |
|||
} |
|||
.e_card { |
|||
width: 45vw; |
|||
margin-bottom: 13px; |
|||
} |
|||
.page_empty { |
|||
width: 100%; |
|||
height: 100px; |
|||
margin-top: 100px; |
|||
font-size: 14px; |
|||
color: #aaa; |
|||
text-align: center; |
|||
} |
Loading…
Reference in new issue