improvePrompt.vue 6.4 KB

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