Browse Source

feature:优化sd

feature-1.0
Penny 3 years ago
parent
commit
725e0a574a
  1. 2
      main.js
  2. 63
      pages/ai/paint/paint.vue
  3. 195
      pages/ai/paint/paintDetail.vue
  4. 6
      pages/atlas/hotSearch.vue
  5. 3
      pages/userInfo/aiPaint/aiPaint.vue
  6. 8
      pages/userInfo/userInfo.vue

2
main.js

@ -6,7 +6,7 @@ import common from './utils/common.js'
// const baseURL = 'http://localhost:7010' // const baseURL = 'http://localhost:7010'
// const baseURL = 'http://81.69.47.31:7010' // const baseURL = 'http://81.69.47.31:7010'
const baseURL = 'https://service.bnyer.cn' const baseURL = 'https://service.bnyer.cn'
//const baseURL = 'http://dbb5xc.natappfree.cc' //const baseURL = 'http://vaqc3e.natappfree.cc'
Vue.prototype.baseURL = baseURL; Vue.prototype.baseURL = baseURL;
Vue.prototype.$noMultipleClicks = common.noMultipleClicks; Vue.prototype.$noMultipleClicks = common.noMultipleClicks;

63
pages/ai/paint/paint.vue

@ -101,7 +101,7 @@
checkPrompt: undefined, //true;false checkPrompt: undefined, //true;false
checkStyleBox: undefined, //true;false checkStyleBox: undefined, //true;false
checkSize: undefined, //true;false checkSize: undefined, //true;false
checkCanPaint: false, //true;false //checkCanPaint: false, //true;false
}, },
userInfo: {}, userInfo: {},
noClick:true, // noClick:true, //
@ -151,7 +151,7 @@
this.style_active = 0; this.style_active = 0;
this.prompt_active = 0; this.prompt_active = 0;
this.checkLogin(); this.checkLogin();
this.checkUserCanAiPaint(); //this.checkUserCanAiPaint();
}, },
methods: { methods: {
@ -188,13 +188,14 @@
startPaint(){ startPaint(){
const that = this; const that = this;
//console.log('that.checkData.checkCanPaint',that.checkData.checkCanPaint) //console.log('that.checkData.checkCanPaint',that.checkData.checkCanPaint)
//ai //ai TODO
if(that.checkData.checkCanPaint === true){ // if(that.checkData.checkCanPaint === true){
return uni.showToast({ // return uni.showToast({
title: '当日绘画次数已用完,请明日再来!', // title: ',!',
icon: 'none' // icon: 'none'
}) // })
} // }
// //
//console.log('prompt',that.formData.promptText) //console.log('prompt',that.formData.promptText)
// console.log('',that.formData.height) // console.log('',that.formData.height)
@ -325,28 +326,28 @@
}, },
//AI //AI
async checkUserCanAiPaint(){ // async checkUserCanAiPaint(){
let that = this; // let that = this;
const data = { // const data = {
userId: that.userInfo.id, // userId: that.userInfo.id,
platform: 0, // platform: 0,
appType: 0 // appType: 0
} // }
const res = await checkUserCanAiPaint(data); // const res = await checkUserCanAiPaint(data);
//console.log('res',res) // //console.log('res',res)
if(res.data.code === 200){ // if(res.data.code === 200){
if(res.data.data === true){ // if(res.data.data === true){
that.checkData.checkCanPaint = true; // that.checkData.checkCanPaint = true;
}else{ // }else{
that.checkData.checkCanPaint = false; // that.checkData.checkCanPaint = false;
} // }
}else{ // }else{
return uni.showModal({ // return uni.showModal({
content: '检查绘画上限失败!', // content: '',
showCancel: false // showCancel: false
}); // });
} // }
}, // },
// //
async getPaintStyleList() { async getPaintStyleList() {

195
pages/ai/paint/paintDetail.vue

@ -260,104 +260,109 @@
let that = this; let that = this;
//console.log('',that.transImg) //console.log('',that.transImg)
uni.showLoading({ uni.showLoading({
title: '正在保存图片...' title: '正在保存图片...',
}); success() {
// //
uni.getSetting({ uni.getSetting({
success: (res) => { success: (res) => {
// //
if (!res.authSetting["scope.album"]) { if (!res.authSetting["scope.album"]) {
// //
uni.authorize({ uni.authorize({
scope: "scope.album", scope: "scope.album",
success: () => { success: () => {
uni.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
// //
filePath: url, filePath: url,
success: (res) => { success: (res) => {
}, },
fail: (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() {
}
});
}
},
});
},
//
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 {
//
uni.saveImageToPhotosAlbum({
filePath: url,
success: (res) => {
console.log('有权限下载图片结果为',res)
console.log('333333')
},
fail: (res) => {
return uni.showToast({
title: res.errMsg,
icon: 'none'
});
},
//
complete: (res) => {
uni.hideLoading();
if (res.errMsg !== "saveImageToPhotosAlbum:ok") {
return uni.showToast({ return uni.showToast({
title: res.errMsg, title: "下载失败!",
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() {
}
});
}
},
});
},
//
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' icon: 'none'
}); });
} }else{
}, return uni.showToast({
}); title: "保存成功!",
}, duration: 2000,
}); icon: 'none'
} else { });
// }
uni.saveImageToPhotosAlbum({ },
filePath: url, });
success: (res) => { }
console.log('有权限下载图片结果为',res) },
uni.hideLoading(); fail: (res) => {},
console.log('333333') });
if(res.errMsg === "saveImageToPhotosAlbum:ok"){ }
console.log('44444')
return uni.showToast({
title: "保存成功!",
duration: 2000,
icon: 'none'
});
}
},
fail: (res) => {
uni.hideLoading();
return uni.showToast({
title: res.errMsg,
icon: 'none'
});
},
//
complete: (res) => {
uni.hideLoading();
},
});
}
},
fail: (res) => {},
}); });
}, },

6
pages/atlas/hotSearch.vue

@ -77,7 +77,7 @@
content: '抱歉没有找到想要的图片。不如试试意境绘画!', content: '抱歉没有找到想要的图片。不如试试意境绘画!',
success(res){ success(res){
if(res.confirm){ if(res.confirm){
uni.navigateTo({ uni.switchTab({
url: '../ai/paint/paint' url: '../ai/paint/paint'
}) })
} }
@ -164,10 +164,10 @@
}else{ }else{
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '抱歉没有找到想要的图片。不如试试意境绘画!', content: '这是一个模态弹窗!',
success(res){ success(res){
if(res.confirm){ if(res.confirm){
uni.navigateTo({ uni.switchTab({
url: '../ai/paint/paint' url: '../ai/paint/paint'
}) })
} }

3
pages/userInfo/aiPaint/aiPaint.vue

@ -5,9 +5,6 @@
<view> <view>
<uni-load-more :status="loadStatus"></uni-load-more> <uni-load-more :status="loadStatus"></uni-load-more>
</view> </view>
<!-- <view class="ad-view">
<ad adpid="__UNI__069D14D" type="banner" @load="onload" @close="onclose" @error="onerror"></ad>
</view> -->
</view> </view>
</template> </template>

8
pages/userInfo/userInfo.vue

@ -20,12 +20,12 @@
<uni-icons custom-prefix="iconfont" type="icon-wodeshoucang"size="40" :color="primaryColor" /> <uni-icons custom-prefix="iconfont" type="icon-wodeshoucang"size="40" :color="primaryColor" />
</view> </view>
</view> </view>
<view class="prominent-menu-item collect-menu" @click="toLinkAuth('/pages/userInfo/aiPaint/aiPaint')"> <!-- <view class="prominent-menu-item collect-menu" @click="toLinkAuth('/pages/userInfo/aiPaint/aiPaint')">
<view class="prominent-menu-title">创作工坊</view> <view class="prominent-menu-title">创作工坊</view>
<view class="prominent-menu-icon"> <view class="prominent-menu-icon">
<uni-icons custom-prefix="iconfont" type="icon-wodeshoucang"size="40" :color="primaryColor" /> <uni-icons custom-prefix="iconfont" type="icon-wodeshoucang"size="40" :color="primaryColor" />
</view> </view>
</view> </view> -->
</view> </view>
<view class="list-menu"> <view class="list-menu">
<view class="list-menu-item" v-for="item in menus" @click="toLink(item.url)"> <view class="list-menu-item" v-for="item in menus" @click="toLink(item.url)">
@ -295,8 +295,8 @@ import UniIcons from "../../uni_modules/uni-icons/components/uni-icons/uni-icons
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
//width //width
width: calc(50% - 10rpx); //width: calc(50% - 10rpx);
//width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 10rpx; border-radius: 10rpx;
background-image: linear-gradient(-225deg, #E3FDF5 0%, #FFE6FA 100%); background-image: linear-gradient(-225deg, #E3FDF5 0%, #FFE6FA 100%);

Loading…
Cancel
Save