wcomlist.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <template>
  2. <view>
  3. <scroll-view scroll-x class="bg-white nav solid-bottom solid-bottom echo-fixed-top">
  4. <view class="flex text-center">
  5. <view class="cu-item flex-sub" :class="status==0?'text-blue cur':''" @tap="tabSelect" data-status="0">全部</view>
  6. <view class="cu-item flex-sub" :class="status==1?'text-blue cur':''" @tap="tabSelect" data-status="1">待修改</view>
  7. <view class="cu-item flex-sub" :class="status==2?'text-blue cur':''" @tap="tabSelect" data-status="2">待审核</view>
  8. <view class="cu-item flex-sub" :class="status==3?'text-blue cur':''" @tap="tabSelect" data-status="3">已上架</view>
  9. <view class="cu-item flex-sub" :class="status==4?'text-blue cur':''" @tap="tabSelect" data-status="4">已停招</view>
  10. <view class="cu-item flex-sub" :class="status==5?'text-blue cur':''" @tap="tabSelect" data-status="5">已下架</view>
  11. </view>
  12. </scroll-view>
  13. <view class="echo-fixed-top-empty"></view>
  14. <block v-for="(item,index) in plist" :key="index">
  15. <view class="cu-card dynamic no-card solid-bottom echo-comjobs-item margin-tb-sm">
  16. <view class="cu-item shadow padding-top-sm padding-bottom">
  17. <view class="padding-lr padding-bottom-xs flex justify-between align-center">
  18. <view class="basis-xl text-bold text-lg text-cut">
  19. {{item.title}}
  20. <text class="text-red text-sm" v-if="item.wtype==1">(按月)</text>
  21. <text class="text-red text-sm" v-if="item.wtype==2">(按时)</text>
  22. <text class="text-red text-sm" v-if="item.wtype==3">(按件)</text>
  23. <text class="text-red text-sm" v-if="item.wtype==4">(按项目)</text>
  24. <text class="text-sm">{{item.recruit_num}}名</text>
  25. </view>
  26. <view class="basis-xs text-cut text-right text-gray text-sm">{{item.city}}</view>
  27. </view>
  28. <view class="padding-lr flex justify-between align-bottom">
  29. <view><text class="text-red text-bold">{{item.zwagall}}</text></view>
  30. <view class="text-red" v-if="item.recruitment_cate == 2">悬赏{{item.retmoney}}</view>
  31. </view>
  32. <view class="padding-lr padding-bottom-sm text-cut">
  33. <view v-for="(titem,tindex) in item.tags" :key="tindex" class="cu-tag light bg-gray sm">{{titem}}</view>
  34. </view>
  35. <view class="grid solids-top text-center col-2" v-if="item.status==1">
  36. <view @tap="goWcomform" :data-comjobsid="item.id" class="padding-top"><text class="cuIcon-write padding-right-xs"></text> 编辑 </view>
  37. <view @tap="statusComjobs" :data-comjobsid="item.id" :data-status="2" class="padding-top"><text class="cuIcon-pulldown padding-right-xs"></text> 提交审核 </view>
  38. </view>
  39. <view class="grid solids-top text-center col-1" v-if="item.status==2">
  40. <view @tap="goWcomform" :data-comjobsid="item.id" class="padding-top"><text class="cuIcon-write padding-right-xs"></text> 编辑 </view>
  41. </view>
  42. <view class="grid solids-top text-center col-5" v-if="item.status==3">
  43. <view @tap="goWcomform" :data-comjobsid="item.id" class="padding-top"><text class="cuIcon-write padding-right-xs"></text> 编辑 </view>
  44. <view @tap="shareComjobs" :data-comjobsid="item.id" class="padding-top"><text class="cuIcon-share padding-right-xs"></text> 分享 </view>
  45. <view @tap="statusComjobs" :data-comjobsid="item.id" :data-status="5" class="padding-top"><text class="cuIcon-pulldown padding-right-xs"></text> 下架 </view>
  46. <view @tap="updateTime" :data-comjobsid="item.id" class="padding-top"><text class="cuIcon-top padding-right-xs"></text> 置顶 </view>
  47. <view @tap="goComjobsDetail" :data-comjobsid="item.id" class="padding-top"><text class="cuIcon-text padding-right-xs"></text> 详情 </view>
  48. </view>
  49. <view class="grid solids-top text-center col-4" v-if="item.status==4">
  50. <view @tap="goWcomform" :data-comjobsid="item.id" class="padding-top"><text class="cuIcon-write padding-right-xs"></text> 编辑 </view>
  51. <view @tap="shareComjobs" :data-comjobsid="item.id" class="padding-top"><text class="cuIcon-share padding-right-xs"></text> 分享 </view>
  52. <view @tap="statusComjobs" :data-comjobsid="item.id" :data-status="5" class="padding-top"><text class="cuIcon-pulldown padding-right-xs"></text> 下架 </view>
  53. <view @tap="goComjobsDetail" :data-comjobsid="item.id" class="padding-top"><text class="cuIcon-text padding-right-xs"></text> 详情 </view>
  54. </view>
  55. <view class="grid solids-top text-center col-2" v-if="item.status==5">
  56. <view @tap="goWcomform" :data-comjobsid="item.id" class="padding-top"><text class="cuIcon-write padding-right-xs"></text> 编辑 </view>
  57. <view @tap="statusComjobs" :data-comjobsid="item.id" :data-status="4" class="padding-top"><text class="cuIcon-pullup padding-right-xs"></text> 上架 </view>
  58. </view>
  59. </view>
  60. </view>
  61. </block>
  62. <uni-load-more :status="pstatus"></uni-load-more>
  63. <view class="padding"></view>
  64. <button class="cu-btn bg-blue lg shadow echo-gohome" data-pageurl="/pages/worker/wcomform" @tap="goPage"> 发布招聘 </button>
  65. <view class="cu-modal" :class="modal.isshow">
  66. <view class="cu-dialog picmodal">
  67. <view class="bg-img">
  68. <image mode="widthFix" :src="modal.comjobspic"></image>
  69. <view class="cu-bar justify-end text-white picmodalclose">
  70. <view class="action" @tap="hideModal">
  71. <text class="cuIcon-close "></text>
  72. </view>
  73. </view>
  74. </view>
  75. <view class="cu-bar bg-white margin-top-xs">
  76. <view class="action margin-0 flex-sub solid-left" @tap="saveImage">保存到相册</view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. </template>
  82. <script>
  83. import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
  84. var _this;
  85. export default {
  86. components: {
  87. uniLoadMore
  88. },
  89. data() {
  90. return {
  91. isRotate: false,
  92. status: 3,
  93. userinfo: false,
  94. workerinfo: false,
  95. param: {},
  96. pstatus: 'more',
  97. ppage: 1,
  98. psize: 20,
  99. plist: [],
  100. modal:{
  101. isshow: "",
  102. comjobspic: ""
  103. }
  104. }
  105. },
  106. onLoad: function(option) {
  107. _this = this;
  108. _this.status = option.status || 3;
  109. _this.userinfo = _this.checkLogin("/pages/my/my");
  110. _this.workerinfo = uni.getStorageSync('workerinfo') || false;
  111. if (_this.userinfo === false || _this.workerinfo === false) {
  112. uni.reLaunch({
  113. url: "/pages/my/my"
  114. });
  115. return false;
  116. }
  117. _this.getMore();
  118. },
  119. onPullDownRefresh: function() {
  120. _this.pageRefresh();
  121. },
  122. onReachBottom: function() {
  123. if (_this.pstatus !== 'more') {
  124. return;
  125. }
  126. _this.getMore();
  127. },
  128. methods: {
  129. goComjobsDetail: function(e) {
  130. var comjobsid = e.currentTarget.dataset.comjobsid;
  131. uni.navigateTo({
  132. url: '/pages/comjobs/detail?comjobsid='+comjobsid
  133. });
  134. },
  135. goWcomform: function(e) {
  136. var comjobsid = e.currentTarget.dataset.comjobsid;
  137. uni.navigateTo({
  138. url: '/pages/worker/wcomform?comjobsid='+comjobsid
  139. });
  140. },
  141. saveImage: function() {
  142. uni.downloadFile({
  143. url: _this.modal.comjobspic, //仅为示例,并非真实的资源
  144. success: (res) => {
  145. if (res.statusCode === 200) {
  146. uni.saveImageToPhotosAlbum({
  147. filePath: res.tempFilePath,
  148. success: function () {
  149. uni.showModal({
  150. title: '信息提示',
  151. content: "已保存到手机相册,注意查收。",
  152. showCancel: false
  153. });
  154. }
  155. });
  156. }
  157. }
  158. });
  159. },
  160. hideModal: function() {
  161. _this.modal.isshow = "";
  162. },
  163. shareComjobs: function(e) {
  164. var comjobsid = e.currentTarget.dataset.comjobsid;
  165. _this.$req.ajax({
  166. title: "招聘简章生成中...",
  167. path: "comjobs/getcomjobscode",
  168. data: {
  169. comjobsid: comjobsid,
  170. userid: _this.userinfo.id
  171. }
  172. }).then((data) => {
  173. _this.modal.comjobspic = data.comjobspic;
  174. _this.modal.isshow = "show";
  175. }).catch((err) => {
  176. uni.showModal({
  177. title: '温馨提示',
  178. content: err,
  179. showCancel: false
  180. });
  181. });
  182. },
  183. statusComjobs: function(e) {
  184. var comjobsid = e.currentTarget.dataset.comjobsid;
  185. var status = e.currentTarget.dataset.status;
  186. _this.$req.ajax({
  187. path: "wcomjobs/statuscomjobs",
  188. data: {
  189. comjobsid: comjobsid,
  190. userid: _this.userinfo.id,
  191. workerid: _this.workerinfo.id,
  192. status: status
  193. }
  194. }).then((data) => {
  195. _this.pageRefresh();
  196. }).catch((err) => {
  197. uni.showModal({
  198. title: '信息提示',
  199. content: err,
  200. showCancel: false
  201. });
  202. });
  203. },
  204. updateTime: function(e) {
  205. var comjobsid = e.currentTarget.dataset.comjobsid;
  206. uni.showModal({
  207. title: '信息提示',
  208. content: '每次置顶会扣除'+_this.param.topcomjobs+'积分,确定要做置顶操作吗?',
  209. success: function(res) {
  210. if (res.confirm) {
  211. _this.$req.ajax({
  212. path: "wcomjobs/updatecomjobs",
  213. data: {
  214. comjobsid: comjobsid,
  215. userid: _this.userinfo.id,
  216. workerid: _this.workerinfo.id
  217. }
  218. }).then((data) => {
  219. _this.pageRefresh();
  220. }).catch((err) => {
  221. uni.showModal({
  222. title: '信息提示',
  223. content: err,
  224. showCancel: false
  225. });
  226. });
  227. }
  228. }
  229. });
  230. },
  231. pageRefresh: function() {
  232. _this.pstatus = 'more';
  233. _this.ppage = 1;
  234. _this.plist = [];
  235. _this.getMore();
  236. },
  237. getMore: function() {
  238. _this.$req.ajax({
  239. path: "wcomjobs/listcomjobs",
  240. data: {
  241. ppage: _this.ppage,
  242. psize: _this.psize,
  243. status: _this.status,
  244. workerid: _this.workerinfo.id
  245. }
  246. }).then((data) => {
  247. _this.param = data.param;
  248. _this.pstatus = data.pstatus;
  249. _this.plist = _this.plist.concat(data.plist);
  250. _this.ppage += 1;
  251. uni.stopPullDownRefresh();
  252. }).catch((err) => {
  253. uni.showModal({
  254. title: '信息提示',
  255. content: err,
  256. showCancel: false
  257. });
  258. });
  259. },
  260. tabSelect: function(e) {
  261. _this.status = e.currentTarget.dataset.status;
  262. _this.pageRefresh();
  263. },
  264. goPage: function(e) {
  265. var pageurl = e.currentTarget.dataset.pageurl;
  266. uni.navigateTo({
  267. url: pageurl,
  268. fail: function() {
  269. uni.switchTab({
  270. url: pageurl
  271. });
  272. }
  273. });
  274. },
  275. },
  276. }
  277. </script>
  278. <style>
  279. .picmodal{ width: 640rpx; background-color: transparent; }
  280. .picmodal image{ width: 100%; }
  281. .picmodal .bg-img{ position: relative; }
  282. .picmodalclose{ position: absolute; top: 0rpx; right: 0rpx; }
  283. </style>