优化我的日记、对接文章分享图、对接错误日志接口

master
chen 2022-08-17 17:15:37 +08:00
parent 6daa6818e7
commit 11fcf3611d
22 changed files with 66 additions and 35 deletions

View File

@ -63,20 +63,36 @@ const checkError = (e) => {
}
} else {
if(e.errMsg=="request:fail 对应的服务器证书无效。" || e.errno==600001) {
if(errorFlag) {
errorFlag = false;
uni.showModal({
title:'服务器证书无效',
confirmText:'确定',
showCancel:false,
success:(e)=> {
if(e.confirm) {
// 退出小程序
wx.exitMiniProgram();
}
uni.request({
url: `${hostapi}index/err-log`,
method: 'POST',
data:{
log:`接口:${uni.getStorageSync('apiurl')},错误信息:${e}`
},
headers:{
'Content-Type': 'application/json; charset=UTF-8',
'Authorization': 'Bearer '+uni.getStorageSync('token') || ''
},
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 => {
uni.setStorageSync('apiurl',url);
checkError(e)
},
complete: rest => {

View File

@ -21,8 +21,8 @@
<nothing-page v-if="dataList.length==0" :content="'暂无日记'"></nothing-page>
</view>
<!-- 底部按钮 -->
<view class="posixzy pad-sx25">
<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 class="posixzy pad-sx25" style="bottom:140rpx;">
<view @tap="goAddDiary" class="fon30 radius20 tc colf bold" style="margin: 0 83rpx;height: 90rpx;line-height: 90rpx;" :style="{background:publicColor}">添加日记</view>
</view>
<!-- 底部客服 -->
<public-customer></public-customer>

View File

@ -172,6 +172,7 @@
ifSwiper:0,//swiper
shareFlag:true,
ifNeedAuth:false,//
shareImg:''
}
},
computed: {
@ -212,7 +213,8 @@
var shareObj = {
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')}`, // /
imageUrl: `${ya.$http}${ya.detailObj.share_img || ya.detailObj.cover}` //PNGJPG imageUrl 使 5:4
// imageUrl: `${ya.$http}${ya.detailObj.share_img || ya.detailObj.cover}` //PNGJPG imageUrl 使 5:4
imageUrl: this.shareImg //PNGJPG imageUrl 使 5:4
};
return shareObj;
},
@ -282,6 +284,17 @@
}
},
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(){
this.$toolAll.tools.showToast('分享图生成中...','none',10000);
@ -359,6 +372,7 @@
})
},
checkDetail(newId) {
this.getShareImg(newId);
this.$requst.post('archives/detail', {
id: newId,
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