123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381 |
- <template>
- <view class="container">
- <view class="top-image">
- <image src="../../static/img/user-top.png" mode="widthFix"></image>
- <view class="user-wrap">
- <image :src="userInfo.avatar" mode="" v-if="userInfo.avatar" class="user-avatar"></image>
- <image src="../../static/error/missing-face.png" mode="" class="user-avatar" v-else></image>
- <view class="user-name clamp" v-if="userInfo.nickname">
- {{ userInfo.nickname}}
- </view>
- <view class="user-name clamp" v-else>
- 游客
- </view>
- <view class="user-level" v-if="userInfo.nickname">
- {{userInfo.level == 0? '普通用户': '会员'}}
- </view>
- </view>
- </view>
- <!-- <view class="u-up" @click="navTo('/pages/user/menber')">
- <image src="../../static/img/u-up.png" mode="" class="u-up-bg"></image>
- <view class="u-up-tit">
- 开通会员享受更多权益
- </view>
- <view class="u-up-btn">
- 去申请
- </view>
- </view> -->
- <!-- <view class="my-box" @click="navTo('/pages/user/mytimes')">
- <view class="box-tit flex">
- <image src="../../static/icon/u1.png" mode="" class="left-img"></image>
- <view class="">
- 我的次数
- </view>
- <image src="../../static/icon/back.png" mode="" class="right-img"></image>
- </view>
- <view class="box-msg flex">
- <view class="msg-item flex">
- <view class="msg-val">
- 0
- </view>
- <view class="msg-name">
- 获得次数
- </view>
- </view>
- <view class="msg-item flex">
- <view class="msg-val">
- 0
- </view>
- <view class="msg-name">
- 使用次数
- </view>
- </view>
- <view class="msg-item flex">
- <view class="msg-val">
- 0
- </view>
- <view class="msg-name">
- 可用次数
- </view>
- </view>
- </view>
- </view> -->
- <view class="user-list flex" @click="navTo('/pages/user/myjslis')">
- <image src="../../static/icon/ul1.png" mode="" class="left-img"></image>
- <view class="">
- 计算记录
- </view>
- <image src="../../static/icon/back.png" mode="" class="right-img"></image>
- </view>
- <!-- <view class="user-list flex">
- <image src="../../static/icon/ul2.png" mode="" class="left-img"></image>
- <view class="">
- 关于我们
- </view>
- <image src="../../static/icon/back.png" mode="" class="right-img"></image>
- </view> -->
- <view class="user-list flex" @click="navTo('/pages/set/userinfo')">
- <image src="../../static/icon/ul3.png" mode="" class="left-img"></image>
- <view class="">
- 设置
- </view>
- <image src="../../static/icon/back.png" mode="" class="right-img"></image>
- </view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex';
- import uniList from '@/components/uni-list/uni-list.vue';
- import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
- import {
- orderData,
- getUserInfo
- } from '@/api/user.js';
- import {
- saveUrl,
- interceptor
- } from '@/utils/loginUtils.js';
- let startY = 0,
- moveY = 0,
- pageAtTop = true;
- export default {
- components: {
- uniList,
- uniListItem
- },
- data() {
- return {
- coverTransform: 'translateY(0px)',
- coverTransition: '0s',
- moving: false,
- };
- },
- onShow() {
-
- if (this.hasLogin) {
- this.loadBaseData();
- }else {
- this.loadBaseData();
- }
- },
- computed: {
- ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
- },
- methods: {
- ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
-
- loadBaseData() {
- getUserInfo({})
- .then(({
- data
- }) => {
- this.setUserInfo(data);
-
- orderData({})
- .then(({
- data
- }) => {
- this.setOrderInfo(data);
- })
- .catch(e => {
- this.setOrderInfo({
- complete_count: 0,
- received_count: 0,
- unshipped_count: 0,
- order_count: 0,
- unpaid_count: 0
- });
- });
- })
- .catch(e => {
- console.log(e);
- });
- },
-
- navTo(url) {
- if (!this.hasLogin) {
-
- saveUrl();
-
- interceptor();
- } else {
- uni.navigateTo({
- url
- });
- }
- },
-
- coverTouchstart(e) {
-
- if (pageAtTop === false) {
- return;
- }
- this.coverTransition = 'transform .1s linear';
- startY = e.touches[0].clientY;
- },
- coverTouchmove(e) {
-
- moveY = e.touches[0].clientY;
- let moveDistance = moveY - startY;
- let maxDowm = this.userMaxDowm;
- let Dowm = this.userDowm;
- if (moveDistance < 0) {
- this.moving = false;
- return;
- }
- this.moving = true;
- if (moveDistance >= Dowm && moveDistance < maxDowm) {
- moveDistance = Dowm;
- }
- if (moveDistance > 0 && moveDistance <= Dowm) {
- this.coverTransform = `translateY(${moveDistance}px)`;
- }
- },
- coverTouchend() {
- if (this.moving === false) {
- return;
- }
- this.moving = false;
- this.coverTransition = 'transform 0.3s cubic-bezier(.21,1.93,.53,.64)';
- this.coverTransform = 'translateY(0px)';
- }
- }
- };
- </script>
- <style lang="scss">
- page {
- height: 100%;
- }
- .top-image {
- position: relative;
-
- height: 370rpx;
- width: 750rpx;
- image {
- width: 100%;
-
- }
- }
- .user-wrap {
- position: absolute;
- width: 692rpx;
- height: 293rpx;
- background: #FFFFFF;
- box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
- border-radius: 28rpx;
- top: 83rpx;
- left: 0;
- right: 0;
- margin: auto;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- .user-avatar {
- width: 132rpx;
- height: 132rpx;
- border-radius: 50%;
- }
- .user-name {
- text-align: center;
- width: 300rpx;
- font-size: 30rpx;
- font-weight: bold;
- color: #333333;
- padding: 15rpx 0 ;
- }
- .user-level {
- font-size: 20rpx;
- font-weight: 500;
- color: #FF7E3E;
- }
- }
- .u-up {
- width: 690rpx;
- height: 90rpx;
- margin: 20rpx auto;
- position: relative;
- image {
- width: 690rpx;
- height: 90rpx;
- }
- .u-up-tit {
- font-size: 30rpx;
- font-weight: bold;
- color: #6A4714;
- line-height: 90rpx;
- position: absolute;
- top: 0;
- left: 80rpx;
- }
- .u-up-btn {
- position: absolute;
- right: 20rpx;
- top: 0;
- bottom: 0;
- margin: auto;
- width: 148rpx;
- height: 50rpx;
- line-height: 50rpx;
- border-radius: 25rpx;
- font-size: 28rpx;
- font-weight: 500;
- color: #F0E1C9;
- text-align: center;
- background: linear-gradient(-90deg, #8C5F1D 0%, #8C5F1C 77%, #875916 99%);
- }
- }
- .my-box {
- width: 690rpx;
- height: 246rpx;
- background: #FFFFFF;
- box-shadow: 0px 4rpx 13rpx 0px rgba(229,229,229,0.46);
- border-radius: 20rpx;
- margin: 20rpx auto;
- .box-tit {
- font-size: 28rpx;
- font-weight: bold;
- color: #333333;
- padding: 0 25rpx;
- height: 80rpx;
- .left-img {
- width: 33rpx;
- height: 32rpx;
- }
- view {
- padding-left: 20rpx;
- flex-grow: 1;
- }
- .right-img {
- width: 13rpx;
- height: 23rpx;
- }
- }
- .box-msg {
- height: 165rpx;
- .msg-item {
- width: 33%;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- .msg-val {
- font-size: 36px;
- font-weight: bold;
- color: #333333;
- }
- .msg-name {
- font-size: 22rpx;
- font-weight: 500;
- color: #666666;
- }
- }
- }
-
- }
- .user-list {
- width: 691rpx;
- height: 104rpx;
- background: #FFFFFF;
- box-shadow: 0px 0px 20rpx 0px rgba(50,50,52,0.06);
- border-radius: 28rpx;
- margin:20rpx auto;
- padding: 0 25rpx;
- .left-img {
- width: 40rpx;
- height: 40rpx;
- }
- view {
- padding-left: 20rpx;
- flex-grow: 1;
- font-size: 29rpx;
- font-weight: bold;
- color: #5D5D5D;
- }
- .right-img {
- width: 13rpx;
- height: 23rpx;
- }
- }
- </style>
|