优化我的日记、对接文章分享图、对接错误日志接口
parent
6daa6818e7
commit
11fcf3611d
|
@ -63,20 +63,36 @@ const checkError = (e) => {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(e.errMsg=="request:fail 对应的服务器证书无效。" || e.errno==600001) {
|
if(e.errMsg=="request:fail 对应的服务器证书无效。" || e.errno==600001) {
|
||||||
if(errorFlag) {
|
uni.request({
|
||||||
errorFlag = false;
|
url: `${hostapi}index/err-log`,
|
||||||
uni.showModal({
|
method: 'POST',
|
||||||
title:'服务器证书无效',
|
data:{
|
||||||
confirmText:'确定',
|
log:`接口:${uni.getStorageSync('apiurl')},错误信息:${e}`
|
||||||
showCancel:false,
|
},
|
||||||
success:(e)=> {
|
headers:{
|
||||||
if(e.confirm) {
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
// 退出小程序
|
'Authorization': 'Bearer '+uni.getStorageSync('token') || ''
|
||||||
wx.exitMiniProgram();
|
},
|
||||||
|
success: (res) => {
|
||||||
|
if(res.code==0){
|
||||||
|
uni.removeStorageSync('apiurl');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
// if(errorFlag) {
|
||||||
|
// errorFlag = false;
|
||||||
|
// uni.showModal({
|
||||||
|
// title:'服务器证书无效',
|
||||||
|
// confirmText:'确定',
|
||||||
|
// showCancel:false,
|
||||||
|
// success:(e)=> {
|
||||||
|
// if(e.confirm) {
|
||||||
|
// // 退出小程序
|
||||||
|
// wx.exitMiniProgram();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,6 +211,7 @@ const request = (method, url, options, ifLogin) => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: e => {
|
fail: e => {
|
||||||
|
uni.setStorageSync('apiurl',url);
|
||||||
checkError(e)
|
checkError(e)
|
||||||
},
|
},
|
||||||
complete: rest => {
|
complete: rest => {
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
<nothing-page v-if="dataList.length==0" :content="'暂无日记'"></nothing-page>
|
<nothing-page v-if="dataList.length==0" :content="'暂无日记'"></nothing-page>
|
||||||
</view>
|
</view>
|
||||||
<!-- 底部按钮 -->
|
<!-- 底部按钮 -->
|
||||||
<view class="posixzy pad-sx25">
|
<view class="posixzy pad-sx25" style="bottom:140rpx;">
|
||||||
<view @tap="goAddDiary" class="fon30 radius20 tc colf bold" style="margin: 0 83rpx;bottom:51px;height: 90rpx;line-height: 90rpx;" :style="{background:publicColor}">添加日记</view>
|
<view @tap="goAddDiary" class="fon30 radius20 tc colf bold" style="margin: 0 83rpx;height: 90rpx;line-height: 90rpx;" :style="{background:publicColor}">添加日记</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 底部客服 -->
|
<!-- 底部客服 -->
|
||||||
<public-customer></public-customer>
|
<public-customer></public-customer>
|
||||||
|
|
|
@ -172,6 +172,7 @@
|
||||||
ifSwiper:0,//是否显示swiper
|
ifSwiper:0,//是否显示swiper
|
||||||
shareFlag:true,
|
shareFlag:true,
|
||||||
ifNeedAuth:false,//是否需要授权
|
ifNeedAuth:false,//是否需要授权
|
||||||
|
shareImg:''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -212,7 +213,8 @@
|
||||||
var shareObj = {
|
var shareObj = {
|
||||||
title: `${ya.detailObj.title}`, // 默认是小程序的名称(可以写slogan等)
|
title: `${ya.detailObj.title}`, // 默认是小程序的名称(可以写slogan等)
|
||||||
path: `/pagesB/problemDetail/problemDetail?id=${this.detailObj.id}&category_id=${this.category_id}&share_id=${uni.getStorageSync('userId')}&invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
path: `/pagesB/problemDetail/problemDetail?id=${this.detailObj.id}&category_id=${this.category_id}&share_id=${uni.getStorageSync('userId')}&invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||||
imageUrl: `${ya.$http}${ya.detailObj.share_img || ya.detailObj.cover}` //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
// imageUrl: `${ya.$http}${ya.detailObj.share_img || ya.detailObj.cover}` //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
||||||
|
imageUrl: this.shareImg //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
||||||
};
|
};
|
||||||
return shareObj;
|
return shareObj;
|
||||||
},
|
},
|
||||||
|
@ -282,6 +284,17 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 获取文章分享图
|
||||||
|
getShareImg(id){
|
||||||
|
this.$requst.get('archives/detail-share',{id}).then(res=>{
|
||||||
|
if(res.code==0){
|
||||||
|
// this.shareImg = res.data.src;
|
||||||
|
base64ToPath(res.data.share_img).then(path=>{
|
||||||
|
this.shareImg = path;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
// 分享图分享
|
// 分享图分享
|
||||||
shareImgEv(){
|
shareImgEv(){
|
||||||
this.$toolAll.tools.showToast('分享图生成中...','none',10000);
|
this.$toolAll.tools.showToast('分享图生成中...','none',10000);
|
||||||
|
@ -359,6 +372,7 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
checkDetail(newId) {
|
checkDetail(newId) {
|
||||||
|
this.getShareImg(newId);
|
||||||
this.$requst.post('archives/detail', {
|
this.$requst.post('archives/detail', {
|
||||||
id: newId,
|
id: newId,
|
||||||
share_id: this.share_id
|
share_id: this.share_id
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue