completeMsg.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. <template>
  2. <view class="company">
  3. <nav-bar title="完善招聘名片"></nav-bar>
  4. <view class="company-content">
  5. <view class="company-title">完善你的招聘名片</view>
  6. <view class="company-desc">求职者更愿意主动联系名片信息完整的HR</view>
  7. <!-- 头像上传区域 -->
  8. <view class="form-label">头像</view>
  9. <view class="avatar-section">
  10. <view class="avatar-upload" @click="chooseAvatar">
  11. <view class="avatar-preview">
  12. <image v-if="avatar" :src="avatar" class="avatar-image" mode="aspectFill"></image>
  13. <image v-else src="@/static/images/jobApplicant/touxiang.svg" mode="scaleToFill"
  14. class="user-img" />
  15. </view>
  16. <view class="upload-view">修改头像</view>
  17. </view>
  18. </view>
  19. <!-- 姓名 -->
  20. <view class="form-item">
  21. <view class="form-label">填写职务</view>
  22. <view class="input-wrapper">
  23. <input placeholder="真实的职务,更能赢得牛人的信任" v-model="name" class="form-input" placeholder-class="placeholder" />
  24. </view>
  25. </view>
  26. <!-- email -->
  27. <!-- <view class="form-item">
  28. <view class="form-label">填写email</view>
  29. <u-input placeholder="填写email,方便牛人联系" v-model="email" :border="false"
  30. :class="{ 'form-input': true, 'error': emailError }" @blur="validateEmailOnBlur"></u-input>
  31. <view v-if="emailError" class="error-message">
  32. {{ emailError }}
  33. </view>
  34. </view> -->
  35. <view class="form-item list">
  36. <view class="form-label">求职者视角中的效果</view>
  37. <view class="form-border" v-for="(item, inx) in userpost" :key="inx">
  38. <view class="form-border-top">
  39. <view class="form-border-title">{{ item.ruleClassifyName }}</view>
  40. <view class="form-border-money">{{ item.salaryRange }} <text v-if="item.salaryTimes">· {{ item.salaryTimes }}</text></view>
  41. </view>
  42. <view class="form-border-desc" v-if="item.company">{{ item.company.companyName || item.company.companyAllName}} {{ item.company.companyPeople }}</view>
  43. <view class="form-border-img-name">
  44. <view class="people-img">
  45. <image v-if="avatar" :src="avatar" class="avatar-image"
  46. mode="aspectFill"></image>
  47. <image v-else src="@/static/images/jobApplicant/touxiang.svg" mode="scaleToFill"
  48. class="user-img" />
  49. </view>
  50. <view class="people-name">{{ item.hr ? item.hr.hrPosition : "无" }} 招聘者</view>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="fixed-section">
  55. <view class="link-btn" v-if="showAfterBtn" @click="handleAfterFinished">稍后完善</view>
  56. <view class="submit-btn" @click="submithr">开始招聘</view>
  57. </view>
  58. </view>
  59. <!-- 弹窗说明 -->
  60. <c-modal
  61. :value="showModal"
  62. title="企业介绍"
  63. confirm-button-text="完善信息"
  64. cancel-button-text="稍后完善"
  65. @cancel="handleAfterFinished"
  66. @confirm="handleConfirm"
  67. >为了让更多的求职者关注您的招聘岗位,建议您直接完善公司介绍</c-modal>
  68. <!-- 权限说明弹窗 -->
  69. <u-popup mode="top" ref="permission">
  70. <view class="popup-content">
  71. <view class="popup-text-permission">选择/拍摄照片需要相机/相册权限,用于上传用户头像</view>
  72. </view>
  73. </u-popup>
  74. </view>
  75. </template>
  76. <script>
  77. import navBar from "@/components/nav-bar/index.vue";
  78. import cModal from '@/components/c-modal.vue';
  79. export default {
  80. data() {
  81. return {
  82. avatar: "",
  83. name: "",
  84. isok: false,
  85. email: '',
  86. emailError: "", // 添加错误提示
  87. userpost: [],
  88. showAfterBtn: true, // 显示页面的稍后完善按钮,用户没有职务时显示
  89. showModal: false,
  90. companyStatus: 1, // 公司状态 1审核中 2审核通过 3审核拒绝
  91. isAdmin: false, // 是否是管理员
  92. hasReviewPosition: false, // 判断是否有审核中的岗位
  93. companyId: '',
  94. companyInfo: {}
  95. };
  96. },
  97. components: {
  98. navBar,
  99. cModal,
  100. },
  101. onShow() {
  102. this.getPositionInfo()
  103. this.getmypost()
  104. this.getcompanystatus()
  105. },
  106. methods: {
  107. // 选择头像
  108. async chooseAvatar() {
  109. var that = this
  110. /// 1. 检查权限状态
  111. const hasPermission = await this.$queue.checkPermission(
  112. 'camera',
  113. '选择/拍摄照片需要相机/相册权限,用于上传用户头像',
  114. this
  115. );
  116. // 2. 如果未授权或者用户拒绝,显示提示
  117. if (!hasPermission) {
  118. return;
  119. }
  120. uni.chooseImage({
  121. count: 1,
  122. sizeType: ["compressed"],
  123. sourceType: ["album", "camera"],
  124. success: (res) => {
  125. that.$queue.uploadFile(res.tempFilePaths[0], function (path) {
  126. console.log("上传返回?:", path)
  127. if (path) {
  128. that.avatar = path;
  129. }
  130. })
  131. },
  132. });
  133. },
  134. // 验证所有表单字段
  135. validateForm() {
  136. let isValid = true;
  137. // 验证头像
  138. if (!this.avatar) {
  139. uni.showToast({
  140. title: "请上传头像",
  141. icon: "none"
  142. });
  143. return false;
  144. }
  145. // 验证职务
  146. if (!this.name) {
  147. uni.showToast({
  148. title: "请输入职务",
  149. icon: "none"
  150. });
  151. return false;
  152. }
  153. // // 验证邮箱
  154. // if (!this.email) {
  155. // this.emailError = "邮箱不能为空";
  156. // uni.showToast({
  157. // title: "请输入邮箱",
  158. // icon: "none"
  159. // });
  160. // return false;
  161. // }
  162. // // 验证邮箱格式
  163. // if (!this.validateEmail(this.email)) {
  164. // this.emailError = "邮箱格式不正确";
  165. // uni.showToast({
  166. // title: "邮箱格式不正确",
  167. // icon: "none"
  168. // });
  169. // return false;
  170. // }
  171. this.emailError = ""; // 清除错误提示
  172. return true;
  173. },
  174. // 提交 hr 信息(修改后的版本)
  175. submithr() {
  176. // 先验证表单
  177. if (!this.validateForm()) {
  178. return;
  179. }
  180. // 构造提交数据(添加邮箱)
  181. const data = {
  182. hrImg: this.avatar, // 头像
  183. hrPosition: this.name, // 职位
  184. hrEmail: this.email // 添加邮箱
  185. };
  186. // 调用接口提交
  187. uni.showLoading({
  188. title: "提交中..."
  189. });
  190. this.$Request.postJson("/app/HrFirst/addHr", data)
  191. .then((res) => {
  192. uni.hideLoading();
  193. if (res.code === 0) {
  194. this.isok = true;
  195. // 判断是否是管理员
  196. if (this.isAdmin && this.companyStatus != 2) {
  197. this.showModal = true
  198. } else {
  199. this.handleAfterFinished()
  200. }
  201. } else {
  202. uni.showToast({
  203. title: res.msg || "提交失败",
  204. icon: "none"
  205. });
  206. }
  207. })
  208. .catch((err) => {
  209. uni.hideLoading();
  210. console.error("提交失败:", err);
  211. // uni.showToast({
  212. // title: "网络异常",
  213. // icon: "none"
  214. // });
  215. });
  216. },
  217. //获取我发布的岗位列表
  218. getmypost() {
  219. this.$Request.get("/app/postPush/getMyPostPush", { status: "" })
  220. .then((res) => {
  221. if (res.code != 0) {
  222. uni.showToast({
  223. title: res.msg || "查询失败",
  224. icon: "none"
  225. });
  226. return;
  227. }
  228. this.userpost = res.data.records || [];
  229. if (this.userpost.length && this.userpost[0].hr) {
  230. // this.name = this.userpost[0].hr.hrPosition || ""
  231. // this.avatar = this.userpost[0].hr.hrImg || ""
  232. this.showAfterBtn = this.userpost[0]?.hr?.hrPosition ? false : true
  233. }
  234. // 判断是否有审核中职位
  235. if (this.userpost.length == 1) {
  236. this.hasReviewPosition = this.userpost[0].status == 1
  237. }
  238. console.log("查询我的岗位列表状态", res)
  239. })
  240. .catch((err) => {
  241. console.error("查询失败:", err);
  242. uni.showToast({
  243. title: "查询失败",
  244. icon: "none"
  245. });
  246. });
  247. },
  248. // 查询用户企业状态
  249. getcompanystatus() {
  250. this.$Request.get('/app/company/selectCompanyByUserId')
  251. .then((res) => {
  252. if (res.code == 0) {
  253. // 判断是否是管理员
  254. if (res.data?.companyUser?.isAdmin == 1) {
  255. this.isAdmin = true
  256. }
  257. // 公司状态
  258. if (res.data.status) {
  259. this.companyStatus = res.data.status
  260. }
  261. this.companyInfo = res.data
  262. this.companyId = res.data.companyId
  263. }
  264. })
  265. },
  266. // 获取职位信息
  267. getPositionInfo() {
  268. this.$Request.getT('/app/HrFirst/getUserHr')
  269. .then(res => {
  270. if (res.code == 0) {
  271. this.avatar = res.data.HrEntity.hrImg
  272. this.name = res.data.HrEntity.hrPosition
  273. this.email = res.data.HrEntity.hrEmail
  274. }
  275. })
  276. },
  277. handleConfirm() {
  278. this.showModal = false
  279. uni.navigateTo({
  280. url: `/my/renzheng/editCompany?companyId=${this.companyId}`
  281. })
  282. },
  283. // 稍后完善,如果没有职位等待审核中,则跳转到陈列页
  284. handleAfterFinished() {
  285. if (!this.isAdmin) {
  286. return uni.reLaunch({ url: '/pages/index/index' })
  287. }
  288. if (this.hasReviewPosition) {
  289. // 第一次发布岗位,并且正在审核中
  290. uni.reLaunch({ url: '/pages/index/index' })
  291. } else {
  292. uni.navigateTo({ url: '/pages/jobManagement/jobManagement?type=canClose' })
  293. }
  294. }
  295. },
  296. };
  297. </script>
  298. <style scoped lang="scss">
  299. @import '@/common.scss';
  300. .company {
  301. position: absolute;
  302. left: 0;
  303. right: 0;
  304. top: 0;
  305. bottom: 0;
  306. display: flex;
  307. flex-direction: column;
  308. font-family: DM Sans;
  309. .company-content {
  310. flex: 1;
  311. padding: 40rpx 40rpx 180rpx;
  312. box-sizing: border-box;
  313. overflow: hidden;
  314. overflow-y: auto;
  315. .company-title {
  316. color: #333;
  317. font-size: 48rpx;
  318. font-weight: 700;
  319. line-height: 60rpx;
  320. margin-bottom: 20rpx;
  321. }
  322. .company-desc {
  323. color: rgba(102, 102, 102, 1);
  324. font-size: 24rpx;
  325. font-weight: 400;
  326. line-height: 32rpx;
  327. margin-bottom: 20rpx;
  328. }
  329. .form-label {
  330. color: #1f2c37;
  331. font-family: DM Sans;
  332. font-size: 28rpx;
  333. font-weight: 500;
  334. line-height: 44rpx;
  335. margin-bottom: 20rpx;
  336. box-sizing: border-box;
  337. }
  338. .avatar-section {
  339. display: flex;
  340. margin-bottom: 36rpx;
  341. }
  342. .avatar-upload {
  343. display: flex;
  344. align-items: center;
  345. }
  346. .avatar-preview {
  347. width: 48rpx;
  348. height: 48rpx;
  349. border-radius: 50%;
  350. display: flex;
  351. align-items: center;
  352. justify-content: center;
  353. margin-right: 20rpx;
  354. }
  355. .avatar-image {
  356. width: 100%;
  357. height: 100%;
  358. border-radius: 50%;
  359. }
  360. .upload-view {
  361. color: #016bf6;
  362. font-family: DM Sans;
  363. font-size: 20rpx;
  364. font-weight: 500;
  365. line-height: 48rpx;
  366. }
  367. .form-item {
  368. padding-bottom: 24rpx;
  369. box-sizing: border-box;
  370. .job-txt {
  371. color: #016bf6;
  372. font-family: DM Sans;
  373. font-size: 20rpx;
  374. margin-left: 16rpx;
  375. }
  376. .form-border {
  377. box-sizing: border-box;
  378. border: 1rpx solid rgba(227, 231, 236, 1);
  379. border-radius: 12rpx;
  380. background: rgba(253, 253, 253, 1);
  381. padding: 36rpx;
  382. box-sizing: border-box;
  383. margin-bottom: 20rpx;
  384. .form-border-top {
  385. display: flex;
  386. justify-content: space-between;
  387. align-items: center;
  388. .form-border-title {
  389. color: rgba(23, 23, 37, 1);
  390. font-family: DM Sans;
  391. font-size: 32rpx;
  392. font-weight: 700;
  393. line-height: 48rpx;
  394. }
  395. .form-border-money {
  396. color: #016bf6;
  397. font-family: DM Sans;
  398. font-size: 24rpx;
  399. font-weight: 700;
  400. line-height: 40rpx;
  401. }
  402. }
  403. .form-border-desc {
  404. color: rgba(156, 164, 171, 1);
  405. font-family: DM Sans;
  406. font-size: 24rpx;
  407. font-weight: 400;
  408. line-height: 40rpx;
  409. padding: 6rpx 0;
  410. box-sizing: border-box;
  411. }
  412. .form-border-img-name {
  413. display: flex;
  414. align-items: center;
  415. gap: 8rpx;
  416. .people-img {
  417. image {
  418. width: 40rpx;
  419. height: 40rpx;
  420. }
  421. }
  422. .people-name {
  423. color: rgba(156, 164, 171, 1);
  424. font-family: DM Sans;
  425. font-size: 16rpx;
  426. font-weight: 400;
  427. }
  428. }
  429. }
  430. }
  431. .form-item:last-child {
  432. border-bottom: none;
  433. }
  434. .list {
  435. padding-bottom: 100rpx;
  436. }
  437. .form-label {
  438. color: #1f2c37;
  439. font-family: DM Sans;
  440. font-size: 28rpx;
  441. font-weight: 500;
  442. line-height: 44rpx;
  443. margin-bottom: 20rpx;
  444. box-sizing: border-box;
  445. }
  446. .input-wrapper {
  447. flex: 1;
  448. border: 1px solid rgba(227, 231, 236, 1);
  449. padding: 11rpx 32rpx;
  450. border-radius: 30rpx;
  451. }
  452. .form-input {
  453. font-size: 24rpx;
  454. line-height: 48rpx;
  455. }
  456. .placeholder {
  457. color: rgba(153, 153, 153, 1);
  458. }
  459. }
  460. .submit-btn {
  461. text-align: center;
  462. line-height: 90rpx;
  463. color: #fff;
  464. }
  465. .link-btn {
  466. text-align: center;
  467. color: rgba(1, 107, 246, 1);
  468. font-size: 16px;
  469. font-weight: 400;
  470. line-height: 16px;
  471. margin-bottom: 32rpx;
  472. }
  473. }
  474. ::v-deep .u-input {
  475. text-align: left !important;
  476. }
  477. // .error-message {
  478. // color: #ff4d4f;
  479. // font-size: 24rpx;
  480. // margin-top: 8rpx;
  481. // padding-left: 24rpx;
  482. // }
  483. /* 如果有错误,可以修改输入框边框颜色 */
  484. // .form-input.error {
  485. // border-color: #ff4d4f !important;
  486. // }
  487. </style>