提交 858ece8b authored 作者: 杨斌基's avatar 杨斌基

feat(发布类型): 新增交通违法分组

上级 5d215e41
...@@ -3,8 +3,10 @@ ...@@ -3,8 +3,10 @@
<view class="wrapper"> <view class="wrapper">
<view class="title">{{ title }}</view> <view class="title">{{ title }}</view>
<template v-for="list of totalList">
<view v-if="list.title" class="category">{{ list.title }}</view>
<u-grid style="padding: 0 30rpx"> <u-grid style="padding: 0 30rpx">
<u-grid-item v-for="(item, index) in list" :key="item.id" @click="onListClick(item, index)"> <u-grid-item v-for="(item, index) in list.data" :key="item.id" @click="onListClick(item, index)">
<view style="padding: 20rpx 10rpx; display: flex; flex-direction: column; align-items: center; justify-content: flex-start"> <view style="padding: 20rpx 10rpx; display: flex; flex-direction: column; align-items: center; justify-content: flex-start">
<image :src="item.img" style="display: block; width: 120rpx; height: 120rpx" /> <image :src="item.img" style="display: block; width: 120rpx; height: 120rpx" />
<view style="height: 16rpx" /> <view style="height: 16rpx" />
...@@ -12,6 +14,7 @@ ...@@ -12,6 +14,7 @@
</view> </view>
</u-grid-item> </u-grid-item>
</u-grid> </u-grid>
</template>
<!-- 取消举报说明 <!-- 取消举报说明
<view style="height: 120rpx" /> <view style="height: 120rpx" />
...@@ -33,6 +36,14 @@ ...@@ -33,6 +36,14 @@
</template> </template>
<script> <script>
const categoryMap = {
1: '违反交通信号灯指示',
2: '违反标志标线',
3: '违章乱停',
4: '不文明驾驶',
5: '其他违法行为',
}
export default { export default {
data() { data() {
return { return {
...@@ -44,6 +55,8 @@ export default { ...@@ -44,6 +55,8 @@ export default {
isFirstRecordType: 0, isFirstRecordType: 0,
isFirstRecordTypeId: 0, isFirstRecordTypeId: 0,
totalList: []
}; };
}, },
...@@ -67,6 +80,21 @@ export default { ...@@ -67,6 +80,21 @@ export default {
async fetchPhotoTaskTypeData() { async fetchPhotoTaskTypeData() {
const { list } = await uni.$u.http.get('/api/app/phototasktype/list', { params: { parent_id: this.query.id } }); const { list } = await uni.$u.http.get('/api/app/phototasktype/list', { params: { parent_id: this.query.id } });
this.list = list; this.list = list;
// 可分类
if (list.some(v => v.category > 0)) {
this.totalList = Object.keys(categoryMap).map((c, index) => {
const category = +c
const data = list.filter(v => v.category === category)
const res = {
title: categoryMap[category],
data,
}
return res
})
return
}
this.totalList = [{ data: list }]
}, },
async fetchPhotoTaskTypeDetail() { async fetchPhotoTaskTypeDetail() {
...@@ -121,4 +149,10 @@ export default { ...@@ -121,4 +149,10 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
@import 'index.scss'; @import 'index.scss';
.category {
padding: 0 40rpx;
font-weight: bold;
font-size: 36rpx;
}
</style> </style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论