Browse Source

hotfix:优化细节

feature-1.1-dev
Penny 3 years ago
parent
commit
d5b04f544a
  1. 2
      api/creator.js
  2. 9
      api/userInfo.js
  3. 8
      pages/ai/paint/loverPainResult.vue
  4. 2
      pages/ai/paint/paint.vue
  5. 349
      pages/creator/imgDetail.vue
  6. 2
      pages/index/indexProto.vue
  7. 2
      pages/userInfo/userInfo.vue

2
api/creator.js

@ -126,6 +126,6 @@ export function checkUserCanDownload(data, headers) {
url: `${serviceTitle}${prefix}/checkUserCanDownload`,
method: 'post',
data,
headers: headers
//headers: headers
})
}

9
api/userInfo.js

@ -40,3 +40,12 @@ export function unifiedOrder(data) {
data
})
}
//获取当日下载/绘画奖励剩余次数
export function getRestNum(data) {
return request({
url: `${serviceTitle}${prefix}/getRestNum`,
method: 'post',
data
})
}

8
pages/ai/paint/loverPainResult.vue

@ -212,7 +212,7 @@
width: 677rpx;
height: 245rpx;
// border: 1px solid black;
background-image: url('https://vediocnd.corpring.com/520love/520_title.png');
background-image: url('https://img.bnyer.cn/520_title.png');
background-size: 100% 100%;
// z-index: 10;
margin-bottom: -10px;
@ -221,7 +221,7 @@
// margin-top: -10px;
width: 100%;
height: 750rpx;
background-image: url('https://vediocnd.corpring.com/520love/love_bg_1.gif');
background-image: url('https://img.bnyer.cn/love_bg_1.gif');
background-size: 110% 110%;
background-position: center;
padding: 200rpx 30rpx;
@ -246,7 +246,7 @@
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-image: url('https://vediocnd.corpring.com/520love/heart_icon_1.png');
background-image: url('https://img.bnyer.cn/heart_icon_1.png');
background-size: 100% 100%;
}
.img-item {
@ -267,7 +267,7 @@
.save-button {
width: 250rpx;
height: 75rpx;
background-image: url('https://vediocnd.corpring.com/520love/save_button.png');
background-image: url('https://img.bnyer.cn/save_button.png');
background-size: 100% 100%;
}
}

2
pages/ai/paint/paint.vue

@ -73,7 +73,7 @@
<view>
<view class="head">
<view class="left">
<view class="title">高级设置<uni-icons class="tip-vip-icon" custom-prefix="iconfont" type="icon-tipvip" size="14" color="#f3a73f"/></view>
<view class="title">高级设置<uni-icons class="tip-vip-icon" custom-prefix="iconfont" type="icon-tipvip" size="26" color="#f3a73f"/></view>
</view>
<view class="right">
<switch :checked="advancedSetting" :color="primaryColor" style="transform:scale(0.7)" @change="openAdvancedSetting"/>

349
pages/creator/imgDetail.vue

@ -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="isShowDownLoadBox()">
<view class="toolbar-box" @click="$noMultipleClicks(clickDownload,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>
@ -30,15 +30,18 @@
</button>
</view>
</view>
<view v-if="!showDownLoad" class="downLoad-wrap">
<view class="ad_button" @click="$noMultipleClicks(authDownload,detailMsg.imgUrl)"></view>
<view v-if="showDownLoad" class="downLoad-wrap">
<view class="ad_button" @click="authDownload(detailMsg.imgUrl)"></view>
<view class="vip_button" @click="goOpenVip()"></view>
<view class="close_button" @click="isShowDownLoadBox()"></view>
<view class="restNum">今日剩余还可下载 {{canDownloadNum}}</view>
</view>
</view>
</template>
<script>
var videoAd = null;
import {
detailsTiktokImg, //
judgeTiktokLike, //
@ -53,6 +56,8 @@
checkUserCanDownload//
} from '@/api/creator.js'
import {loginTiktok} from '@/api/auth.js'
import {checkVip} from "@/api/paint";
import {getRestNum} from "@/api/userInfo.js";
export default {
data() {
return {
@ -73,21 +78,30 @@
urlParamId: undefined,
isplayOver: false,
downloadUrl: undefined,
isVip: false,
canDownloadNum: 0, //
canRewardNum: 0, //
userInfo:{},
adList:['0qfnoa4053uwkefbas','2v63zq5hvfclpxmurl','d4ltbnxa23zp2hhqwe'] //广
}
},
onLoad(option){
async onLoad(option){
await this.checkIsVip();
console.log('vip状态为',this.isVip);
if (option?.id) {
this.urlParamId = option.id;
}
//
if(this.isVip === false){
this.isplayOver = false;
//广
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]);
}
},
onShow() {
//this.achieveSaveImg();
this.userInfo = uni.getStorageSync('userInfo')
},
onHide() {
console.log('进入onHide')
@ -121,34 +135,123 @@
}
},
methods: {
//
async clickDownload(url){
let that = this;
if(that.isVip == 1) {
//广
that.vipSaveImg(url);
} else {
//获取可下载图片次数 await this.getRestNum("0");
//广广
that.isShowDownLoadBox();
}
},
//vip
async checkIsVip() {
let that = this;
const data = {
userId: that.userInfo.id,
userClientType: 10
}
const res = await checkVip(data);
console.log('res===', res);
if (res.data.code === 200) {
if(res.data.data.isVip == '1') {
that.isVip = true;
}else{
that.isVip = false;
}
}else {
uni.showModal({
content: '网络错误,请稍后再试~',
showCancel: false
});
}
},
///
async getRestNum(adType) {
const params = {
userId: this.userInfo.id,
appType: '0',
platform: '0' ,//0
adType: adType
}
const res = await getRestNum(params);
if (res.data.code === 200) {
console.log("当日非会员用户可下载/奖励结果为", res.data.data)
if(adType === '0'){
//
this.canDownloadNum = res.data.data
console.log('this.canDownloadNum',this.canDownloadNum)
}else{
//
this.canRewardNum = res.data.data
console.log('this.canRewardNum',this.canRewardNum)
}
} else {
uni.showToast({
title: '获取下载/绘画奖励剩余次数失败!',
icon: 'none'
})
}
},
//广
isShowDownLoadBox() {
console.log('11111111');
console.log('this.showDownLoad',this.showDownLoad);
this.showDownLoad = !this.showDownLoad
//
},
//VIP
goOpenVip() {
this.isShowDownLoadBox()
let that = this;
//iosios
uni.getSystemInfo({ success(res) { console.log(res.osName)
if(res.osName === 'ios'){
return uni.showToast({
title: 'ios暂不支持.如已开通请关联绑定会员卡',
duration: 2500,
icon: 'none',
success() {
that.isShowDownLoadBox();
}
})
}else{
that.isShowDownLoadBox()
uni.navigateTo({
url:'/pages/userInfo/vip/vip'
})
} } });
},
//广
loadAdvertise(adId){
// 广
let videoAd = null
var that = this
// onLoad广
if (tt.createRewardedVideoAd) {
videoAd = tt.createRewardedVideoAd({
adUnitId: adId
})
that.videoAd = videoAd
});
//BUG
try{
if (videoAd.closeHandler) {
videoAd.offClose(videoAd.closeHandler);
console.log("videoAd.offClose卸载成功");
}
}catch(e){
console.log("videoAd.offClose 卸载失败");
console.error(e);
}
videoAd.onLoad(() => {
//console.log('广'+adId+'')
console.log('激励视频广告'+adId+'加载成功')
})
videoAd.onError((err) => {
that.err()
})
videoAd.onClose((res) => {
videoAd.closeHandler = (res) =>{
if (res && res.isEnded || res === undefined) {
//
that.isplayOver = true;
@ -156,19 +259,22 @@
that.achieveSaveImg();
}else{
that.isplayOver = false;
//console.log('广',that.isplayOver)
uni.showToast({
title: '您还没有看完视频,无法下载图片',
icon: 'none'
})
}
})
}
videoAd.onClose(videoAd.closeHandler);
}
},
//广
showAdvertise(url){
let videoAd = this.videoAd
uni.hideLoading();
//
this.isShowDownLoadBox();
//let videoAd = this.videoAd
this.downloadUrl = url;
//console.log('广url',url);
//console.log('this.downloadUrl广',this.downloadUrl);
@ -216,7 +322,7 @@
this.userInfo = res.data
this.searchIsLike()
this.searchisCollect()
this.checkUserDownload()
//this.checkUserDownload()
}
})
} else {
@ -365,7 +471,7 @@
TiktokAuthorization: res.data.data.access_token,
platform: res.data.data.platform
}
this.checkUserDownload(headers)
//this.checkUserDownload(headers)
callBack && callBack(headers)
this.searchIsLike(headers)
this.searchisCollect(headers)
@ -434,7 +540,7 @@
scanCode: that.scanCode,
userId: that.userInfo.id,
appType: '0',
platform: '0'
platform: '0' //0
}
const res = await insertOrUpdatePreAdProfit(params);
if (res.data.code === 200) {
@ -456,7 +562,7 @@
creatorId: that.detailMsg.creatorId,
scanCode: that.scanCode,
appType: '0',
platform: '0'
platform: '0' //0
}
const res = await insertOrUpdatePreInviteProfit(params)
if (res.data.code === 200) {
@ -471,15 +577,16 @@
},
//
async checkUserDownload(token) {
async checkUserDownload(adType) {
const params = {
userId: this.userInfo.id,
appType: '0',
platform: '0'
platform: '0' ,//0
adType: adType
}
const res = await checkUserCanDownload(params,token);
const res = await checkUserCanDownload(params);
if (res.data.code === 200) {
console.log("当日下载结果为", res.data.data)
console.log("当日非会员用户是否可下载/奖励结果为", res.data.data)
this.canDownload = res.data.data;
} else {
uni.showToast({
@ -488,7 +595,10 @@
})
}
},
authDownload(url) {
async authDownload(url) {
// 0
await this.checkUserDownload("0");
if (!this.userInfo) {
this.getUserInfoLogin(() => {
this.download(url)
@ -498,10 +608,155 @@
}
},
//
vipSaveImg(imgUrl){
let that = this;
let url = imgUrl;
//console.log('',url)
that.isDownload = true;
uni.showLoading({
title: '正在保存图片...',
success() {
//
uni.getSetting({
success(res){
//console.log('res',res)
//
if (!res.authSetting["scope.album"]) {
//
uni.authorize({
scope: "scope.album",
success: () => {
//
uni.downloadFile({
url,
success: (res) => {
//console.log('res',res)
if (res.statusCode === 200) {
uni.saveImageToPhotosAlbum({
//
filePath: res.tempFilePath,
success: (res) => {
},
fail: (res) => {
return uni.showToast({
title: res.errMsg,
icon: 'none'
});
},
complete: (res) => {
uni.hideLoading();
if (res.errMsg !== "saveImageToPhotosAlbum:ok") {
return uni.showToast({
title: "下载失败!",
icon: 'none'
});
} else {
return uni
.showToast({
title: "下载成功!",
icon: 'none',
success() {
that.isDownload = false;
}
});
}
},
});
} else {
uni.showToast({
title: "下载失败!",
icon: 'none'
});
}
}
})
},
//
fail: () => {
uni.hideLoading();
uni.showModal({
title: "您已拒绝获取相册权限",
content: "是否进入权限管理,调整授权?",
success: (res) => {
if (res.confirm) {
//
uni.openSetting({
success: (res) => {
},
});
} else if (res.cancel) {
return uni.showToast({
title: "已取消!",
icon: 'none'
});
}
},
});
},
});
} else {
//
//console.log(',',url);
//
uni.downloadFile({
url,
success: (res) => {
//console.log('',res);
if (res.statusCode === 200) {
uni.saveImageToPhotosAlbum({
//
filePath: res.tempFilePath,
success: (res) => {
//console.log('',res);
},
fail: (res) => {
return uni.showToast({
title: res.errMsg,
icon: 'none'
});
},
complete: (res) => {
uni.hideLoading();
if (res.errMsg !== "saveImageToPhotosAlbum:ok") {
return uni.showToast({
title: "下载失败!",
icon: 'none'
});
} else {
return uni.showToast({
title: "下载成功!",
icon: 'none',
success() {
that.isDownload = false;
}
});
}
},
});
} else {
uni.showToast({
title: "下载失败!",
icon: 'none'
});
}
}
})
}
},
fail: (res) => {},
});
}
});
},
//广
achieveSaveImg(){
let that = this;
console.log('广告状态',that.isplayOver)
//console.log('广',that.isplayOver)
if(that.isplayOver){
//广
let url = that.downloadUrl;
@ -554,6 +809,8 @@
that.insertPreAdProfit();
that.insertPreInviteProfit();
that.isplayOver = false;
//
that.isDownload = false;
}
});
}
@ -629,6 +886,8 @@
that.insertPreAdProfit();
that.insertPreInviteProfit();
that.isplayOver = false;
//
that.isDownload = false;
}
});
}
@ -656,27 +915,26 @@
//
download(url) {
let that = this;
//console.log('that.canDownload',that.canDownload)
uni.showLoading({
title: '加载中'
});
// false
if (that.canDownload !== true) {
//
//
that.isDownload = true
//console.log('res123',123)
uni.showModal({
title: '提示',
content: '看一段广告解锁图片下载',
success: function (res) {
//console.log('res',res)
if(res.confirm){
//广
that.showAdvertise(url);
}
}
});
} else {
// canDownloadtrue
return uni.showToast({
title: '当日下载次数已用完,请明日再来!',
icon: 'none'
icon: 'none',
success() {
//
that.isShowDownLoadBox();
}
})
}
@ -701,7 +959,7 @@
transform: translate(-50%, -50%);
width: 80%;
height: 1000rpx;
background-image: url('https://vediocnd.corpring.com/AIDrawCYYJ/vip_box_bg1.png');
background-image: url('https://img.bnyer.cn/vip_box_bg1%20%281%29.png');
background-size: 100% 100%;
padding: 40rpx;
box-sizing: border-box;
@ -712,7 +970,7 @@
right: 20rpx;
width: 60rpx;
height: 60rpx;
background-image: url('https://vediocnd.corpring.com/AIDrawCYYJ/down_box_close.png');
background-image: url('https://img.bnyer.cn/down_box_close.png');
background-size: 100% 100%;
}
.vip_button {
@ -722,7 +980,7 @@
transform: translateX(-50%);
width: 310rpx;
height: 100rpx;
background-image: url('https://vediocnd.corpring.com/AIDrawCYYJ/down_box_vip.png');
background-image: url('https://img.bnyer.cn/down_box_vip.png');
background-size: 100% 100%;
}
.ad_button {
@ -732,9 +990,16 @@
// transform: translateX(-50%);
width: 190rpx;
height: 80rpx;
background-image: url('https://vediocnd.corpring.com/AIDrawCYYJ/ad_button1.png');
background-image: url('https://img.bnyer.cn/ad_button1.png');
background-size: 100% 100%;
}
.restNum{
position: absolute;
top: 430rpx;
color: red;
font-size: 30rpx;
}
}
.imgDetail {
height: 100vh;

2
pages/index/indexProto.vue

@ -260,7 +260,7 @@
.love-icon {
width: 140rpx;
height: 140rpx;
background-image: url('https://vediocnd.corpring.com/520love/520_icon.png');
background-image: url('https://img.bnyer.cn/520_icon.png');
background-size: 100% 100%;
position: fixed;
bottom: 40rpx;

2
pages/userInfo/userInfo.vue

@ -138,6 +138,8 @@ import UniIcons from "../../uni_modules/uni-icons/components/uni-icons/uni-icons
if (res.data.code === 200) {
if(res.data.data.isVip == '1') {
that.isVip = true;
}else{
that.isVip = false;
}
}else {
uni.showModal({

Loading…
Cancel
Save