浏览代码

Merge branch 'master' of https://git.citupro.com/zhengnaiwen_citu/menduner-uniapp

Xiao_123 8 月之前
父节点
当前提交
7cab54b5cb
共有 1 个文件被更改,包括 81 次插入32 次删除
  1. 81 32
      pagesB/positionDetail/index.vue

+ 81 - 32
pagesB/positionDetail/index.vue

@@ -1,6 +1,6 @@
 <template>
   <view>
-    <scroll-view class="scrollBox" style="position:relative;">
+    <scroll-view class="scrollBox" style="position:relative;" @touchmove.stop.prevent="">
       <view class="box">
         <view v-if="loading" class="vertical80-center">{{ loadingText }}</view>
         <view v-else>
@@ -30,19 +30,10 @@
                 class="mr"
                 size="25"
               ></uni-icons>
-              <!-- <span style="color: #fc6d5e">{{ isCollection ? '取消收藏' : '收藏职位' }}</span> -->
             </view>
           </view>
           <!-- 标签 -->
           <view class="tagList mt">
-            <!-- <view class="tagListItem" v-for="(tag,i) in info?.tagList || []" :key="'tagList' + i">
-              <uni-tag 
-                :text="tag"
-                inverted="false"
-                size="small"
-                custom-style="background-color: #e2f0ef; color:#00897B; border-color:#e2f0ef;"
-              />
-            </view> -->
             <view class="tag" v-for="(tag,i) in info?.tagList || []" :key="'tagList' + i">
               {{ tag }}
             </view>
@@ -57,7 +48,6 @@
             <view class="fs15 w-600 my5">岗位职责</view>
             <view v-if="!info.content">暂无</view>
             <rich-text v-else class="htmlCss" :nodes="info.content"></rich-text>
-            <!-- <view class="html fs14" v-html="info.content"></view> -->
           </view>
           <!-- 岗位要求 -->
           <view class="topLine mt-5">
@@ -65,6 +55,7 @@
             <view v-if="!info.requirement">暂无</view>
             <rich-text v-else class="htmlCss" :nodes="info.requirement"></rich-text>
           </view>
+          <!-- 企业信息 -->
           <view class="topLine mt-5 d-flex">
             <view class="avatarBox">
               <image class="avatar" :src="info.contact?.avatar || 'https://minio.citupro.com/dev/menduner/7.png'"></image>
@@ -74,6 +65,7 @@
               <view class="contact-info">{{ info.enterprise?.name }} · {{ info.contact?.postNameCn }}</view>
             </view>
           </view>
+          <!-- 工作地址 -->
           <view class="topLine mt-5">
             <view class="fs15 w-600 my5">工作地址</view>
             <view class="my10">
@@ -89,6 +81,7 @@
         </view>
       </view>
     </scroll-view>
+    <!-- 分享 投递 -->
     <view class="bottom-sticky" v-if="!loading && jobId">
       <view style="display: flex;justify-content: space-evenly;align-items: center;width: 100%;margin: 20rpx 0;">
         <view @click="null" style="display: flex;justify-content: center;flex-direction: column;align-items: center;">
@@ -99,14 +92,15 @@
         <button v-else class="buttons" @click="handleDelivery">我要投递</button>
       </view>
     </view>
-    <uni-popup ref="popup" background-color="#fff">
+    <!-- 选择简历 -->
+    <uni-popup ref="popup" background-color="#fff" :mask-click="false" >
       <view class="dialogBox" style="width: 86vw;">
         <view class="dialog-title">
           <view class="title">选择简历</view>
           <uni-icons type="close" color="grey" size="26" @click="popupClose" />
         </view>
-        <view style="height: 1px; margin: 0 10rpx; background-color: #dedede;"></view>
-        <view class="dialog-content" style="max-height: 50vh;">
+        <view style="height: 1px; margin: 0 20rpx; background-color: #dedede;"></view>
+        <scroll-view class="dialog-content" scroll-y="true" style="max-height: 50vh; width: auto;">
           <uni-card
             v-for="(item, index) in resumeList"
             :key="index"
@@ -130,20 +124,31 @@
               </view>
             </view>
           </uni-card>
-        </view>
-        <view class="dialog-bottom" @click="handleSubmit">确认投递</view>
+          <view class="selectOnline" @click="handleUpload">选取微信聊天文件</view>
+        </scroll-view>
+        <view class="dialog-bottom" @click="deliverySubmit()">确认投递</view>
       </view>
     </uni-popup>
+    <!-- 上传简历 -->
+    <uni-popup ref="uploadPopup" type="dialog">
+			<uni-popup-dialog
+        type="warn"
+        cancelText="取消"
+        confirmText="确定"
+        title="系统提示"
+        content="您还未上传过简历,是否选取微信聊天文件投递?"
+        @confirm="handleUpload"
+				@close="uploadPopup.close()"
+      ></uni-popup-dialog>
+		</uni-popup>
   </view>
 </template>
 <script setup>
 import { commissionCalculation } from '@/utils/position'
 import { timesTampChange } from '@/utils/date'
 import { preview } from '@/utils/preview'
-// import loginPage from '@/views/common/loginDialog.vue'
-// import simplePage from './sendResume/simple.vue'
-// import selectPage from './sendResume/select.vue'
-import { reactive, ref } from 'vue';
+import { uploadFileTest } from '@/api/file'
+import { ref } from 'vue';
 import {
   jobCvRelSend,
   getPositionDetails,
@@ -154,7 +159,6 @@ import {
 } from '@/api/position'
 import { getPersonResumeCv, saveResume } from '@/api/user'
 import { dealDictObjData } from '@/utils/position'
-// import Snackbar from '@/plugins/snackbar'
 import { getAccessToken } from '@/utils/request'
 import { onLoad } from '@dcloudio/uni-app';
 
@@ -203,28 +207,28 @@ const deliveryCheck = async () => {
 }
 
 const popup = ref()
+const uploadPopup = ref()
 const resumeList = ref([])
 const selectIndex = ref(null)
 const handleDelivery = async () => {
+  // 未登录
   if (!getAccessToken()) {
     uni.showToast({ title: '您还未上传过简历,请先上传简历', icon: 'none', duration: 2000, })
     return
   }
+  // 已投递
   if (delivery.value) {
     uni.showToast({ title: '您已投递过该职位!', icon: 'none', duration: 2000, })
     return
   }
   const { data } = await getPersonResumeCv()
   resumeList.value = data
-  if (!resumeList.value?.length) {
-    uni.showToast({ title: '您还未上传过简历,请先上传简历', icon: 'none', duration: 2000, })
-    return
-  }
-  // show.value = true
+  // 未上传简历
+  if (!resumeList.value?.length) return uploadPopup.value.open()
   popup.value.open()
 }
-const handleSubmit = async () => {
-  const resume = resumeList.value[selectIndex.value]
+const deliverySubmit = async (uploadFile) => {
+  const resume = uploadFile ? uploadFile : resumeList.value[selectIndex.value]
   if (!resume) {
     selectIndex.value = null
     uni.showToast({ title: '请选择简历', icon: 'none', duration: 2000, })
@@ -235,8 +239,10 @@ const handleSubmit = async () => {
   deliveryCheck()
   popup.value.close()
 }
+
 const popupClose = () => {
   selectIndex.value = null
+  popup.value.close()
 }
 
 
@@ -250,13 +256,49 @@ const getCollectionStatus = async () => {
 
 // 操作 收藏&取消收藏职位
 const handleCollection = async () => {
-  // if (!getAccessToken()) return
-  console.log('1', 1)
   const api = isCollection.value ? getPersonJobUnfavorite : getPersonJobFavorite
   await api(isCollection.value ? jobId : { jobId })
   await getCollectionStatus()
 }
 
+// 选取微信聊天文件
+// 上传附件
+const handleUpload = () => {
+  wx.chooseMessageFile({
+    count: 1,
+    type: 'file',
+    success (res) {
+      const title = res.tempFiles[0].name
+      const path = res.tempFiles[0].path
+      //效验是否为支持的文件格式
+      if(/\.(pdf|docx|doc)$/.test(title)){
+        uploadFileTest(path).then(async (res) => {
+          if (!res.data) {
+            uni.showToast({
+              title: '上传失败',
+              icon: 'none'
+            })
+            return
+          }
+          await saveResume({ title, url: res.data })
+          uni.showToast({
+            title: '上传成功',
+            icon: 'success'
+          })
+          deliverySubmit({ title, url: res.data })
+        })
+      }else{
+        uni.showToast({
+          icon: 'none',
+          title: '请上传pdf、word类型的文件',
+          duration: 2000
+        })
+        return
+      }
+    }
+  })
+}
+
 </script>
 <style scoped lang="scss">
 .mb5 { margin-bottom: 5px; }
@@ -411,7 +453,7 @@ const handleCollection = async () => {
 	display: flex;
 	align-items: center;
 }
-.show-more{
+.showPopup-more{
 	width: 26vw;
 	white-space: nowrap;
 	overflow: hidden;
@@ -436,7 +478,8 @@ const handleCollection = async () => {
     color:#767a82;
     padding: 20rpx;
     .title {
-      font-weight:bold;
+      font-weight: bold;
+      margin-left: 10rpx;
     }
   }
   .dialog-content{
@@ -446,6 +489,12 @@ const handleCollection = async () => {
       background-color: #00897b !important;
     }
   }
+  .selectOnline {
+    font-size: 14px;
+    color: #00897b;
+    text-align: center;
+    margin-top: 10rpx;
+  }
   .dialog-bottom{
     width: 100%;
     height: 44px;