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
//console.log('this.paintStyle',this.paintStyle)
}else {
uni.showModal({
content: '网络错误,请稍后再试~',
showCancel: false
});
}
// else {
// uni.showModal({
// content: '~',
// showCancel: false
// });
// }
},
//
async getPaintStyleList() {

13
pages/ai/paint/paint.vue

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

52
pages/creator/imgDetail.vue

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

35
pages/userInfo/goldNum/goldNum.vue

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

11
pages/userInfo/goldNum/goldNumLog.vue

@ -77,11 +77,12 @@ export default {
this.loadStatus = 'more';
that.isLoadMore = false
}
}else {
uni.showModal({
content: '网络错误,请稍后再试~',
showCancel: false
});
}
else {
// uni.showModal({
// content: '~',
// showCancel: false
// });
that.isLoadMore = false
if(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{
that.isVip = false;
}
}else {
uni.showModal({
content: '网络错误,请稍后再试~',
showCancel: false
});
}
// else {
// uni.showModal({
// content: '~',
// showCancel: false
// });
// }
},
//
async queryGoldNum(){
let that = this;
const res = await queryGoldNum(that.userInfo.id);
console.log('goldRes===', res);
if (res.data.code === 200) {
that.goldNum = res.data.data;
console.log(that.goldNum);
}else {
uni.showModal({
content: '网络错误,请稍后再试~',
showCancel: false
});
}
// else {
// uni.showModal({
// content: '~',
// showCancel: false
// });
// }
},
async loginFunc(res, userInfo) {

11
pages/userInfo/vip/vip.vue

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

17
utils/request.js

@ -148,14 +148,14 @@ service.interceptors.request.use(
service.interceptors.response.use(res => {
//未授权
if(res.data.code === 401){
//清理缓存,解决一进入页面未登录但有头像的情况
uni.clearStorage();
uni.clearStorageSync();
uni.showModal({
title:'提示',
content:'您还没有登录!点击确定跳转登录界面以体验服务',
success(res) {
if (res.confirm) {
//清理缓存,解决一进入页面未登录但有头像的情况
uni.clearStorage();
uni.clearStorageSync();
//跳转登录界面
uni.switchTab({
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{
return res;
}
}, error => {
console.log('触发了401error')
if(error.response.status === 401){
refreshToken() //刷新token并重置token
} else {

Loading…
Cancel
Save