enterprise_form.html 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. {extend name="public/base_human"/}
  2. {block name="css"}
  3. <style>
  4. .btn_search_item{background:#f2f6ff;display:inline-block;border-radius:5px;line-height:35px;height:35px;text-align:center;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;position:relative;font-size:13px;width:100%;color:#666;margin-bottom:10px;}
  5. .btn_search_item.active{color:var(--blue);}
  6. .btn_search_icon{position:absolute;bottom:-3px;right:-3px;font-size:30px;}
  7. </style>
  8. {/block}
  9. {block name="body"}
  10. <van-nav-bar
  11. class="nav-theme"
  12. :fixed="true"
  13. :placeholder="true"
  14. left-text="返回"
  15. left-arrow
  16. @click-left="onBack"
  17. >
  18. <template #title>
  19. <span class="text-white">企业报名</span>
  20. </template>
  21. </van-nav-bar>
  22. <van-form @submit="onSubmit">
  23. <van-cell-group>
  24. <van-field
  25. v-model="form.name"
  26. required
  27. type="text"
  28. label="企业名称"
  29. placeholder="请输入企业名称"
  30. :rules="[{ required: true, message: '请输入企业名称' }]"
  31. ></van-field>
  32. <van-field
  33. v-model="form.join"
  34. required
  35. type="text"
  36. label="姓名"
  37. placeholder="请输入姓名"
  38. :rules="[{ required: true, message: '请输入姓名' }]"
  39. ></van-field>
  40. <van-field
  41. v-model="form.join_mobile"
  42. required
  43. type="mobile"
  44. label="手机号"
  45. placeholder="请输入手机号"
  46. :rules="[{ required: true, message: '请输入手机号' }]"
  47. ></van-field>
  48. <van-field
  49. v-model="form.wechat"
  50. type="text"
  51. label="微信号"
  52. placeholder="请输入微信号"
  53. ></van-field>
  54. <van-field name="form.cooperate" label="希望合作的业务">
  55. <template #input>
  56. <van-row :gutter="10">
  57. <van-col span="8" v-for="(item) in cooperate_list">
  58. <div :class="{btn_search_item:true,active: in_array(item,form.cooperate)}"
  59. @click="selectAnimal(item)">
  60. {{item}}
  61. <van-icon v-if="in_array(item,form.cooperate)"
  62. class="iconfont icon-gouxuan-youxiajiaogouxuan btn_search_icon text-blue"></van-icon>
  63. </div>
  64. </van-col>
  65. </van-row>
  66. </template>
  67. </van-field>
  68. <van-cell-group>
  69. <van-field
  70. v-model="form.suggestion"
  71. rows="3"
  72. autosize
  73. label="活动建议"
  74. type="textarea"
  75. placeholder="请输入对本次活动想说的话"
  76. ></van-field>
  77. </van-cell-group>
  78. </van-cell-group>
  79. <div style="margin: 16px;">
  80. <van-button round block type="primary" native-type="submit">
  81. 提交
  82. </van-button>
  83. </div>
  84. </van-form>
  85. {/block}
  86. {block name="script"}
  87. <script>
  88. function v_setup() {
  89. let base = {};
  90. base.cooperate_list = {$cooperate_list};
  91. base.selectAnimal = (value) => {
  92. if (base.in_array(value,base.form.cooperate)) {
  93. base.removeByVal(base.form.cooperate,value);
  94. } else {
  95. base.form.cooperate.push(value);
  96. }
  97. console.log(base.form.cooperate);
  98. }
  99. base.in_array = (search,array) => {
  100. for(let i in array){
  101. if(array[i] == search){
  102. return true;
  103. }
  104. }
  105. return false;
  106. };
  107. base.removeByVal = (arrylist , val) => {
  108. for(let i = 0; i < arrylist .length; i++) {
  109. if(arrylist[i] == val) {
  110. arrylist .splice(i, 1);
  111. break;
  112. }
  113. }
  114. }
  115. base.form = Vue.reactive({
  116. cooperate: []
  117. });
  118. base.onBack = () => {
  119. location.href = "{:url('human/index')}";
  120. };
  121. //表单提交
  122. base.onSubmit = () => {
  123. postJson('/human/enterpriseFormPost',base.form).then(() => {
  124. vant.showDialog({
  125. title: '提示',
  126. message: '报名成功',
  127. }).then(() => {
  128. location.href = "{:url('human/tips')}";
  129. });
  130. });
  131. };
  132. return base;
  133. }
  134. </script>
  135. {/block}