completeMsg.vue 12 KB

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