Jelajahi Sumber

申请联系方式,消息跳转

lrf 8 bulan lalu
induk
melakukan
ea5a68d48d

+ 1 - 1
src/components/custom/custom-layout.vue

@@ -190,7 +190,7 @@ const toCenter = () => {
 // 消息
 const toChat = () => {
   if (user.value && user.value.id) {
-    router.push({ path: `/chat` })
+    router.push({ path: `/center/notice` })
   } else {
     router.push({ path: '/login', query: { status: '1' } })
   }

+ 28 - 0
src/store/api/user/contactApply.js

@@ -0,0 +1,28 @@
+import { defineStore } from 'pinia'
+import { AxiosWrapper } from '@/utils/axios-wrapper'
+const url = '/contactApply'
+const axios = new AxiosWrapper()
+
+export const ContactApplyStore = defineStore('contactApply', () => {
+  const query = async ({ skip = 0, limit = undefined, ...info } = {}) => {
+    let cond = {}
+    if (skip) cond.skip = skip
+    if (limit) cond.limit = limit
+    cond = { ...cond, ...info }
+    const res = await axios.$get(`${url}`, cond)
+    return res
+  }
+  const fetch = async (payload) => {
+    const res = await axios.$get(`${url}/${payload}`)
+    return res
+  }
+  const create = async (payload) => {
+    const res = await axios.$post(`${url}`, payload)
+    return res
+  }
+  return {
+    query,
+    fetch,
+    create,
+  }
+})

+ 7 - 0
src/views/detail/demandDetail.vue

@@ -87,9 +87,11 @@
 <script setup>
 import { get } from 'lodash-es'
 import { DictDataStore } from '@/store/api/system/dictData'
+import { ContactApplyStore } from '@/store/api/user/contactApply'
 import { DemandStore } from '@/store/api/platform/demand'
 const store = DemandStore()
 const dictDataStore = DictDataStore()
+const contactApplyStore = ContactApplyStore()
 // 收藏
 import moment from 'moment'
 import { CollectionStore } from '@/store/api/platform/collection'
@@ -221,6 +223,11 @@ const toChat = () => {
   if (user.value.id) {
     ElMessageBox.confirm(`您确认要获取联系方式?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
       .then(async () => {
+        let source_id = route.query.id
+        let source = 'demand'
+        let apply_user = user.value.id
+        const obj = { source_id, source, apply_user }
+        await contactApplyStore.create(obj)
         ElMessage({ message: `获取联系方式成功等待消息通知`, type: 'success' })
       })
       .catch(() => {})

+ 7 - 0
src/views/detail/expertDetail.vue

@@ -84,6 +84,8 @@
 <script setup>
 import userLogo from '/images/userLogo.png'
 import { ExpertStore } from '@/store/api/user/expert'
+import { ContactApplyStore } from '@/store/api/user/contactApply'
+const contactApplyStore = ContactApplyStore()
 const store = ExpertStore()
 
 // 收藏
@@ -145,6 +147,11 @@ const toChat = () => {
   if (user.value.id) {
     ElMessageBox.confirm(`您确认要获取联系方式?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
       .then(async () => {
+        let source_id = route.query.id
+        let source = 'expert'
+        let apply_user = user.value.id
+        const obj = { source_id, source, apply_user }
+        await contactApplyStore.create(obj)
         ElMessage({ message: `获取联系方式成功等待消息通知`, type: 'success' })
       })
       .catch(() => {})

+ 7 - 0
src/views/detail/supplyDetail.vue

@@ -86,6 +86,8 @@
 import { get } from 'lodash-es'
 import { DictDataStore } from '@/store/api/system/dictData'
 import { SupplyStore } from '@/store/api/platform/supply'
+import { ContactApplyStore } from '@/store/api/user/contactApply'
+const contactApplyStore = ContactApplyStore()
 const store = SupplyStore()
 const dictDataStore = DictDataStore()
 import { UserStore } from '@/store/user'
@@ -210,6 +212,11 @@ const toChat = () => {
   if (user.value.id) {
     ElMessageBox.confirm(`您确认要获取联系方式?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
       .then(async () => {
+        let source_id = route.query.id
+        let source = 'supply'
+        let apply_user = user.value.id
+        const obj = { source_id, source, apply_user }
+        await contactApplyStore.create(obj)
         ElMessage({ message: `获取联系方式成功等待消息通知`, type: 'success' })
       })
       .catch(() => {})