push.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <view class="main">
  3. <view class="form_group">
  4. <view class="lable re">职位名称</view>
  5. <input placeholder="请输入" v-model="item.title" />
  6. </view>
  7. <view class="form_group">
  8. <view class="lable re">职位类型</view>
  9. <picker :disabled="true" @click="go('/pages/job/position/classification')">
  10. <input placeholder="请选择" v-model="item.positionName" :disabled="true" />
  11. <view class="icon more">&#xe8f2;</view>
  12. </picker>
  13. </view>
  14. <view class="form_group">
  15. <view class="lable re">职位描述</view>
  16. <leditor ref="editor" v-model="item.contents" placeholder="请输入职位描述"></leditor>
  17. </view>
  18. <view class="form_group">
  19. <view class="lable re">经验要求</view>
  20. <picker :range="dict.experience" @change="picker($event, 'experience')">
  21. <input placeholder="请选择" v-model="item.experience" :disabled="true" />
  22. <view class="icon more">&#xe8f2;</view>
  23. </picker>
  24. </view>
  25. <view v-if="item.type == 0">
  26. <view class="form_group">
  27. <view class="lable re">薪资范围</view>
  28. <multiSelector v-model="item.salary" :range="dict.salary" name="薪资" placeholder="请选择薪资范围"></multiSelector>
  29. </view>
  30. </view>
  31. <view v-else>
  32. <view class="form_group">
  33. <view class="lable re">{{ lable }}金额(元)</view>
  34. <input type="number" placeholder="请输入" v-model="item.salary" />
  35. </view>
  36. <view class="form_group">
  37. <view class="lable re">结算类型</view>
  38. <picker :range="dict.unit" @change="picker($event, 'unit')">
  39. <input placeholder="请选择" v-model="item.unit" :disabled="true" />
  40. <view class="icon more">&#xe8f2;</view>
  41. </picker>
  42. </view>
  43. <view class="form_group">
  44. <view class="lable re">{{ lable }}时间</view>
  45. </view>
  46. <view class="form_group" style="display: flex">
  47. <view class="start">
  48. <picker mode="date" :start="end" @change="picker($event, 'startDate')">
  49. <input placeholder="开始时间" v-model="item.startDate" :disabled="true" />
  50. </picker>
  51. </view>
  52. <view class="hor">至</view>
  53. <view class="start">
  54. <picker mode="date" :start="end" @change="picker($event, 'endDate')">
  55. <input placeholder="结束时间" v-model="item.endDate" :disabled="true" />
  56. </picker>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="form_group">
  61. <view class="lable re">工作地点</view>
  62. <picker :disabled="true" @click="chooseLocation()" v-if="item.type == 0">
  63. <input placeholder="请选择" v-model="item.location" :disabled="true" />
  64. <view class="icon more">&#xe8f2;</view>
  65. </picker>
  66. <picker :range="dict.location" @change="picker($event, 'location')" v-else>
  67. <input placeholder="请选择" v-model="item.location" :disabled="true" />
  68. <view class="icon more">&#xe8f2;</view>
  69. </picker>
  70. <input placeholder="请输入楼层/单元室/门牌号" v-model="item.mph" v-if="item.address" />
  71. <view class="bz">请仔细确认位置点,否置会影响求职者导航</view>
  72. </view>
  73. <button class="btn" @click="save()">保存</button>
  74. </view>
  75. </template>
  76. <script>
  77. export default {
  78. data() {
  79. return {
  80. lable: '职位',
  81. user: this.getUser(),
  82. item: {},
  83. end: this.util.getDate('day'),
  84. dict: {
  85. positionName: this.util.getData('positionName'),
  86. experience: this.util.getData('experience'),
  87. education: ['不限'].concat(this.util.getData('education')),
  88. salary: [['面议'], ['']],
  89. location: this.util.getData('address'),
  90. unit: this.util.getData('unit')
  91. },
  92. rule: [],
  93. userState: ''
  94. };
  95. },
  96. onLoad(e) {
  97. if (e.type) {
  98. this.item.type = e.type;
  99. }
  100. if (e.id) {
  101. this.http.request({
  102. url: '/app/position/user/push/detail/' + e.id,
  103. success: (res) => {
  104. this.item = res.data.data;
  105. this.$refs.editor.setContents();
  106. }
  107. });
  108. }
  109. uni.$on('select_position', (res) => {
  110. this.item.positionName = res.title;
  111. this.item.positionId = res.id;
  112. this.$forceUpdate();
  113. });
  114. },
  115. methods: {
  116. backTo() {
  117. this.http.request({
  118. url: '/app/position/close/' + this.item.id,
  119. success: (res) => {
  120. uni.showToast({
  121. title: '操作成功!'
  122. });
  123. setTimeout(() => {
  124. uni.$emit('position');
  125. uni.navigateBack();
  126. }, 1500);
  127. }
  128. });
  129. },
  130. go(url) {
  131. uni.navigateTo({
  132. url: url
  133. });
  134. },
  135. picker(e, tag) {
  136. if (tag == 'startDate' || tag == 'endDate') {
  137. this.item[tag] = e.detail.value;
  138. } else {
  139. this.item[tag] = this.dict[tag][e.detail.value];
  140. }
  141. if (this.item.positionName == '选择职位') {
  142. this.item.positionName = '';
  143. uni.navigateTo({
  144. url: '/pages/position/select'
  145. });
  146. }
  147. if (this.item.location == '选择工作地点') {
  148. this.item.location = '';
  149. this.chooseLocation();
  150. }
  151. this.$forceUpdate();
  152. },
  153. chooseLocation() {
  154. uni.chooseLocation({
  155. success: (res) => {
  156. let reg = /.+?(省|市|自治区|自治州|县|区)/g;
  157. let addressList = res.address.match(reg).toString().split(',');
  158. //注意区分直辖市;
  159. let city = addressList.length >= 3 ? addressList[1] : addressList[0];
  160. let region = addressList.length >= 3 ? addressList[2] : addressList[1];
  161. this.item.
  162. this.item.location = res.name;
  163. this.item.address = res.address;
  164. this.item.longitude = res.longitude;
  165. this.item.latitude = res.latitude;
  166. this.item.regionName = region;
  167. this.$forceUpdate();
  168. }
  169. });
  170. },
  171. save() {
  172. /* if (!this.verify.check(this.item, this.rule)) {
  173. uni.showModal({
  174. content: this.verify.error,
  175. showCancel: false
  176. });
  177. return false;
  178. } */
  179. this.item.type=0;
  180. this.http.request({
  181. url: '/app/position/edit',
  182. data: this.item,
  183. method: 'POST',
  184. success: (res) => {
  185. uni.showToast({ title: '发布成功' });
  186. setTimeout(() => {
  187. uni.$emit('position');
  188. uni.navigateBack();
  189. }, 1500);
  190. }
  191. });
  192. }
  193. }
  194. };
  195. </script>
  196. <style lang="scss"></style>