Skip to content

Commit

Permalink
🐛 fixed bugs in share and prepare for release
Browse files Browse the repository at this point in the history
  • Loading branch information
idealclover committed Feb 22, 2020
1 parent 708696d commit 9e8d6c8
Show file tree
Hide file tree
Showing 13 changed files with 123 additions and 115 deletions.
4 changes: 1 addition & 3 deletions UniTypecho/components/articledetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@
that.title = item.title;
that.thumb = item.thumb.type == 'self' ? item.thumb.url : null;
that.link = item.link;
console.log(that.donateQrURL)
console.log(that.showDonate)
if (!Util.isNull(that.donateQrURL) && that.showDonate == true)
if (!Util.isNull(that.donateQrURL) && that.showDonate == true)
that.isShowDonate = true;
that.$emit('getInfo', {
"title": item.title,
Expand Down
24 changes: 12 additions & 12 deletions UniTypecho/components/commentdetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
},
watch: {
cid: function(cid) {
if(this.isPage) this.getdetails(cid);
if (this.isPage) this.getdetails(cid);
},
refresh: function() {
this.getdetails(this.cid);
Expand All @@ -81,7 +81,7 @@
},
methods: {
getdetails(cid) {
if(Util.isNull(cid)) return;
if (Util.isNull(cid)) return;
let that = this;
Net.request({
url: API.getLikedNum(cid),
Expand All @@ -93,12 +93,12 @@
success: function(res) {
let datas = res.data.data;
let avatarList = [];
for(let i in datas){
for (let i in datas) {
let avatarUrl = datas[i]['avatarUrl'];
avatarList.push(avatarUrl);
}
let leftAvatars = that.likeNum - avatarList.length
for(let i = 0; i < leftAvatars; i++){
for (let i = 0; i < leftAvatars; i++) {
avatarList.push("https://i.loli.net/2020/02/21/suCXpZ4rxQFeMDn.jpg");
};
avatarList.reverse();
Expand Down Expand Up @@ -132,7 +132,7 @@
navigate(href, e) {
let re = new RegExp("^https:\/\/" + cfg.getdomain + "\/archives\/([0-9]*)\/?");
let str = href.match(re);
if(!Util.isNull(str)) {
if (!Util.isNull(str)) {
uni.navigateTo({
url: '/pages/post/post?cid=' + str[1]
});
Expand All @@ -142,16 +142,15 @@
window.open(href);
// #endif
// #ifdef APP-PLUS
plus.runtime.openURL(href, function(res) {
});
plus.runtime.openURL(href, function(res) {});
// #endif
// #ifdef MP
uni.setClipboardData({
data: href,
success: function(){
success: function() {
uni.showToast({
title: '链接已复制',
duration: 2000
title: '链接已复制',
duration: 2000
});
}
});
Expand All @@ -164,11 +163,12 @@
.cu-bar .action:first-child {
margin-left: 0;
}
.cu-avatar-group {
white-space: nowrap;
}
.cu-list .cu-item .content {
word-break: break-all;
}
}
</style>
4 changes: 2 additions & 2 deletions UniTypecho/components/commentsender/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,12 @@
0,
),
success: function(res) {
if(res.data.data.status == "waiting"){
if (res.data.data.status == "waiting") {
uni.showToast({
title: "请等待审核",
duration: 2000
});
}else if(res.data.data.status == "approved"){
} else if (res.data.data.status == "approved") {
uni.showToast({
title: "评论成功",
duration: 2000
Expand Down
4 changes: 2 additions & 2 deletions UniTypecho/components/commentsender/h5.vue
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,12 @@
0,
),
success: function(res) {
if(res.data.data.status == "waiting"){
if (res.data.data.status == "waiting") {
uni.showToast({
title: "请等待审核",
duration: 2000
});
}else if(res.data.data.status == "approved"){
} else if (res.data.data.status == "approved") {
uni.showToast({
title: "评论成功",
duration: 2000
Expand Down
4 changes: 2 additions & 2 deletions UniTypecho/components/commentsender/qq.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@
getApp().globalData.userInfo.avatarUrl,
),
success: function(res) {
if(res.data.data.status == "waiting"){
if (res.data.data.status == "waiting") {
uni.showToast({
title: "请等待审核",
duration: 2000
});
}else if(res.data.data.status == "approved"){
} else if (res.data.data.status == "approved") {
uni.showToast({
title: "评论成功",
duration: 2000
Expand Down
4 changes: 2 additions & 2 deletions UniTypecho/components/commentsender/toutiao.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@
getApp().globalData.userInfo.avatarUrl,
),
success: function(res) {
if(res.data.data.status == "waiting"){
if (res.data.data.status == "waiting") {
uni.showToast({
title: "请等待审核",
duration: 2000
});
}else if(res.data.data.status == "approved"){
} else if (res.data.data.status == "approved") {
uni.showToast({
title: "评论成功",
duration: 2000
Expand Down
68 changes: 34 additions & 34 deletions UniTypecho/components/commentsender/wx.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@
}
})
},
getPoster(){
getPoster() {
uni.showLoading({
title: "加载中",
mask: false
title: "加载中",
mask: false
});
if(!this.isPage) {
if (!this.isPage) {
this.qrUrl = API.getPosterUrl('/page/index/index?cid=' + this.cid);
} else this.qrUrl = API.getPosterUrl('/pages/index/index');
this.imgUrl = Util.isNull(this.thumb) ? "https://api.isoyu.com/bing_images.php" : this.thumb;
Expand All @@ -123,19 +123,19 @@
this.modalName = "DialogModal2"
this.posterURL = res.tempFilePath;
},
savePoster(){
savePoster() {
let that = this;
uni.authorize({
scope: 'scope.writePhotosAlbum',
success() {
uni.saveImageToPhotosAlbum({
filePath: that.posterURL,
success: function () {
that.loadDialogModal2 = false;
that.modalName = "";
}
});
}
scope: 'scope.writePhotosAlbum',
success() {
uni.saveImageToPhotosAlbum({
filePath: that.posterURL,
success: function() {
that.loadDialogModal2 = false;
that.modalName = "";
}
});
}
})
},
hidePoster() {
Expand Down Expand Up @@ -212,12 +212,12 @@
getApp().globalData.userInfo.avatarUrl,
),
success: function(res) {
if(res.data.data.status == "waiting"){
if (res.data.data.status == "waiting") {
uni.showToast({
title: "请等待审核",
duration: 2000
});
}else if(res.data.data.status == "approved"){
} else if (res.data.data.status == "approved") {
uni.showToast({
title: "评论成功",
duration: 2000
Expand All @@ -226,24 +226,24 @@
console.log('success');
that.$emit('onRefreshComments');
that.value = ""
if(Util.isNull(getApp().globalData.templateIds)) return;
if (Util.isNull(getApp().globalData.templateIds)) return;
uni.requestSubscribeMessage({
tmplIds: getApp().globalData.templateIds,
success (res) {
console.log(res);
Net.request({
showLoading: false,
url: API.subscribe(getApp().globalData.userInfo.openid),
success: function(res) {}
});
uni.showToast({
title: "订阅成功",
duration: 2000
});
},
fail (e) {
console.log(e);
}
tmplIds: getApp().globalData.templateIds,
success(res) {
console.log(res);
Net.request({
showLoading: false,
url: API.subscribe(getApp().globalData.userInfo.openid),
success: function(res) {}
});
uni.showToast({
title: "订阅成功",
duration: 2000
});
},
fail(e) {
console.log(e);
}
})
}
});
Expand Down
4 changes: 2 additions & 2 deletions UniTypecho/pages/about/about.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<image src="/static/images/wave.gif" mode="scaleToFill" class="gif-wave"></image>
</view>
<view class="margin-xl">
<articledetail :cid="cid" :isPage="true" :showTools="false" @getInfo="getInfo"/>
<articledetail :cid="cid" :isPage="true" :showTools="false" @getInfo="getInfo" />
<commentdetail :cid="cid" :isPage="true" :refresh="refreshComments" v-if="showComments" />
<footerinfo />
</view>
<commentsender :cid="cid" :isPage="true" :title="title" :thumb="thumb" @onRefreshComments="onRefreshComments" v-if="showComments" />
<commentsender :cid="cid" :isPage="true" :title="title" :thumb="thumb" @onRefreshComments="onRefreshComments" v-if="showComments" />
</view>
</template>

Expand Down
23 changes: 13 additions & 10 deletions UniTypecho/pages/index/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@
success: function(res) {
getApp().globalData.userInfo = res.userInfo;
Login.login({
success: function() {
}
success: function() {}
});
}
});
// #endif
Expand All @@ -65,8 +64,8 @@
getApp().globalData.showComments = showComments;
getApp().globalData.showShare = showShare;
getApp().globalData.showDonate = showDonate;
if(!Util.isNull(templateIds)) getApp().globalData.templateIds = templateIds;
if(!Util.isNull(option.cid)){
if (!Util.isNull(templateIds)) getApp().globalData.templateIds = templateIds;
if (!Util.isNull(option.cid)) {
that.cid = option.cid;
uni.navigateTo({
url: '../post/post?cid=' + option.cid
Expand All @@ -75,13 +74,17 @@
}
});
},
// #ifdef MP-QQ
onShareAppMessage: function () {
qq.showShareMenu({
onShareAppMessage: function() {
// #ifdef MP-QQ
qq.showShareMenu({
showShareItems: ['qq', 'qzone', 'wechatFriends', 'wechatMoment']
})
});
// #endif
return {
title: '来看看这个博客小程序!',
path: '/pages/index/index?'
}
}
// #endif
}
</script>

Expand Down
15 changes: 11 additions & 4 deletions UniTypecho/pages/post/post.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
getInfo(e) {
this.title = e.title;
this.thumb = e.thumb;
if(!this.isPage) {
if (!this.isPage) {
uni.setNavigationBarTitle({
title: e.title
});
Expand All @@ -63,10 +63,17 @@
this.refreshComments = !this.refreshComments;
}
},
onShareAppMessage: function () {
qq.showShareMenu({
onShareAppMessage: function() {
// #ifdef MP-QQ
qq.showShareMenu({
showShareItems: ['qq', 'qzone', 'wechatFriends', 'wechatMoment']
})
});
// #endif
return {
title: this.title,
path: '/pages/index/index?cid=' + this.cid,
imageUrl: this.thumb
}
}
}
</script>
Expand Down
4 changes: 2 additions & 2 deletions UniTypecho/utils/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@ module.exports = {
},
//#endif
//#ifndef MP
postComment: function(cid, name, mail, website, text, parent){
postComment: function(cid, name, mail, website, text, parent) {
return this.appendAPISEC(
API_URL + "postcomment?cid=" + cid + "&name=" + name + "&mail=" + mail + "&text=" + text + "&parent=" +
parent + "&website=" + website + "&type=app"
);
}
//#endif
// #ifdef MP-WEIXIN
subscribe: function(openid){
subscribe: function(openid) {
return this.appendAPISEC(
API_URL + "subscribe?openid=" + openid
);
Expand Down
6 changes: 3 additions & 3 deletions UniTypecho/utils/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import Util from './util.js';

function login(handler) {
uni.showLoading({
title: "加载中",
mask: false
title: "加载中",
mask: false
});
uni.login({
provider: 'weixin',
success: function(res) {
if(Util.isNull(getApp().globalData.userInfo)) {
if (Util.isNull(getApp().globalData.userInfo)) {
uni.hideLoading();
return;
}
Expand Down
Loading

0 comments on commit 9e8d6c8

Please sign in to comment.