talent.vue 10 KB

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