|
@@ -1,58 +1,60 @@
|
|
|
<script lang="ts" setup>
|
|
|
+import { addQuestionReportData, pageQuestionReportData } from '@/api/questionReqort';
|
|
|
+import { AddQuestionReportDataReq, QuestionListRes } from '@/api/questionReqort/types'
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
const active = ref(0)
|
|
|
|
|
|
-const formData = ref({})
|
|
|
-const range = ref([
|
|
|
- {
|
|
|
- text: '功能问题',
|
|
|
- value: '1',
|
|
|
- },
|
|
|
- {
|
|
|
- text: '界面问题',
|
|
|
- value: '2',
|
|
|
- },
|
|
|
- {
|
|
|
- text: '其他问题',
|
|
|
- value: '3',
|
|
|
- },
|
|
|
-])
|
|
|
-/**
|
|
|
- * 上传图片
|
|
|
- */
|
|
|
-const imageValue = ref([])
|
|
|
-const select = (e) => {}
|
|
|
-const progress = (e) => {
|
|
|
- console.log(e)
|
|
|
-}
|
|
|
-const success = (e) => {
|
|
|
- console.log(e)
|
|
|
-}
|
|
|
-const fail = (e) => {
|
|
|
- console.log(e)
|
|
|
-}
|
|
|
+const formData = ref<AddQuestionReportDataReq & { location?: string }>({})
|
|
|
+const range = ref([])
|
|
|
+const rules = ref({
|
|
|
+ type: [{ required: true, message: '请选择问题类型' }],
|
|
|
+ title: [{ required: true, message: '请输入问题标题' }],
|
|
|
+ content: [{ required: true, message: '请输入问题内容' }],
|
|
|
+ location: [{ required: true, message: '请输入问题所在地' }],
|
|
|
+})
|
|
|
|
|
|
-const submit = () => {
|
|
|
- console.log(formData.value)
|
|
|
+/** 上报问题 */
|
|
|
+const submit = async () => {
|
|
|
+ const { data } = await addQuestionReportData(formData.value)
|
|
|
+ if (data) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '上报成功',
|
|
|
+ icon: 'success',
|
|
|
+ duration: 1000,
|
|
|
+ })
|
|
|
+ formData.value = {}
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 已上报问题
|
|
|
*/
|
|
|
-const list = ref([])
|
|
|
-const onLoad = () => {
|
|
|
- list.value.push('列表')
|
|
|
+const list = ref<QuestionListRes[]>([])
|
|
|
+const pageInfo = ref({
|
|
|
+ pageNumber: 1,
|
|
|
+ pageSize: 10,
|
|
|
+})
|
|
|
+const questList = async () => {
|
|
|
+ const { data } = await pageQuestionReportData({
|
|
|
+ pageNumber: pageInfo.value.pageNumber,
|
|
|
+ pageSize: pageInfo.value.pageSize,
|
|
|
+ })
|
|
|
+ list.value = list.value.concat(data.records)
|
|
|
+ pageInfo.value.pageNumber++
|
|
|
+ finished.value = data.records.length < pageInfo.value.pageSize
|
|
|
+ loading.value = false
|
|
|
+ if (data.records.length === 0 || !data.records) {
|
|
|
+ finished.value = true
|
|
|
+ }
|
|
|
}
|
|
|
const loading = ref(false)
|
|
|
const finished = ref(false)
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/** 跳转问题详情 */
|
|
|
-const handleGoDetail = () => {
|
|
|
+const handleGoDetail = (item: QuestionListRes) => {
|
|
|
uni.navigateTo({
|
|
|
- url: '/subPages/pages/reportProblems/questDetail',
|
|
|
+ url: `/subPages/pages/reportProblems/detail?id=${item.uuid}`,
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -62,51 +64,38 @@ const handleGoDetail = () => {
|
|
|
<van-tabs v-model:active="active" type="card" class="top-tabs">
|
|
|
<van-tab title="上报问题">
|
|
|
<view class="tab-container">
|
|
|
- <uni-forms :modelValue="formData">
|
|
|
- <uni-forms-item label="问题类型" name="type">
|
|
|
- <uni-data-select v-model="formData.type" :localdata="range"></uni-data-select>
|
|
|
+ <uni-forms :modelValue="formData" :rules="rules" label-align="right" label-width="80">
|
|
|
+ <uni-forms-item label="问题类型" required name="questionType">
|
|
|
+ <uni-data-select v-model="formData.questionType" :localdata="range"></uni-data-select>
|
|
|
</uni-forms-item>
|
|
|
<!-- 问题标题 -->
|
|
|
- <uni-forms-item label="问题标题" name="title">
|
|
|
- <uni-easyinput v-model="formData.title" placeholder="请输入问题标题"></uni-easyinput>
|
|
|
+ <uni-forms-item label="问题标题" required name="questionTitle">
|
|
|
+ <uni-easyinput v-model="formData.questionTitle" placeholder="请输入问题标题"></uni-easyinput>
|
|
|
</uni-forms-item>
|
|
|
<!-- 问题内容 -->
|
|
|
- <uni-forms-item label="问题内容" name="content">
|
|
|
- <uni-easyinput v-model="formData.content" type="textarea" placeholder="请输入问题内容"></uni-easyinput>
|
|
|
+ <uni-forms-item label="问题内容" required name="questionContent">
|
|
|
+ <uni-easyinput v-model="formData.questionContent" type="textarea" placeholder="请输入问题内容"></uni-easyinput>
|
|
|
</uni-forms-item>
|
|
|
<!-- 问题所在地 -->
|
|
|
- <uni-forms-item label="问题所在地" name="location">
|
|
|
- <uni-easyinput v-model="formData.location" placeholder="请输入问题所在地"></uni-easyinput>
|
|
|
- </uni-forms-item>
|
|
|
- <!-- 上传附件 -->
|
|
|
- <uni-forms-item label="上传附件" name="attachment">
|
|
|
- <uni-file-picker
|
|
|
- v-model="imageValue"
|
|
|
- fileMediatype="image"
|
|
|
- mode="grid"
|
|
|
- @select="select"
|
|
|
- @progress="progress"
|
|
|
- @success="success"
|
|
|
- @fail="fail"
|
|
|
- />
|
|
|
- <view class="mt-[10px]">支持上传jpg、png、jpeg、pdf的格式</view>
|
|
|
+ <uni-forms-item label="问题所在地" required name="addrName">
|
|
|
+ <uni-easyinput v-model="formData.addrName" placeholder="请输入问题所在地"></uni-easyinput>
|
|
|
</uni-forms-item>
|
|
|
</uni-forms>
|
|
|
- <van-button type="primary" @click="submit">提交</van-button>
|
|
|
+ <van-button class="w-full mb-3" type="primary" @click="submit">提交</van-button>
|
|
|
</view>
|
|
|
</van-tab>
|
|
|
<van-tab title="已上报问题">
|
|
|
<view class="tab-container">
|
|
|
- <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
|
|
|
- <view class="list-item-style">
|
|
|
+ <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="questList">
|
|
|
+ <view v-for="item in list" :key="item.uuid" class="list-item-style">
|
|
|
<view class="top">
|
|
|
- <view class="title">xxx</view>
|
|
|
- <van-button plain hairline size="mini" type="primary" @click="handleGoDetail">查看详情</van-button>
|
|
|
+ <view class="title">{{ item.questionTitle }}</view>
|
|
|
+ <van-button plain hairline size="mini" type="primary" @click="handleGoDetail(item)">查看详情</van-button>
|
|
|
</view>
|
|
|
- <view>定位:xxxx</view>
|
|
|
+ <view>定位:{{ item.addrName }}</view>
|
|
|
<view class="flex gap-3">
|
|
|
<view class="type">问题类型</view>
|
|
|
- <van-tag color="#7232dd">标签</van-tag>
|
|
|
+ <van-tag color="#CFFECE" text-color="black">{{ item.questionType }}</van-tag>
|
|
|
</view>
|
|
|
</view>
|
|
|
</van-list>
|
|
@@ -123,8 +112,14 @@ const handleGoDetail = () => {
|
|
|
}
|
|
|
.tab-container {
|
|
|
padding: 20px;
|
|
|
+ padding-bottom: 30px;
|
|
|
min-height: calc(100vh - var(--van-tabs-card-height));
|
|
|
box-sizing: border-box;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ > uni-view:first-child {
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
}
|
|
|
.list-item-style {
|
|
|
padding: 20px;
|