Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

Commit a9a9eb2

Browse files
committed
修复点赞bug和markdown bug
1 parent e9e15a7 commit a9a9eb2

File tree

4 files changed

+23
-18
lines changed

4 files changed

+23
-18
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ yarn-error.log*
1111
*.ntvs*
1212
*.njsproj
1313
*.sln
14+
15+
temp_wemark/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ API来自于[cnode社区](https://cnodejs.org/api)
1212

1313
线上版本更新日志
1414

15-
v0.0.4 修复几处样式,添加帖子热帖,发帖添加markdown预览,通知添加一键已读和点击已读 // markdown发布的预览有bug。。。没发布
15+
v0.0.4 修复几处样式,添加帖子热帖,发帖添加markdown预览,通知添加一键已读和点击已读 markdown发布的预览
1616

1717
v0.0.3 添加扫码登陆
1818

src/pages/detail/index.vue

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</div>
1010
<div class='list'><img @click.stop="collect" :src="detailData.is_collect?'../../../static/star2.png':'../../../static/star1.png'" style='width:40rpx;height:40rpx;'><span>楼主</span></div>
1111
</div>
12-
<scroll-view class='body' scroll-y='true' :scroll-top="top" enable-back-to-top='true' @scrolltolower='getMore'>
12+
<scroll-view class='body' scroll-y='true' @scroll='onScroll($event)' :scroll-top="top" enable-back-to-top='true' @scrolltolower='getMore'>
1313
<div class='title'>
1414
<p class='big'>{{detailData.title}}</p>
1515
<div class='time-info'>
@@ -75,6 +75,9 @@ export default {
7575
},
7676
7777
methods: {
78+
onScroll(e) {
79+
this.top = e.target.scrollTop;
80+
},
7881
async getData() {
7982
const accesstoken = wx.getStorageSync("accesstoken");
8083
//this.id = wx.getStorageSync("topicid");
@@ -131,17 +134,10 @@ export default {
131134
// console.log(11);
132135
setTimeout(() => (this.top = 0));
133136
this.top = 1;
134-
// wx.pageScrollTo({
135-
// scrollTop: 500,
136-
// duration: 300
137-
// });
138137
},
139138
getMore() {
140139
if (this.remainReplies.length > 0) {
141-
this.currentReplies = [
142-
...this.currentReplies,
143-
...this.remainReplies.splice(0, 10)
144-
];
140+
this.currentReplies.concat(this.remainReplies.splice(0, 10));
145141
} else {
146142
wx.showToast({
147143
title: "无更多数据",
@@ -152,7 +148,7 @@ export default {
152148
},
153149
async upOrCancel(e) {
154150
// / todo 防抖
155-
console.log(e);
151+
// console.log(e);
156152
const accesstoken = wx.getStorageSync("accesstoken");
157153
if (accesstoken) {
158154
try {
@@ -168,10 +164,18 @@ export default {
168164
icon: "none",
169165
duration: 2000
170166
});
171-
// e.currentTarget.dataset.originindex
172-
this.currentReplies[e.currentTarget.dataset.originindex].is_uped = res.data.action === 'up';
167+
// e.currentTarget.dataset.originindex
168+
if (res.data.action === "up"){
169+
this.currentReplies[e.currentTarget.dataset.originindex].ups.length += 1;
170+
}else{
171+
this.currentReplies[e.currentTarget.dataset.originindex].ups.length -= 1;
172+
}
173+
174+
this.currentReplies[e.currentTarget.dataset.originindex].is_uped =
175+
res.data.action === "up";
173176
}
174-
// this.getData();
177+
178+
// this.getData();
175179
} catch (e) {
176180
wx.showToast({
177181
title: e.response.data.error_msg,
@@ -249,7 +253,7 @@ export default {
249253
width: 64rpx;
250254
height: 64rpx;
251255
}
252-
.name{
256+
.name {
253257
margin-left: 20rpx;
254258
}
255259
}

src/pages/publish/index.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@
1313
<div :class='{selected:tab==="preview"}' @click.stop='changeTab($event)' data-tab='preview'>预览</div>
1414
</div>
1515
<textarea v-show="tab==='markdown'" class='textarea' v-model="content"></textarea>
16-
<div v-show="tab==='preview'" style="min-height:500rpx;background-color:white;margin-top:-20rpx;margin-bottom:30rpx;">
17-
<wemark mdData='bug待修复'></wemark>
16+
<div v-show="tab==='preview'">
17+
<wemark :mdData='content' customStyle="min-height:500rpx;background-color:white;margin-top:-20rpx;margin-bottom:30rpx;"></wemark>
1818
</div>
1919
<button @click.stop="handle">发帖</button>
2020
</div>
2121
</template>
2222

2323
<script>
2424
import login from "../../components/login";
25-
//import wemark from "mpvue-wemark";
2625
import wemark from "mpvue-wemark";
2726
import { api } from "../../const";
2827
export default {

0 commit comments

Comments
 (0)