Browse Source

hotfix:优化细节

feature-1.1-dev
Penny 3 years ago
parent
commit
94c18dbe7f
  1. 17
      api/paint.js
  2. 2
      pages/ai/paint/loverPaint.vue
  3. 81
      pages/ai/paint/paint.vue
  4. 4
      pages/userInfo/aiPaint/aiPaint.vue
  5. 1
      pages/userInfo/aiPaint/aiPaintDetail.vue
  6. 60
      pages/userInfo/userInfo.vue
  7. 45
      pages/userInfo/vip/vip.vue

17
api/paint.js

@ -80,4 +80,21 @@ export function checkVip(data) {
})
}
//获取用户画意值
export function queryGoldNum(userId) {
return request({
url: `${serviceTitle}${prefix}/queryGoldNum/${userId}`,
method: 'get'
})
}
//获取用户画意值记录
export function queryGoldLogPage(data) {
return request({
url: `${serviceTitle}${prefix}/queryGoldLogPage`,
method: 'post',
data
})
}

2
pages/ai/paint/loverPaint.vue

@ -50,7 +50,7 @@
</view>
<view class="draw-button" @click="checkIsVip()">
生成<br/>(消耗{{goldNum}}点画意值)
开始创作<br/>消耗({{goldNum}}点画意值)
</view>

81
pages/ai/paint/paint.vue

@ -134,7 +134,7 @@
<button type="default" @click="$noMultipleClicks(startPaint)" class="startPaint">开始创作<br/>消耗{{formData.goldNum}}点画意值</button>
</view> -->
<view class="startPaint" @click="$noMultipleClicks(startPaint)">
开始创作<br/>消耗{{formData.goldNum}}点画意值
开始创作<br/>消耗({{formData.goldNum}}点画意值)
</view>
</view>
</uni-forms>
@ -143,7 +143,7 @@
<script>
import base64ToImg from '@/utils/base64Utils';
import {getPaintStyle, getPrompt, textToImg, checkUserCanAiPaint} from '@/api/paint.js';
import {getPaintStyle, getPrompt, textToImg} from '@/api/paint.js';
import {checkVip} from "@/api/paint";
export default {
data() {
@ -230,6 +230,7 @@
this.getPrompt();
},
onShow() {
console.log('show')
//
this.formData.height = undefined;
this.formData.width = undefined;
@ -244,29 +245,36 @@
this.formData.sfgScale = 7;
this.formData.steps = 20;
this.formData.eta = 0;
this.formData.samplerIndex = "Euler a";
this.formData.samplerIndex = "DPM++ 2S a Karras";
this.size_active = 0;
this.style_active = 0;
this.prompt_active = 0;
this.checkLogin();
this.checkUserCanAiPaint();
//this.checkUserCanAiPaint();
this.$forceUpdate();
},
methods: {
//
openAdvancedSetting(e) {
console.log('e',e)
let that = this;
if (e.detail.value) {
checkVip({userId: this.userInfo.id, userClientType: "10"}).then(res => {
checkVip({userId: that.userInfo.id, userClientType: 10}).then(res => {
if (res.data.code === 200) {
if (res.data.data.isVip === "1") {
this.advancedSetting = e.detail.value;
that.advancedSetting = e.detail.value;
} else {
this.advancedSetting = !e.detail.value;
that.advancedSetting = !e.detail.value;
uni.showModal({
title: '提示',
content: '还不是会员,点击跳转开通会员',
title: '你还不是VIP',
content: '点击确定解锁更多权益哟~',
cancelText: '狠心拒绝',
cancelColor: '#ff0000',
confirmColor: '#0000ff',
confirmText: '立刻前往',
success(res){
if (res.confirm) {
//
//vip
uni.navigateTo({
url:'/pages/userInfo/vip/vip'
})
@ -276,14 +284,19 @@
icon: 'none',
duration: 2000,
success() {
this.advancedSetting = false;
that.advancedSetting = false;
}
});
}
},
});
}
}
}else {
uni.showModal({
content: '网络错误,请稍后再试~',
showCancel: false
});
}
});
} else {
this.advancedSetting = e.detail.value;
@ -476,28 +489,28 @@
},
//AI
async checkUserCanAiPaint(){
let that = this;
const data = {
userId: that.userInfo.id,
platform: 1,
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: 1,
// 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() {

4
pages/userInfo/aiPaint/aiPaint.vue

@ -83,9 +83,9 @@
console.log('res',res)
if (res.data.code === 200) {
let imgData = res.data.rows?.map?.(item => {
if (item.width == 1024 && item.height == 512) {
if (item.width == '1024' && item.height == '512') {
item.typeId = 4;
} else if (item.width == 512 && item.height == 1024) {
} else if (item.width == '512' && item.height == '1024') {
item.typeId = 3;
} else {
item.typeId = 1;

1
pages/userInfo/aiPaint/aiPaintDetail.vue

@ -98,6 +98,7 @@ export default {
onLoad(options) {
//
const paintData = JSON.parse(options.data);
console.log(paintData)
this.imgHeight = paintData.height;
this.imgWidth = paintData.width;
this.prompt = paintData['prompt'];

60
pages/userInfo/userInfo.vue

@ -9,8 +9,9 @@
<view class="right">
<view class="username" v-if="userInfo.username">
{{userInfo.username}}
<uni-icons class="vip-icon" custom-prefix="iconfont" type="icon-VIP" size="14" :color="userInfo.isVip === '1' ? primaryColor : noVipColor "/>
</view>
<uni-icons class="vip-icon" custom-prefix="iconfont" type="icon-VIP" size="14" :color="isVip === true ? primaryColor : noVipColor "/>
<br/>画意值{{goldNum}}
</view>
<view class="login-btn uni-primary" v-else @click="$noMultipleClicks(getUserInfoLogin)">点击登录</view>
</view>
</view>
@ -36,6 +37,11 @@
<view class="text">我的会员</view>
<uni-icons class="list-menu-genduo" custom-prefix="iconfont" type="icon-gengduo"></uni-icons>
</view>
<view class="list-menu-item" @click="toLink()">
<uni-icons class="list-menu-icon" custom-prefix="iconfont" type="icon-gengduo" size="20" :color="primaryColor" />
<view class="text">画意值记录</view>
<uni-icons class="list-menu-genduo" custom-prefix="iconfont" type="icon-gengduo"></uni-icons>
</view>
<view class="list-menu-item" @click="$noMultipleClicks(useCdk)">
<uni-icons class="list-menu-icon" custom-prefix="iconfont" type="icon-gengduo" size="20" :color="primaryColor" />
<view class="text">兑换绘画次数</view>
@ -79,6 +85,7 @@
<script>
import {loginTiktok} from '@/api/auth.js'
import {useCdk} from '@/api/paint.js'
import {checkVip, queryGoldNum} from '@/api/paint.js'
import UniIcons from "../../uni_modules/uni-icons/components/uni-icons/uni-icons";
export default {
components: {UniIcons},
@ -86,6 +93,8 @@ import UniIcons from "../../uni_modules/uni-icons/components/uni-icons/uni-icons
return {
userInfo: {},
noClick:true, //,
isVip: false,
goldNum: 0,
primaryColor: "#1a94bc",
noVipColor: "#6a6a6a",
menus: [
@ -104,17 +113,56 @@ import UniIcons from "../../uni_modules/uni-icons/components/uni-icons/uni-icons
},
onShow(){
this.userInfo = uni.getStorageSync('userInfo')
this.checkIsVip();
this.queryGoldNum();
},
onShareAppMessage(res) {
if (res.from === 'button') { //
// console.log(res)
}
return {
title: '想要好看的图片就来[次元意境]吧!',
title: '来[次元意境]成为独一无二的画意人吧!',
path: `/pages/index/index?id=${this.userInfo.id}`
}
},
methods: {
//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 {
uni.showModal({
content: '网络错误,请稍后再试~',
showCancel: false
});
}
},
//
async queryGoldNum(){
let that = this;
const res = await queryGoldNum(that.userInfo.id);
console.log('goldRes===', res);
if (res.data.code === 200) {
that.goldNum = res.data.data;
console.log(that.goldNum);
}else {
uni.showModal({
content: '网络错误,请稍后再试~',
showCancel: false
});
}
},
loginFunc(res, userInfo) {
const params = {
code: res.code,
@ -144,6 +192,9 @@ import UniIcons from "../../uni_modules/uni-icons/components/uni-icons/uni-icons
uni.showToast({
title: '登录成功!',
icon: 'none',
success() {
this.queryGoldNum();
}
})
}
})
@ -211,6 +262,9 @@ import UniIcons from "../../uni_modules/uni-icons/components/uni-icons/uni-icons
url: url
});
},
toLinkAuth(url) {
if (this.userInfo) {
uni.navigateTo({

45
pages/userInfo/vip/vip.vue

@ -3,14 +3,16 @@
<view class="header">
<view class="vip-info">
<image :src="userInfo.img" mode="" class="vip-info__avatar"></image>
<div>
<div class="vip-info__name">{{userInfo.username}}</div>
<div class="vip-info__tips">你还不是会员,开通立享 9 项特权</div>
</div>
<view>
<view class="vip-info__name">{{userInfo.username}}</view>
<view class="vip-info__tips" v-if="vipInfo.isVip == '0'">你还不是会员,开通立享 9 项特权</view>
<view class="vip-info__tips" v-if="vipInfo.isVip == '1'">您的会员为{{vipInfo.vipName}}</view>
<view class="vip-info__tips" v-if="vipInfo.isVip == '1'">到期时间为{{vipInfo.endTime}}</view>
</view>
</view>
<view class="vip-explan">
<view class="vip-explan" v-if="vipInfo.isVip == '0'">
会员说明
<uni-icons type="help" size="20" color="#eee" />
<uni-icons type="help" size="20" color="#eee" @click="openIntro()"/>
</view>
</view>
@ -44,16 +46,38 @@
addVipOrder,
unifiedOrder
} from '@/api/userInfo.js'
import {checkVip} from '@/api/paint.js'
export default {
data() {
return {
userInfo: null,
vipList: [],
active: 0,
disabled: false
disabled: false,
vipInfo: undefined
}
},
methods: {
//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) {
that.vipInfo = res.data.data
}else {
uni.showModal({
content: '网络错误,请稍后再试~',
showCancel: false
});
}
},
async getVipList() {
const {
data
@ -103,10 +127,15 @@
this.disabled = false
},
})
}
},
//
openIntro(){
console.log("打开会员说明")
},
},
onShow() {
this.userInfo = uni.getStorageSync('userInfo')
this.checkIsVip();
},
created() {
if (!this.userInfo) {

Loading…
Cancel
Save