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

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 { } 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 => {

View File

@ -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>

View File

@ -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}` //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; 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