bug
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<div class="my">
|
||||
<div class="user" @click="toSetting">
|
||||
<image src="https://jisheng-xiaochengxu.oss-cn-hangzhou.aliyuncs.com/admin/5bad9165-fa6e-4c81-894d-2beae426260b.png" />
|
||||
<image :src="user.avatarUrl || 'https://cdn.cunwuyun.cn/wxmp/tianfuxing/avatar.png'" />
|
||||
<div class="right" v-if="isLogin">
|
||||
<h2>张三</h2>
|
||||
<p>文明天府星市民 Lv.1</p>
|
||||
<h2>{{ user.nickName }}</h2>
|
||||
<p v-if="user.levelTitle">{{ user.levelTitle }}</p>
|
||||
</div>
|
||||
<div class="right" v-else @click="toLogin">
|
||||
<h2>登录</h2>
|
||||
@@ -14,27 +14,30 @@
|
||||
<div class="info">
|
||||
<div class="info-item">
|
||||
<h3>积分总额</h3>
|
||||
<span>32</span>
|
||||
<span>{{ user.integral }}</span>
|
||||
<image src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/nav2.png" />
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<h3>积分排名</h3>
|
||||
<span>32</span>
|
||||
<span>{{ user.integralOrder }}</span>
|
||||
<image src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/nav1.png" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="my-list">
|
||||
<h2>积分明细</h2>
|
||||
<div class="list">
|
||||
<div class="item" v-for="(item, index) in 10" :key="index">
|
||||
<div class="item" v-for="(item, index) in list" :key="index">
|
||||
<div class="left">
|
||||
<h2>随手拍</h2>
|
||||
<p>2022-07-21 10:10:13</p>
|
||||
<h2>{{ item.detail }}</h2>
|
||||
<p>{{ item.createTime }}</p>
|
||||
</div>
|
||||
<div class="right">
|
||||
<i>+</i>
|
||||
<span>5</span>
|
||||
<i>{{ item.calcType === '0' ? '-' : '+' }}</i>
|
||||
<span>{{ item.integral || 0 }}</span>
|
||||
<em>积分</em>
|
||||
</div>
|
||||
</div>
|
||||
<AiEmpty v-if="!list.length"></AiEmpty>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -48,7 +51,9 @@
|
||||
|
||||
data () {
|
||||
return {
|
||||
|
||||
list: [],
|
||||
current: 1,
|
||||
isMore: false
|
||||
}
|
||||
},
|
||||
|
||||
@@ -61,10 +66,9 @@
|
||||
},
|
||||
|
||||
onLoad () {
|
||||
console.log(this.user)
|
||||
console.log(this.token)
|
||||
if (this.token) {
|
||||
this.getUserInfo()
|
||||
this.getList()
|
||||
}
|
||||
},
|
||||
|
||||
@@ -85,8 +89,44 @@
|
||||
} else {
|
||||
this.getUserInfo()
|
||||
}
|
||||
},
|
||||
|
||||
getList () {
|
||||
if (this.isMore) return
|
||||
|
||||
this.$instance.post(`/appwechatintegraldetail/list`, null, {
|
||||
params: {
|
||||
current: this.current,
|
||||
size: 10
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$hideLoading()
|
||||
if (this.current > 1) {
|
||||
this.list = [...this.list, ...res.data.records]
|
||||
} else {
|
||||
this.list = res.data.records
|
||||
}
|
||||
|
||||
if (res.data.records.length < 10) {
|
||||
this.isMore = true
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
this.current = this.current + 1
|
||||
} else {
|
||||
this.isMore = true
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$hideLoading()
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
onReachBottom () {
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -95,6 +135,10 @@
|
||||
padding-top: 32px;
|
||||
padding-bottom: 30px;
|
||||
|
||||
div {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.user, .info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -194,16 +238,33 @@
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
position: relative;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 28px;
|
||||
width: 192px;
|
||||
width: 318px;
|
||||
height: 112px;
|
||||
padding: 0 24px;
|
||||
color: #4D5596;
|
||||
box-sizing: border-box;
|
||||
|
||||
div:last-child {
|
||||
&:last-child {
|
||||
color: #316568;
|
||||
}
|
||||
|
||||
h3, span {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
image {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
width: 318px;
|
||||
height: 112px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,26 +4,28 @@
|
||||
<div class="form">
|
||||
<div class="form-item avatar">
|
||||
<h2>头像</h2>
|
||||
<div class="form-item__right" @click="uploadImg">
|
||||
<button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
|
||||
<image class="avatar" :src="userInfo.avatar"></image>
|
||||
<div class="form-item__right">
|
||||
<button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
|
||||
<image class="avatar" :src="userInfo.avatarUrl || 'https://cdn.cunwuyun.cn/wxmp/tianfuxing/avatar.png'"></image>
|
||||
</button>
|
||||
<image class="right" src="/static/images/next.png" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<h2>昵称</h2>
|
||||
<div class="form-item__right">
|
||||
<input placeholder="请输入昵称" type="nickname" v-model="userInfo.nickname" />
|
||||
<input placeholder="请输入昵称" type="nickname" v-model="userInfo.nickName" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn" @click="save">保存</div>
|
||||
<div class="btn-wrapper">
|
||||
<div class="btn" hover-class="text-hover">保存</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
export default {
|
||||
appName: '设置',
|
||||
name: 'UserInfo',
|
||||
@@ -33,15 +35,14 @@
|
||||
}
|
||||
},
|
||||
|
||||
onLoad () {
|
||||
if (uni.getStorageSync('token')) {
|
||||
this.userInfo = uni.getStorageSync('userInfo')
|
||||
console.log(this.userInfo)
|
||||
}
|
||||
computed: {
|
||||
...mapState(['user'])
|
||||
},
|
||||
|
||||
uni.$on('updateUserInfo', () => {
|
||||
this.getUserInfo()
|
||||
})
|
||||
onLoad () {
|
||||
this.userInfo = {
|
||||
...this.user
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
@@ -56,6 +57,32 @@
|
||||
})
|
||||
},
|
||||
|
||||
onChooseAvatar (e) {
|
||||
this.$loading()
|
||||
uni.uploadFile({
|
||||
url: this.$instance.defaults.baseURL + '/api/file/add',
|
||||
filePath: e.detail.avatarUrl,
|
||||
name: 'file',
|
||||
header: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
Authorization: uni.getStorageSync('token'),
|
||||
},
|
||||
success: (res) => {
|
||||
const data = JSON.parse(res.data)
|
||||
|
||||
if (data.code === 0) {
|
||||
this.$set(this.userInfo, 'avatarUrl', data.data[0].split(';')[0])
|
||||
} else {
|
||||
this.$toast(data.msg)
|
||||
}
|
||||
},
|
||||
complete: () => {
|
||||
this.$nextTick(() => {
|
||||
this.$hideLoading()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
uploadImg () {
|
||||
uni.chooseImage({
|
||||
@@ -118,6 +145,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
.avatar-wrapper {
|
||||
padding: 0;
|
||||
width: 120px!important;
|
||||
height: 120px!important;
|
||||
border-radius: 50%;
|
||||
margin: 0;
|
||||
|
||||
image {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
}
|
||||
}
|
||||
|
||||
.form {
|
||||
.form-item {
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user