123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- <template>
- <view class="user-content">
- <!-- 头部 -->
- <view class="user-head">
- <view class="user-photo">
- <u-avatar :src="userAvatarUrl" size="large" class="avatar"></u-avatar>
- </view>
- <view class="user-info">
- <text class="user-name">用户名</text>
- <text class="user-phone">15785829632</text>
- </view>
- </view>
- <!-- 列表 -->
- <view class="user-list">
- <u-cell-group>
- <u-cell-item icon="file-text" icon-size="40" :icon-style="{color:'#ffaa00'}" index="0" @click="toPage" title="服务协议及隐私政策"></u-cell-item>
- <!-- <u-cell-item icon="info-circle" icon-size="38" :icon-style="{color:'#55aa00'}" index="1" @click="toPage" title="关于我们"></u-cell-item> -->
- <u-cell-item icon="lock" icon-size="38" :icon-style="{color:'#00aaff'}" index="2" @click="toPage" title="修改密码"></u-cell-item>
- </u-cell-group>
- </view>
- <!-- 退出 -->
- <view class="user-btn">
- <u-button type="success" :custom-style="quitButton" @click="quitSys" shape="circle">退出登录</u-button>
- </view>
- </view>
- </template>
- <script>
- import {logout} from '@/api/login.js'
- import { getUserInfo } from '@/api/user.js'
- export default {
- data() {
- return {
- quitButton: {
- borderRadius:'100rpx',
- fontSize:'30rpx',
- background: '#ed1c24'
- },
- userInfoData: null, // 用户信息
- userAvatarUrl: '' // 用户头像
- };
- },
- onShow() {
- this.getUserInfo()
- },
- onLoad() {
- },
- methods:{
- // 获取用户信息
- getUserInfo(){
- // getUserInfo().then(res => {
- // if(res.status == 200){
- // this.userInfoData = res.data
- // }else{
- // this.userInfoData = null
- // }
- // })
- },
- // 打开对应的页面
- toPage(index){
- let pageUrl=[
- '/pages/agreement/agreement?fromPage=usercenter',
- '/pages/userCenter/changePwd'
- ]
- uni.navigateTo({
- url: pageUrl[index]
- })
- },
- // 跳转
- toUserPage(){
- // 未登录跳转登录,已登录跳转用户信息页
- uni.navigateTo({
- url: '/pages/userCenter/userInfo/userInfo'
- })
- },
- // 乐豆明细
- toLdPage(){
- uni.navigateTo({
- url: '/pages/userCenter/ldDetailed'
- })
- },
- // 退出登录
- quitSys(){
- let _this = this
- uni.showModal({
- title: '提示',
- content: '您确定要退出登录吗?',
- success(res) {
- if (res.confirm) {
- // logout({}).then(res => {
- // getApp().globalData.token = ''
- // _this.$u.vuex('vuex_token','')
- // // 关闭socket
- // // _this.$store.commit("$closeWebsocket")
- // uni.reLaunch({
- // url: '/pages/login/pwLogin'
- // })
- // })
- }
- }
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .user-content{
- width: 100%;
- .user-head{
- background: #ed1c24;
- display: flex;
- align-items: center;
- padding: 35rpx 55rpx;
- .user-photo{
- flex-shrink: 0;
- margin-right: 5rpx;
- // width: 130rpx;
- // height: 130rpx;
- // border-radius: 50%;
- // overflow: hidden;
- }
- .user-info{
- flex-grow: 1;
- padding: 0 20rpx;
- color: #FFFFFF;
- .user-name{
- display: block;
- font-size: 30rpx;
- margin-bottom: 20rpx;
- }
- .user-phone{
- display: block;
- font-size: 26rpx;
- }
- }
- }
- .user-list{
- border-radius: 15upx;
- margin: 20upx;
- overflow: hidden;
- box-shadow: 0upx 3upx 6upx #eee;
- }
- .user-btn{
- padding: 85rpx 200rpx;
- }
- }
- </style>
|