completeMsg.vue 12 KB

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