talent.vue 10 KB

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