Browse Source

普通职位不登录也能分享,赏金职位没登录时弹窗提示是否需要登录

Xiao_123 4 months ago
parent
commit
964e6004e7
1 changed files with 41 additions and 16 deletions
  1. 41 16
      pagesB/positionDetail/index.vue

+ 41 - 16
pagesB/positionDetail/index.vue

@@ -182,6 +182,18 @@
       </uni-popup-share>
       </uni-popup-share>
     </uni-popup>
     </uni-popup>
 
 
+    <!-- 当前是赏金职位时,询问是否登录,不登录则没有赏金 -->
+    <uni-popup ref="loginPopup" type="dialog">
+			<uni-popup-dialog 
+        type="warn" 
+        cancelText="取消" 
+        confirmText="登录" 
+        title="系统提示" 
+        content="当前为赏金职位,不登录进行分享将无法获得赏金,是否登录?" 
+        @confirm="handleLoginConfirm"
+				@close="handleLoginClose" />
+		</uni-popup>
+
     <view class="hideCanvasView">
     <view class="hideCanvasView">
       <canvas class="shareCanvas" canvas-id="shareCanvas" style="width: 452px; height: 362px;"></canvas>
       <canvas class="shareCanvas" canvas-id="shareCanvas" style="width: 452px; height: 362px;"></canvas>
     </view>
     </view>
@@ -639,25 +651,38 @@ const handleUpload = () => {
 }
 }
 
 
 // 分享
 // 分享
+const loginPopup = ref()
 const handleClickShare = () => {
 const handleClickShare = () => {
-  if (!getAccessToken()) {
-    uni.showToast({
-      title:'请先登录',
-      icon: 'none'
-    })
-    showAuthModal()
-    return
-  }
-  if (showNecessaryInfoPopup()) {
-		uni.showToast({
-			title: '请先完善基本信息',
-			icon: 'none'
-		})
-		showAuthModal('necessaryInfo')
-		return
-	}
+  // if (!getAccessToken()) {
+  //   uni.showToast({
+  //     title:'请先登录',
+  //     icon: 'none'
+  //   })
+  //   showAuthModal()
+  //   return
+  // }
+  // if (showNecessaryInfoPopup()) {
+	// 	uni.showToast({
+	// 		title: '请先完善基本信息',
+	// 		icon: 'none'
+	// 	})
+	// 	showAuthModal('necessaryInfo')
+	// 	return
+	// }
+
+  // 如果当前职位是赏金职位且没有登录的状态,则弹窗询问是否需要登录;普通职位登录与不登录都可直接分享
+  if (!getAccessToken() && info.value.hire) return loginPopup.value.open()
   sharePopup.value.open()
   sharePopup.value.open()
 }
 }
+
+// 取消则直接弹窗分享
+const handleLoginClose = () => {
+  sharePopup.value.open()
+}
+// 确认则弹窗登录
+const handleLoginConfirm = () => {
+  showAuthModal()
+}
 </script>
 </script>
 
 
 <style scoped lang="scss">
 <style scoped lang="scss">