Browse Source

修改BUG 0.0.2

master
lqq 6 years ago
parent
commit
4be59e5ab4
  1. 16
      components/cell/index.js
  2. 2
      components/cell/index.wxml
  3. 6
      components/empty/index.js
  4. 4
      components/swiper/index.wxml
  5. 16
      components/swiper/index.wxss
  6. 8
      pages/article/index.js
  7. 4
      pages/article/index.wxml
  8. 4
      pages/article/index.wxss
  9. 1
      pages/billboards/policy/index.json
  10. 1
      pages/billboards/policy/index.wxml
  11. 4
      pages/billboards/policy/policy-list/index.js
  12. 3
      pages/billboards/policy/policy-list/index.json
  13. 1
      pages/billboards/policy/policy-list/index.wxml
  14. 9
      pages/home/index.js
  15. 1
      pages/home/index.wxml

16
components/cell/index.js

@ -4,6 +4,7 @@ Component({
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
index: Number,
cId: String, cId: String,
title: String, title: String,
readed: { readed: {
@ -16,12 +17,18 @@ Component({
value: false, value: false,
} }
}, },
observers: {
readed (value) {
this.setData({
_readed: value
})
}
},
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
_readed: false,
}, },
/** /**
@ -29,7 +36,10 @@ Component({
*/ */
methods: { methods: {
onTap () { onTap () {
this.triggerEvent('clickListItem', { id: this.properties.cId}) this.setData({
_readed: true
})
this.triggerEvent('clickListItem', { id: this.properties.cId, index: this.properties.index})
} }
} }
}) })

2
components/cell/index.wxml

@ -1,6 +1,6 @@
<!--components/cell/index.wxml--> <!--components/cell/index.wxml-->
<view class="cell" id="e-cell" bindtap="onTap"> <view class="cell" id="e-cell" bindtap="onTap">
<view class="cell_title {{readed ? 'cell_title_readed':''}}">{{title}}</view> <view class="cell_title {{_readed ? 'cell_title_readed':''}}">{{title}}</view>
<view class="cell_info"> <view class="cell_info">
<view class="cell_info_meta">{{time}}</view> <view class="cell_info_meta">{{time}}</view>
<image wx:if="{{showTop}}" class="cell_info_top" src="images/top.png"></image> <image wx:if="{{showTop}}" class="cell_info_top" src="images/top.png"></image>

6
components/empty/index.js

@ -6,15 +6,15 @@ Component({
properties: { properties: {
loading: { loading: {
type: Boolean, type: Boolean,
value: true, value: false,
}, },
empty: { empty: {
type: Boolean, type: Boolean,
value: false, value: false,
}, },
message: { message: {
type: Boolean, type: String,
value: '页面迷路了!' value: '暂无内容数据'
} }
}, },

4
components/swiper/index.wxml

@ -10,7 +10,9 @@
> >
<block wx:for="{{images}}" wx:key="swiper-{{index}}"> <block wx:for="{{images}}" wx:key="swiper-{{index}}">
<swiper-item bind:tap="onTapImage" data-item="{{item}}"> <swiper-item bind:tap="onTapImage" data-item="{{item}}">
<image class="swiper_icon" src="{{item.image}}"></image> <image class="swiper_icon" src="{{item.image}}">
<text class="swiper_title">{{item.title}}</text>
</image>
</swiper-item> </swiper-item>
</block> </block>
</swiper> </swiper>

16
components/swiper/index.wxss

@ -1,8 +1,24 @@
/* components/swiper/index.wxss */ /* components/swiper/index.wxss */
.e-swiper {
position: relative;
}
.e-swiper>swiper { .e-swiper>swiper {
height: 180px; height: 180px;
} }
.swiper_icon { .swiper_icon {
width: 100%; width: 100%;
height: 100%; height: 100%;
}
.swiper_title {
position: absolute;
left: 0;
right: 0;
bottom: 0;
padding: 0 10rpx;
z-index: 10;
text-overflow: ellipsis;
color: white;
white-space: nowrap;
overflow: hidden;
background-color: rgba(0, 0, 0, 0.2);
} }

8
pages/article/index.js

@ -59,12 +59,12 @@ Page({
addOrRemoveCollectionApi () { addOrRemoveCollectionApi () {
artice.addOrRemoveCollect(this.data.aId, res => { artice.addOrRemoveCollect(this.data.aId, res => {
console.log(res) console.log(res)
this.setData({
isStar: !this.data.isStar
})
if (res.code == 200) { if (res.code == 200) {
this.setData({
isStar: !this.data.isStar
})
wx.showToast({ wx.showToast({
title: res.message, title: this.data.isStar ? '收藏成功' : '取消收藏成功',
icon: 'none' icon: 'none'
}) })
} }

4
pages/article/index.wxml

@ -3,8 +3,8 @@
<view class="page_hd"> <view class="page_hd">
<view class="artice_title">{{title}}</view> <view class="artice_title">{{title}}</view>
<view class="artice_info"> <view class="artice_info">
<text class="artice_origin">{{origin}}</text> <text class="artice_origin">{{origin || ''}}</text>
<text class="artice_time">{{date}}</text> <text class="artice_time">{{date || ''}}</text>
<image class="artice_collect" src="{{isStar ? star : unStar}}" bindtap="onClickCollect"></image> <image class="artice_collect" src="{{isStar ? star : unStar}}" bindtap="onClickCollect"></image>
</view> </view>
</view> </view>

4
pages/article/index.wxss

@ -20,7 +20,11 @@
line-height: 27px; line-height: 27px;
} }
.artice_origin { .artice_origin {
max-width: 50vw;
color: #66708B; color: #66708B;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
} }
.artice_time { .artice_time {
color: #B3B3B3; color: #B3B3B3;

1
pages/billboards/policy/index.json

@ -4,6 +4,7 @@
"usingComponents": { "usingComponents": {
"w-searchbar": "/components/weui/searchbar/searchbar", "w-searchbar": "/components/weui/searchbar/searchbar",
"e-cell": "/components/cell/index", "e-cell": "/components/cell/index",
"e-empty": "/components/empty/index",
"e-tags": "components/tags/index" "e-tags": "components/tags/index"
} }
} }

1
pages/billboards/policy/index.wxml

@ -12,4 +12,5 @@
bind:clickListItem="clickListItem" bind:clickListItem="clickListItem"
/> />
</block> </block>
<e-empty empty="{{list.length <= 0}}" message="暂无搜索内容"/>
</view> </view>

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

@ -50,10 +50,6 @@ Page({
this.setData({ this.setData({
nodes: '' nodes: ''
}) })
wx.showToast({
title: res.message,
icon: 'none'
})
} }
}) })
} }

3
pages/billboards/policy/policy-list/index.json

@ -1,6 +1,7 @@
{ {
"navigationBarTitleText": "人才政策", "navigationBarTitleText": "人才政策",
"usingComponents": { "usingComponents": {
"e-segment": "/components/segment/index" "e-segment": "/components/segment/index",
"e-empty": "/components/empty/index"
} }
} }

1
pages/billboards/policy/policy-list/index.wxml

@ -10,4 +10,5 @@
<view class="page_bd"> <view class="page_bd">
<rich-text nodes="{{nodes}}"></rich-text> <rich-text nodes="{{nodes}}"></rich-text>
</view> </view>
<e-empty empty="{{nodes.length <= 0}}" message="暂无数据"/>
</view> </view>

9
pages/home/index.js

@ -63,7 +63,7 @@ Page({
title: item.title, title: item.title,
showTop: item.isTop == 1 ? true : false, showTop: item.isTop == 1 ? true : false,
time: dayjs(item.createTime).toNow(), time: dayjs(item.createTime).toNow(),
readed: item.isRead == 0 ? 'false' : 'true' readed: item.isRead == 0 ? false : true
}) })
}) })
if (page == 1) { if (page == 1) {
@ -98,10 +98,10 @@ Page({
const datas = res.list const datas = res.list
let tempBanners = [] let tempBanners = []
datas.forEach(item => { datas.forEach(item => {
console.log(item)
tempBanners.push({ tempBanners.push({
id: item.id, id: item.id,
image: item.titlePic image: item.titlePic,
title: item.title
}) })
}) })
this.setData({ this.setData({
@ -137,7 +137,8 @@ Page({
}, },
clickListItem (e) { clickListItem (e) {
console.log(e.detail) console.log(e.detail)
this.gotoArticePage(e.detail.id) const {id, index} = e.detail
this.gotoArticePage(id)
}, },
gotoArticePage (id) { gotoArticePage (id) {
wx.navigateTo({ wx.navigateTo({

1
pages/home/index.wxml

@ -4,6 +4,7 @@
<e-focus bind:tapFocusItem="tapFocusItem" items="{{hots}}"/> <e-focus bind:tapFocusItem="tapFocusItem" items="{{hots}}"/>
<block wx:for="{{list}}" wx:key="{{index}}"> <block wx:for="{{list}}" wx:key="{{index}}">
<e-cell <e-cell
index="{{index}}"
read="{{item.readed}}" read="{{item.readed}}"
cId="{{item.id}}" cId="{{item.id}}"
title="{{item.title}}" title="{{item.title}}"

Loading…
Cancel
Save