improvePrompt.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <template>
  2. <view class="container">
  3. <view>
  4. <image src="/static/images/slogan.png" class="slogan"></image>
  5. <view class="content">
  6. <image src="/static/images/logo-long.png" class="logo"></image>
  7. <view class="tip">温馨提示</view>
  8. <view class="tip-text">
  9. <template v-if="scene == 1">
  10. <view class="text">如果您的简历完善度不足80%</view>
  11. <view class="text">我们将无法进行推荐</view>
  12. <view class="text">为更好地求职机会,请充分填写简历</view>
  13. </template>
  14. <template v-else>
  15. <view class="text">如果您的求职期望至少有一条,</view>
  16. <view class="text">且完善总分数大于等于60分</view>
  17. <view class="text">我们将进行简历推荐,请充分填写简历</view>
  18. </template>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="buttons">
  23. <template v-if="scene == 1">
  24. <view class="white-btn" @click="toOnlineResume">完善在线简历</view>
  25. </template>
  26. <template v-else>
  27. <view class="link-btn" @click="handleSubmit">手动完善简历</view>
  28. <view class="white-btn" @click="handlUploadFile">附件简历一键识别</view>
  29. </template>
  30. </view>
  31. <view class="load-container" v-if="showLoadCard">
  32. <view class="video-container">
  33. <view class="title">简历解析中</view>
  34. <video src="https://bossweb.edccc.cn/video_260307_151616.mp4" :muted="true" :autoplay="true" :controls="false" :loop="true" object-fit="fill"></video>
  35. </view>
  36. </view>
  37. <!-- <load-card :progress="progress" v-if="showLoadCard"></load-card> -->
  38. </view>
  39. </template>
  40. <script>
  41. // #ifdef APP-PLUS
  42. import { chooseFileFromModule } from '@/uni_modules/sr-file-choose'
  43. // #endif
  44. import loadCard from '@/components/load-card.vue'
  45. import config from '@/common/config'
  46. export default {
  47. components: {
  48. loadCard
  49. },
  50. data() {
  51. return {
  52. scene: 0, // 0正常进入 1邀请进入
  53. progress: 0,
  54. showLoadCard: false,
  55. timer: null
  56. };
  57. },
  58. onLoad(options) {
  59. if (options.scene) {
  60. this.scene = options.scene
  61. }
  62. },
  63. // onUnload() {
  64. // if (this.timer) {
  65. // clearInterval(this.timer)
  66. // }
  67. // },
  68. methods: {
  69. toOnlineResume() {
  70. uni.navigateTo({
  71. url: `/pages/my/onlineResume?scene=${this.scene}`
  72. })
  73. },
  74. // 手动完善
  75. handleSubmit() {
  76. uni.navigateTo({
  77. url: `/pages/my/onlineResume?scene=${this.scene}`
  78. })
  79. },
  80. // 附件一键识别
  81. handlUploadFile() {
  82. // #ifdef APP-PLUS
  83. chooseFileFromModule({
  84. complete: res => {
  85. let path = res.path
  86. let name = res.name
  87. let fileType = ''
  88. // 如果没有name,默认为:截取最后一个/之后的内容
  89. if (!name) {
  90. let lastIndex = path.lastIndexOf('/');
  91. if (lastIndex !== -1) {
  92. name = path.substring(lastIndex + 1);
  93. } else {
  94. name = Math.random().toString(36).substr(2) + Date.now();
  95. }
  96. }
  97. // 使用 lastIndexOf 方法找到最后一个 . 的位置
  98. let lastDotIndex = name.lastIndexOf('.');
  99. if (lastDotIndex !== -1) {
  100. fileType = name.substring(lastDotIndex + 1);
  101. } else {
  102. console.log('文件路径中没有 .');
  103. }
  104. let file = {
  105. size: res.size,
  106. path,
  107. fileType,
  108. name
  109. }
  110. this.uploadFile(file)
  111. }
  112. })
  113. // #endif
  114. // #ifdef H5
  115. uni.chooseFile({
  116. count: 1,
  117. success: res => {
  118. this.uploadFile({
  119. path: res.tempFilePaths[0],
  120. name: 'file'
  121. })
  122. }
  123. })
  124. // #endif
  125. },
  126. // 上传文件
  127. uploadFile(file) {
  128. this.$queue.uploadFiles({
  129. url: '/app/resumes/aiResumesUpload',
  130. path: file.path,
  131. name: 'file'
  132. }, (res) => {
  133. if (res && res.code === 0) {
  134. const id = res.data?.id
  135. const resumesAttachmentId = res.data?.resumesAttachmentId || null
  136. if (id) {
  137. this.getAiResumesAnalysis(id, resumesAttachmentId)
  138. }
  139. } else {
  140. this.$queue.showToast(res ? res.msg : '文件上传失败')
  141. }
  142. })
  143. },
  144. // 获取简历解析数据
  145. getAiResumesAnalysis(fileId, resumesAttachmentId) {
  146. // if (this.timer) {
  147. // clearInterval(this.timer)
  148. // this.progress = 0
  149. // }
  150. this.showLoadCard = true
  151. // this.timer = setInterval(() => {
  152. // if (this.progress < 99) {
  153. // this.progress++
  154. // }
  155. // }, 900)
  156. uni.request({
  157. url: config.APIHOST + '/app/resumes/aiResumesAnalysis',
  158. header: {
  159. 'content-type': 'application/x-www-form-urlencoded', // 模拟 form-data
  160. token: uni.getStorageSync('token'),
  161. },
  162. method: 'post',
  163. data: {
  164. workflowId: '7594327567932309547',
  165. fileId,
  166. resumesAttachmentId
  167. },
  168. timeout: 180000,
  169. success: (res) => {
  170. this.stopLoadStatus()
  171. if (res.data?.code == 0) {
  172. const data = res.data.data.data
  173. this.$queue.setData('AI_Resume_Data', data.output)
  174. uni.reLaunch({
  175. url: `/pages/my/onlineResume?fileId=${fileId}`
  176. })
  177. }
  178. },
  179. fail: (err) => {
  180. this.$queue.showToast('解析失败,请稍后重试')
  181. this.stopLoadStatus()
  182. }
  183. })
  184. },
  185. stopLoadStatus() {
  186. this.showLoadCard = false
  187. // this.progress = 0
  188. // clearInterval(this.timer)
  189. }
  190. }
  191. }
  192. </script>
  193. <style lang="scss">
  194. .container {
  195. position: relative;
  196. display: flex;
  197. flex-direction: column;
  198. justify-content: space-between;
  199. min-height: 100vh;
  200. background-color: #016bf6;
  201. background-image: url('/static/images/bg1.png');
  202. background-size: 100%;
  203. background-repeat: repeat;
  204. .slogan {
  205. display: block;
  206. width: 634rpx;
  207. height: 358rpx;
  208. margin: 80rpx auto;
  209. }
  210. .content {
  211. width: 654rpx;
  212. padding: 64rpx;
  213. background-color: #fff;
  214. border-radius: 64rpx;
  215. margin: 0 auto;
  216. text-align: center;
  217. .logo {
  218. display: block;
  219. width: 166rpx;
  220. height: 46rpx;
  221. margin: 0 auto;
  222. }
  223. .tip {
  224. font-size: 40rpx;
  225. font-weight: bold;
  226. line-height: 64rpx;
  227. color: #016bf6;
  228. margin: 48rpx auto 15rpx;
  229. }
  230. .text {
  231. font-size: 32rpx;
  232. line-height: 50rpx;
  233. color: #999;
  234. }
  235. }
  236. .buttons {
  237. margin-bottom: 40rpx;
  238. .white-btn {
  239. width: 600rpx;
  240. height: 88rpx;
  241. font-size: 32rpx;
  242. line-height: 88rpx;
  243. text-align: center;
  244. color: #016bf6;
  245. background-color: #fff;
  246. border-radius: 88rpx;
  247. margin: 32rpx auto 0;
  248. }
  249. .link-btn {
  250. text-align: center;
  251. color: #fff;
  252. }
  253. }
  254. }
  255. .load-container {
  256. position: fixed;
  257. left: 0;
  258. top: 0;
  259. width: 100%;
  260. height: 100%;
  261. display: flex;
  262. align-items: center;
  263. justify-content: center;
  264. background: rgba(0, 0, 0, 0.5);
  265. .video-container {
  266. width: 600rpx;
  267. // height: 600rpx;
  268. background: #fff;
  269. border-radius: 20rpx;
  270. padding: 40rpx;
  271. .title {
  272. font-size: 36rpx;
  273. font-weight: bold;
  274. text-align: center;
  275. line-height: 1;
  276. padding-bottom: 40rpx;
  277. }
  278. }
  279. video {
  280. display: block;
  281. width: 520rpx;
  282. height: 320rpx;
  283. margin: 0 auto;
  284. }
  285. }
  286. </style>