Browse Source

hotfix:优化流量主逻辑

feature-1.1-dev
Penny 3 years ago
parent
commit
4a6b209eaf
  1. 11
      pages/ai/paint/loverPaint.vue
  2. 13
      pages/ai/paint/paint.vue
  3. 52
      pages/creator/imgDetail.vue
  4. 35
      pages/userInfo/goldNum/goldNum.vue
  5. 11
      pages/userInfo/goldNum/goldNumLog.vue
  6. 23
      pages/userInfo/userInfo.vue
  7. 11
      pages/userInfo/vip/vip.vue
  8. 17
      utils/request.js

11
pages/ai/paint/loverPaint.vue

@ -160,12 +160,13 @@
} }
// this.paintStyle = res.data.data // this.paintStyle = res.data.data
//console.log('this.paintStyle',this.paintStyle) //console.log('this.paintStyle',this.paintStyle)
}else {
uni.showModal({
content: '网络错误,请稍后再试~',
showCancel: false
});
} }
// else {
// uni.showModal({
// content: '~',
// showCancel: false
// });
// }
}, },
// //
async getPaintStyleList() { async getPaintStyleList() {

13
pages/ai/paint/paint.vue

@ -291,12 +291,13 @@
}, },
}); });
} }
}else { }
uni.showModal({ // else {
content: '网络错误,请稍后再试~', // uni.showModal({
showCancel: false // content: '~',
}); // showCancel: false
} // });
// }
}); });
} else { } else {
this.advancedSetting = e.detail.value; this.advancedSetting = e.detail.value;

52
pages/creator/imgDetail.vue

@ -76,13 +76,13 @@ var videoAd = null;
likeColor: '#ef223c', likeColor: '#ef223c',
collectColor: '#dcaa04', collectColor: '#dcaa04',
urlParamId: undefined, urlParamId: undefined,
isplayOver: false, //isplayOver: false,
downloadUrl: undefined, downloadUrl: undefined,
isVip: false, isVip: false,
canDownloadNum: 0, // canDownloadNum: 0, //
canRewardNum: 0, // canRewardNum: 0, //
userInfo:{}, userInfo:{},
adList:['0qfnoa4053uwkefbas','2v63zq5hvfclpxmurl','d4ltbnxa23zp2hhqwe'] //广 //adList:['0qfnoa4053uwkefbas','2v63zq5hvfclpxmurl','d4ltbnxa23zp2hhqwe'] //广
} }
}, },
async onLoad(option){ async onLoad(option){
@ -93,11 +93,12 @@ var videoAd = null;
} }
// //
if(this.isVip === false){ if(this.isVip === false){
this.isplayOver = false; //this.isplayOver = false;
//广 //广
let num = Math.floor(Math.random() * this.adList.length + 1)-1; //let num = Math.floor(Math.random() * this.adList.length + 1)-1;
console.log('随机激励视频id为:',this.adList[num]) //console.log('id',this.adList[num])
this.loadAdvertise(this.adList[num]); // this.loadAdvertise(this.adList[num]);
this.loadAdvertise('0qfnoa4053uwkefbas');
} }
}, },
onShow() { onShow() {
@ -106,7 +107,7 @@ var videoAd = null;
onHide() { onHide() {
console.log('进入onHide') console.log('进入onHide')
//广 //广
this.isplayOver = false; //this.isplayOver = false;
}, },
created() { created() {
const detailId = uni.getStorageSync('detailId') const detailId = uni.getStorageSync('detailId')
@ -162,12 +163,13 @@ var videoAd = null;
}else{ }else{
that.isVip = false; that.isVip = false;
} }
}else {
uni.showModal({
content: '网络错误,请稍后再试~',
showCancel: false
});
} }
// else {
// uni.showModal({
// content: '~',
// showCancel: false
// });
// }
}, },
// //
@ -246,16 +248,23 @@ var videoAd = null;
console.log('激励视频广告'+adId+'加载成功') console.log('激励视频广告'+adId+'加载成功')
}) })
videoAd.onError((err) => { videoAd.onError((err) => {
if(err.errCode == 1004){
uni.showToast({
icon: 'none',
title: '请稍后再试~'
})
}
that.err() that.err()
}) })
videoAd.closeHandler = (res) =>{ videoAd.closeHandler = (res) =>{
console.log('激励视频下图管理res',res)
if (res && res.isEnded || res === undefined) { if (res && res.isEnded || res === undefined) {
// //
that.isplayOver = true; //that.isplayOver = true;
//console.log('广',that.isplayOver) //console.log('广',that.isplayOver)
that.achieveSaveImg(); that.achieveSaveImg();
}else{ }else{
that.isplayOver = false; //that.isplayOver = false;
uni.showToast({ uni.showToast({
title: '您还没有看完视频,无法下载图片', title: '您还没有看完视频,无法下载图片',
icon: 'none' icon: 'none'
@ -542,7 +551,6 @@ var videoAd = null;
const res = await insertOrUpdatePreAdProfit(params); const res = await insertOrUpdatePreAdProfit(params);
if (res.data.code === 200) { if (res.data.code === 200) {
console.log("写入广告收益成功!") console.log("写入广告收益成功!")
that.adResult = res.data.code;
} else { } else {
uni.showToast({ uni.showToast({
title: '图片下载失败!', title: '图片下载失败!',
@ -754,7 +762,7 @@ var videoAd = null;
achieveSaveImg(){ achieveSaveImg(){
let that = this; let that = this;
//console.log('广',that.isplayOver) //console.log('广',that.isplayOver)
if(that.isplayOver){ // if(that.isplayOver){
//广 //广
let url = that.downloadUrl; let url = that.downloadUrl;
//console.log('that.downloadUrl广',that.downloadUrl); //console.log('that.downloadUrl广',that.downloadUrl);
@ -805,7 +813,7 @@ var videoAd = null;
// //
that.insertPreAdProfit(); that.insertPreAdProfit();
that.insertPreInviteProfit(); that.insertPreInviteProfit();
that.isplayOver = false; //that.isplayOver = false;
// //
that.isDownload = false; that.isDownload = false;
} }
@ -882,7 +890,7 @@ var videoAd = null;
// //
that.insertPreAdProfit(); that.insertPreAdProfit();
that.insertPreInviteProfit(); that.insertPreInviteProfit();
that.isplayOver = false; //that.isplayOver = false;
// //
that.isDownload = false; that.isDownload = false;
} }
@ -904,10 +912,10 @@ var videoAd = null;
}); });
} }
}); });
}else{ // }else{
//广 // //广
console.log('未观看完广告,不可下载图片') // console.log('广')
} // }
}, },
// //
download(url) { download(url) {

35
pages/userInfo/goldNum/goldNum.vue

@ -19,16 +19,17 @@
var videoAd = null; var videoAd = null;
import { signGetGold,watchAdGetGold,checkUserCanGetGold} from "@/api/paint.js"; import { signGetGold,watchAdGetGold,checkUserCanGetGold} from "@/api/paint.js";
import {getRestRewardNum} from "@/api/userInfo.js"; import {getRestRewardNum} from "@/api/userInfo.js";
import {loginTiktok} from '@/api/auth.js'
export default { export default {
data() { data() {
return { return {
userInfo: {}, userInfo: {},
noClick:true, // noClick:true, //
isplayOver: false, //isplayOver: false,
isWatch: false, isWatch: false,
canWatch: false, //false canWatch: false, //false
canRewardNum: 0, canRewardNum: 0,
adList:['0qfnoa4053uwkefbas','2v63zq5hvfclpxmurl','d4ltbnxa23zp2hhqwe'] //广 //adList:['0qfnoa4053uwkefbas','2v63zq5hvfclpxmurl','d4ltbnxa23zp2hhqwe'] //广
}; };
}, },
onShow() { onShow() {
@ -38,14 +39,15 @@ export default {
onHide() { onHide() {
console.log('进入onHide') console.log('进入onHide')
//广 //广
this.isplayOver = false; //this.isplayOver = false;
}, },
onLoad() { onLoad() {
this.isplayOver = false; //this.isplayOver = false;
//广 //广
let num = Math.floor(Math.random() * this.adList.length + 1)-1; // let num = Math.floor(Math.random() * this.adList.length + 1)-1;
console.log('随机激励视频id为:',this.adList[num]) // console.log('id',this.adList[num])
this.loadAdvertise(this.adList[num]); // this.loadAdvertise(this.adList[num]);
this.loadAdvertise('d4ltbnxa23zp2hhqwe');
}, },
methods: { methods: {
@ -128,16 +130,23 @@ export default {
console.log('激励视频广告'+adId+'加载成功') console.log('激励视频广告'+adId+'加载成功')
}) })
videoAd.onError((err) => { videoAd.onError((err) => {
if(err.errCode == 1004){
uni.showToast({
icon: 'none',
title: '请稍后再试~'
})
}
that.err() that.err()
}) })
videoAd.closeHandler = (res) =>{ videoAd.closeHandler = (res) =>{
console.log('激励视频领取画意值管理res',res)
if (res && res.isEnded || res === undefined) { if (res && res.isEnded || res === undefined) {
// //
that.isplayOver = true; //that.isplayOver = true;
//console.log('广',that.isplayOver) //console.log('广',that.isplayOver)
that.watchAdGetGold(); that.watchAdGetGold();
}else{ }else{
that.isplayOver = false; //that.isplayOver = false;
uni.showToast({ uni.showToast({
title: '您还没有看完视频,无法下载图片', title: '您还没有看完视频,无法下载图片',
icon: 'none' icon: 'none'
@ -164,9 +173,9 @@ export default {
title: '画意值领取失败', title: '画意值领取失败',
content: '请稍后重试', content: '请稍后重试',
showCancel: false, showCancel: false,
complete: function() { // complete: function() {
this.isplayOver = false; // this.isplayOver = false;
} // }
}) })
}) })
}) })
@ -204,7 +213,7 @@ export default {
appType: 0 appType: 0
} }
const res = await watchAdGetGold(data); const res = await watchAdGetGold(data);
console.log('观看广告结果===', res); //console.log('广===', res);
if (res.data.code === 200) { if (res.data.code === 200) {
return uni.showToast({ return uni.showToast({
title: "画意值领取成功!", title: "画意值领取成功!",

11
pages/userInfo/goldNum/goldNumLog.vue

@ -77,11 +77,12 @@ export default {
this.loadStatus = 'more'; this.loadStatus = 'more';
that.isLoadMore = false that.isLoadMore = false
} }
}else { }
uni.showModal({ else {
content: '网络错误,请稍后再试~', // uni.showModal({
showCancel: false // content: '~',
}); // showCancel: false
// });
that.isLoadMore = false that.isLoadMore = false
if(that.page > 1){ if(that.page > 1){
that.page -= 1 that.page -= 1

23
pages/userInfo/userInfo.vue

@ -152,28 +152,29 @@ import UniIcons from "../../uni_modules/uni-icons/components/uni-icons/uni-icons
}else{ }else{
that.isVip = false; that.isVip = false;
} }
}else {
uni.showModal({
content: '网络错误,请稍后再试~',
showCancel: false
});
} }
// else {
// uni.showModal({
// content: '~',
// showCancel: false
// });
// }
}, },
// //
async queryGoldNum(){ async queryGoldNum(){
let that = this; let that = this;
const res = await queryGoldNum(that.userInfo.id); const res = await queryGoldNum(that.userInfo.id);
console.log('goldRes===', res);
if (res.data.code === 200) { if (res.data.code === 200) {
that.goldNum = res.data.data; that.goldNum = res.data.data;
console.log(that.goldNum); console.log(that.goldNum);
}else {
uni.showModal({
content: '网络错误,请稍后再试~',
showCancel: false
});
} }
// else {
// uni.showModal({
// content: '~',
// showCancel: false
// });
// }
}, },
async loginFunc(res, userInfo) { async loginFunc(res, userInfo) {

11
pages/userInfo/vip/vip.vue

@ -160,12 +160,13 @@
console.log('res===', res); console.log('res===', res);
if (res.data.code === 200) { if (res.data.code === 200) {
that.vipInfo = res.data.data that.vipInfo = res.data.data
}else {
uni.showModal({
content: '网络错误,请稍后再试~',
showCancel: false
});
} }
// else {
// uni.showModal({
// content: '~',
// showCancel: false
// });
// }
}, },
async getVipList() { async getVipList() {

17
utils/request.js

@ -148,14 +148,14 @@ service.interceptors.request.use(
service.interceptors.response.use(res => { service.interceptors.response.use(res => {
//未授权 //未授权
if(res.data.code === 401){ if(res.data.code === 401){
//清理缓存,解决一进入页面未登录但有头像的情况
uni.clearStorage();
uni.clearStorageSync();
uni.showModal({ uni.showModal({
title:'提示', title:'提示',
content:'您还没有登录!点击确定跳转登录界面以体验服务', content:'您还没有登录!点击确定跳转登录界面以体验服务',
success(res) { success(res) {
if (res.confirm) { if (res.confirm) {
//清理缓存,解决一进入页面未登录但有头像的情况
uni.clearStorage();
uni.clearStorageSync();
//跳转登录界面 //跳转登录界面
uni.switchTab({ uni.switchTab({
url: '/pages/userInfo/userInfo' url: '/pages/userInfo/userInfo'
@ -168,10 +168,21 @@ service.interceptors.response.use(res => {
} }
} }
}); });
}else if(res.data.code != 200){
//拦截响应,做统一处理
uni.showToast({
title: '网络错误,请稍后再试~',
icon:"none",
duration: 2000,
success() {
console.log('接口请求错误',res.data.msg)
}
})
}else{ }else{
return res; return res;
} }
}, error => { }, error => {
console.log('触发了401error')
if(error.response.status === 401){ if(error.response.status === 401){
refreshToken() //刷新token并重置token refreshToken() //刷新token并重置token
} else { } else {

Loading…
Cancel
Save