addOpticsData.vue
4.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<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)
// console.log(newTime)
return newTime
},
getFirstName(name){
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>