Browse Source

feature : 上传问题页面完成

梦辉 2 months ago
parent
commit
aa71563281

+ 5 - 0
components.d.ts

@@ -8,12 +8,17 @@ export {}
 declare module 'vue' {
   export interface GlobalComponents {
     VanButton: typeof import('vant/es')['Button']
+    VanCell: typeof import('vant/es')['Cell']
     VanCellGroup: typeof import('vant/es')['CellGroup']
     VanDivider: typeof import('vant/es')['Divider']
     VanField: typeof import('vant/es')['Field']
     VanForm: typeof import('vant/es')['Form']
     VanIcon: typeof import('vant/es')['Icon']
+    VanList: typeof import('vant/es')['List']
     VanPopup: typeof import('vant/es')['Popup']
+    VanTab: typeof import('vant/es')['Tab']
+    VanTabs: typeof import('vant/es')['Tabs']
+    VanTag: typeof import('vant/es')['Tag']
     VanUploader: typeof import('vant/es')['Uploader']
   }
 }

+ 14 - 1
src/pages.json

@@ -10,7 +10,20 @@
   "subPackages": [
     {
       "root": "subPages",
-      "pages": []
+      "pages": [
+        {
+          "path": "pages/reportProblems/index",
+          "style": {
+            "navigationBarTitleText": "上报问题"
+          }
+        },
+        {
+          "path": "pages/reportProblems/questDetail",
+          "style": {
+            "navigationBarTitleText": "问题详情"
+          }
+        }
+      ]
     }
   ],
   "globalStyle": {

+ 24 - 8
src/pages/index/index.vue

@@ -1,13 +1,29 @@
-<script setup lang="ts">
-
-</script>
+<script setup lang="ts"></script>
 
 <template>
-  <view class="common-page-containerBar">
-    <view class="common-content">
-      测试
-    </view>
+  <view class="container">
+    <navigator url="/subPages/pages/reportProblems/index">上报问题</navigator>
+    <navigator url="/pages/somepage/somepage">上报服务</navigator>
+    <navigator url="/pages/somepage/somepage">店铺/企业检查结果</navigator>
+    <navigator url="/pages/somepage/somepage">我的管理</navigator>
   </view>
 </template>
 
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+.container {
+  padding: 20px;
+  margin-top: 40px;
+  display: grid;
+  grid-template-columns: repeat(2, 1fr);
+  gap: 20px;
+  uni-navigator {
+    border: 1px solid black;
+    border-radius: 8px;
+    padding: 40px;
+    height: 100px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+  }
+}
+</style>

+ 9 - 0
src/style/base/custom-reset.scss

@@ -6,3 +6,12 @@
 :root:root {
   --van-primary-color: #12a4f2;
 }
+
+.uni-toast__icon {
+  margin-right: auto;
+  margin-left: auto;
+}
+
+.van-toast {
+  background-color: var(--van-toast-background) !important;
+}

+ 2 - 1
src/style/common.scss

@@ -1,11 +1,12 @@
 .common-page-containerBar {
   overflow-y: auto;
-  height: calc(100vh - 50px);
+  height: calc(100vh - 85px);
   display: flex;
   flex-direction: column;
 }
 .common-content {
   padding: 12px;
+  padding-bottom: 65px;
   flex: 1;
   overflow-y: auto;
 }

+ 1 - 0
src/style/index.scss

@@ -1,6 +1,7 @@
 @tailwind base;
 @tailwind components;
 @tailwind utilities;
+@import 'vant/lib/index.css';
 
 @import "./base/custom-reset";
 @import "common";

+ 149 - 0
src/subPages/pages/reportProblems/index.vue

@@ -0,0 +1,149 @@
+<script lang="ts" setup>
+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 submit = () => {
+  console.log(formData.value)
+}
+
+/**
+ * 已上报问题
+ */
+const list = ref([])
+const onLoad = () => {
+  list.value.push('列表')
+}
+const loading = ref(false)
+const finished = ref(false)
+
+
+
+/** 跳转问题详情 */
+const handleGoDetail = () => {
+  uni.navigateTo({
+    url: '/subPages/pages/reportProblems/questDetail',
+  })
+}
+
+</script>
+
+<template>
+  <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-item>
+          <!-- 问题标题 -->
+          <uni-forms-item label="问题标题" name="title">
+            <uni-easyinput v-model="formData.title" 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>
+          <!-- 问题所在地 -->
+          <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>
+        </uni-forms>
+        <van-button 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">
+            <view class="top">
+              <view class="title">xxx</view>
+              <van-button plain hairline size="mini" type="primary" @click="handleGoDetail">查看详情</van-button>
+            </view>
+            <view>定位:xxxx</view>
+            <view class="flex gap-3">
+              <view class="type">问题类型</view>
+              <van-tag color="#7232dd">标签</van-tag>
+            </view>
+          </view>
+        </van-list>
+      </view>
+    </van-tab>
+  </van-tabs>
+</template>
+
+<style lang="scss" scoped>
+.top-tabs {
+  :deep(.van-tabs__nav) {
+    margin: 0;
+  }
+}
+.tab-container {
+  padding: 20px;
+  min-height: calc(100vh - var(--van-tabs-card-height));
+  box-sizing: border-box;
+}
+.list-item-style {
+  padding: 20px;
+  margin-bottom: 10px;
+  background-color: white;
+  > view {
+    margin-bottom: 10px;
+  }
+  .top {
+    display: flex;
+    align-items: center;
+    .title {
+      font-size: 20px;
+      font-weight: bold;
+      flex: 1;
+    }
+    .type {
+      margin-right: 10px;
+    }
+  }
+}
+</style>

+ 53 - 0
src/subPages/pages/reportProblems/questDetail.vue

@@ -0,0 +1,53 @@
+<script lang="ts" setup></script>
+
+<template>
+  <view class="p-[20px]">
+    <view class="form-item">
+      <view class="label">问题类型:</view>
+      <view class="flex value">
+        <view class="value">xx</view>
+        <van-tag color="#7232dd">xx</van-tag>
+      </view>
+    </view>
+    <!-- 问题标题 -->
+    <view class="form-item">
+      <view class="label">问题标题:</view>
+      <view class="value">xx</view>
+    </view>
+    <!-- 问题内容 -->
+    <view class="form-item">
+      <view class="label">问题内容:</view>
+      <view class="value">xx</view>
+    </view>
+    <!-- 问题所在地 -->
+    <view class="form-item">
+      <view class="label">问题所在地:</view>
+      <view class="value">xx</view>
+    </view>
+    <!-- 附件 -->
+    <view class="form-item">
+      <view class="label">附件:</view>
+      <view class="value">xx</view>
+    </view>
+    <van-divider></van-divider>
+    <!-- 问题解答 -->
+    <view class="form-item">
+      <view class="label">问题解答:</view>
+      <view class="value">xx</view>
+    </view>
+  </view>
+</template>
+
+<style lang="scss" scoped>
+.form-item {
+  display: flex;
+  align-items: center;
+  padding: 10px;
+  .label {
+    flex: 1;
+  }
+  .value {
+    flex: 1;
+  }
+}
+</style>

+ 1 - 4
tailwind.config.js

@@ -1,9 +1,6 @@
 /** @type {import('tailwindcss').Config} */
 module.exports = {
-  content: [
-    "./index.html",
-    "./src/**/*.{vue,js,ts,jsx,tsx}",
-  ],
+  content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}', './src/**/**/*.{vue,js,ts,jsx,tsx}'],
   theme: {
     extend: {},
   },