Преглед изворни кода

修改需求和成果详情

zs пре 1 година
родитељ
комит
19a5d829ed
2 измењених фајлова са 213 додато и 69 уклоњено
  1. 117 37
      src/views/achievement/detail.vue
  2. 96 32
      src/views/demand/detail.vue

+ 117 - 37
src/views/achievement/detail.vue

@@ -5,7 +5,7 @@
         <div class="w_1200">
           <el-col :span="24" class="one">
             <el-row :span="24" class="one_1">
-              <el-col :span="20" class="title">{{ info.title || '暂无标题' }}</el-col>
+              <el-col :span="20" class="title">{{ info.name || '暂无标题' }}</el-col>
               <el-col :span="4" class="file">
                 <el-icon>
                   <Download />
@@ -13,46 +13,72 @@
                 附件下载
               </el-col>
             </el-row>
-            <el-row :span="24" class="one_2"> 普通许可 </el-row>
+            <el-row :span="24" class="one_2"> {{ getDict(info.sell, 'sell') }} </el-row>
           </el-col>
           <el-col :span="24" class="two">
             <a-descriptions bordered>
-              <a-descriptions-item label="行业分类">行业分类</a-descriptions-item>
-              <a-descriptions-item label="成果属性">成果属性</a-descriptions-item>
-              <a-descriptions-item label="出让方式">出让方式</a-descriptions-item>
-              <a-descriptions-item label="成熟度">成熟度</a-descriptions-item>
-              <a-descriptions-item label="技术分类">技术分类</a-descriptions-item>
-              <a-descriptions-item label="成果地区">成果地区</a-descriptions-item>
-              <a-descriptions-item label="发布时间">发布时间</a-descriptions-item>
+              <a-descriptions-item label="行业分类">
+                {{ getDict(info.field, 'field') }}
+              </a-descriptions-item>
+              <a-descriptions-item label="成果属性">
+                {{ getDict(info.attribute, 'attribute') }}
+              </a-descriptions-item>
+              <a-descriptions-item label="出让方式">
+                {{ getDict(info.sell, 'sell') }}
+              </a-descriptions-item>
+              <a-descriptions-item label="成熟度">
+                {{ getDict(info.mature, 'mature') }}
+              </a-descriptions-item>
+              <a-descriptions-item label="技术分类">
+                {{ getDict(info.technology, 'technology') }}
+              </a-descriptions-item>
+              <a-descriptions-item label="成果地区">
+                {{ getArea(info.area) }}
+              </a-descriptions-item>
+              <a-descriptions-item label="发布时间">
+                {{ info.time }}
+              </a-descriptions-item>
             </a-descriptions>
           </el-col>
+          <el-col :span="24" class="pointer">
+            <div class="money">
+              参考价格:<span> {{ info.money || '面议' }} </span>
+            </div>
+            <a-button type="primary"> 我要买 </a-button>
+          </el-col>
+          <el-col :span="24" class="pointer" v-if="!user && !user._id">
+            提醒:您还没有登录,登录成功后再对接
+          </el-col>
           <el-col :span="24" class="thr">
             <el-col :span="24" class="thr_1">
               <p>单位信息</p>
             </el-col>
             <el-row :span="24" class="thr_2">
-              <el-col :span="17" class="left">
+              <el-col :span="16" class="left">
                 <el-col :span="24" class="name">
-                  {{ info.unit || '暂无' }}
+                  {{ unit.name || '暂无' }}
                 </el-col>
                 <el-col :span="24" class="other">
-                  <span>联系人</span>{{ info.unit || '暂无' }}
+                  <span>联系人</span>
+                  {{ unit.contacts || '暂无' }}
                 </el-col>
               </el-col>
-              <el-col :span="4" class="right">
+              <el-col :span="8" class="right">
                 <a-button type="primary">
                   <template #icon>
                     <MessageOutlined />
                   </template>
                   点击在线洽谈
                 </a-button>
+                <a-button class="button"> 进入单位 </a-button>
+                <a-button class="button"> 收藏单位 </a-button>
               </el-col>
             </el-row>
           </el-col>
           <a-divider />
           <el-col :span="24" class="four">
             <el-col :span="24" class="four_1">
-              <p>成果描述</p>
+              <p>成果详情</p>
             </el-col>
             <el-col :span="24" class="four_2">{{ info.brief || '暂无' }}</el-col>
           </el-col>
@@ -65,17 +91,28 @@
 <script setup>
 // 基础
 import { MessageOutlined } from '@ant-design/icons-vue'
-
+import { get } from 'lodash-es'
+const $checkRes = inject('$checkRes')
+// 接口
+import { AchievementStore } from '@/store/api/platform/achievement'
+import { DictDataStore } from '@/store/api/system/dictData'
+const store = AchievementStore()
+const dictDataStore = DictDataStore()
+import { UserStore } from '@/store/user'
+const userStore = UserStore()
+const user = computed(() => userStore.user)
+// 路由
+const route = useRoute()
 // 加载中
 const loading = ref(false)
-const info = ref({
-  unit: '舟山海韵机械制造有限公司',
-  title: '双头颗粒灌装机',
-  time: '2024-01-05 09:12:23',
-  end_time: '2024-01-05 09:12:23',
-  money: '3',
-  brief: '一种双头颗粒的灌装机'
-})
+const info = ref({})
+const unit = ref({ name: '吉林大学', contacts: '陈老师' })
+// 字典表
+const fieldList = ref([])
+const attributeList = ref([])
+const matureList = ref([])
+const sellList = ref([])
+const technologyList = ref([])
 // 请求
 onMounted(async () => {
   loading.value = true
@@ -84,22 +121,43 @@ onMounted(async () => {
   loading.value = false
 })
 const search = async () => {
-  //   let id = route.query.id;
-  //   if (id) {
-  //     let res: IQueryResult = await userCheckAxios.fetch(id);
-  //     if (res.errcode == '0') {
-  //       let info: any = res.data as {};
-  //       form.value = info;
-  //       dataChange({ value: info.work_status, model: 'work_status' });
-  //     }
-  //   }
+  let id = route.query.id
+  if (id) {
+    let res = await store.fetch(id)
+    if (res.errcode == '0') info.value = res.data
+  }
 }
-// 查询其他信息
 const searchOther = async () => {
-  //   let res: IQueryResult;
-  //   // 性别
-  //   res = await dictAxios.query({ type: 'common_gender' });
-  //   if (res.errcode == '0') genderList.value = res.data;
+  let result
+  // 成熟度
+  result = await dictDataStore.query({ code: 'mature', is_use: '0' })
+  if ($checkRes(result)) matureList.value = result.data
+  // 出让方式
+  result = await dictDataStore.query({ code: 'sell', is_use: '0' })
+  if ($checkRes(result)) sellList.value = result.data
+  // 技术领域
+  result = await dictDataStore.query({ code: 'field', is_use: '0' })
+  if ($checkRes(result)) fieldList.value = result.data
+  // 属性
+  result = await dictDataStore.query({ code: 'attribute', is_use: '0' })
+  if ($checkRes(result)) attributeList.value = result.data
+  // 技术分类
+  result = await dictDataStore.query({ code: 'technology', is_use: '0' })
+  if ($checkRes(result)) technologyList.value = result.data
+}
+// 字典数据转换
+const getDict = (data, model) => {
+  let res
+  if (model == 'mature') res = matureList.value.find((f) => f.value == data)
+  else if (model == 'sell') res = sellList.value.find((f) => f.value == data)
+  else if (model == 'field') res = fieldList.value.find((f) => f.value == data)
+  else if (model == 'attribute') res = attributeList.value.find((f) => f.value == data)
+  else if (model == 'technology') res = technologyList.value.find((f) => f.value == data)
+  return get(res, 'label')
+}
+// 地区
+const getArea = (data) => {
+  if (data) return data.join(',')
 }
 </script>
 <style scoped lang="scss">
@@ -222,6 +280,10 @@ const searchOther = async () => {
       .right {
         display: flex;
         justify-content: space-between;
+        .button {
+          border-color: #2374ff;
+          color: #2374ff;
+        }
       }
     }
   }
@@ -248,5 +310,23 @@ const searchOther = async () => {
       }
     }
   }
+  .pointer {
+    display: flex;
+    align-items: center;
+    justify-content: flex-end;
+    font-family: PingFangSC-Regular;
+    font-size: 14px;
+    color: #7e8288;
+    margin: 10px 0 0 0;
+    .money {
+      margin: 0 10px 0 0;
+      span {
+        font-family: PingFangSC-Semibold;
+        font-size: 20px;
+        color: #e94643;
+        line-height: 20px;
+      }
+    }
+  }
 }
 </style>

+ 96 - 32
src/views/demand/detail.vue

@@ -5,25 +5,41 @@
         <div class="w_1200">
           <el-col :span="24" class="one">
             <el-row :span="24" class="one_1">
-              <el-col :span="20" class="title">{{ info.title || '暂无标题' }}</el-col>
+              <el-col :span="20" class="title">{{ info.name || '暂无标题' }}</el-col>
               <el-col :span="4" class="file">
-                <el-icon>
-                  <Download />
-                </el-icon>
-                附件下载
+                <el-icon><Star /></el-icon>
+                收藏
               </el-col>
             </el-row>
-            <el-row :span="24" class="one_2"> 普通许可 </el-row>
           </el-col>
           <el-col :span="24" class="two">
             <a-descriptions bordered>
-              <a-descriptions-item label="行业领域">行业领域</a-descriptions-item>
-              <a-descriptions-item label="需求紧急度">需求紧急度</a-descriptions-item>
-              <a-descriptions-item label="合作方式">合作方式</a-descriptions-item>
-              <a-descriptions-item label="有效期">有效期</a-descriptions-item>
-              <a-descriptions-item label="地区">地区</a-descriptions-item>
+              <a-descriptions-item label="行业领域">
+                {{ getDict(info.field, 'field') }}
+              </a-descriptions-item>
+              <a-descriptions-item label="需求紧急度">
+                {{ getDict(info.urgent, 'urgent') }}
+              </a-descriptions-item>
+              <a-descriptions-item label="合作方式">
+                {{ getDict(info.method, 'method') }}
+              </a-descriptions-item>
+              <a-descriptions-item label="有效期">
+                {{ getTime(info.time) }}
+              </a-descriptions-item>
+              <a-descriptions-item label="需求地区">
+                {{ getArea(info.area) }}
+              </a-descriptions-item>
             </a-descriptions>
           </el-col>
+          <el-col :span="24" class="pointer">
+            <div class="money">
+              价格:<span> {{ info.money || '面议' }} </span>
+            </div>
+            <a-button type="primary"> 我要对接 </a-button>
+          </el-col>
+          <el-col :span="24" class="pointer" v-if="!user && !user._id">
+            提醒:您还没有登录,登录成功后再对接
+          </el-col>
           <el-col :span="24" class="thr">
             <el-col :span="24" class="thr_1">
               <p>单位信息</p>
@@ -31,10 +47,11 @@
             <el-row :span="24" class="thr_2">
               <el-col :span="17" class="left">
                 <el-col :span="24" class="name">
-                  {{ info.unit || '暂无' }}
+                  {{ unit.name || '暂无' }}
                 </el-col>
                 <el-col :span="24" class="other">
-                  <span>联系人</span>{{ info.unit || '暂无' }}
+                  <span>联系人</span>
+                  {{ unit.contacts || '暂无' }}
                 </el-col>
               </el-col>
               <el-col :span="4" class="right">
@@ -63,16 +80,27 @@
 <script setup>
 // 基础
 import { MessageOutlined } from '@ant-design/icons-vue'
+import { get } from 'lodash-es'
+const $checkRes = inject('$checkRes')
 // 接口
 import { DemandStore } from '@/store/api/platform/demand'
+import { DictDataStore } from '@/store/api/system/dictData'
 const store = DemandStore()
+const dictDataStore = DictDataStore()
+import { UserStore } from '@/store/user'
+const userStore = UserStore()
+const user = computed(() => userStore.user)
+// 路由
+const route = useRoute()
 // 加载中
 const loading = ref(false)
-const info = ref({
-  unit: '舟山海韵机械制造有限公司',
-  title: '异戊烯醇产品后续加工需要技术支持',
-  brief: '异戊烯醇产品完成之后后续加工需要技术支持'
-})
+const info = ref({})
+const unit = ref({ name: '吉林大学', contacts: '陈老师' })
+// 字典表
+const methodList = ref([])
+const urgentList = ref([])
+const fieldList = ref([])
+const demandList = ref([])
 // 请求
 onMounted(async () => {
   loading.value = true
@@ -81,22 +109,40 @@ onMounted(async () => {
   loading.value = false
 })
 const search = async () => {
-  //   let id = route.query.id;
-  //   if (id) {
-  //     let res: IQueryResult = await userCheckAxios.fetch(id);
-  //     if (res.errcode == '0') {
-  //       let info: any = res.data as {};
-  //       form.value = info;
-  //       dataChange({ value: info.work_status, model: 'work_status' });
-  //     }
-  //   }
+  let id = route.query.id
+  if (id) {
+    let res = await store.fetch(id)
+    if (res.errcode == '0') info.value = res.data
+  }
 }
-// 查询其他信息
 const searchOther = async () => {
-  //   let res: IQueryResult;
-  //   // 性别
-  //   res = await dictAxios.query({ type: 'common_gender' });
-  //   if (res.errcode == '0') genderList.value = res.data;
+  let result
+  // 合作方式
+  result = await dictDataStore.query({ code: 'method', is_use: '0' })
+  if ($checkRes(result)) methodList.value = result.data
+  // 需求紧急度
+  result = await dictDataStore.query({ code: 'urgent', is_use: '0' })
+  if ($checkRes(result)) urgentList.value = result.data
+  // 技术领域
+  result = await dictDataStore.query({ code: 'field', is_use: '0' })
+  if ($checkRes(result)) fieldList.value = result.data
+}
+// 字典数据转换
+const getDict = (data, model) => {
+  let res
+  if (model == 'method') res = methodList.value.find((f) => f.value == data)
+  else if (model == 'urgent') res = urgentList.value.find((f) => f.value == data)
+  else if (model == 'field') res = fieldList.value.find((f) => f.value == data)
+  else if (model == 'demand') res = demandList.value.find((f) => f.value == data)
+  return get(res, 'label')
+}
+// 时间
+const getTime = (data) => {
+  if (data) return `${data[0]} 至 ${data[1]}`
+}
+// 地区
+const getArea = (data) => {
+  if (data) return data.join(',')
 }
 </script>
 <style scoped lang="scss">
@@ -245,5 +291,23 @@ const searchOther = async () => {
       }
     }
   }
+  .pointer {
+    display: flex;
+    align-items: center;
+    justify-content: flex-end;
+    font-family: PingFangSC-Regular;
+    font-size: 14px;
+    color: #7e8288;
+    margin: 10px 0 0 0;
+    .money {
+      margin: 0 10px 0 0;
+      span {
+        font-family: PingFangSC-Semibold;
+        font-size: 20px;
+        color: #e94643;
+        line-height: 20px;
+      }
+    }
+  }
 }
 </style>