Commit bb4161fc by 梁建民

js

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