Files
dvcp_v2_wechat_app/src/project/tianfuxing/AppMy/AppMy.vue

231 lines
4.5 KiB
Vue
Raw Normal View History

2022-11-01 18:30:12 +08:00
<template>
2022-11-01 19:18:44 +08:00
<div class="my">
<div class="user">
<image src="https://jisheng-xiaochengxu.oss-cn-hangzhou.aliyuncs.com/admin/5bad9165-fa6e-4c81-894d-2beae426260b.png" />
2022-11-02 10:38:06 +08:00
<div class="right" v-if="isLogin">
2022-11-01 19:18:44 +08:00
<h2>张三</h2>
<p>文明天府星市民 Lv.1</p>
</div>
2022-11-02 10:38:06 +08:00
<div class="right" v-else @click="toLogin">
<h2>登录</h2>
<p>点击进行登录</p>
</div>
2022-11-01 19:18:44 +08:00
</div>
<div class="info">
<div class="info-item">
<h3>积分总额</h3>
<span>32</span>
</div>
<div class="info-item">
<h3>积分排名</h3>
<span>32</span>
</div>
</div>
<div class="my-list">
<h2>积分明细</h2>
<div class="list">
<div class="item" v-for="(item, index) in 10" :key="index">
<div class="left">
<h2>随手拍</h2>
<p>2022-07-21 10:10:13</p>
</div>
<div class="right">
<i>+</i>
<span>5</span>
<em>积分</em>
</div>
</div>
</div>
</div>
2022-11-01 18:30:12 +08:00
</div>
</template>
<script>
2022-11-02 10:38:06 +08:00
import { mapActions, mapState } from 'vuex'
2022-11-01 18:30:12 +08:00
export default {
appName: '我的',
2022-11-02 10:38:06 +08:00
name: 'AppMy',
data () {
return {
}
},
computed: {
...mapState(['user', 'token']),
isLogin () {
return !!this.user.id
}
},
onLoad () {
console.log(this.user)
console.log(this.token)
},
methods: {
...mapActions(['autoLogin', 'getUserInfo', 'getToken', 'getCode']),
login () {
return new Promise(function (resolve, reject) {
uni.login({
success: function (res) {
if (res.code) {
resolve(res)
} else {
reject(res)
}
},
fail: function () {
reject(false)
}
})
})
},
toLogin () {
wx.getUserProfile({
desc: '用于完善会员资料',
lang: 'zh_CN',
success: data => {
this.$loading()
this.getCode().then(res => {
this.getToken({
...data.userInfo,
code: res
}).then(e => {
console.log(e)
this.$hideLoading()
}).catch(() => {
this.$hideLoading()
})
})
}
})
}
}
2022-11-01 18:30:12 +08:00
}
</script>
<style lang="scss" scoped>
2022-11-01 19:18:44 +08:00
.my {
2022-11-02 10:38:06 +08:00
padding-top: 32px;
padding-bottom: 30px;
.user, .info {
display: flex;
align-items: center;
padding: 0 48px;
}
.user {
line-height: 1;
margin-bottom: 48px;
image {
width: 112px;
height: 112px;
margin-right: 32px;
border-radius: 50%;
border: 4px solid #FFFFFF;
}
p {
color: #8891A1;
font-size: 26px;
}
h2 {
margin-bottom: 18px;
font-weight: 600;
font-size: 34px;
color: #1D2229;
}
}
.my-list {
padding: 0 32px;
& > h2 {
margin-bottom: 42px;
font-weight: 600;
font-size: 34px;
color: #333333;
}
.item {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 24px;
padding: 24px;
background: #FFFFFF;
box-shadow: 0 0 8px 0 rgba(0,0,0,0.02);
border-radius: 16px;
.right {
display: flex;
align-items: baseline;
line-height: 1;
i {
color: #FFB94C;
font-size: 32px;
}
span {
color: #FFB94C;
font-size: 40px;
}
em {
font-size: 26px;
color: #999999;
}
}
.left {
flex: 1;
margin-right: 20px;
h2 {
line-height: 1.3;
margin-bottom: 10px;
font-size: 34px;
color: #333333;
}
p {
font-size: 26px;
color: #999999;
}
}
}
}
.info {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 58px;
.info-item {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 28px;
width: 192px;
height: 112px;
color: #4D5596;
2022-11-01 18:30:12 +08:00
2022-11-02 10:38:06 +08:00
div:last-child {
color: #316568;
}
}
}
2022-11-01 19:18:44 +08:00
}
2022-11-01 18:30:12 +08:00
</style>