123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <template>
- <!-- 我的 -->
- <view class="card_mine">
- <view class="card_avatar" v-if="token != ''">
- <image class="mine_image" src="../../static/portrait.png" mode=""></image>
- <view class="card_user_title">
- <view class="mine_phone">{{userInfo.nickName}}</view>
- <view class="mine_phone">{{userInfo.username}}</view>
- </view>
- </view>
- <view class="card_avatar" v-else @click="login">
- <image class="mine_image" src="../../static/portrait.png" mode=""></image>
- <view class="mine_title">登录/注册</view>
- </view>
- <view class="space_between card_mine_option" @click="goPersonal">
- <view class="option_title">个人资料</view>
- <u-icon name="arrow-right" size="20"></u-icon>
- </view>
- <view class="space_between card_mine_option" @click="changePassword">
- <view class="option_title">修改密码</view>
- <u-icon name="arrow-right" size="20"></u-icon>
- </view>
- <view class="space_between card_mine_option" @click="goAddress">
- <view class="option_title">地址管理</view>
- <u-icon name="arrow-right" size="20"></u-icon>
- </view>
- <view class="space_between card_mine_option" @click="goPersonal">
- <view class="option_title">我的安全检查</view>
- <u-icon name="arrow-right" size="20"></u-icon>
- </view>
- <view class="space_between card_mine_option" @click="goSet">
- <view class="option_title">系统设置</view>
- <u-icon name="arrow-right" size="20"></u-icon>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- token: '',
- userInfo: {},
- }
- },
- mounted() {
- var token = this.$cache.getToken()
- this.token = token
- var userInfo = this.$cache.getCache('userInfo')
- this.userInfo = userInfo
- },
- methods: {
- // 刷新token
- refreshTokenil() {
- var token = this.$cache.getToken()
- this.token = token
- var userInfo = this.$cache.getCache('userInfo')
- this.userInfo = userInfo
- },
- //微信授权
- set_is_login(val) {
- let _this = this;
- uni.getUserProfile({
- 'desc': '获取用户基本信息',
- 'lang': 'zh_CN',
- success: function(infoRes) {
- console.log(infoRes, 8)
- uni.login({
- success: function(loginRes) {
- console.log(loginRes, 23)
- }
- });
- },
- });
- },
- // 登录注册
- login() {
- uni.navigateTo({
- url: '/pages/login'
- });
- },
- // 个人资料
- goPersonal() {
- if (this.token) {
- uni.navigateTo({
- url: '/pages/mine/personal'
- });
- } else {
- uni.$u.toast('请先登录')
- }
- },
- // 修改密码
- changePassword() {
- if (this.token) {
- uni.navigateTo({
- url: '/pages/mine/password'
- });
- } else {
- uni.$u.toast('请先登录')
- }
- },
- // 地址管理
- goAddress() {
- if (this.token) {
- uni.navigateTo({
- url: '/pages/mine/address'
- });
- } else {
- uni.$u.toast('请先登录')
- }
- },
- // 系统设置
- goSet() {
- if (this.token) {
- uni.navigateTo({
- url: '/pages/mine/system'
- });
- } else {
- uni.$u.toast('请先登录')
- }
- }
- }
- }
- </script>
- <style lang="scss">
- .card_user_title {
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- }
- .card_mine {
- padding-top: var(--status-bar-height);
- padding: 0rpx 30rpx;
- }
- .mine_image {
- width: 100rpx;
- height: 100rpx;
- border-radius: 50%;
- }
- .mine_phone {
- margin-left: 20rpx;
- font-size: 30rpx;
- }
- .mine_title {
- margin-left: 20rpx;
- font-size: 40rpx;
- font-weight: bold;
- }
- .card_avatar {
- display: flex;
- align-items: center;
- margin-bottom: 60rpx;
- padding-top: 60rpx;
- }
- .card_mine_option {
- margin: 40rpx 0rpx;
- padding-bottom: 30rpx;
- border-bottom: 2rpx solid #E4E7ED;
- }
- .option_title {
- font-size: 32rpx;
- font-weight: bold;
- }
- </style>
|