Skip to content

Commit

Permalink
bbs
Browse files Browse the repository at this point in the history
  • Loading branch information
deancn committed Apr 27, 2019
1 parent 85212bc commit 4835e7e
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
dist
.idea
.DS_Store
.wepycache
8 changes: 5 additions & 3 deletions src/app.wpy
Original file line number Diff line number Diff line change
Expand Up @@ -153,20 +153,22 @@ export default class extends wepy.app {
// <!--广告开始-->
// 在页面中定义插屏广告
let interstitialAd = null

// 在页面onLoad回调事件中创建插屏广告实例
if (wepy.createInterstitialAd) {
interstitialAd = wepy.createInterstitialAd({
if (wx.createInterstitialAd) {
interstitialAd = wx.createInterstitialAd({
adUnitId: 'adunit-1a35266b79a02a85'
})
}

// 在适合的场景显示插屏广告
if (interstitialAd) {
interstitialAd.show().catch((err) => {
console.error(err)
})
}
// <!--广告结束-->
}

// 获取权限
async getPerms() {
let perms = []
Expand Down
1 change: 1 addition & 0 deletions src/components/topicList.wpy
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
// 格式化updated_at
topics.forEach(function (topic) {
topic.updated_at_diff = util.diffForHumans(topic.UpdatedAt)
console.log('------', topic)
})
// 如果传入参数 reset 为true,则覆盖 topics
this.topics = reset ? topics : this.topics.concat(topics)
Expand Down
2 changes: 1 addition & 1 deletion src/mixins/replyMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default class ReplyMixin extends wepy.mixin {
replies.forEach((reply) => {
// 控制是否可以删除
reply.can_delete = this.canDelete(user, reply)
reply.created_at_diff = util.diffForHumans(reply.created_at)
reply.created_at_diff = util.diffForHumans(reply.CreatedAt)
})
// 如果reset不为true则合并 this.replies;否则直接覆盖
this.replies = reset ? replies : this.replies.concat(replies)
Expand Down
9 changes: 4 additions & 5 deletions src/pages/topics/index.wpy
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@
<view class="page">
<view class="category-list__item">
<view class="weui-flex category-list__item-hd" @tap="toggle">
<view class="weui-flex__item page-title">{{ currentCategory.name || '话题' }}</view>
<view class="weui-flex__item page-title">{{ currentCategory.name || '全部' }}</view>
<image class="category-list__img" src="/images/category.png"></image>
</view>

<view class="category-list__item-bd {{ categoryOpen ? 'category-list__item-bd_show' : '' }}">
<view class="weui-cells {{ categoryOpen ? 'weui-cells_show' : '' }}">
<view @tap="changeCategory()" class="weui-cell weui-cell_access {{ !currentCategory.id ? 'category-list__item_selected' : ''}}">
<view class="weui-cell__bd">话题</view>
<view class="weui-cell__bd">全部</view>
</view>
<view @tap="changeCategory({{ category.id }})" class="weui-cell weui-cell_access {{ currentCategory.id === category.id ? 'category-list__item_selected' : ''}}" wx:for="{{ categories }}" wx:for-item="category" wx:key="id">
<view @tap="changeCategory({{ category.ID }})" class="weui-cell weui-cell_access {{ currentCategory.id === category.ID ? 'category-list__item_selected' : ''}}" wx:for="{{ categories }}" wx:for-item="category" wx:key="id">
<view class="weui-cell__bd">{{ category.name }}</view>
</view>
</view>
Expand Down Expand Up @@ -125,7 +125,6 @@
}

this.categories = categories
console.log('categories====', categories)
this.$apply()
}
onLoad() {
Expand Down Expand Up @@ -155,7 +154,7 @@
},
// 选择分类重新加载
changeCategory (id = 0) {
this.currentCategory = id ? this.categories.find(category => category.id === id) : {}
this.currentCategory = id ? this.categories.find(category => category.ID === id) : {}
this.categoryOpen = false
this.$apply()
this.requestData.category_id = this.currentCategoryId
Expand Down
1 change: 0 additions & 1 deletion src/pages/topics/show.wpy
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ page{
}
}
async onLoad(options) {
console.log('11111111 --- show onload', options.id)
await this.getTopic(options.id)
// 获取当前登录用户
this.user = await this.$parent.getCurrentUser()
Expand Down
4 changes: 2 additions & 2 deletions src/pages/users/show.wpy
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@
this.user = userResponse.data

// 格式化注册时间
this.user.created_at_diff = util.diffForHumans(this.user.created_at)
this.user.created_at_diff = util.diffForHumans(this.user.CreatedAt)
// 格式化最后活跃时间
this.user.last_actived_at_diff = util.diffForHumans(this.user.last_actived_at)
this.user.last_actived_at_diff = util.diffForHumans(this.user.LastActivedAt)

this.$apply()

Expand Down

0 comments on commit 4835e7e

Please sign in to comment.