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
| <template>
| <view class="pages-task">
| <view class="header">
| <view class="item">
| <view class="title">{{accumulated_duration}}<text class="text">min</text></view>
| <view class="text">累计时长</view>
| </view>
| <view class="item">
| <view class="title">{{accumulated_mileage}}<text class="text">m</text></view>
| <view class="text">累计里程</view>
| </view>
| <view class="item">
| <view class="title">{{cumulative_number}}</view>
| <view class="text">累计次数</view>
| </view>
| </view>
| <view class="list">
| <TaskItemView class="item" v-for="(item,index) in list" :key="index" :taskData="item"
| @click-item="clickMap">
|
| </TaskItemView>
| </view>
| </view>
| </template>
|
| <script>
| import {
| showToast,
| showModal
| } from "@/comm/utils.js"
| import TaskItemView from "./infos/task-item.vue"
| export default {
| name: "PagesTask",
| components: {
| TaskItemView
| },
| data() {
| return {
| accumulated_duration: 167991,
| accumulated_mileage: 7532556,
| cumulative_number: 6000,
| list: [{
| name: "地图1",
| date: "5-18",
| accumulated_duration: 5693,
| accumulated_mileage: 6421,
| cumulative_number: 55,
| }, {
| name: "地图2",
| date: "5-08",
| accumulated_duration: 888,
| accumulated_mileage: 642,
| cumulative_number: 31,
| }, {
| name: "地图3",
| date: "4-28",
| accumulated_duration: 998,
| accumulated_mileage: 2421,
| cumulative_number: 85,
| }, {
| name: "地图4",
| date: "4-28",
| accumulated_duration: 688,
| accumulated_mileage: 1421,
| cumulative_number: 65,
| }]
| }
| },
| computed: {
|
| },
|
| methods: {
| setData(obj) {
| let that = this;
| let keys = [];
| let val, data;
|
| Object.keys(obj).forEach(function(key) {
| keys = key.split(".");
| val = obj[key];
| data = that.$data;
| keys.forEach(function(key2, index) {
| if (index + 1 == keys.length) {
| that.$set(data, key2, val);
| } else {
| if (!data[key2]) {
| that.$set(data, key2, {});
| }
| }
| data = data[key2];
| });
| });
| },
| clickMap(item) {
| uni.navigateTo({
| url: "/pages/task/map-task"
| })
| }
|
| }
| }
| </script>
|
| <style lang="scss">
| .pages-task {
| display: flex;
| width: 750rpx;
| height: 100vh;
| flex-direction: column;
|
| .header {
| width: 100%;
| padding: 10px;
| height: 30px;
| display: flex;
| flex-direction: row;
|
| .item {
| padding: 0 10px;
| display: flex;
| width: 100%;
| flex-direction: column;
| flex: 1;
|
| .title {
| font-size: 20px;
| font-weight: 700;
| }
|
| .text {
| font-size: 14px;
| color: #888;
| }
| }
| }
|
| .list {
| width: calc(100% - 40px);
| margin: 10px;
| padding: 0 10px;
| display: flex;
| flex-direction: column;
| flex: 1;
| overflow: auto;
|
| .item {
| border-bottom: 1px solid #ddd;
| }
|
|
| }
|
| }
| </style>
|
|