Browse Source

feature-tiktok-1.0:fix bug

feature-1.0
chengkun 4 years ago
parent
commit
14f3f44568
  1. 9
      api/creator.js
  2. 2
      pages/creator/creator.vue
  3. 66
      pages/creator/imgDetail.vue

9
api/creator.js

@ -110,3 +110,12 @@ export function insertOrUpdatePreInviteProfit(data) {
data data
}) })
} }
// 检查某平台用户当日下载次数是否超标
export function checkUserCanDownload(data) {
return request({
url: `${serviceTitle}/img/mini/tiktok/checkUserCanDownload`,
method: 'post',
data
})
}

2
pages/creator/creator.vue

@ -66,7 +66,7 @@
duration: 1000, duration: 1000,
indicatorDots: true, indicatorDots: true,
pageNum: 1, pageNum: 1,
pageSize: 2, pageSize: 10,
creatorInfo: {} creatorInfo: {}
} }
}, },

66
pages/creator/imgDetail.vue

@ -42,7 +42,8 @@
tiktokUnCollect, // tiktokUnCollect, //
queryCreatorScanCodeById, // queryCreatorScanCodeById, //
insertOrUpdatePreAdProfit, ///广 insertOrUpdatePreAdProfit, ///广
insertOrUpdatePreInviteProfit // / insertOrUpdatePreInviteProfit, // /
checkUserCanDownload //
} from '@/api/creator.js' } from '@/api/creator.js'
export default { export default {
data() { data() {
@ -53,6 +54,7 @@
isLike: false, // / isLike: false, // /
isCollect: false, // , isCollect: false, // ,
scanCode: undefined, // scanCode: undefined, //
canDownload: false // false
} }
}, },
@ -102,6 +104,7 @@
console.log('userInfo', this.userInfo) console.log('userInfo', this.userInfo)
this.searchIsLike() this.searchIsLike()
this.searchisCollect() this.searchisCollect()
this.checkUserDownload()
} }
}) })
} else { } else {
@ -207,6 +210,7 @@
imgId: this.detailMsg.id, imgId: this.detailMsg.id,
creatorId: this.detailMsg.creatorId, creatorId: this.detailMsg.creatorId,
scanCode: this.scanCode, scanCode: this.scanCode,
userId: this.userInfo.id,
appType: '0', appType: '0',
platform: '0' platform: '0'
} }
@ -243,19 +247,36 @@
} }
}, },
//
async checkUserDownload() {
const params = {
userId: this.userInfo.id,
appType: '0',
platform: '0'
}
const res = await checkUserCanDownload(params);
if (res.data.code === 200) {
console.log("当日下载结果为", res.data.data)
this.canDownload = res.data.data;
} else {
uni.showToast({
title: '检查下载状态失败!',
icon: 'none'
})
}
},
// //
download(url) { download(url) {
let that = this;
if (this.canDownload != true) {
//
this.isDownload = true this.isDownload = true
uni.showLoading({ uni.showLoading({
title: '正在保存图片...' title: '正在保存图片...'
}); });
this.insertPreAdProfit();
this.insertPreInviteProfit();
console.log('广告响应结果',this.adResult);
console.log('邀请响应',this.inviteResult)
// if(aResult === 200 && iResult === 200){
// }
// //
uni.getSetting({ uni.getSetting({
success: (res) => { success: (res) => {
@ -273,7 +294,8 @@
if (res.statusCode === 200) { if (res.statusCode === 200) {
uni.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
// //
filePath: res.tempFilePath, filePath: res
.tempFilePath,
success: (res) => { success: (res) => {
console.log( console.log(
'success', 'success',
@ -281,7 +303,8 @@
}, },
fail: (res) => { fail: (res) => {
console.log('fail', console.log(
'fail',
res) res)
return uni return uni
.showToast({ .showToast({
@ -291,8 +314,10 @@
}); });
}, },
complete: (res) => { complete: (res) => {
uni.hideLoading(); uni
if (res.errMsg !== .hideLoading();
if (res
.errMsg !==
"saveImageToPhotosAlbum:ok" "saveImageToPhotosAlbum:ok"
) { ) {
return uni return uni
@ -304,7 +329,11 @@
return uni return uni
.showToast({ .showToast({
title: "下载成功!", title: "下载成功!",
icon: 'none' icon: 'none',
success() {
that.insertPreAdProfit();
that.insertPreInviteProfit();
}
}); });
} }
}, },
@ -375,6 +404,14 @@
}, },
fail: (res) => {}, fail: (res) => {},
}); });
} else {
// canDownloadtrue
uni.showToast({
title: '当日下载次数已用完,请明日再来!',
icon: 'none'
})
}
}, },
// //
share() { share() {
@ -407,6 +444,7 @@
right: 10px; right: 10px;
border-radius: 60px; border-radius: 60px;
padding-top: 40rpx; padding-top: 40rpx;
.share-box { .share-box {
>button { >button {
@ -417,10 +455,12 @@
border: none; border: none;
} }
>button::after { >button::after {
border: none; border: none;
} }
} }
.toolbar-box { .toolbar-box {
height: 60px; height: 60px;
text-align: center; text-align: center;

Loading…
Cancel
Save