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://81.69.47.31:7010'
const baseURL = 'https://service.bnyer.cn'
//const baseURL = 'http://dbb5xc.natappfree.cc'
//const baseURL = 'http://vaqc3e.natappfree.cc'
Vue.prototype.baseURL = baseURL;
Vue.prototype.$noMultipleClicks = common.noMultipleClicks;

63
pages/ai/paint/paint.vue

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

195
pages/ai/paint/paintDetail.vue

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

6
pages/atlas/hotSearch.vue

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

3
pages/userInfo/aiPaint/aiPaint.vue

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

8
pages/userInfo/userInfo.vue

@ -20,12 +20,12 @@
<uni-icons custom-prefix="iconfont" type="icon-wodeshoucang"size="40" :color="primaryColor" />
</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-icon">
<uni-icons custom-prefix="iconfont" type="icon-wodeshoucang"size="40" :color="primaryColor" />
</view>
</view>
</view> -->
</view>
<view class="list-menu">
<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;
justify-content: space-between;
//width
width: calc(50% - 10rpx);
//width: 100%;
//width: calc(50% - 10rpx);
width: 100%;
height: 100%;
border-radius: 10rpx;
background-image: linear-gradient(-225deg, #E3FDF5 0%, #FFE6FA 100%);

Loading…
Cancel
Save