|
|
|
@ -8,7 +8,7 @@ |
|
|
|
<uni-icons v-if="detailMsg.isHot ==='0'" class="tool-bar-icon" custom-prefix="iconfont" :type="'icon-hot'" size="24" ></uni-icons> |
|
|
|
<uni-icons v-else class="tool-bar-icon" custom-prefix="iconfont" :type="'icon-hot'" size="24" :color="likeColor"></uni-icons> |
|
|
|
</view> |
|
|
|
<view class="toolbar-box" @click="$noMultipleClicks(download,detailMsg.imgUrl)"> |
|
|
|
<view class="toolbar-box" @click="$noMultipleClicks(authDownload,detailMsg.imgUrl)"> |
|
|
|
<uni-icons v-if="isDownload" class="tool-bar-icon" custom-prefix="iconfont" :type="'icon-xiazai'" size="24" ></uni-icons> |
|
|
|
<uni-icons v-else class="tool-bar-icon" custom-prefix="iconfont" :type="'icon-xiazai'" size="24" ></uni-icons> |
|
|
|
<text>下载</text> |
|
|
|
@ -58,27 +58,27 @@ |
|
|
|
isCollect: false, // 是否收藏, |
|
|
|
scanCode: undefined, //艺术家搜索码 |
|
|
|
noClick:true, //防止重复提交 |
|
|
|
artist: {}, |
|
|
|
artist: {}, |
|
|
|
canDownload: false, //能否下载 false为能下载 |
|
|
|
whiteColor: '#FFFFFF', |
|
|
|
primaryColor: '#1a94bc', |
|
|
|
likeColor: '#ef223c', |
|
|
|
collectColor: '#dcaa04', |
|
|
|
urlParamId: undefined, |
|
|
|
whiteColor: '#FFFFFF', |
|
|
|
primaryColor: '#1a94bc', |
|
|
|
likeColor: '#ef223c', |
|
|
|
collectColor: '#dcaa04', |
|
|
|
urlParamId: undefined, |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(option){ |
|
|
|
if (option?.id) { |
|
|
|
this.urlParamId = option.id; |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(option){ |
|
|
|
if (option?.id) { |
|
|
|
this.urlParamId = option.id; |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
const detailId = uni.getStorageSync('detailId') |
|
|
|
if (detailId) { |
|
|
|
this.getImgDetail(detailId) |
|
|
|
} else { |
|
|
|
//可能是路径参数 |
|
|
|
this.urlParamId && this.getImgDetail(this.urlParamId); |
|
|
|
this.urlParamId && this.getImgDetail(this.urlParamId); |
|
|
|
} |
|
|
|
}, |
|
|
|
onShareAppMessage(res) { |
|
|
|
@ -86,14 +86,16 @@ |
|
|
|
if (res.from === 'button') { // 来自页面内分享按钮 |
|
|
|
console.log(res) |
|
|
|
} |
|
|
|
uni.showToast({ |
|
|
|
title: '分享成功', |
|
|
|
icon: 'none', |
|
|
|
}) |
|
|
|
return { |
|
|
|
title: '来看看艺术家[' + that.scanCode + ']精心准备的图片吧~', |
|
|
|
path: `/pages/creator/imgDetail?id=${that.detailMsg.id}`, |
|
|
|
bgImgUrl: `${that.detailMsg.imgUrl}` |
|
|
|
bgImgUrl: `${that.detailMsg.imgUrl}`, |
|
|
|
success() { |
|
|
|
uni.showToast({ |
|
|
|
title: '分享成功', |
|
|
|
icon: 'none', |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
@ -102,11 +104,11 @@ |
|
|
|
const res = await detailsTiktokImg(id) |
|
|
|
if (res.data.code === 200) { |
|
|
|
if (!res.data?.data){ |
|
|
|
uni.showToast({ |
|
|
|
title: '获取图片信息失败', |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
} |
|
|
|
uni.showToast({ |
|
|
|
title: '获取图片信息失败', |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
} |
|
|
|
this.detailMsg = res.data.data |
|
|
|
const result = await queryCreatorScanCodeById(this.detailMsg.creatorId) |
|
|
|
if (result.data.code === 200) { |
|
|
|
@ -140,7 +142,7 @@ |
|
|
|
imgId: this.detailMsg.id, |
|
|
|
userId: this.userInfo.id |
|
|
|
} |
|
|
|
const res = await judgeTiktokLike(params, token) |
|
|
|
const res = await judgeTiktokLike(params,token) |
|
|
|
if (res.data.code === 200) { |
|
|
|
this.isLike = res.data.data |
|
|
|
} else { |
|
|
|
@ -156,7 +158,7 @@ |
|
|
|
imgId: this.detailMsg.id, |
|
|
|
userId: this.userInfo.id |
|
|
|
} |
|
|
|
const res = await judgeTiktokCollect(params, token) |
|
|
|
const res = await judgeTiktokCollect(params,token) |
|
|
|
if (res.data.code === 200) { |
|
|
|
this.isCollect = res.data.data |
|
|
|
} else { |
|
|
|
@ -166,37 +168,38 @@ |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
async lickRequest(token) { |
|
|
|
const params = { |
|
|
|
imgId: this.detailMsg.id, |
|
|
|
userId: this.userInfo.id |
|
|
|
} |
|
|
|
let isLike = this.isLike |
|
|
|
if (!isLike) { |
|
|
|
//点赞 |
|
|
|
const res = await tiktokLike(params, token) |
|
|
|
if (res.data.code === 200) { |
|
|
|
this.isLike = !isLike |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
title: res.data.msg, |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
} |
|
|
|
} else { |
|
|
|
//取消点赞 |
|
|
|
const res = await tiktokUnLike(params, token) |
|
|
|
if (res.data.code === 200) { |
|
|
|
this.isLike = !isLike |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
title: res.data.msg, |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
async collectRequest(token) { |
|
|
|
|
|
|
|
async lickRequest() { |
|
|
|
const params = { |
|
|
|
imgId: this.detailMsg.id, |
|
|
|
userId: this.userInfo.id |
|
|
|
} |
|
|
|
let isLike = this.isLike |
|
|
|
if (!isLike) { |
|
|
|
//点赞 |
|
|
|
const res = await tiktokLike(params) |
|
|
|
if (res.data.code === 200) { |
|
|
|
this.isLike = !isLike |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
title: res.data.msg, |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
} |
|
|
|
} else { |
|
|
|
//取消点赞 |
|
|
|
const res = await tiktokUnLike(params) |
|
|
|
if (res.data.code === 200) { |
|
|
|
this.isLike = !isLike |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
title: res.data.msg, |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
async collectRequest() { |
|
|
|
const params = { |
|
|
|
imgId: this.detailMsg.id, |
|
|
|
userId: this.userInfo.id |
|
|
|
@ -204,7 +207,7 @@ |
|
|
|
let isCollect = this.isCollect |
|
|
|
if (!isCollect) { |
|
|
|
//收藏 |
|
|
|
const res = await tiktokCollect(params, token) |
|
|
|
const res = await tiktokCollect(params) |
|
|
|
if (res.data.code === 200) { |
|
|
|
this.isCollect = !isCollect |
|
|
|
} else { |
|
|
|
@ -215,7 +218,7 @@ |
|
|
|
} |
|
|
|
} else { |
|
|
|
//取消收藏 |
|
|
|
const res = await tiktokUnCollect(params, token) |
|
|
|
const res = await tiktokUnCollect(params) |
|
|
|
if (res.data.code === 200) { |
|
|
|
this.isCollect = !isCollect |
|
|
|
} else { |
|
|
|
@ -226,18 +229,19 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
async lickOrCollect(val, token) { |
|
|
|
async lickOrCollect(val) { |
|
|
|
if (val === 'isLike') { |
|
|
|
await this.lickRequest(token); |
|
|
|
await this.lickRequest(); |
|
|
|
} else if (val === 'isCollect') { |
|
|
|
await this.collectRequest(token); |
|
|
|
await this.collectRequest(); |
|
|
|
} |
|
|
|
}, |
|
|
|
// 点赞/收藏 |
|
|
|
likeCollect(val) { |
|
|
|
if (!this.userInfo) { |
|
|
|
this.getUserInfoLogin((token) => { |
|
|
|
this.lickOrCollect(val, token) |
|
|
|
this.getUserInfoLogin(res => { |
|
|
|
succ |
|
|
|
this.lickOrCollect(val) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.lickOrCollect(val) |
|
|
|
@ -257,17 +261,18 @@ |
|
|
|
data: res.data.data.userInfo, |
|
|
|
}) |
|
|
|
this.userInfo = res.data.data.userInfo; |
|
|
|
console.log('this.userInfo',this.userInfo) |
|
|
|
uni.setStorage({ |
|
|
|
key: 'token', |
|
|
|
data: res.data.data.access_token |
|
|
|
}) |
|
|
|
let headers = { |
|
|
|
TiktokAuthorization: res.data.data.access_token |
|
|
|
} |
|
|
|
this.checkUserDownload(headers) |
|
|
|
callBack && callBack(headers) |
|
|
|
this.searchIsLike(headers) |
|
|
|
this.searchisCollect(headers) |
|
|
|
let headers = { |
|
|
|
TiktokAuthorization: res.data.data.access_token |
|
|
|
} |
|
|
|
this.checkUserDownload(headers) |
|
|
|
callBack && callBack(headers) |
|
|
|
this.searchIsLike(headers) |
|
|
|
this.searchisCollect(headers) |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
title: res.data.msg, |
|
|
|
@ -289,20 +294,8 @@ |
|
|
|
success: async (userInfo) => { |
|
|
|
await this.loginFunc(res, userInfo, callBack) |
|
|
|
}, |
|
|
|
complete: () => { |
|
|
|
|
|
|
|
}, |
|
|
|
fail: (errMsg) => { |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
complete: () => { |
|
|
|
|
|
|
|
}, |
|
|
|
fail: (errMsg) => { |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
uni.showModal({ |
|
|
|
@ -321,26 +314,11 @@ |
|
|
|
success: async (userInfo) => { |
|
|
|
await this.loginFunc(res, userInfo, callBack) |
|
|
|
}, |
|
|
|
complete: () => { |
|
|
|
|
|
|
|
}, |
|
|
|
fail: (errMsg) => { |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
complete: () => { |
|
|
|
|
|
|
|
}, |
|
|
|
fail: (errMsg) => { |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
fail: () => { |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
} else if (res.cancel) { |
|
|
|
console.log('用户点击取消'); |
|
|
|
@ -352,7 +330,7 @@ |
|
|
|
}) |
|
|
|
}, |
|
|
|
//写入图片广告收益 |
|
|
|
async insertPreAdProfit(token) { |
|
|
|
async insertPreAdProfit() { |
|
|
|
let that = this; |
|
|
|
const params = { |
|
|
|
imgId: that.detailMsg.id, |
|
|
|
@ -362,7 +340,7 @@ |
|
|
|
appType: '0', |
|
|
|
platform: '0' |
|
|
|
} |
|
|
|
const res = await insertOrUpdatePreAdProfit(params, token); |
|
|
|
const res = await insertOrUpdatePreAdProfit(params); |
|
|
|
if (res.data.code === 200) { |
|
|
|
console.log("写入广告收益成功!") |
|
|
|
that.adResult = res.data.code; |
|
|
|
@ -375,7 +353,7 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
//写入图片邀请收益 |
|
|
|
async insertPreInviteProfit(token) { |
|
|
|
async insertPreInviteProfit() { |
|
|
|
let that = this; |
|
|
|
const params = { |
|
|
|
imgId: that.detailMsg.id, |
|
|
|
@ -384,7 +362,7 @@ |
|
|
|
appType: '0', |
|
|
|
platform: '0' |
|
|
|
} |
|
|
|
const res = await insertOrUpdatePreInviteProfit(params, token) |
|
|
|
const res = await insertOrUpdatePreInviteProfit(params) |
|
|
|
if (res.data.code === 200) { |
|
|
|
// console.log("写入邀请收益成功"); |
|
|
|
that.inviteResult = res.data.code; |
|
|
|
@ -403,7 +381,7 @@ |
|
|
|
appType: '0', |
|
|
|
platform: '0' |
|
|
|
} |
|
|
|
const res = await checkUserCanDownload(params, token); |
|
|
|
const res = await checkUserCanDownload(params,token); |
|
|
|
if (res.data.code === 200) { |
|
|
|
console.log("当日下载结果为", res.data.data) |
|
|
|
this.canDownload = res.data.data; |
|
|
|
@ -416,15 +394,15 @@ |
|
|
|
}, |
|
|
|
authDownload(url) { |
|
|
|
if (!this.userInfo) { |
|
|
|
this.getUserInfoLogin((token) => { |
|
|
|
this.download(url, token) |
|
|
|
this.getUserInfoLogin(() => { |
|
|
|
this.download(url) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.download(url) |
|
|
|
} |
|
|
|
}, |
|
|
|
// 下载 |
|
|
|
download(url, token) { |
|
|
|
download(url) { |
|
|
|
let that = this; |
|
|
|
if (that.canDownload !== true) { |
|
|
|
//满足可下载条件 |
|
|
|
@ -471,8 +449,9 @@ |
|
|
|
title: "下载成功!", |
|
|
|
icon: 'none', |
|
|
|
success() { |
|
|
|
that.insertPreAdProfit(token); |
|
|
|
that.insertPreInviteProfit(token); |
|
|
|
//下载成功写入下载收益、邀请收益 |
|
|
|
that.insertPreAdProfit(); |
|
|
|
that.insertPreInviteProfit(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|