Commit bb4161fc by 梁建民

js

parent 162e35af
......@@ -54,9 +54,9 @@ App({
if (this.globalData.auth) {
//是否登录
if (this.globalData.token) {
wx.switchTab({
url: '/pages/tab/home/home'
});
// wx.switchTab({
// url: '/pages/tab/home/home'
// });
} else {
wx.redirectTo({
url: '/pages/person/login/index'
......
......@@ -17,7 +17,7 @@ Page({
checkList: [], //最新数据
checkPopular: [], //热门数据
topic_id: '', //话题id
limit: 30,
limit: 10,
p: 1,
total: 1,
isShowBottom: false
......@@ -122,9 +122,9 @@ Page({
} else if (this.data.tabIndex == 2) {
//热门
this.setData({
checkPopular: res.data,
});
this.setData({
checkPopular: res.data,
});
}
......@@ -213,8 +213,12 @@ Page({
*/
praise: function (e) {
let type = e.currentTarget.dataset.type,
praise = '';
let type = e.currentTarget.dataset.type;
let praise = '';
let index = e.currentTarget.dataset.index;
console.log(index)
if (type == 1) {
praise = true;
......@@ -228,8 +232,13 @@ Page({
praise: praise,
id: e.currentTarget.dataset.id
}, (res) => {
if (res.errcode === 0) {
if (res.errcode === 0) {
wx.showToast({
title: '点赞成功',
icon: 'none',
duration: 2000
});
} else {
wx.showToast({
title: res.errmsg,
......
......@@ -34,11 +34,11 @@
<view class="item-center">{{item.content}}。</view>
<view class="item-bottom row bothSide verCenter">
<view class="up-down row verCenter">
<view class="up row verCenter" bind:tap="praise" data-id="{{item.id}}" data-type="1">
<view class="up row verCenter" bind:tap="praise" data-id="{{item.id}}" data-type="1" data-index="{{index}}">
<text class="icon iconfont iconiconxiantiaoshouji31 {{item.is_praise == 1 ? 'hasup':'' }}"></text>
<text class="num">{{item.praise}}</text>
</view>
<view class="down row verCenter" bind:tap="praise" data-id="{{item.id}}" data-type="2">
<view class="down row verCenter" bind:tap="praise" data-id="{{item.id}}" data-type="2" data-index="{{index}}">
<text class="icon iconfont iconiconxiantiaoshouji30 {{item.is_praise == 2 ? 'hasdown':'' }}"></text>
<text class="num">{{item.low}}</text>
</view>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment