talent.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <view class="huodong-details">
  3. <view class="p-30 ">
  4. <view class="detail-title">
  5. {{ title }}
  6. </view>
  7. <view class="content-box bg-white m-t-30">
  8. <view class="detail-cell row-between u-border-bottom" v-for="(item, index) in surveyList"
  9. @tap="pickerShow(item.name)" v-if="item.type != 'array'">
  10. <view class="width75">
  11. {{item.description}}
  12. </view>
  13. <view class="text-right flex-1" v-if="item.type == 'radio' || item.type == 'select'">
  14. <text class="muted">{{info[item.name]}}</text>
  15. <u-icon name="arrow-right" size="28" color="#B8B8B8"
  16. :label="info[item.name]!= undefined ? '' :'请选择'" label-pos="left"></u-icon>
  17. <u-picker v-model="show[item.name]" mode="selector" :range="item.value"
  18. @confirm="pickerConfirm(index, $event)" @cancel="pickerCancel(index)"></u-picker>
  19. </view>
  20. <view class="text-right flex-1" v-if="item.type == 'checkbox'">
  21. <u-checkbox-group shape="circle" active-color="#DD4250" :name="item.name"
  22. @change="groupChange(index, $event)">
  23. <u-checkbox :name="value" v-for="(value, key) in item.value" :key="key"
  24. v-model="item.checked[key]">
  25. {{value}}
  26. </u-checkbox>
  27. </u-checkbox-group>
  28. </view>
  29. <view class="text-right flex-1" v-if="item.type == 'text'">
  30. <cus-selects :data="item.value" v-model="info[item.name]" :clearable='true' :filterable='true'
  31. :searchType='1' arrLeft='300' placeholder='输入搜索'></cus-selects>
  32. </view>
  33. </view>
  34. <view class="detail-cell row-between u-border-bottom">
  35. <view class="bold">
  36. 验证码
  37. </view>
  38. <view class="text-right flex-1 flex row-right">
  39. <input type="text" v-model="info.code" placeholder="请输入">
  40. <image :src="captchaImg" mode="heightFix" style="height: 54rpx;" class="m-l-10"
  41. @tap="refreshCaptcha"></image>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="footer">
  47. <button class="white btn lg" @click="handleConsult">提交</button>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. import cusSelects from '@/components/cus-selects-fan/cus-selects-fan.vue'
  53. import {
  54. mapGetters,
  55. mapActions
  56. } from 'vuex'
  57. import {
  58. getSurvey,
  59. submitSurvey
  60. } from '@/api/app';
  61. import {
  62. getCaptcha
  63. } from '@/utils/tools'
  64. const app = getApp()
  65. export default {
  66. components: {
  67. cusSelects
  68. },
  69. data() {
  70. return {
  71. show: {},
  72. surveyList: [],
  73. info: {},
  74. captcha: '',
  75. top: 172,
  76. title: '人才信息'
  77. }
  78. },
  79. onLoad(o) {
  80. //人才类型
  81. this.type = this.$Route.query.type;
  82. this.title = this.title = this.$Route.query.title + '人才信息填写';
  83. this.getSurvey();
  84. this.captchaImg = getCaptcha()
  85. },
  86. onShow() {
  87. uni.setNavigationBarTitle({
  88. title: this.title
  89. });
  90. },
  91. onHide() {},
  92. onPullDownRefresh() {},
  93. methods: {
  94. refreshCaptcha() {
  95. this.captchaImg = getCaptcha()
  96. this.$forceUpdate();
  97. },
  98. // ...mapActions(['getUser']),
  99. groupChange(index, detail) {
  100. let item = this.surveyList[index]
  101. this.info[item.name] = detail
  102. },
  103. pickerShow(index) {
  104. this.show[index] = true
  105. this.$forceUpdate();
  106. },
  107. pickerConfirm(index, obj) {
  108. let item = this.surveyList[index]
  109. this.info[item.name] = item.value[obj[0]]
  110. this.show[item.name] = false
  111. this.$forceUpdate();
  112. },
  113. pickerCancel(index, obj) {
  114. let item = this.surveyList[index]
  115. this.show[item.name] = false
  116. this.$forceUpdate();
  117. },
  118. //获取动态表单
  119. async getSurvey() {
  120. const {
  121. status,
  122. data
  123. } = await getSurvey({
  124. type: this.type
  125. });
  126. if (status == 1) {
  127. this.surveyList = data
  128. this.surveyList.map((item, index) => {
  129. // this.show[item.name] = false;
  130. //初始化radio的info
  131. if (item.type == 'radio' || item.type == 'select') {
  132. this.info[item.name] = item.value[0]
  133. }
  134. //初始化模糊搜索框
  135. if (item.type == 'text') {
  136. item.value.forEach((value, key) => {
  137. item.value[key] = {
  138. label: key+1 + '、' + value,
  139. value: value
  140. }
  141. })
  142. }
  143. //checkbox多选判断,初始化checked状态
  144. if (item.type == 'checkbox') {
  145. item.checked = []
  146. item.value.forEach((value, key) => {
  147. item.checked[key] = false
  148. })
  149. return item;
  150. }
  151. })
  152. }
  153. },
  154. //提交表单
  155. async handleConsult() {
  156. if (!this.info.code) {
  157. this.$toast({
  158. title: '请输入验证码'
  159. })
  160. return false;
  161. }
  162. const {
  163. status,
  164. data,
  165. cengci,
  166. msg
  167. } = await submitSurvey(this.info);
  168. if (status == 1) {
  169. uni.setStorageSync('policyList', data);
  170. uni.setStorageSync('policyCengci', cengci);
  171. uni.navigateTo({
  172. url: '/pages/policy/list',
  173. })
  174. }
  175. },
  176. },
  177. computed: {
  178. ...mapGetters(['appConfig']),
  179. }
  180. }
  181. </script>
  182. <style lang="less" scoped>
  183. .huodong-details {
  184. padding-bottom: calc(200rpx + env(safe-area-inset-bottom));
  185. }
  186. .details-images {
  187. height: 408rpx;
  188. border-radius: 20rpx;
  189. overflow: hidden;
  190. width: 100%;
  191. image {
  192. width: 100%;
  193. height: 100%;
  194. }
  195. }
  196. .detail-title {
  197. // font-size: 36rpx;
  198. font-weight: bold;
  199. // padding: 30rpx 0;
  200. }
  201. .detail-cell {
  202. display: flex;
  203. // align-items: center;
  204. padding: 30rpx 0;
  205. .cell-img {
  206. padding: 5rpx 0;
  207. image {
  208. width: 48rpx;
  209. height: 48rpx;
  210. display: block
  211. }
  212. }
  213. }
  214. // .muted {
  215. // color: #989898;
  216. // padding-left: 10rpx;
  217. // }
  218. .detail-biaoti {
  219. // font-size: 36rpx;
  220. height: 88rpx;
  221. line-height: 88rpx;
  222. }
  223. .bj-w {
  224. background-color: #fff;
  225. }
  226. .padding-30 {
  227. padding: 0 30rpx !important;
  228. }
  229. .content-box {
  230. padding: 0 24rpx;
  231. box-shadow: 0rpx 8rpx 16rpx 2rpx rgba(0, 0, 0, 0.03);
  232. border-radius: 12rpx 12rpx 12rpx 12rpx;
  233. input {
  234. font-size: 28rpx;
  235. }
  236. textarea {
  237. width: 100%;
  238. height: 100rpx;
  239. font-size: 28rpx;
  240. }
  241. }
  242. .btn-r-border {
  243. position: relative;
  244. &::after {
  245. content: ' ';
  246. width: 1rpx;
  247. height: 36rpx;
  248. background-color: #CCCCCC;
  249. right: 0;
  250. top: 50%;
  251. margin-top: -18rpx;
  252. position: absolute;
  253. }
  254. }
  255. .width75 {
  256. width: 150rpx;
  257. font-weight: bold;
  258. }
  259. </style>
  260. <style lang="scss">
  261. .footer {
  262. left: 0%;
  263. bottom: 30rpx;
  264. width: 100%;
  265. padding: 0 24rpx;
  266. position: fixed;
  267. z-index: 99;
  268. .btn {
  269. height: 84rpx;
  270. line-height: 84rpx;
  271. background-color: $-color-primary;
  272. box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(243, 113, 113, 0.39);
  273. border-radius: 18rpx 18rpx 18rpx 18rpx;
  274. }
  275. }
  276. page {
  277. padding: 0;
  278. }
  279. .talent-tab {
  280. .title {
  281. font-size: 36rpx;
  282. font-weight: 400;
  283. color: #333333;
  284. }
  285. }
  286. /deep/ .select_input {
  287. border: none !important;
  288. }
  289. /deep/ .select_modal_con {
  290. position: sticky;
  291. // left: -100px;
  292. margin-left: -200rpx;
  293. width: 700rpx;
  294. .select_modal {
  295. height: 100%;
  296. }
  297. .select_content_li {
  298. text-align: left !important;
  299. white-space: normal !important;
  300. overflow: auto !important;
  301. height: auto !important;
  302. line-height: normal !important;
  303. margin-bottom: 16rpx !important;
  304. }
  305. }
  306. </style>