Browse Source

合并冲突

master
fanp 6 years ago
parent
commit
95fd09f70e
  1. 1
      app.json
  2. 2
      components/card/index.js
  3. 2
      components/segment/index.wxss
  4. 32
      models/artice.js
  5. 2
      models/auth.js
  6. 28
      models/billboard.js
  7. 8
      models/home.js
  8. 50
      models/policy.js
  9. 131
      pages/article/index.js
  10. 6
      pages/article/index.wxml
  11. 121
      pages/billboards/firm/index.js
  12. 1
      pages/billboards/firm/index.json
  13. 7
      pages/billboards/firm/index.wxml
  14. 57
      pages/billboards/park/index.js
  15. 4
      pages/billboards/park/index.json
  16. 9
      pages/billboards/park/index.wxml
  17. 15
      pages/billboards/park/index.wxss
  18. 60
      pages/billboards/park/park-list/index.js
  19. 7
      pages/billboards/park/park-list/index.json
  20. 9
      pages/billboards/park/park-list/index.wxml
  21. 20
      pages/billboards/park/park-list/index.wxss
  22. 5
      pages/billboards/policy/components/tags/index.js
  23. 6
      pages/billboards/policy/components/tags/index.wxml
  24. 1
      pages/billboards/policy/components/tags/index.wxss
  25. 141
      pages/billboards/policy/index.js
  26. 1
      pages/billboards/policy/index.json
  27. 8
      pages/billboards/policy/index.wxml
  28. 112
      pages/billboards/policy/policy-list/index.js
  29. 28
      pages/home/index.js
  30. 14
      utils/http.js

1
app.json

@ -6,6 +6,7 @@
"pages/topics/index",
"pages/billboards/firm/index",
"pages/billboards/park/index",
"pages/billboards/park/park-list/index",
"pages/billboards/policy/index",
"pages/billboards/policy/policy-list/index",
"pages/article/index",

2
components/card/index.js

@ -22,7 +22,7 @@ Component({
*/
methods: {
onTap () {
this.triggerEvent('clickCardItem', this.properties.cId)
this.triggerEvent('clickCardItem', {id: this.properties.cId})
}
}
})

2
components/segment/index.wxss

@ -6,7 +6,7 @@
padding: 5px;
}
.title {
width: 150rpx;
min-width: 150rpx;
display: flex;
align-items: center;
justify-content: center;

32
models/artice.js

@ -3,9 +3,8 @@ import { HTTP, Method } from '../utils/http.js'
// 请求url常量
const ArticeConst = {
artice_url: '/api/content/queryById',
artice_add_collect_url: '/api/content/addCollection',
artice_remove_collect_url: '/api/content/removeCollection',
artice_online_url: '',
artice_add_remove_collect_url: '/api/content/addOrDeleteCollection',
artice_online_url: '/api/content/signin',
}
class ArticeModel extends HTTP {
@ -16,8 +15,8 @@ class ArticeModel extends HTTP {
getDetail(aId, success) {
let params = {
url: ArticeConst.artice_url,
sucess: success,
method: Method.POST,
success: success,
method: Method.GET,
data: {
id: aId
}
@ -26,22 +25,11 @@ class ArticeModel extends HTTP {
}
// 设置收藏还是取消
// type: 0: 添加;1: 移除
addCollect(aId, type, success) {
let params = {
url: artice_add_collect_url,
success: success,
method: Method.POST,
data: {
id: aId
}
}
this.request(params)
}
removeCollect(aId, success) {
addOrRemoveCollect(aId, success) {
let params = {
url: artice_remove_collect_url,
url: ArticeConst.artice_add_remove_collect_url,
success: success,
method: Method.POST,
method: Method.GET,
data: {
id: aId
}
@ -51,11 +39,11 @@ class ArticeModel extends HTTP {
// 在线报名
onlineSign(aId, type, success) {
let params = {
url: artice_online_url,
url: ArticeConst.artice_online_url,
success: success,
method: Method.POST,
method: Method.GET,
data: {
contentId: aId
}
}
this.request(params)

2
models/auth.js

@ -58,7 +58,7 @@ class AuthModel extends HTTP {
},
success: (data) => {
// 将获取到的token存放起来
let token = data
let token = 'test token'
wx.setStorageSync(HTTPConst.TokenStoreKey, token)
success(token)
},

28
models/billboard.js

@ -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}

8
models/home.js

@ -17,8 +17,6 @@ class HomeModel extends HTTP {
method: Method.POST,
data: {
typeCode: 'sc-banner',
page: 1,
pageSize: 20,
},
success: success
}
@ -31,8 +29,6 @@ class HomeModel extends HTTP {
method: Method.POST,
data: {
typeCode: 'sc-jdtz',
page: 1,
pageSize: 20,
},
success: success
}
@ -41,12 +37,10 @@ class HomeModel extends HTTP {
// 首页列表
getHomeList(page, success){
let params = {
url: HOMEConst.home_list_url,
url: HOMEConst.home_list_url + '?pageNo=' + page,
method: Method.POST,
data: {
typeCode: 'sc-tzgg',
page: page,
pageSize: 20,
},
success: success
}

50
models/policy.js

@ -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 }

131
pages/article/index.js

@ -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 () {
}
})

6
pages/article/index.wxml

@ -1,10 +1,10 @@
<!--pages/article/index.wxml-->
<view class="container">
<view class="page_hd">
<view class="artice_title">市北区区情概况市北区区情概况市北区区情概况</view>
<view class="artice_title">{{title}}</view>
<view class="artice_info">
<text class="artice_origin">市北区工作领导小组办公室</text>
<text class="artice_time">6月7日</text>
<text class="artice_origin">{{origin}}</text>
<text class="artice_time">{{date}}</text>
<image class="artice_collect" src="{{isStar ? star : unStar}}" bindtap="onClickCollect"></image>
</view>
</view>

121
pages/billboards/firm/index.js

@ -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
pages/billboards/firm/index.json

@ -1,5 +1,6 @@
{
"navigationBarTitleText": "重点企业",
"enablePullDownRefresh": true,
"usingComponents": {
"e-card": "/components/card/index",
"e-segment": "/components/segment/index"

7
pages/billboards/firm/index.wxml

@ -4,8 +4,11 @@
<e-segment headerTitles="{{navs}}" bind:tapSegment="tapSegemnt"/>
</view>
<view class="page_bd">
<block wx:for="{{[1,3,4]}}" wx:key="*this">
<e-card cId="{{index}}"
<block wx:for="{{list}}" wx:key="firm-{{index}}">
<e-card
cId="{{item.id}}"
title="{{item.title}}"
image="{{item.image}}"
tag-class="e_card"
bind:clickCardItem="clickCardItem"/>
</block>

57
pages/billboards/park/index.js

@ -1,4 +1,5 @@
// pages/billboards/park/index.js
Page({
/**
@ -14,55 +15,11 @@ Page({
onLoad: function (options) {
},
clickCardItem (e) {
console.log(e.detail)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
onClickItem(e) {
const { code } = e.currentTarget.dataset
console.log(code)
wx.navigateTo({
url: '/pages/billboards/park/park-list/index?code=' + code,
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

4
pages/billboards/park/index.json

@ -1,6 +1,4 @@
{
"navigationBarTitleText": "平台载体",
"usingComponents": {
"e-card": "/components/card/index"
}
"usingComponents": {}
}

9
pages/billboards/park/index.wxml

@ -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>

15
pages/billboards/park/index.wxss

@ -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;
}

60
pages/billboards/park/park-list/index.js

@ -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()
},
})

7
pages/billboards/park/park-list/index.json

@ -0,0 +1,7 @@
{
"navigationBarTitleText": "平台载体",
"enablePullDownRefresh": true,
"usingComponents": {
"e-card": "/components/card/index"
}
}

9
pages/billboards/park/park-list/index.wxml

@ -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>

20
pages/billboards/park/park-list/index.wxss

@ -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;
}

5
pages/billboards/policy/components/tags/index.js

@ -4,7 +4,10 @@ Component({
* 组件的属性列表
*/
properties: {
items: {
type: Array,
value: []
}
},
/**

6
pages/billboards/policy/components/tags/index.wxml

@ -1,8 +1,8 @@
<!--pages/billboards/policy/tags/index.wxml-->
<view class="tags">
<view class="tags" wx:if="{{items.length > 0}}">
<view class="tags-list">
<block wx:for="{{[1,2,3,4,5,6]}}" wx:key="*this">
<view class="tag-item" bindtap="onTap" data-index="{{index}}">人才政策</view>
<block wx:for="{{items}}" wx:key="tags-{{index}}">
<view class="tag-item" bindtap="onTap" data-index="{{index}}">{{item.name}}</view>
</block>
</view>
<view class="tag-all" bindtap="onTap" data-index="0">全部</view>

1
pages/billboards/policy/components/tags/index.wxss

@ -7,6 +7,7 @@
border-bottom: 1px solid #f7f7f7;
}
.tags-list {
flex:1;
display: flex;
flex-direction: row;
align-items: center;

141
pages/billboards/policy/index.js

@ -1,33 +1,19 @@
// pages/billboards/policy/index.js
Page({
import {PolicyModel} from '../../../models/policy.js'
import dayjs from '../../../utils/dayjs/index.js'
let policy = new PolicyModel()
Page({
/**
* 页面的初始数据
*/
data: {
list: [
{
id: '1',
title: '啦啦啦量阿拉蕾阿拉啦',
showTop: true,
time: '刚刚'
},
{
id: '2',
title: '一条大河,向东流',
showTop: false,
time: '1分钟前'
},
{
id: '3',
title: '啦啦啦量阿拉蕾阿拉啦',
showTop: false,
time: '1小时前'
},
]
list: [],
currPage: 1,
searchKey: '',
tags: [],
},
clickListItem(e) {
console.log(e.detail)
const {id} = e.detail
wx.navigateTo({
url: `/pages/article/index?id=${id}`,
@ -37,55 +23,94 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.fetchPolicyTags()
this.fetchPolicyList()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
onSearchClear (e) {
this.setData({
currPage: 1,
searchKey: ''
})
console.log(e)
this.fetchPolicyList()
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
onSearchInput (e) {
const key = e.detail.value
this.setData({
searchKey: key,
currPage: 1,
})
console.log(e)
this.fetchPolicyList()
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.setData({
currPage: 1
})
this.fetchPolicyList()
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
const page = this.data.currPage + 1
this.setData({
currPage: page
})
this.fetchPolicyList()
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
// 获取 Tags
fetchPolicyTags () {
policy.fetchPolicyTags(res => {
const datas = res.result.records
this.setData({
tags: datas
})
wx.setStorageSync('PolicyTags', datas)
})
},
// 获取列表,搜索列表
fetchPolicyList () {
const {searchKey} = this.data
const page = this.data.currPage
policy.fetchPolicyList(page, searchKey, res => {
console.log(res)
const datas = res.list
let tempDatas = []
datas.forEach(item => {
tempDatas.push({
id: item.id,
title: item.title,
showTop: item.isTop == 1 ? true : false,
time: dayjs(item.createTime).toNow(),
})
})
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()
})
}
})

1
pages/billboards/policy/index.json

@ -1,5 +1,6 @@
{
"navigationBarTitleText": "人才政策",
"enablePullDownRefresh": true,
"usingComponents": {
"w-searchbar": "/components/weui/searchbar/searchbar",
"e-cell": "/components/cell/index",

8
pages/billboards/policy/index.wxml

@ -1,11 +1,11 @@
<!--pages/billboards/policy/index.wxml-->
<view class="container">
<view class="page_hd">
<w-searchbar />
<e-tags/>
<w-searchbar search="{{search}}" cancel="{{false}}" bindclear="onSearchClear" bindinput="onSearchInput"/>
<e-tags items="{{tags}}"/>
</view>
<block wx:for="{{list}}" wx:key="*this">
<e-cell cId="{{index}}"
<block wx:for="{{list}}" wx:key="policy-{{index}}">
<e-cell cId="{{item.id}}"
title="{{item.title}}"
time="{{item.time}}"
showTop="{{item.showTop}}"

112
pages/billboards/policy/policy-list/index.js

@ -1,4 +1,6 @@
// pages/billboards/policy/policy-list/index.js
import { PolicyModel } from '../../../../models/policy.js'
let policy = new PolicyModel()
Page({
/**
@ -6,43 +8,10 @@ Page({
*/
data: {
navSelectIndex: 0,
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>`,
navs: [
"千人计划",
"泰山学者",
"泰山学者",
"泰山学者",
"泰山学者",
"泰山学者",
]
nodes: '',
navs: [],
tags: [], // 导航的原始数据
curCode: ''
},
/**
@ -50,60 +19,33 @@ Page({
*/
onLoad: function (options) {
console.log(options)
const tags = wx.getStorageSync('PolicyTags')
let navs = tags.map(item=> {return item.name})
const {index} = options
this.setData({
navSelectIndex: index
tags: tags,
navSelectIndex: index,
navs: navs,
curCode: tags[index].code
})
this.fetchPolicyArtice()
},
tapSegemnt (e) {
console.log(e.detail)
const index = e.detail.index
this.setData({
curCode: this.data.tags[index].code
})
this.fetchPolicyArtice()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
fetchPolicyArtice () {
policy.fetchPolicyArtice(this.data.curCode, res => {
console.log(res)
const list = res.list
this.setData({
nodes: list[0].content
})
})
}
})

28
pages/home/index.js

@ -9,26 +9,7 @@ Page({
currPage: 1,
banners: [],
hots: [],
list: [
{
id: '1',
title: '啦啦啦量阿拉蕾阿拉啦',
showTop: true,
time: '刚刚'
},
{
id: '2',
title: '一条大河,向东流',
showTop: false,
time: '1分钟前'
},
{
id: '3',
title: '啦啦啦量阿拉蕾阿拉啦',
showTop: false,
time: '1小时前'
},
]
list: []
},
onLoad: function () {
console.log(dayjs().toNow())
@ -62,7 +43,7 @@ Page({
let page = this.data.currPage
homeModel.getHomeList(page, res => {
console.log('啦啦啦')
const datas = res.result.records
const datas = res.list
let tempDatas = []
datas.forEach(item => {
tempDatas.push({
@ -70,6 +51,7 @@ Page({
title: item.title,
showTop: item.isTop == 1 ? true : false,
time: dayjs(item.createTime).toNow(),
readed: item.isRead == 0 ? 'false' : 'true'
})
})
if (page == 1) {
@ -101,7 +83,7 @@ Page({
homeModel.getHomeBanner(res => {
console.log('Banner')
console.log(res)
const datas = res.result.records
const datas = res.list
let tempBanners = []
datas.forEach(item => {
console.log(item)
@ -119,7 +101,7 @@ Page({
homeModel.getHomeHot(res => {
console.log('Hot')
console.log(res)
const datas = res.result.records
const datas = res.list
let tempHots = []
datas.forEach(item => {
tempHots.push({

14
utils/http.js

@ -15,26 +15,36 @@ class HTTP {
// 从缓存中读取 token
let token = wx.getStorageSync(HTTPConst.TokenStoreKey) || ''
let url = this.baseUrl + params.url
console.log(params.url)
if (!params.method) {
params.method = Method.GET
}
// token 拼接到 请求体中
let data = Object.assign({ token: token }, params.data)
let data = params.data
console.log(data)
wx.request({
url: url,
data: data,
header: {
'token': token,
'content-type': 'application/json',
},
method: params.method,
dataType: 'json',
success: function (res) {
// console.log(res)
console.log(res)
let code = res.statusCode.toString()
let startCode = code.charAt(0)
if (startCode == '2') {
if (res.data.code == 200) {
params.success && params.success(res.data)
} else {
console.log('数据请求失败')
wx.showToast({
title: res.data.message,
icon: 'none'
})
}
} else {
console.log('请求错误')
params.error && params.error(res)

Loading…
Cancel
Save