push.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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" v-if="item.type == 0">
  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">兼职金额(元)</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">兼职时间</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" :class="item.type == 0 ? 're' : ''">{{ item.type == 0 ? '工作地点' : '兼职地点' }}</view>
  62. <picker :disabled="true" @click="chooseLocation()">
  63. <input :placeholder="item.type == 0 ? '请选择' : '留空不限工作地点'" v-model="item.location" :disabled="true" />
  64. <view class="icon more">&#xe8f2;</view>
  65. </picker>
  66. <input placeholder="请输入楼层/单元室/门牌号" v-model="item.mph" v-if="item.address" />
  67. <view class="bz">请仔细确认位置点,否置会影响求职者导航</view>
  68. </view>
  69. <button class="btn" @click="save()">{{ item.id ? '编辑' : '保存' }}</button>
  70. </view>
  71. </template>
  72. <script>
  73. export default {
  74. data() {
  75. return {
  76. lable: '职位',
  77. user: this.getUser(),
  78. item: {},
  79. end: this.util.getDate('day'),
  80. dict: {
  81. positionName: this.util.getData('positionName'),
  82. experience: this.util.getData('experience'),
  83. salary: [['面议'], ['']],
  84. location: this.util.getData('address'),
  85. unit: this.util.getData('unit')
  86. },
  87. rule: []
  88. };
  89. },
  90. onLoad(e) {
  91. if (e.type) {
  92. this.item.type = e.type;
  93. setTimeout(() => {
  94. uni.setNavigationBarTitle({ title: e.type == 0 ? '发布全职' : '发布兼职' });
  95. }, 300);
  96. this.$forceUpdate();
  97. }
  98. if (e.id) {
  99. this.http.request({
  100. url: '/app/position/manage/detail/' + e.id,
  101. success: (res) => {
  102. this.item = res.data.data;
  103. this.$refs.editor.setContents();
  104. uni.setNavigationBarTitle({ title: this.item.type == 0 ? '编辑全职' : '编辑兼职' });
  105. }
  106. });
  107. }
  108. uni.$on('select_position', (res) => {
  109. this.item.positionName = res.title;
  110. this.item.positionId = res.id;
  111. this.$forceUpdate();
  112. });
  113. },
  114. methods: {
  115. picker(e, tag) {
  116. if (tag == 'startDate' || tag == 'endDate') {
  117. this.item[tag] = e.detail.value;
  118. } else {
  119. this.item[tag] = this.dict[tag][e.detail.value];
  120. }
  121. this.$forceUpdate();
  122. },
  123. go(url) {
  124. uni.navigateTo({ url: url });
  125. },
  126. chooseLocation() {
  127. uni.chooseLocation({
  128. success: (res) => {
  129. let reg = /.+?(省|市|自治区|自治州|县|区)/g;
  130. let addressList = res.address.match(reg).toString().split(',');
  131. //注意区分直辖市;
  132. let city = addressList.length >= 3 ? addressList[1] : addressList[0];
  133. let region = addressList.length >= 3 ? addressList[2] : addressList[1];
  134. this.item.location = res.name;
  135. this.item.address = res.address;
  136. this.item.longitude = res.longitude;
  137. this.item.latitude = res.latitude;
  138. this.item.regionName = region;
  139. this.item.cityName = city;
  140. this.$forceUpdate();
  141. }
  142. });
  143. },
  144. save() {
  145. this.http.request({
  146. url: this.item.id ? '/app/position/manage/edit' : '/app/position/manage/add',
  147. data: this.item,
  148. method: 'POST',
  149. success: (res) => {
  150. //实名认证跳转
  151. if (res.data.code == 7878) {
  152. uni.showModal({
  153. title: '提示',
  154. content: res.data.msg,
  155. showCancel: false,
  156. success: (res) => {
  157. uni.navigateTo({ url: '/pages/user/auth' });
  158. }
  159. });
  160. return;
  161. }
  162. //企业认证跳转
  163. if (res.data.code == 7979) {
  164. uni.showModal({
  165. title: '提示',
  166. content: res.data.msg,
  167. showCancel: false,
  168. success: (res) => {
  169. uni.navigateTo({ url: '/pages/user/enterprise/index' });
  170. }
  171. });
  172. return;
  173. }
  174. uni.showToast({ title: '操作成功' });
  175. setTimeout(() => {
  176. uni.$emit('position');
  177. uni.navigateBack();
  178. }, 1500);
  179. }
  180. });
  181. }
  182. }
  183. };
  184. </script>
  185. <style lang="scss"></style>