diff --git a/main.js b/main.js index a1d0498..6c66fd1 100644 --- a/main.js +++ b/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; diff --git a/pages/ai/paint/paint.vue b/pages/ai/paint/paint.vue index a976d8f..95780a0 100644 --- a/pages/ai/paint/paint.vue +++ b/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() { diff --git a/pages/ai/paint/paintDetail.vue b/pages/ai/paint/paintDetail.vue index a2cff56..3b36fe5 100644 --- a/pages/ai/paint/paintDetail.vue +++ b/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) => {}, + }); + } }); }, diff --git a/pages/atlas/hotSearch.vue b/pages/atlas/hotSearch.vue index 325b9ef..26dbcbb 100644 --- a/pages/atlas/hotSearch.vue +++ b/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' }) } diff --git a/pages/userInfo/aiPaint/aiPaint.vue b/pages/userInfo/aiPaint/aiPaint.vue index 35a42f7..64e21c4 100644 --- a/pages/userInfo/aiPaint/aiPaint.vue +++ b/pages/userInfo/aiPaint/aiPaint.vue @@ -5,9 +5,6 @@ - diff --git a/pages/userInfo/userInfo.vue b/pages/userInfo/userInfo.vue index d9d0e67..1e1418f 100644 --- a/pages/userInfo/userInfo.vue +++ b/pages/userInfo/userInfo.vue @@ -20,12 +20,12 @@ - + @@ -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%);