30 changed files with 490 additions and 407 deletions
@ -1,10 +1,36 @@ |
|||||
import {HTTP, Method} from '../utils/http.js' |
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 { |
class BillboardModel extends HTTP { |
||||
constructor () { |
constructor () { |
||||
super() |
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} |
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
|
// pages/article/index.js
|
||||
|
import {ArticeModel} from '../../models/artice.js' |
||||
|
import dayjs from '../../utils/dayjs/index.js' |
||||
|
let artice = new ArticeModel() |
||||
|
|
||||
Page({ |
Page({ |
||||
|
|
||||
/** |
/** |
||||
* 页面的初始数据 |
* 页面的初始数据 |
||||
*/ |
*/ |
||||
data: { |
data: { |
||||
nodes: `<section class="_editor" data-support="96编辑器" data-style-id="24818">
|
nodes: '', |
||||
<section style="text-align: center;margin:10px 0px;"> |
isStar: true, // 是否
|
||||
<section style="width:4px;height:24px;background-color:#ffc100;display:inline-block;vertical-align: middle;transform: rotatez(0deg);"></section> |
showBtn: true, |
||||
<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;"> |
aId: '', |
||||
<p style="letter-spacing: 2px;"> |
title: '', |
||||
便民举措<br/> |
date: '', |
||||
</p> |
origin: '', |
||||
</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>`, |
|
||||
unStar: '/images/common/star.png', |
unStar: '/images/common/star.png', |
||||
star: '/images/common/star_light.png', |
star: '/images/common/star_light.png', |
||||
isStar: true, |
|
||||
showBtn: true, |
|
||||
}, |
}, |
||||
onClickCollect () { |
onClickCollect () { |
||||
this.setData({ |
|
||||
isStar: !this.data.isStar |
|
||||
}) |
|
||||
// 收藏功能
|
// 收藏功能
|
||||
|
this.addOrRemoveCollectionApi() |
||||
}, |
}, |
||||
onlineSubmit () { |
onlineSubmit () { |
||||
console.log('在线报名') |
console.log('在线报名') |
||||
|
this.onlineSignApi() // 在线报名
|
||||
}, |
}, |
||||
/** |
/** |
||||
* 生命周期函数--监听页面加载 |
* 生命周期函数--监听页面加载 |
||||
*/ |
*/ |
||||
onLoad: function (options) { |
onLoad: function (options) { |
||||
|
console.log(options) |
||||
}, |
const {id} = options |
||||
|
this.setData({ |
||||
/** |
aId: id |
||||
* 生命周期函数--监听页面初次渲染完成 |
}) |
||||
*/ |
this.fetchArticeApi() |
||||
onReady: function () { |
|
||||
|
|
||||
}, |
|
||||
|
|
||||
/** |
|
||||
* 生命周期函数--监听页面显示 |
|
||||
*/ |
|
||||
onShow: function () { |
|
||||
|
|
||||
}, |
|
||||
|
|
||||
/** |
|
||||
* 生命周期函数--监听页面隐藏 |
|
||||
*/ |
|
||||
onHide: function () { |
|
||||
|
|
||||
}, |
}, |
||||
|
fetchArticeApi () { |
||||
/** |
artice.getDetail(this.data.aId, (res) => { |
||||
* 生命周期函数--监听页面卸载 |
console.log('artice detail') |
||||
*/ |
console.log(res) |
||||
onUnload: function () { |
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 |
||||
|
}) |
||||
|
}) |
||||
}, |
}, |
||||
|
addOrRemoveCollectionApi () { |
||||
/** |
artice.addOrRemoveCollect(this.data.aId, res => { |
||||
* 页面相关事件处理函数--监听用户下拉动作 |
console.log(res) |
||||
*/ |
this.setData({ |
||||
onPullDownRefresh: function () { |
isStar: !this.data.isStar |
||||
|
}) |
||||
|
if (res.code == 200) { |
||||
|
wx.showToast({ |
||||
|
title: res.message, |
||||
|
icon: 'none' |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
}, |
}, |
||||
|
onlineSignApi () { |
||||
/** |
artice.onlineSign(this.data.aId, res => { |
||||
* 页面上拉触底事件的处理函数 |
console.log(res) |
||||
*/ |
}) |
||||
onReachBottom: function () { |
|
||||
|
|
||||
}, |
}, |
||||
|
|
||||
/** |
|
||||
* 用户点击右上角分享 |
|
||||
*/ |
|
||||
onShareAppMessage: function () { |
|
||||
|
|
||||
} |
|
||||
}) |
}) |
@ -1,78 +1,111 @@ |
|||||
// pages/billboards/firm/index.js
|
// pages/billboards/firm/index.js
|
||||
|
import { BillboardModel } from '../../../models/billboard.js' |
||||
|
let billboard = new BillboardModel() |
||||
Page({ |
Page({ |
||||
|
|
||||
/** |
/** |
||||
* 页面的初始数据 |
* 页面的初始数据 |
||||
*/ |
*/ |
||||
data: { |
data: { |
||||
navs: [ |
list: [], |
||||
"千人计划", |
navs: [], |
||||
"泰山学者", |
curCode: '', |
||||
"泰山学者", |
currPage: 1, |
||||
"泰山学者", |
tags: [], |
||||
"泰山学者", |
|
||||
"泰山学者", |
|
||||
] |
|
||||
}, |
}, |
||||
|
|
||||
/** |
/** |
||||
* 生命周期函数--监听页面加载 |
* 生命周期函数--监听页面加载 |
||||
*/ |
*/ |
||||
onLoad: function (options) { |
onLoad: function (options) { |
||||
|
this.fetchTags() // 获取Tags
|
||||
}, |
}, |
||||
tapSegemnt (e) { |
tapSegemnt (e) { |
||||
console.log(e.detail) |
console.log(e.detail) |
||||
|
const {index} = e.detail |
||||
|
this.setData({ |
||||
|
curCode: this.data.tags[index].code, |
||||
|
currPage: 1, |
||||
|
}) |
||||
|
this.fetchList() |
||||
}, |
}, |
||||
clickCardItem(e) { |
clickCardItem(e) { |
||||
console.log(e.detail) |
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.currPage |
||||
onReady: function () { |
billboard.fetchBailList(curCode, page, res => { |
||||
|
console.log(res) |
||||
}, |
const datas = res.list |
||||
|
let tempDatas = [] |
||||
/** |
datas.forEach(item => { |
||||
* 生命周期函数--监听页面显示 |
tempDatas.push({ |
||||
*/ |
id: item.id, |
||||
onShow: function () { |
title: item.title, |
||||
|
image: item.titlePic |
||||
}, |
}) |
||||
|
}) |
||||
/** |
if (page == 1) { |
||||
* 生命周期函数--监听页面隐藏 |
this.setData({ |
||||
*/ |
list: tempDatas |
||||
onHide: function () { |
}) |
||||
|
} 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() |
||||
|
}) |
||||
}, |
}, |
||||
|
// 获取分类Tags
|
||||
/** |
fetchTags () { |
||||
* 生命周期函数--监听页面卸载 |
billboard.fetchTagsByCode('sc-zdqy', res => { |
||||
*/ |
console.log(res) |
||||
onUnload: function () { |
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 () { |
onPullDownRefresh: function () { |
||||
|
this.setData({ |
||||
|
currPage: 1 |
||||
|
}) |
||||
|
this.fetchList() |
||||
}, |
}, |
||||
|
|
||||
/** |
/** |
||||
* 页面上拉触底事件的处理函数 |
* 页面上拉触底事件的处理函数 |
||||
*/ |
*/ |
||||
onReachBottom: function () { |
onReachBottom: function () { |
||||
|
const page = this.data.currPage + 1 |
||||
}, |
this.setData({ |
||||
|
currPage: page |
||||
/** |
}) |
||||
* 用户点击右上角分享 |
this.fetchList() |
||||
*/ |
|
||||
onShareAppMessage: function () { |
|
||||
|
|
||||
} |
} |
||||
}) |
}) |
@ -1,6 +1,4 @@ |
|||||
{ |
{ |
||||
"navigationBarTitleText": "平台载体", |
"navigationBarTitleText": "平台载体", |
||||
"usingComponents": { |
"usingComponents": {} |
||||
"e-card": "/components/card/index" |
|
||||
} |
|
||||
} |
} |
@ -1,8 +1,7 @@ |
|||||
<!--pages/billboards/park/index.wxml--> |
<!--pages/billboards/park/index.wxml--> |
||||
<view class="container"> |
<view class="container"> |
||||
<block wx:for="{{[1,3,4]}}" wx:key="*this"> |
<image bindtap="onClickItem" data-code="park-cbd" class="billboard_item" src="/images/billboard/1.png"></image> |
||||
<e-card cId="{{index}}" |
<image bindtap="onClickItem" data-code="park-bhxq" class="billboard_item" src="/images/billboard/2.png"></image> |
||||
tag-class="e_card" |
<image bindtap="onClickItem" data-code="park-cxzy" class="billboard_item" src="/images/billboard/3.png"></image> |
||||
bind:clickCardItem="clickCardItem"/> |
<image bindtap="onClickItem" data-code="park-lswh" class="billboard_item" src="/images/billboard/3.png"></image> |
||||
</block> |
|
||||
</view> |
</view> |
||||
|
@ -1,12 +1,13 @@ |
|||||
/* pages/billboards/park/index.wxss */ |
/* pages/billboards/park/index.wxss */ |
||||
.container { |
.container { |
||||
padding: 0 3vw; |
height: 100vh; |
||||
display: flex; |
display: flex; |
||||
flex-direction: row; |
flex-direction: column; |
||||
justify-content: space-between; |
justify-content: center; |
||||
flex-wrap: wrap; |
align-items: center; |
||||
} |
} |
||||
.e_card { |
.billboard_item { |
||||
width: 45vw; |
margin-top: 15px; |
||||
margin-bottom: 13px; |
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