Commit 625ce282 by LJM

js

parent 8ea855a9
Showing with 62 additions and 8 deletions
......@@ -41,7 +41,7 @@
</view>
</view>
</view>
<view class="btn row rowCenter verCenter" v-if="is_login">下载</view>
<view class="btn row rowCenter verCenter" v-if="is_login" @click.stop="downloadFile(item.data_id)">下载</view>
<navigator class="btn row rowCenter verCenter" url="/login?referer=/download" v-else>下载</navigator>
</view>
</view>
......@@ -72,7 +72,7 @@
<view class="t2" style="margin-bottom: 13rpx;">{{ item.user_content }}</view>
<view class="row bothSide verCenter">
<view class="time">{{ item.user_time }} {{ item.user_area }}</view>
<view class="row verCenter dianzan curr">
<view class="row verCenter dianzan" :class="{ curr: item.is_good == 1 }" @click.stop="goodArticleMessage(item.aeme_id)">
<text class="iconfont icon-a-juxing11"></text>
<text class="t3">{{ item.user_good_num || 0 }}</text>
</view>
......@@ -95,7 +95,7 @@
<text class="tt">暂无相关类目数据</text>
</view>
</view>
<!-- 留言 -->
<!-- 留言 -->
<uni-popup ref="popup" type="bottom">
<view class="layer-box">
<view class="title row verCenter bothSide">
......@@ -106,7 +106,8 @@
<view class="right row"><text class="iconfont icon-xxx" @click="close()"></text></view>
</view>
<view class="textarea-box row bothSide verCenter"><textarea placeholder="输入你的留言内容" class="uni-textarea" v-model="content"></textarea></view>
<view class="save row rowCenter verCenter" @click="createArticleMessage()">留言</view>
<view class="save row rowCenter verCenter" @click="createArticleMessage()" v-if="is_login">留言</view>
<navigator class="btn row rowCenter verCenter" url="/login?referer=/download" v-else>留言</navigator>
</view>
</uni-popup>
</view>
......@@ -216,12 +217,11 @@ export default {
if (res.err_code === 0) {
uni.showToast({
title: '留言成功',
icon: 'success',
duration: 10000000
icon: 'success'
});
setTimeout(() => {
// this.getShowData();
// this.close();
this.getShowData();
this.close();
}, 2000);
} else {
uni.showToast({
......@@ -230,6 +230,60 @@ export default {
});
}
});
},
/**
* 点赞
*/
goodArticleMessage(aeme_id) {
this.request(Api_Url + '/article/goodArticleMessage', 'GET', { aeme_id: aeme_id }, true, true).then(res => {
if (res.err_code === 0) {
uni.showToast({
title: '点赞成功',
icon: 'success'
});
setTimeout(() => {
this.getShowData();
}, 2000);
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
},
downloadFile(data_id) {
this.request(Api_Url + '/article/DownloadFile', 'POST', { data_id: data_id }, true, true).then(res => {
if (res.err_code === 0) {
var url = res.data[0].file_url;
uni.downloadFile({
url: url,
success: function(res) {
const filePath = res.tempFilePath;
uni.openDocument({
filePath: filePath,
showMenu: true,
success: function(res) {
console.log('打开文档成功');
},
fail: function() {
uni.showModal({
title: '提示',
content: '暂不支持该文件类型预览',
showCancel: false
});
console.log('打开文档失败');
}
});
}
});
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
}
}
};
......
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