shareEmployment.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <template>
  2. <view>
  3. <u-navbar back-text="共享用工" back-icon-size="28" back-icon-color="#ffffff" :background="{backgroundColor: '#2795FD',}"
  4. :back-text-style="{color: '#ffffff'}"></u-navbar>
  5. <!-- 标签 -->
  6. <view class="tabs">
  7. <u-tabs :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
  8. </view>
  9. <view class="content">
  10. <view class="info-card" v-for="(item,i) in list[current].list" :key="i">
  11. <!-- 卡片信息 -->
  12. <view class="detail" @click="gotoUrl('pages/packages/shareEmployment/articleDetail?id='+item.id)">
  13. {{item.content}}
  14. </view>
  15. <view class="tag" @click="gotoUrl('pages/packages/shareEmployment/articleDetail?id='+item.id)">
  16. <view class="item1" v-if="item.type == '1'">
  17. 急需用工
  18. </view>
  19. <view class="item2" v-if="item.type == '2'">
  20. 资源共享
  21. </view>
  22. <view class="date-item">
  23. {{item.createTime.slice(0,10)}}
  24. </view>
  25. </view>
  26. <u-line color="#CFD2D5" />
  27. <!-- 发布状态 -->
  28. <view class="check">
  29. <view class="state" v-if="item.status == '1'">
  30. 发布中
  31. </view>
  32. <view class="state" v-if="item.status == '0'">
  33. 待审核
  34. </view>
  35. <view class="state" v-if="item.status == '2'">
  36. 未通过
  37. </view>
  38. <view class="handle">
  39. <view class="amend" @click="toPostMessage(item)">
  40. 修改
  41. </view>
  42. <view class="delete" @click="deleteWork(item.id)">
  43. 删除
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <u-divider bg-color="#F0F0F2" margin-top="40" border-color="#CFD2D5"
  50. v-if="formList[current].recordsTotal==list[current].list.length"
  51. :isnone="formList[current].recordsTotal==0" nonetext="没有找到相关内容">
  52. 已经到底了
  53. </u-divider>
  54. <!-- 底部按钮 -->
  55. <button class="btn" @click="toPostMessage()">发布信息
  56. </button>
  57. </view>
  58. </template>
  59. <script>
  60. import * as API_packages from '@/apis/pagejs/packages.js'
  61. export default {
  62. data() {
  63. return {
  64. formList: [
  65. {
  66. pageIndex: 1,
  67. pageSize: 20,
  68. recordsTotal: 1,
  69. status: "1",
  70. },
  71. {
  72. pageIndex: 1,
  73. pageSize: 20,
  74. recordsTotal: 1,
  75. status: "0",
  76. },
  77. {
  78. pageIndex: 1,
  79. pageSize: 20,
  80. recordsTotal: 1,
  81. status: "2",
  82. },
  83. ],
  84. list: [{
  85. name: '发布中',
  86. list: []
  87. }, {
  88. name: '待审核',
  89. list: []
  90. }, {
  91. name: '未通过',
  92. list: []
  93. }],
  94. current: 0
  95. }
  96. },
  97. onReady() {
  98. this.getMyShareWorkList();
  99. },
  100. onReachBottom() {
  101. var obj = this.list[this.current];
  102. var objf = this.formList[this.current];
  103. if (obj.list.length < objf.recordsTotal) {
  104. this.myLoadmore();
  105. }
  106. },
  107. methods: {
  108. init() {
  109. //this.current = 0
  110. for(var i in this.list){
  111. this.formList[i].pageIndex = 1
  112. this.list[i].list = []
  113. }
  114. this.getMyShareWorkList()
  115. },
  116. toPostMessage(item) {
  117. var url = "";
  118. if(item) {
  119. var url = "/pages/packages/mine/employmentService/postMessage?id=" +item.id;
  120. } else {
  121. var url = "/pages/packages/mine/employmentService/postMessage";
  122. }
  123. uni.navigateTo({
  124. url: url,
  125. events: {
  126. refreshData: () => {
  127. this.init()
  128. }
  129. }
  130. })
  131. },
  132. deleteWork(id) {
  133. uni.showLoading({
  134. title: "加载中",
  135. mask: true,
  136. })
  137. API_packages.myShareWorkDelete({id: id}).then((res) => {
  138. this.getMyShareWorkList();
  139. uni.hideLoading();
  140. }).catch(error => {
  141. uni.showToast({
  142. title: error,
  143. icon: "none"
  144. })
  145. })
  146. },
  147. getMyShareWorkList() {
  148. uni.showLoading({
  149. title: "加载中",
  150. mask: true,
  151. })
  152. var list = this.list[this.current].list
  153. var listForm = this.formList[this.current]
  154. API_packages.myShareWork(listForm).then((res) => {
  155. if (listForm.pageIndex == 1) {
  156. list = res.data.data;
  157. } else {
  158. list = [
  159. ...list,
  160. ...res.data.data
  161. ];
  162. }
  163. this.list[this.current].list = list
  164. this.formList[this.current].recordsTotal = res.data.recordsTotal;
  165. uni.hideLoading();
  166. }).catch(error => {
  167. uni.showToast({
  168. title: error,
  169. icon: "none"
  170. })
  171. })
  172. },
  173. myLoadmore() {
  174. this.formList[this.current].pageIndex += 1;
  175. this.getMyShareWorkList();
  176. },
  177. change(index) {
  178. this.current = index;
  179. var list = this.list[this.current].list
  180. if (list.length == 0) {
  181. this.getMyShareWorkList();
  182. }
  183. }
  184. }
  185. }
  186. </script>
  187. <style>
  188. page {
  189. background: #F0F0F2;
  190. padding-bottom: 120px;
  191. }
  192. </style>
  193. <style scoped lang="scss">
  194. // 标签
  195. .tabs {
  196. position: fixed;
  197. left: 0;
  198. right: 0;
  199. z-index: 99;
  200. }
  201. .content {
  202. margin-top: 108rpx;
  203. }
  204. .info-card {
  205. margin: 24rpx 32rpx 0;
  206. padding: 24rpx;
  207. background-color: #fff;
  208. border-radius: 24rpx;
  209. // 卡片信息
  210. .detail {
  211. color: rgba(16, 16, 16, 1);
  212. line-height: 40rpx;
  213. }
  214. .tag {
  215. display: flex;
  216. justify-content: space-between;
  217. margin-top: 16rpx;
  218. margin-bottom: 24rpx;
  219. .item1 {
  220. color: rgba(39, 149, 253, 1);
  221. font-size: 24rpx;
  222. }
  223. .item2 {
  224. color: rgba(0, 185, 98, 1);
  225. font-size: 24rpx;
  226. }
  227. }
  228. // 发布状态
  229. .check {
  230. display: flex;
  231. justify-content: space-between;
  232. align-items: center;
  233. margin-top: 32rpx;
  234. .state {
  235. color: rgba(51, 51, 51, 1);
  236. font-weight: 600;
  237. }
  238. .handle {
  239. display: flex;
  240. align-items: center;
  241. .unamend {
  242. width: 120rpx;
  243. height: 56rpx;
  244. line-height: 56rpx;
  245. text-align: center;
  246. font-family: Microsoft Yahei;
  247. border: 1px solid rgba(231, 232, 234, 1);
  248. border-radius: 50px;
  249. opacity: 0.4;
  250. }
  251. .amend {
  252. width: 120rpx;
  253. height: 56rpx;
  254. line-height: 56rpx;
  255. text-align: center;
  256. font-family: Microsoft Yahei;
  257. border: 1px solid rgba(231, 232, 234, 1);
  258. border-radius: 50px;
  259. }
  260. .delete {
  261. width: 120rpx;
  262. height: 56rpx;
  263. line-height: 56rpx;
  264. text-align: center;
  265. font-family: Microsoft Yahei;
  266. border: 1px solid rgba(231, 232, 234, 1);
  267. border-radius: 50px;
  268. margin-left: 24rpx;
  269. color: #E60012;
  270. }
  271. }
  272. }
  273. }
  274. // 底部按钮
  275. .btn {
  276. position: fixed;
  277. bottom: 40rpx;
  278. left: 0;
  279. right: 0;
  280. background-color: #F0F0F2;
  281. padding: 0 32rpx;
  282. border-radius: 50px;
  283. background-color: rgba(34, 149, 255, 1);
  284. color: rgba(241, 241, 241, 1);
  285. font-size: 36rpx;
  286. margin: 0 32rpx;
  287. box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.03);
  288. }
  289. </style>