瀏覽代碼

职位详情未登录下快速登录

lifanagju_citu 7 月之前
父節點
當前提交
4309e4e3e1

+ 26 - 12
src/components/Enterprise/components/positions.vue

@@ -90,6 +90,8 @@ import { getJobAdvertisedPositionCount, getJobAreaByEnterpriseId, getJobAdvertis
 import MPagination from '@/components/CtPagination'
 import conditionFilter from '@/views/recruit/personal/position/components/conditionFilter'
 import loginPage from '@/views/common/loginDialog.vue'
+import { getToken } from '@/utils/auth'
+import Snackbar from '@/plugins/snackbar'
 
 const props = defineProps({
   info: {
@@ -98,16 +100,6 @@ const props = defineProps({
   }
 })
 
-import { getToken } from '@/utils/auth'
-import Snackbar from '@/plugins/snackbar'
-const showLogin = ref(false)
-// 打开快速登录
-const quickLogonOpen = () => {
-  Snackbar.warning('您还未登录,请先登录后再试')
-  showLogin.value = true
-}
-
-
 const total = ref(0)
 const pageInfo = ref({
   pageSize: 10,
@@ -254,9 +246,16 @@ const desc = [
   { mdi: 'mdi-clock-time-ten-outline', value: 'expName' }
 ]
 
-// 立即沟通
+// 沟通
 const toDetails = async (info) => {
-  if (!getToken()) return quickLogonOpen()
+  if (!getToken()) {
+    showLogin.value = true // 打开快速登录弹窗
+    Snackbar.warning('您还未登录,请先登录后再试')
+    //
+    nextFunc.value = null // 登录成功后要执行的操作
+    loginCloseWarningWord = '您已取消登录,无法对职位进行沟通' // 取消登录提示语
+    return
+  }
   const userId = info.contact.userId
   const enterpriseId = info.contact.enterpriseId
   const textObj = {
@@ -271,6 +270,21 @@ const toDetails = async (info) => {
 
   router.push(url)
 }
+
+const showLogin = ref(false)
+const nextFunc = ref(null)
+let loginCloseWarningWord = ''
+// 快速登录
+const loginSuccess = () => {
+  showLogin.value = false
+  Snackbar.success('登录成功')
+  if (nextFunc.value) nextFunc.value()
+}
+
+const loginClose = () => {
+  showLogin.value = false
+  Snackbar.warning(loginCloseWarningWord)
+}
 </script>
 
 <style scoped lang="scss">

+ 23 - 7
src/components/Enterprise/details.vue

@@ -94,12 +94,6 @@ const props = defineProps({
   }
 })
 
-const showLogin = ref(false)
-// 打开快速登录
-const quickLogonOpen = () => {
-  Snackbar.warning('您还未登录,请先登录后再试')
-  showLogin.value = true
-}
 
 const route = useRoute()
 const router = useRouter()
@@ -159,7 +153,14 @@ const getCollectionStatus = async (id) => {
 
 // 关注&取消关注企业
 const handleFollow = async () => {
-  if (!getToken()) return quickLogonOpen()
+  if (!getToken()) {
+    showLogin.value = true // 打开快速登录弹窗
+    Snackbar.warning('您还未登录,请先登录后再试')
+    //
+    nextFunc.value = handleFollow // 登录成功后要执行的操作
+    loginCloseWarningWord = '您已取消登录,无法关注企业' // 取消登录提示语
+    return
+  }
   const api = isCollection.value ? getEnterpriseUnsubscribe : getEnterpriseSubscribe
   await api(isCollection.value ? props.id : { enterpriseId: props.id })
   getCollectionStatus(props.id)
@@ -172,6 +173,21 @@ const businessList = [
   { label: '成立日期:', value: 'establishmentTime' },
   { label: '注册资本:', value: 'registeredCapital' }
 ]
+
+const showLogin = ref(false)
+const nextFunc = ref(null)
+let loginCloseWarningWord = ''
+// 快速登录
+const loginSuccess = () => {
+  showLogin.value = false
+  Snackbar.success('登录成功')
+  if (nextFunc.value) nextFunc.value()
+}
+
+const loginClose = () => {
+  showLogin.value = false
+  Snackbar.warning(loginCloseWarningWord)
+}
 </script>
 
 <style scoped lang="scss">

+ 24 - 9
src/components/Position/longStrip.vue

@@ -62,6 +62,7 @@ import { useRouter } from 'vue-router'
 import { ref } from 'vue'
 import { prologue, defaultText } from '@/hooks/web/useIM'
 import loginPage from '@/views/common/loginDialog.vue'
+import { getToken } from '@/utils/auth'
 
 const emits = defineEmits(['refresh'])
 const { t } = useI18n()
@@ -76,14 +77,6 @@ const props = defineProps({
   }
 })
 
-import { getToken } from '@/utils/auth'
-const showLogin = ref(false)
-// 打开快速登录
-const quickLogonOpen = () => {
-  Snackbar.warning('您还未登录,请先登录后再试')
-  showLogin.value = true
-}
-
 const router = useRouter()
 
 const desc = ['industryName', 'financingName', 'scaleName']
@@ -108,7 +101,14 @@ const handleToEnterprise = (item) => {
 
 // 立即沟通
 const toDetails = async (info) => {
-  if (!getToken()) return  quickLogonOpen()
+  if (!getToken()) {
+    showLogin.value = true // 打开快速登录弹窗
+    Snackbar.warning('您还未登录,请先登录后再试')
+    //
+    nextFunc.value = null // 登录成功后要执行的操作
+    loginCloseWarningWord = '您已取消登录,无法对职位进行沟通' // 取消登录提示语
+    return
+  }
   const userId = info.contact.userId
   const enterpriseId = info.contact.enterpriseId
   const textObj = {
@@ -123,6 +123,21 @@ const toDetails = async (info) => {
 
   router.push(url)
 }
+
+const showLogin = ref(false)
+const nextFunc = ref(null)
+let loginCloseWarningWord = ''
+// 快速登录
+const loginSuccess = () => {
+  showLogin.value = false
+  Snackbar.success('登录成功')
+  if (nextFunc.value) nextFunc.value()
+}
+
+const loginClose = () => {
+  showLogin.value = false
+  Snackbar.warning(loginCloseWarningWord)
+}
 </script>
 
 <style scoped lang="scss">

+ 6 - 6
src/views/recruit/personal/position/components/details.vue

@@ -438,17 +438,17 @@ const handleSubmit = async (val) =>{
   }, 3000)
 }
 
-let toDetailsInfo = {}
+// let toDetailsInfo = {}
 // 沟通
-const toDetails = async () => {
-  if (info.value) toDetailsInfo = info // 快速登录弹窗回调使用
-  else info.value = toDetailsInfo
+const toDetails = async (info) => {
+  // if (info) toDetailsInfo = info // 快速登录弹窗回调使用
+  // else info = toDetailsInfo
   if (!getToken()) {
     showLogin.value = true // 打开快速登录弹窗
     Snackbar.warning('您还未登录,请先登录后再试')
     //
-    nextFunc.value = toDetails // 登录成功后要执行的操作
-    loginCloseWarningWord = '您已取消登录,无法进行沟通' // 取消登录提示语
+    nextFunc.value = null // 登录成功后要执行的操作
+    loginCloseWarningWord = '您已取消登录,无法对职位进行沟通' // 取消登录提示语
     return
   }
   try {