创建虚拟人物,调整登录逻辑
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<scroll-view class="role-figure-scroll" scroll-x="true" >
|
||||
<view
|
||||
class="role-figure-item"
|
||||
v-for="(item, index) in figure"
|
||||
v-for="(item, index) in (sex === 1 ? male: female)"
|
||||
:class="storageId === item.storage_id ? 'active': ''"
|
||||
:key="index"
|
||||
@click="storageId = item.storage_id"
|
||||
@@ -34,7 +34,8 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
figure : [],
|
||||
male : [],
|
||||
female : [],
|
||||
nickname : '',
|
||||
sex : 1,
|
||||
storageId : '',
|
||||
@@ -43,14 +44,16 @@
|
||||
},
|
||||
watch: {
|
||||
sex(newVale){
|
||||
this.storageId = this.figure[0].storage_id
|
||||
this.storageId = (this.sex === 1 ? this.male[0].storage_id : this.female[0].storage_id)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
userFigure().then(res => {
|
||||
this.figure = res
|
||||
this.storageId = res[0].storage_id
|
||||
this.female = res.female
|
||||
this.male = res.male
|
||||
this.storageId = res.male[0].storage_id
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
uni.showToast({
|
||||
title: err.status_code + ':' + err.message,
|
||||
icon : 'none'
|
||||
@@ -69,7 +72,7 @@
|
||||
storage_id : this.storageId
|
||||
}).then(res => {
|
||||
this.$store.commit('setIsNew', 1)
|
||||
this.$Router.pushTab({name: 'Life'})
|
||||
this.$Router.back()
|
||||
}).catch(err => {
|
||||
this.disabled = false
|
||||
uni.showToast({
|
||||
|
||||
Reference in New Issue
Block a user