addOpticsData.vue 4.28 KB
<template>
	<view class="wrap">
		<view class="header">
			<view class="headerLeft" @click=tapShow(0)>
				<text>如何查看验光单?</text>
				<image src="../../static/dataLook.png" mode="aspectFit"></image>
			</view>
			<view class="headerRight" @click=tapShow(1)>
				<text>如何查看眼镜框架?</text>
				<image src="../../static/glassLook.png" mode="aspectFit"></image>
			</view>
		</view>
		<view class="dataMenu">
			<uni-collapse accordion="true">
				<view class="item" v-for="(loveItem,index) in loveList" :key="index">
					<uni-collapse-item :title='loveItem.name' :time='getRightTime(loveItem.in_time)' :iconText='getFirstName(loveItem.name)' showAnimation='true'>
					    <view class="loveDataInfo">
							<view class="dataInfoItem">
								<text>度数(SPH):</text><text>左:{{loveItem.leftSph}}</text><text>右:{{loveItem.rightSph}}</text>
							</view>
							<view class="dataInfoItem">
								<text>散光(CYL):</text><text>左:{{loveItem.leftCyl}}</text><text>右:{{loveItem.rightCyl}}</text>
							</view>
							<view class="dataInfoItem">
								<text>轴位(AXI):</text><text>左:{{loveItem.leftAxi}}</text><text>右:{{loveItem.rightAxi}}</text>
							</view>
							<view class="dataInfoItem">
								<text>瞳距(PD):</text><text>{{loveItem.pd}}</text>
							</view>
					    </view>
					</uni-collapse-item>
				</view>
			</uni-collapse>
		</view>
		<view class="footer">
			<button class="btn" type="default">新建验光单</button>
		</view>
	</view>
</template>

<script>
	import UniCollapse from '@/components/UniCollapse/UniCollapse.vue'
	import UniCollapseItem from '@/components/UniCollapseItem/UniCollapseItem.vue'
	// import uniPopup from '@/components/uni-popup/uni-popup.vue'
	import store from '@/store';
	export default {
		components: {UniCollapse,UniCollapseItem},
		data() {
			return {
				
			};
		},
		onLoad: function(option) {
			//获取关心的人列表
			store.dispatch('myLoveList/getLoveList', {
				uid: "1",
			}); 
		},
		computed:{
			loveList() {
				console.log(this.$store.state.myLoveList.loveList)
				return this.$store.state.myLoveList.loveList || []
			},
		},
		methods:{
			tapShow(item){
				switch(item){
					// 0左边  1右边  
					case '0':
						
					break;
					case '1':
					
					break;
				}
			},
			//给时间搞一个nice的格式
			getRightTime(time){
				//如果小于10 则返回'0'+m
				function add(m){return m<10?'0'+m:m}
				const oldTime = (new Date(time)).getTime()
				const year = new Date(oldTime).getFullYear()
				const month = new Date(oldTime).getMonth()+1
				const day = new Date(oldTime).getDate()
				const newTime = add(year)+'-'+add(month)+'-'+add(day)
				return newTime
			},
			getFirstName(name){
				console.log(name.substring(0,1))
				return name.substring(0,1)
			}
		}
	}
</script>

<style lang="scss">
	.wrap{
		min-height: 100vh;
		width: 100%;
		background-color: #F2F2F2;
		.header{
			height: 304rpx;
			width: 100%;
			background-color: #FFFFFF;
			display: flex;
			justify-content: space-around;	
			align-items: center;
			view{
				height: 210rpx;
				width: 304rpx;
				background: #FDF7F5;
				border-radius: 4px;
				border-radius: 4px;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				text{
					font-size: 12px;
					color: #333333;
				}
				image{
					height: 144rpx;
					width: 144rpx;
				}
			}
		}
		.dataMenu{
			margin-top: 20rpx;
			box-shadow: 0 0 4px 0 rgba(133,107,107,0.10);
			width: 100%;
			background-color: #FFFFFF;
			.item{
				padding: 0 40rpx;
				.loveDataInfo{
					padding: 0 44rpx 0 70rpx;
					display: flex;
					justify-content: space-around;
					flex-direction: column;
					align-items: flex-start;
					.dataInfoItem{
						font-size: 12px;
						color: #333333;
						margin-bottom: 34rpx;
						text{
							font-size: 12px;
							color: #2A2A2A;
							margin-right: 20rpx;
						}
					}
				}
			}
		}
		.footer{
			width: 100%;
			position: fixed;
			bottom: 0;
			left: 0;
			.btn{
				width: 100%;
				height: 112rpx;
				line-height: 112rpx;
				background: #FF6B4A;
				font-size: 16px;
				color: #FFFFFF;
			}
		}
	}
	
</style>