Pārlūkot izejas kodu

完成详情页

yuanmingze 2 mēneši atpakaļ
vecāks
revīzija
96432e4853

+ 7 - 2
src/pages-task/task-entry-page/index.vue

@@ -1,4 +1,3 @@
-
 <template>
   <view class="task-entry">
     <view
@@ -6,6 +5,7 @@
       :key="item.id"
       class="task-entry__item"
       :style="{ background: item.backgroundColor }"
+      @click="toTask(item)"
     >
       <image class="task-entry__image" :src="item.img" mode="aspectFit" />
 
@@ -19,7 +19,7 @@
       </view>
 
       <view class="task-entry__action">
-        <wd-icon name="arrow-right" :color="item.color" size="48rpx" />
+        <wd-icon name="right" :color="item.color" size="48rpx" />
       </view>
     </view>
 
@@ -113,6 +113,11 @@ const getListTaskTypeIds = async () => {
   }
 }
 
+const toTask = (item: TaskItem) => {
+  uni.navigateTo({
+    url: `/pages-task/task-form/index?taskTitle=${item.title}&taskId=${item.id}`,
+  })
+}
 onLoad(async (options: PageLoadOptions = {}) => {
   setNavigationTitle(options.taskTitle)
   initTaskType(options.taskType)

+ 103 - 0
src/pages-task/task-form/index.vue

@@ -0,0 +1,103 @@
+<template>
+  <view class="task-form">
+    <view class="workbench-notice" v-if="showNotice">
+      <wd-notice-bar
+        :text="noticeText"
+        prefix="warn-bold"
+        type="info "
+        color="#f90"
+        background-color="#fdf6ec "
+      />
+    </view>
+  </view>
+</template>
+
+<script setup lang="ts">
+import { computed, ref } from 'vue'
+
+import { onLoad } from '@dcloudio/uni-app'
+
+import { getTaskContentConfigByTaskTypeIdApi } from '@/services/modules/task/taskFrom/index.ts'
+
+interface DynamicFormState {
+  values: {
+    [key: string]: {
+      label: string
+      value: string | number | boolean
+    }
+  }
+}
+
+const form = ref<DynamicFormState>({
+  values: {},
+})
+
+const getTaskContentConfigByTaskTypeId = async (id: string) => {
+  const res = await getTaskContentConfigByTaskTypeIdApi(id)
+  console.log('res', res)
+}
+
+type PageLoadOptions = {
+  taskTitle?: string
+  taskId?: string
+}
+
+const setNavigationTitle = (title?: string) => {
+  if (!title) return
+
+  uni.setNavigationBarTitle({
+    title,
+  })
+}
+
+const showNotice = ref(false)
+const noticeText = ref('')
+
+const setNotice = () => {
+  const showNoticeTaskIds = ['13', '14', '81', '99999']
+
+  let text = ''
+  if (!showNoticeTaskIds.includes(taskId.value)) return
+  switch (taskId.value) {
+    case '13':
+      text = '请以合法方式获取任务所需信息且不得侵犯任何商业秘密,否则将因此承担民/刑事责任。'
+      break
+    case '14':
+      text = '请勿统方,否则您将可能被医疗机构处罚并反馈至相关企业且被企业追究法律责任。'
+      break
+    case '81':
+      text = '注意该任务仅支持采集已购买产品的终端!'
+      break
+    case '99999':
+      text = '测试qaqaq'
+      break
+    default:
+      break
+  }
+
+  showNotice.value = true
+  noticeText.value = text
+}
+
+const taskId = ref('')
+
+onLoad(async (options: PageLoadOptions = {}) => {
+  setNavigationTitle(options.taskTitle)
+  taskId.value = options.taskId ?? ''
+
+  setNotice()
+
+  await getTaskContentConfigByTaskTypeId('99999')
+})
+</script>
+
+<style lang="scss" scoped>
+.task-form {
+  background: #f2f2f2;
+  min-height: 100vh;
+  padding: 20rpx 28rpx;
+
+  .workbench-notice {
+  }
+}
+</style>

+ 7 - 0
src/pages.json

@@ -204,6 +204,13 @@
             "navigationStyle": "default"
           }
         },
+        {
+          "path": "task-form/index",
+          "style": {
+            "navigationBarTitleText": "任务",
+            "navigationStyle": "default"
+          }
+        },
         {
           "path": "task-package/detail",
           "style": {

+ 8 - 0
src/services/modules/task/taskFrom/index.ts

@@ -0,0 +1,8 @@
+import http from '../../../index'
+import type { TaskContentConfigByTaskTypeIdResponse } from './type'
+
+export const getTaskContentConfigByTaskTypeIdApi = (id: string) => {
+  return http.get<TaskContentConfigByTaskTypeIdResponse>(
+    `/admin/api/getTaskContentConfigByTaskTypeId/${id}`
+  )
+}

+ 36 - 0
src/services/modules/task/taskFrom/type.d.ts

@@ -0,0 +1,36 @@
+import type { DictItem } from '@/services/modules/common/type'
+
+export interface TaskContentConfigByTaskTypeIdResponse {
+  config: TaskFieldConfigItem[]
+  dict: TaskFieldDictMap
+}
+
+export interface TaskFieldConfigItem {
+  id: number
+  alias: string | null
+  baseTypeId: string
+  taskTypeId: string
+  taskFiledKey: string
+  taskFiledValue: string
+  taskFiledType: string
+  taskFiledMinsize: number | null
+  taskFiledMaxsize: number | null
+  taskFiledAlert: string | null
+  dictGroupName: string | null
+  dictUrl: string | null
+  isMustfill: string | null
+  invisible: string | null
+  enableFlag: string | null
+  delFlag: string | null
+  seq: number | null
+  tenantId: number | null
+  deptId: number | null
+  createTime: string | null
+  updateTime: string | null
+  createUser: string | number | null
+  updateUser: string | number | null
+}
+
+export interface TaskFieldDictMap {
+  [dictGroupName: string]: DictItem[]
+}