Recruiting.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <div class="Recruiting">
  3. <div class="box1">
  4. <img src="../assets/img/5.gif" alt="" />
  5. </div>
  6. <!-- 表单 -->
  7. <div class="box2">
  8. <el-form
  9. :model="ruleForm"
  10. :rules="rules"
  11. ref="ruleForm"
  12. class="demo-ruleForm"
  13. >
  14. <div class="row">您的姓名 <span>(已加密,请放心填写)</span></div>
  15. <el-form-item prop="name">
  16. <el-input
  17. v-model="ruleForm.name"
  18. maxlength="10"
  19. placeholder="请输入"
  20. ></el-input>
  21. </el-form-item>
  22. <div class="row">您的电话 <span>(已加密,请放心填写)</span></div>
  23. <el-form-item prop="phone">
  24. <el-input
  25. v-model="ruleForm.phone"
  26. maxlength="11"
  27. placeholder="请输入"
  28. ></el-input>
  29. </el-form-item>
  30. <div class="row">所在城市 <span>(已加密,请放心填写)</span></div>
  31. <el-form-item prop="city">
  32. <el-input
  33. v-model="ruleForm.city"
  34. maxlength="50"
  35. placeholder="请输入"
  36. ></el-input>
  37. </el-form-item>
  38. </el-form>
  39. <!-- 按钮 -->
  40. <div class="btnn" @click="submit">提 交 申 请</div>
  41. </div>
  42. </div>
  43. </template>
  44. <script>
  45. import { alipaySave } from "../api/api";
  46. export default {
  47. name: "Recruiting",
  48. components: {},
  49. data() {
  50. //这里存放数据
  51. return {
  52. ruleForm: {
  53. name: "",
  54. phone: "",
  55. city: "",
  56. type: "edu",
  57. },
  58. rules: {
  59. name: [{ required: true, message: "不能为空", trigger: "blur" }],
  60. phone: [
  61. { required: true, message: "不能为空", trigger: "blur" },
  62. {
  63. pattern: /^1[3-9]\d{9}$/,
  64. message: "请输入合法手机号",
  65. trigger: "blur",
  66. },
  67. ],
  68. city: [{ required: true, message: "不能为空", trigger: "blur" }],
  69. },
  70. };
  71. },
  72. //监听属性 类似于data概念
  73. computed: {},
  74. //监控data中的数据变化
  75. watch: {},
  76. //方法集合
  77. methods: {
  78. // 点击提交
  79. async submit() {
  80. try {
  81. await this.$refs.ruleForm.validate();
  82. let res = await alipaySave(this.ruleForm);
  83. if (res.data.code === 0) {
  84. this.$message.success("提交成功");
  85. this.ruleForm = {
  86. name: "",
  87. phone: "",
  88. city: "",
  89. type: "edu",
  90. };
  91. } else this.$message.error(res.data.msg);
  92. } catch (error) {
  93. console.log(error);
  94. }
  95. },
  96. },
  97. //生命周期 - 创建完成(可以访问当前this实例)
  98. created() {},
  99. //生命周期 - 挂载完成(可以访问DOM元素)
  100. mounted() {
  101. document.title = "元宇宙建模师火热招募";
  102. // chrome
  103. document.body.scrollTop = 0;
  104. // firefox
  105. document.documentElement.scrollTop = 0;
  106. // safari
  107. window.pageYOffset = 0;
  108. },
  109. beforeCreate() {}, //生命周期 - 创建之前
  110. beforeMount() {}, //生命周期 - 挂载之前
  111. beforeUpdate() {}, //生命周期 - 更新之前
  112. updated() {}, //生命周期 - 更新之后
  113. beforeDestroy() {}, //生命周期 - 销毁之前
  114. destroyed() {}, //生命周期 - 销毁完成
  115. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  116. };
  117. </script>
  118. <style lang='less' scoped>
  119. ::-webkit-scrollbar {
  120. height: 0;
  121. width: 0;
  122. color: transparent;
  123. }
  124. .Recruiting {
  125. padding-top: 800px;
  126. background: url("../assets/img/bg2.png");
  127. background-size: 100% 100%;
  128. width: 100vw;
  129. max-width: 420px;
  130. height: 2850px;
  131. margin: 0 auto;
  132. .box1 {
  133. width: 100%;
  134. height: 228px;
  135. & > img {
  136. width: 100%;
  137. height: 100%;
  138. }
  139. }
  140. .box2 {
  141. width: 325px;
  142. height: 370px;
  143. background-color: #fff;
  144. border-radius: 5px;
  145. margin: 1400px auto 0;
  146. padding: 10px 20px 0;
  147. .row {
  148. margin-top: 15px;
  149. font-size: 14px;
  150. color: #606266;
  151. & > span {
  152. color: #999;
  153. font-size: 12px;
  154. position: relative;
  155. &::after {
  156. content: "*";
  157. color: #f56c6c;
  158. position: absolute;
  159. right: -1px;
  160. top: 0px;
  161. font-size: 14px;
  162. }
  163. }
  164. }
  165. /deep/.el-form-item {
  166. padding-bottom: 20px;
  167. }
  168. .btnn {
  169. width: 202px;
  170. height: 40px;
  171. line-height: 40px;
  172. border-radius: 20px;
  173. background-color: #5b91fd;
  174. margin: 30px auto 0;
  175. color: #fff;
  176. font-weight: 700;
  177. text-align: center;
  178. }
  179. }
  180. }
  181. </style>