init
This commit is contained in:
101
pages/tabpages/user/user.js
Normal file
101
pages/tabpages/user/user.js
Normal file
@@ -0,0 +1,101 @@
|
||||
import tool from '../../../utils/tool'
|
||||
import scoreApi from "../../../api/scoreApi"
|
||||
import userArticleApi from "../../../api/userArticleApi"
|
||||
|
||||
Page({
|
||||
|
||||
data: {
|
||||
total: [
|
||||
{
|
||||
value: 0,
|
||||
category: '我的积分',
|
||||
path: '/pages/subpages/scoreLog/scoreLog'
|
||||
},
|
||||
{
|
||||
value: 0,
|
||||
category: '下载记录',
|
||||
path: '/pages/subpages/downloadLog/downloadLog'
|
||||
},
|
||||
{
|
||||
value: 0,
|
||||
category: '收藏记录',
|
||||
path: '/pages/subpages/collectionLog/collectionLog'
|
||||
}
|
||||
],
|
||||
funcList: [
|
||||
{
|
||||
name:'每日签到',
|
||||
path: '每日签到',
|
||||
icon: 'thumb-circle-o',
|
||||
color: '#04D17A'
|
||||
},
|
||||
{
|
||||
name:'积分兑换',
|
||||
path: '/pages/subpages/member/member',
|
||||
icon: 'diamond',
|
||||
color: '#F7E031'
|
||||
},
|
||||
{
|
||||
name:'使用说明',
|
||||
path: '/pages/subpages/instruct/instruct',
|
||||
icon: 'notes',
|
||||
color: '#FC6760'
|
||||
},
|
||||
{
|
||||
name:'关于我们',
|
||||
path: '/pages/subpages/aboutus/aboutus',
|
||||
icon: 'friends',
|
||||
color: '#6650F6'
|
||||
}
|
||||
],
|
||||
userInfo: {},
|
||||
memberLevel: null,
|
||||
paymentShow: false,
|
||||
paymentCode: null
|
||||
},
|
||||
|
||||
leaveFor(e){
|
||||
const path = e.currentTarget.dataset.path
|
||||
if (path==="赞赏支持") {
|
||||
this.setData({paymentShow:true})
|
||||
}
|
||||
else if (path==="每日签到") {
|
||||
scoreApi.signIn().then((res)=>{
|
||||
if (res.code===200) {
|
||||
wx.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
this.onLoad()
|
||||
}
|
||||
})
|
||||
}
|
||||
else{
|
||||
wx.navigateTo({ url: path })
|
||||
}
|
||||
},
|
||||
|
||||
onLoad(){
|
||||
const userInfo = tool.data.get('USER_INFO')
|
||||
const userMemberInfo = tool.data.get('USER_MEMBER_INFO')
|
||||
const clientConfig = tool.data.get('CLIENT_CONFIG')
|
||||
this.setData({
|
||||
userInfo,
|
||||
memberLevel: userMemberInfo ? userMemberInfo.level : null,
|
||||
paymentCode: clientConfig.CLIENT_PAYMENT_CODE[0].thumbUrl
|
||||
})
|
||||
|
||||
scoreApi.getUserScore().then(res=>{
|
||||
this.setData({
|
||||
'total[0].value': res.data
|
||||
})
|
||||
})
|
||||
|
||||
userArticleApi.userArticleTotal().then(res=>{
|
||||
this.setData({
|
||||
'total[1].value': res.data.downloadSum,
|
||||
'total[2].value': res.data.collectionSum,
|
||||
})
|
||||
})
|
||||
},
|
||||
})
|
||||
9
pages/tabpages/user/user.json
Normal file
9
pages/tabpages/user/user.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-dialog": "@vant/weapp/dialog/index",
|
||||
"van-tag": "@vant/weapp/tag/index"
|
||||
},
|
||||
"navigationBarTitleText": "个人中心",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarBackgroundColor": "#1D90FB"
|
||||
}
|
||||
34
pages/tabpages/user/user.wxml
Normal file
34
pages/tabpages/user/user.wxml
Normal file
@@ -0,0 +1,34 @@
|
||||
<!-- 用户信息 -->
|
||||
<view class="user-info">
|
||||
<image src="{{userInfo.avatar}}" mode=""/>
|
||||
<view class="name">
|
||||
<text class="nick">{{userInfo.nickname}}</text>
|
||||
<text selectable class="id">ID: {{userInfo.id}} </text>
|
||||
</view>
|
||||
<view class="clock">
|
||||
<van-tag wx:if="{{memberLevel}}" color="#F7DB50" text-color="#ad0000">{{memberLevel}}</van-tag>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 历史记录 -->
|
||||
<view class="card record">
|
||||
<view class="records_item" wx:for="{{total}}" wx:key="index" bindtap="leaveFor" data-path="{{item.path}}">
|
||||
<text class="value">{{item.value}}</text>
|
||||
<text class="key">{{item.category}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 功能列表 -->
|
||||
<view class="card func">
|
||||
<view class="func_item" wx:for="{{funcList}}" wx:key="index" bindtap="leaveFor" data-path="{{item.path}}">
|
||||
<van-icon name="{{item.icon}}" color="{{item.color}}" />
|
||||
<text class="func_name">{{item.name}}</text>
|
||||
</view>
|
||||
|
||||
<view class="func_item ">
|
||||
<van-icon name="chat" color="#F7DB50" />
|
||||
<button class="contact" plain open-type="contact">
|
||||
<text class="func_name">客服</text>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
90
pages/tabpages/user/user.wxss
Normal file
90
pages/tabpages/user/user.wxss
Normal file
@@ -0,0 +1,90 @@
|
||||
.user-info{
|
||||
background-color: #1D90FB;
|
||||
padding: 30px;
|
||||
color: #FFF;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.user-info image{
|
||||
border-radius: 50%;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.user-info .name{
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.user-info .name .nick{
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.user-info .name .id{
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.user-info .clock{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.record{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.records_item{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 0 20px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.records_item .value{
|
||||
font-size: 26px;
|
||||
color: #1D90FB;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.records_item:nth-child(2){
|
||||
border-left: 1px solid #F2F4FB;
|
||||
border-right: 1px solid #F2F4FB;
|
||||
}
|
||||
|
||||
.func{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.func_item{
|
||||
width: 33.3%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
padding: 14px 0;
|
||||
}
|
||||
|
||||
.func_item .van-icon{
|
||||
font-size: 24px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.contact{
|
||||
background-color: #fff;
|
||||
border: none!important;
|
||||
outline: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: fit-content;
|
||||
font-size: 14px;
|
||||
height: 19px;
|
||||
line-height: 19px;
|
||||
}
|
||||
Reference in New Issue
Block a user