uniApp和微信小程序好看的我的页面(有源码)

uniApp和微信小程序好看的我的页面(有源码)

1.先睹为快

未登录状态

在这里插入图片描述
以登录

在这里插入图片描述

uniapp源码

<template>
	<view class="content">
		<view class="content_image">
			<image :src="url" mode="aspectFill"  @click="changImg"></image>
		</view>
		<!-- 内容 -->
		<view class="content_botton">
			<view class="content_info" v-if="userinfo">
				<image :src="userinfo.avatarUrl" mode=""></image>
				<view class="username">
					{{userinfo.nickName}}
				</view>
				<view class="select">
					<view >收藏店铺 12</view>
					<view @click="myCollect">收藏商品 ({{collectNum}})</view>
				</view>
			</view>
			<view v-else class="noLogin">
				<image src="../../static/my/weixin.png" mode="widthFix" @click="login"></image>
				<view class="">点击图片登录</view>
			</view>
			<!--  -->
			<view class="my_order">
				<view class="my_order_title">
					我的订单
				</view>
				<view class="my_order_item" v-for="item in list">
					<view class="my_order_content">
						<image :src="item.url" mode="widthFix"></image>
						<view class="">{{item.name}}</view>
					</view>
				</view>
			</view>
			<!--  -->
			<view class="other">
				<view class="other_addres" @click="addAdress">
					<view >我的地址</view>
					<image src="../../static/my/right.png" mode="widthFix"></image>
				</view>
				<view class="other_our">
					<view>联系我们</view>
					<image src="../../static/my/right.png" mode="widthFix"></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[
					{
						id:1,
						url:'../../static/my/order.png',
						name:"全部订单"
					},
					{
						id:2,
						url:'../../static/my/pay.png',
						name:"待付款"
					},
					{
						id:3,
						url:'../../static/my/getShop.png',
						name:"待发货"
					},
					{
						id:4,
						url:'../../static/my/gopay.png',
						name:"退款"
					}
				],
				url:'',
				userinfo:[],
				collectNum:0
			}
		},
		onShow() {
		 this.userinfo=uni.getStorageSync('user')	
		  this.url=uni.getStorageSync('url')	
		  let  collect=uni.getStorageSync('collect')
		  this.collectNum=collect.length;
		},
		methods: {
			changImg(){
				uni.chooseImage({
					count: 1, //默认9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
					sourceType: ['album'], //从相册选择
					success: function (res) {
						console.log(JSON.stringify(res.tempFilePaths))
						uni.setStorageSync('url',res.tempFilePaths[0])
					}
				});
				this.onShow()
				uni.usei
			},
			login(){
				var that=this
				// #ifdef MP-WEIXIN
				    wx.getUserProfile({
				         desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
				         success: (res) => {
							 console.log(res)
				           that.userinfo=res.userInfo
						   wx.setStorageSync('user',res.userInfo);
				         }
				       })
				// #endif
	
			},
			// 添加地址
			addAdress(){
			 uni.chooseAddress({
			 	success(res) {
			 		console.log(res)
					uni.setStorageSync("address",res);
			 	}
			 })  
			 },
			 myCollect(){
				 uni.navigateTo({
				 	url:'/pages/myCollect/myCollect'
				 })
			 }
		}
	}
</script>

<style lang="scss">
	page{
		background-color:#eee;
	}
   .content_image{
	   image{
		   // 高斯模糊
		   filter: blur(3rpx);
		   width: 100%;
	   }
	   height: 300rpx;
	   position: relative;
   }
   .content_botton{
	   .noLogin{
		   position: absolute;
		   left: 45%;
		     transform: translate(-50%);
		    display: flex;
		    flex-direction: column;
		    align-items: center;
		    justify-content: space-around;
		    margin-top: 15%;
		    margin-left: 5%;
		    border-radius: 20rpx;
		    width: 90%;
		    height: 250rpx;
		    background-color:#fff;
		   justify-content: center;
		   align-items: center;
		   position: relative;
		   image{
			   width: 100rpx;
			   height: 100rpx;
		   }
	   }
	   .content_info{
		  position: relative;
		    z-index: 999;
		   display: flex;
		   flex-direction: column;
		   align-items: center;
		   justify-content: space-around;
		   margin-top: 15%;
		   margin-left: 5%;
		   border-radius: 20rpx;
		   width: 90%;
		   height: 250rpx;
		   background-color:#fff;
		   image{
			   margin-top: -40rpx;
			   width: 130rpx;
			   height: 130rpx;
			   border-radius: 50%;
		   }
		   .username{
			   
		   }
		   .select{
			   display: flex;
			   justify-content: space-between;
			   view{
				   padding: 0 40rpx;
			   }
		   }
	   }
	   .my_order{
		   width: 90%;
		   margin-top: 10rpx;
		   margin-left: 5%;
		   height: 280rpx;
		   border-radius: 20rpx;
		   background-color: #fff;
		   .my_order_title{
			   border-radius: 20rpx;
			   padding-left: 20rpx;
			   line-height: 80rpx;
			   height: 80rpx;
		   }
		   .my_order_item{
			   padding: 4.5%;
		       float: left;
			  .my_order_content{
				  display: flex;
				  flex-direction: column;
				  align-items: center;
				  justify-content: space-between;
				  image{
				  		width: 80rpx;
				  		height: 50rpx;
				  }
			  }
		   }
	   }
   }
   .other{
	  margin: 10rpx 40rpx;
	   height: 190rpx;
	   width: 90%;
	   border-radius: 20rpx;
	   background-color: #fff;
	   .other_addres{
		   height: 60rpx;
		   padding: 20rpx 20rpx;
		   border-bottom: 1rpx dashed gainsboro;
		   display: flex;
		   justify-content: space-between;
		   image{
			   width: 50rpx;
		   }
	   }
	   .other_our{
		   height: 60rpx;
		   padding: 20rpx 20rpx;
		   display: flex;
		   justify-content: space-between;
		   image{
		   		width: 50rpx;
		   }
	   }
   }
</style>

记得点赞哦

  • 7
    点赞
  • 30
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

code袁

你的支持是我莫大的幸运

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值