瑶都万能墙
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

305 lines
5.8 KiB

6 months ago
  1. <template>
  2. <view class="page">
  3. <navbar title="发布优质出行" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="form">
  5. <view class="help-issue">
  6. <text>出行标题</text>
  7. <text style="color: #BD3624;">*</text>
  8. </view>
  9. <view class="form-sheet-cell">
  10. <input type="text"
  11. v-model="form.title"
  12. class="title-input"/>
  13. </view>
  14. <uv-cell
  15. title="工作地点"
  16. rightIconStyle="fontSize: 30rpx;"
  17. :value="form.address || '请选择招工地点'"
  18. @click="selectAddr"
  19. isLink
  20. ></uv-cell>
  21. <uv-cell
  22. title="工龄要求"
  23. rightIconStyle="fontSize: 30rpx;"
  24. :value="form.workYear || '请选择工龄要求'"
  25. @click="openPicker('workYear')"
  26. isLink
  27. ></uv-cell>
  28. <view class="form-sheet-cell">
  29. <view class="label">
  30. 招聘公司
  31. </view>
  32. <input placeholder="请输入招聘公司" v-model="form.company" />
  33. </view>
  34. <view class="form-sheet-cell">
  35. <view class="label">
  36. 薪资范围
  37. </view>
  38. <input placeholder="请输入薪资范围" v-model="form.minPrice" />
  39. </view>
  40. <view class="form-sheet-cell">
  41. <view class="label">
  42. 标签
  43. </view>
  44. <input placeholder="请输入标签(多个用,号分割)" v-model="form.iconText" />
  45. </view>
  46. <view class="form-sheet-cell">
  47. <view class="label">
  48. 联系人
  49. </view>
  50. <input placeholder="请输入联系人" v-model="form.userName" />
  51. </view>
  52. <view class="form-sheet-cell">
  53. <view class="label">
  54. 联系电话
  55. </view>
  56. <input placeholder="请输入联系电话" v-model="form.userPhone" />
  57. </view>
  58. <view class="category">
  59. <view class="title">
  60. 选择地区
  61. </view>
  62. <view class="tagList">
  63. <view
  64. :class="{act : t.id == form.addId}"
  65. @click="form.addId = t.id"
  66. v-for="(t, i) in cityList"
  67. :key="i">
  68. {{ t.name }}
  69. </view>
  70. </view>
  71. </view>
  72. <view class=""
  73. style="margin-top: 20rpx;">
  74. <uv-textarea
  75. v-model="form.jobDetails"
  76. count
  77. :maxlength="300"
  78. autoHeight
  79. placeholder="请输入岗位详细介绍"></uv-textarea>
  80. </view>
  81. <view class="uni-color-btn"
  82. @click="submit">
  83. 发布
  84. </view>
  85. </view>
  86. <uv-picker ref="picker"
  87. :columns="columns"
  88. @confirm="pickerConfirm"></uv-picker>
  89. </view>
  90. </template>
  91. <script>
  92. import Position from '@/utils/position.js'
  93. import { mapState } from 'vuex'
  94. export default {
  95. data() {
  96. return {
  97. form : {
  98. school : '',
  99. workYear : '',
  100. minPrice : '',
  101. maxPrice : '',
  102. address : '',
  103. addId : '',
  104. company : '',
  105. gsContext : '',
  106. jobContext : '',
  107. },
  108. radiovalue : '',
  109. priceList : [
  110. {
  111. name : '日结',
  112. },
  113. {
  114. name : '月结',
  115. },
  116. ],
  117. jopList : [
  118. {
  119. name : '正式工',
  120. },
  121. {
  122. name : '临时工',
  123. },
  124. ],
  125. picker : {
  126. workYear : [
  127. '不限',
  128. ],
  129. school : [
  130. '不限',
  131. '初中',
  132. '高中',
  133. '专科',
  134. '本科',
  135. '研究生',
  136. '博士',
  137. ],
  138. },
  139. pickerKey : 'workYear',
  140. }
  141. },
  142. onLoad() {
  143. for (var i = 0; i < 30; i++) {
  144. this.picker.workYear.push((i + 1) + '年')
  145. }
  146. this.form.addId = this.cityList[0].id
  147. },
  148. computed : {
  149. columns(){
  150. return [this.picker[this.pickerKey]]
  151. },
  152. ...mapState(['cityList', 'category']),
  153. },
  154. methods: {
  155. openPicker(key){
  156. this.pickerKey = key
  157. this.$refs.picker.open()
  158. },
  159. pickerConfirm(e){
  160. this.form[this.pickerKey] = e.value[0]
  161. },
  162. //地图上选择地址
  163. selectAddr() {
  164. Position.selectAddress(res => {
  165. //经纬度信息
  166. this.form.latitude = res.latitude
  167. this.form.longitude = res.longitude
  168. if (res.name) {
  169. return this.form.address = res.name
  170. }
  171. this.form.address = ''
  172. })
  173. },
  174. // 提交
  175. submit(){
  176. // if(this.fileList.length == 0){
  177. // return uni.showToast({
  178. // title: '请上传图片',
  179. // icon : 'none'
  180. // })
  181. // }
  182. if (this.$utils.verificationAll(this.form, {
  183. title: '请输入招工标题',
  184. address : '请选择工作地点',
  185. workYear : '请选择工龄要求',
  186. company : '请输入招聘公司',
  187. minPrice : '请输入薪资范围',
  188. iconText: '请输入标签',
  189. userName: '请输入联系人',
  190. userPhone: '请输入联系电话',
  191. jobDetails: '请输入岗位详细介绍',
  192. })) {
  193. return
  194. }
  195. this.$api('publishJob', this.form, res => {
  196. if(res.code == 200){
  197. uni.showToast({
  198. title: '发布成功!',
  199. icon: 'none'
  200. })
  201. setTimeout(uni.navigateBack, 1000, -1)
  202. }
  203. })
  204. },
  205. }
  206. }
  207. </script>
  208. <style scoped lang="scss">
  209. .page{
  210. background-color: #fff;
  211. min-height: 100vh;
  212. box-sizing: border-box;
  213. color: #333333;
  214. font-size: 28rpx;
  215. /deep/ text{
  216. font-size: 28rpx !important;
  217. }
  218. input{
  219. width: 450rpx;
  220. }
  221. .form{
  222. padding: 30rpx;
  223. .help-issue {
  224. margin: 20rpx;
  225. }
  226. .title-input{
  227. border: 1px solid $uni-color;
  228. width: 100%;
  229. border-radius: 10rpx;
  230. padding: 10rpx 20rpx;
  231. box-sizing: border-box;
  232. height: 65rpx;
  233. }
  234. .form-sheet-cell{
  235. display: flex;
  236. background-color: #fff;
  237. padding: 20rpx 30rpx;
  238. align-items: center;
  239. .label{
  240. width: 160rpx;
  241. }
  242. .price{
  243. display: flex;
  244. text-align: center;
  245. input{
  246. width: 150rpx;
  247. border: 1px solid $uni-color;
  248. margin: 0 10rpx;
  249. }
  250. }
  251. .right-icon{
  252. margin-left: auto;
  253. }
  254. }
  255. }
  256. .category{
  257. padding: 20rpx;
  258. .title{
  259. // font-weight: 900;
  260. // font-size: 30rpx;
  261. }
  262. .tagList{
  263. display: flex;
  264. flex-wrap: wrap;
  265. padding: 10rpx 0;
  266. view{
  267. background: rgba($uni-color, 0.1);
  268. padding: 10rpx 20rpx;
  269. margin: 10rpx;
  270. border-radius: 10rpx;
  271. font-size: 26rpx;
  272. }
  273. .act{
  274. color: #fff;
  275. background: $uni-color;
  276. }
  277. }
  278. }
  279. }
  280. </style>