ソースを参照

直接分享(监听登录状态)

lifanagju_citu 6 ヶ月 前
コミット
51d77d23da
1 ファイル変更25 行追加3 行削除
  1. 25 3
      pagesB/positionDetail/index.vue

+ 25 - 3
pagesB/positionDetail/index.vue

@@ -83,7 +83,11 @@
     <!-- 分享 投递 -->
     <view class="bottom-sticky" v-if="!loading && jobId && info.status === '0'">
       <view class="bottom-content">
-        <view @click="handleClickShare" class="bottom-content-tool">
+        <button v-if="beenLogin" open-type="share" class="bottom-content-tool shareButtonCss">
+          <uni-icons type="redo-filled" size="24" color="#00897B" style="line-height: 24px;"/>
+          <span style="color:#00897B;font-weight:bold;line-height: 22px;">分享</span>
+        </button>
+        <view v-else @click="handleClickShare" class="bottom-content-tool">
           <uni-icons type="redo-filled" size="24" color="#00897B"/>
           <span style="color:#00897B;font-weight:bold;">分享</span>
         </view>
@@ -197,7 +201,7 @@ import { timesTampChange } from '@/utils/date'
 import { preview } from '@/utils/preview'
 import { uploadFile } from '@/api/file'
 import layoutPage from '@/layout'
-import { ref } from 'vue';
+import { ref, watch } from 'vue';
 import {
   jobCvRelSend,
   getPositionDetails,
@@ -213,6 +217,8 @@ import { dealDictObjData } from '@/utils/position'
 import { getAccessToken } from '@/utils/request'
 import { onLoad, onShareAppMessage, onShow } from '@dcloudio/uni-app'
 import { prologue, defaultText } from '@/hooks/useIM'
+import { userStore } from '@/store/user'
+const useUserStore = userStore()
 
 const sharePopup = ref()
 const loading = ref(false)
@@ -227,6 +233,14 @@ const isEmployment = ref(null)
 const imgSrc = ref('')
 const appInfo = ref({})
 const poster = ref()
+const beenLogin = ref(false)
+
+// 监听登录状态
+watch(() => useUserStore.refreshToken, (newVal) => {
+	beenLogin.value = Boolean(newVal)
+}, { immediate: true }, { deep: true })
+
+// }, { immediate: true }, { deep: true })
 
 let jobId = ''
 let obj = {}
@@ -475,7 +489,7 @@ const handleClickShare = () => {
     showAuthModal()
     return
   }
-  sharePopup.value.open()
+  // sharePopup.value.open()
 }
 // 获取设备信息
 function getSystemInfo(){
@@ -696,6 +710,14 @@ async function createPoster () {
     background: #FFF;
     border-radius: 50rpx;
   }
+  .shareButtonCss {
+    // margin: 40rpx;
+    font-size: 16px;
+    background: unset;
+    &::after{
+      border:none !important;
+    }
+  }
   &-tool {
     width: 160rpx;
     display: flex;