yinxiangke преди 1 месец
родител
ревизия
fd0e151333
променени са 3 файла, в които са добавени 163 реда и са изтрити 38 реда
  1. 14 0
      src/api/my.js
  2. 133 32
      src/pages/Personal/Demand.vue
  3. 16 6
      src/pages/Personal/Workflow.vue

+ 14 - 0
src/api/my.js

@@ -27,6 +27,20 @@ export function userQuestList(data = {}) {
   return request.get('/quest/userQuestList',data)
 }
 
+// 删除登录用户的寻找工作流信息
+export function delectQuest(data = {}) {
+  return request.del(`/quest/${data}`)
+}
+
+// 结束需求
+export function updateQuestStatus(data = {}) {
+  return request.put(`/quest/updateQuestStatus`,data)
+}
+// 取消报名
+export function cancelApply(data = {}) {
+  return request.del(`/apply/${data}`)
+}
+
 // 我的订单
 export function orderList(data = {}) {
   return request.get('/order/list',data)

+ 133 - 32
src/pages/Personal/Demand.vue

@@ -5,53 +5,60 @@
         <ul class="demand-list">
           <li v-for="(item, index) in list" :key="index">
             <div class="flex-center-between">
-              <div class="title">{{ item.title }}</div>
+              <div class="flex-align-center">
+                <div v-if="form.activeName == 1" class="tag">报名中</div>
+                <div class="title">{{ item.title }}</div>
+              </div>
               <div class="price">¥{{ item.budgetMin }}-{{ item.budgetMax }}</div>
             </div>
             <div class="flex-align-center content">
               <div class="flex-align-center">
-                <el-button type="primary" size="small" plain>{{ item.categoryName2 }}</el-button>
+                <!-- <el-button type="primary" size="small" plain>{{ item.categoryName1 }}</el-button> -->
+                <!-- <el-button type="primary" size="small" plain>{{ item.categoryName2 }}</el-button> -->
                 <el-button type="primary" size="small" plain>{{ item.categoryName3 }}</el-button>
               </div>
               <ul class="flex-align-center list">
                 <div class="li">
                   <img src="/src/assets/imgs/yuangong.png" alt="">
-                  <div class="">{{ item.publishCount || 0}}{{ $t('common.renbaoming') }}</div>
+                  <div class="">{{ item.questApplyCount || 0 }}{{ $t('common.renbaoming') }}</div>
                 </div>
                 <div class="li">
                   <img src="/src/assets/imgs/rili.png" alt="">
-                  <div class="">{{ $t('common.signUpDeadline') }}:{{ item.publishTime }}</div>
+                  <div class="">{{ $t('common.signUpDeadline') }}:{{ item.deadline }}</div>
                 </div>
               </ul>
             </div>
             <div class="description">{{ item.requirements }}</div>
             <div class="info">
               <div class="info-left">
-                <el-avatar :size="30" :src="appStore.avatarDefault" />
+                <el-avatar :size="30" :src="item.userAvatar || appStore.avatarDefault" />
                 <div class="name">{{ item.nickName }}</div>
                 <div class="date">{{ item.publishTime }} {{ $t('common.publish') }}</div>
               </div>
               <div class="info-right flex-align-center">
                 <template v-if="form.activeName === 0">
-                  <div class="btn" @click="changeItem(item,index,0)">
+                  <div class="btn" @click="changeItem(item, index, 0)">
                     <img src="/src/assets/imgs/my/jilu@2x.png" alt="">
                     <div>{{ $t('personalCenter.viewSignUpRecord') }}</div>
                   </div>
-                  <div class="btn">
-                    <img src="/src/assets/imgs/my/bianji@2x.png" alt="">
-                    <div>{{ $t('common.edit') }}</div>
-                  </div>
-                  <div class="btn">
-                    <img src="/src/assets/imgs/my/guanbi@2x.png" alt="">
-                    <div class="red">{{ $t('personalCenter.endActivity') }}</div>
-                  </div>
-                  <div class="btn">
+                  <template v-if="item.applyStatus == 1">
+                    <div class="btn" @click="changeItem(item, index, 1)">
+                      <img src="/src/assets/imgs/my/bianji@2x.png" alt="">
+                      <div>{{ $t('common.edit') }}</div>
+                    </div>
+                    <div class="btn" @click="changeItem(item, index, 2)">
+                      <img src="/src/assets/imgs/my/guanbi@2x.png" alt="">
+                      <div class="red">{{ $t('personalCenter.endActivity') }}</div>
+                    </div>
+                  </template>
+
+                  <div class="btn" @click="changeItem(item, index, 3)">
                     <img src="/src/assets/imgs/my/shanchu@2x.png" alt="">
                     <div class="red">{{ $t('common.delete') }}</div>
                   </div>
                 </template>
 
-                <div class="btn" v-else>
+                <div class="btn" v-else @click="changeItem(item, index, 4)">
                   <img src="/src/assets/imgs/my/quxiao@2x.png" alt="">
                   <div class="red">{{ $t('personalCenter.cancelSignUp') }}</div>
                 </div>
@@ -62,10 +69,11 @@
         </ul>
       </el-tab-pane>
     </el-tabs>
-   <template v-if="list.length">
-     <Pagination :total="form.total" :page-size="form.pageSize" :current-page="form.pageNum" @page-change="handlePageChange" />
-   </template>
-   <el-empty v-else :description="$t('common.empty')" />
+    <template v-if="list.length">
+      <Pagination :total="form.total" :page-size="form.pageSize" :current-page="form.pageNum"
+        @page-change="handlePageChange" />
+    </template>
+    <el-empty v-else :description="$t('common.empty')" />
 
     <el-dialog v-model="dialogVisible" :title="$t('personalCenter.viewSignUpRecord')" width="1138">
       <div class="detail">
@@ -137,14 +145,29 @@
   </div>
 </template>
 <script lang="ts" setup>
-import { ref,onMounted } from 'vue'
+import { ref, onMounted } from 'vue'
 import { useAppStore } from '@/pinia/appStore'
 import type { TabsPaneContext } from 'element-plus'
 import Pagination from '@/components/Pagination.vue'
 
-import { getWorkflowApplyByUserId,userQuestList,appliList } from '@/api/my.js'
+import { getWorkflowApplyByUserId, userQuestList, appliList, updateQuestStatus, delectQuest, cancelApply } from '@/api/my.js'
+
+import { useRoute, useRouter } from 'vue-router'
+
+import DGTMessage from '@/utils/message'
+
+import { ElMessageBox } from 'element-plus'
+
+import { useI18n } from 'vue-i18n'
+
+const { t } = useI18n()
 
 const appStore = useAppStore();
+
+const route = useRoute()
+
+const router = useRouter()
+
 const tabs = ref([
   { label: 'personalCenter.publishDemandRecord', name: 0 },
   { label: 'personalCenter.myDemandRecord', name: 1 }
@@ -154,18 +177,86 @@ const dialogVisible = ref(false)
 
 const list = ref([])
 const form = ref({
-  pageNum:1,
-  pageSize:10,
+  pageNum: 1,
+  pageSize: 10,
   total: 0,
-  activeName:0
+  activeName: 0
 })
 
-const changeItem = async (item,index,type) =>{
+const itemData = ref({})
+
+const changeItem = async (item, index, type) => {
+  itemData.value = item;
   if (type == 0) {
-    
-    let res = await appliList({questId:item.questId})
+
+    let res = await appliList({ questId: item.questId })
     console.log(res)
     dialogVisible.value = true;
+  } else if (type == 1) {
+    router.push({ path: `/workflow-trade/workflow-trade-add`, query: { id: item.questId } });
+  } else if (type == 2) {
+    ElMessageBox.confirm(
+      'proxy will permanently delete the file. Continue?',
+      'Warning',
+      {
+        confirmButtonText: 'OK',
+        cancelButtonText: 'Cancel',
+        type: 'warning',
+      }
+    )
+      .then(async () => {
+        let res = await updateQuestStatus({
+          questId: item.questId
+        })
+        if (res.code === 200) {
+          getList()
+          DGTMessage.success(`${t('common.success')}`)
+        }
+      })
+      .catch(() => {
+
+      })
+  } else if (type == 3) {
+    ElMessageBox.confirm(
+      'proxy will permanently delete the file. Continue?',
+      'Warning',
+      {
+        confirmButtonText: 'OK',
+        cancelButtonText: 'Cancel',
+        type: 'warning',
+      }
+    )
+      .then(async () => {
+        let res = await delectQuest(item.questId)
+        if (res.code === 200) {
+          getList()
+          DGTMessage.success(`${t('common.delete')}${t('common.success')}`)
+        }
+
+      })
+      .catch(() => {
+
+      })
+  } else if (type == 4) {
+    ElMessageBox.confirm(
+      'proxy will permanently delete the file. Continue?',
+      'Warning',
+      {
+        confirmButtonText: 'OK',
+        cancelButtonText: 'Cancel',
+        type: 'warning',
+      }
+    )
+      .then(async () => {
+        let res = await cancelApply(item.id)
+        if (res.code === 200) {
+          getList()
+          DGTMessage.success(`${t('common.cancel')}${t('common.success')}`)
+        }
+      })
+      .catch(() => {
+
+      })
   }
 }
 
@@ -177,20 +268,20 @@ const handleClick = (tab: TabsPaneContext) => {
 }
 
 // 获取列表
-const getList = async () =>{
+const getList = async () => {
   let res = await (form.value.activeName === 0 ? userQuestList(form.value) : getWorkflowApplyByUserId(form.value))
-  console.log(res.rows)
+
   list.value = res.rows || [];
   form.value.total = res.total;
 }
 
-const handlePageChange = (page) =>{
+const handlePageChange = (page) => {
   list.value = []
   form.value.pageNum = page;
   getList()
 }
 
-onMounted(()=>{
+onMounted(() => {
   getList()
 })
 
@@ -221,6 +312,16 @@ onMounted(()=>{
         color: #333333;
       }
 
+      .tag {
+        padding: 0 12px;
+        line-height: 30px;
+        color: #FFFFFF;
+        font-size: 14px;
+        background: #2D71FF;
+        border-radius: 4px;
+        margin-right: 8px;
+      }
+
 
 
       .description {

+ 16 - 6
src/pages/Personal/Workflow.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="workflow">
-    <div @click="router.push({path:'/workflow-add'})" class="gradient workflow-btn flex-center">
+    <div @click="router.push({ path: '/workflow-add' })" class="gradient workflow-btn flex-center">
       <img src="/src/assets/imgs/add.png" alt="">
       <div class="">{{ $t('common.publishWorkflow') }}</div>
     </div>
@@ -63,7 +63,12 @@ import { ElMessageBox } from 'element-plus'
 
 import DGTMessage from '@/utils/message'
 
+import { useI18n } from 'vue-i18n'
+
+const { t } = useI18n()
+
 const route = useRoute()
+
 const router = useRouter()
 
 let list = ref([])
@@ -76,7 +81,12 @@ const form = ref({
 // 编辑删除
 const changeItem = async (item: any, index: any, type: any) => {
   if (type == 0) {
-
+    router.push({
+      path:'/workflow-add',
+      query:{
+        id:item.publishId
+      }
+    })
   } else if (type == 1) {
     ElMessageBox.confirm(
       'proxy will permanently delete the file. Continue?',
@@ -88,11 +98,11 @@ const changeItem = async (item: any, index: any, type: any) => {
       }
     )
       .then(async () => {
-        console.log('222', item)
         let res = await delectPublish(item.publishId);
-        DGTMessage.success('删除成功')
-        getList()
-        console.log(res);
+        if (res.code === 200) {
+           DGTMessage.success(`${t('common.delete')} ${t('common.success')}`)
+          getList()
+        }
       })
       .catch(() => {