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. 79
      pages/ai/paint/paint.vue
  4. 4
      pages/userInfo/aiPaint/aiPaint.vue
  5. 1
      pages/userInfo/aiPaint/aiPaintDetail.vue
  6. 58
      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>
<view class="draw-button" @click="checkIsVip()"> <view class="draw-button" @click="checkIsVip()">
生成<br/>(消耗{{goldNum}}点画意值) 开始创作<br/>消耗({{goldNum}}点画意值)
</view> </view>

79
pages/ai/paint/paint.vue

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

4
pages/userInfo/aiPaint/aiPaint.vue

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

1
pages/userInfo/aiPaint/aiPaintDetail.vue

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

58
pages/userInfo/userInfo.vue

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

45
pages/userInfo/vip/vip.vue

@ -3,14 +3,16 @@
<view class="header"> <view class="header">
<view class="vip-info"> <view class="vip-info">
<image :src="userInfo.img" mode="" class="vip-info__avatar"></image> <image :src="userInfo.img" mode="" class="vip-info__avatar"></image>
<div> <view>
<div class="vip-info__name">{{userInfo.username}}</div> <view class="vip-info__name">{{userInfo.username}}</view>
<div class="vip-info__tips">你还不是会员,开通立享 9 项特权</div> <view class="vip-info__tips" v-if="vipInfo.isVip == '0'">你还不是会员,开通立享 9 项特权</view>
</div> <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>
<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>
</view> </view>
@ -44,16 +46,38 @@
addVipOrder, addVipOrder,
unifiedOrder unifiedOrder
} from '@/api/userInfo.js' } from '@/api/userInfo.js'
import {checkVip} from '@/api/paint.js'
export default { export default {
data() { data() {
return { return {
userInfo: null, userInfo: null,
vipList: [], vipList: [],
active: 0, active: 0,
disabled: false disabled: false,
vipInfo: undefined
} }
}, },
methods: { 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() { async getVipList() {
const { const {
data data
@ -103,10 +127,15 @@
this.disabled = false this.disabled = false
}, },
}) })
} },
//
openIntro(){
console.log("打开会员说明")
},
}, },
onShow() { onShow() {
this.userInfo = uni.getStorageSync('userInfo') this.userInfo = uni.getStorageSync('userInfo')
this.checkIsVip();
}, },
created() { created() {
if (!this.userInfo) { if (!this.userInfo) {

Loading…
Cancel
Save