need.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. <template>
  2. <view>
  3. <tn-nav-bar fixed customBack>
  4. <view slot="back" class='tn-custom-nav-bar__back' @click="goBack">
  5. <text class='icon tn-icon-left'></text>
  6. </view>
  7. <view slot="default">
  8. <text>我的需求</text>
  9. </view>
  10. </tn-nav-bar>
  11. <view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
  12. <uv-sticky :offsetTop="vuex_custom_bar_height + 'px'" bgColor="#ffffff">
  13. <tn-tabs-swiper :list="list" :isScroll="false" :current="current" name="tab-name" @change="tabChange"
  14. style="border-bottom: 1rpx solid #f1f1f1cc;"></tn-tabs-swiper>
  15. </uv-sticky>
  16. <!-- 图文信息 -->
  17. <block v-for="(item,index) in content" :key="index">
  18. <view class="blogger__item">
  19. <view class="blogger__author tn-flex tn-flex-row-between tn-flex-col-center">
  20. <view class="justify__author__info">
  21. <view class="tn-flex tn-flex-row-center">
  22. <view class="tn-flex tn-flex-row-center tn-flex-col-center">
  23. <!-- <view class="">
  24. <tn-avatar class="" shape="circle" :src="item.userAvatar" size="lg">
  25. </tn-avatar>
  26. </view> -->
  27. <view class="tn-padding-right tn-text-ellipsis">
  28. <view class="tn-padding-right tn-text-bold tn-text-lg">
  29. {{ item.company }}
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. <view v-if="item.status=='4'&&item.showFlag=='否'"
  36. class="blogger__author__btn justify-content-item tn-flex-col-center tn-flex-row-center">
  37. <text class="" style="background: #3F51B542;font-size: 12px;
  38. padding: 8px;
  39. color: #333333;
  40. border-radius: 24px;
  41. ">需求已结束</text>
  42. </view>
  43. <!-- 状态(1:暂存,2:待处理,3:审核中,4:已通过,9:已拒绝,10:已取消) -->
  44. <view v-if="item.status=='1'"
  45. class="blogger__author__btn justify-content-item tn-flex-col-center tn-flex-row-center">
  46. <text class="" style="background: #3F51B542;font-size: 12px;
  47. padding: 8px;
  48. color: #333333;
  49. border-radius: 24px;
  50. ">暂存</text>
  51. </view>
  52. <view v-if="item.status=='3'"
  53. class="blogger__author__btn justify-content-item tn-flex-col-center tn-flex-row-center">
  54. <text class="" style="background: #3f51b56b;font-size: 12px;
  55. padding: 8px;
  56. color: #ff0;
  57. border-radius: 24px;
  58. ">审核中</text>
  59. </view>
  60. <view v-if="item.status=='4'&&item.showFlag!='否'"
  61. class="blogger__author__btn justify-content-item tn-flex-col-center tn-flex-row-center">
  62. <text class="" style="background: #3F51B542;font-size: 12px;
  63. padding: 8px;
  64. color: #007000;
  65. border-radius: 24px;
  66. ">已通过</text>
  67. </view>
  68. <view v-if="item.status=='9'"
  69. class="blogger__author__btn justify-content-item tn-flex-col-center tn-flex-row-center">
  70. <text class="" style="background: #3F51B542;font-size: 12px;
  71. padding: 8px;
  72. color: #d23920;
  73. border-radius: 24px;
  74. " @click="showTips(item)">已拒绝</text>
  75. </view>
  76. <view v-if="item.status=='10'"
  77. class="blogger__author__btn justify-content-item tn-flex-col-center tn-flex-row-center">
  78. <text class="" style="background: #3F51B542;font-size: 12px;
  79. padding: 8px;
  80. color: #333333;
  81. border-radius: 24px;
  82. ">已取消</text>
  83. </view>
  84. </view>
  85. <view
  86. class="blogger__desc tn-margin-top-sm tn-margin-bottom-sm tn-text-justify tn-flex-col-center tn-flex-row-left"
  87. @click="tn('')">
  88. <!-- <view v-for="(label_item,label_index) in item.label" :key="label_index"
  89. class="blogger__desc__label tn-float-left tn-margin-right">
  90. <text class="blogger__desc__label--prefix tn-icon-topics-fill"></text>
  91. <text class="tn-text-df">{{ label_item }}</text>
  92. </view> -->
  93. <!-- 不用限制长度了,因为发布的时候限制长度了-->
  94. <text
  95. class="blogger__desc__content tn-flex-1 tn-text-justify tn-text-df">{{ item.content }}</text>
  96. </view>
  97. <!-- 内容太多疲劳了-->
  98. <!-- <view
  99. v-if="item.content"
  100. class="blogger__content"
  101. :id="`blogger__content--${index}`"
  102. >
  103. <view
  104. class="blogger__content__data clamp-text-2">
  105. {{ item.content }}
  106. </view>
  107. </view> -->
  108. <block v-if="item.imgList">
  109. <view v-if="[1,2,4].indexOf(item.imgList.length) != -1" class="tn-padding-top-xs"
  110. @click="tn('')">
  111. <image v-for="(image_item,image_index) in item.imgList" :key="image_index"
  112. class="blogger__main-image" :class="{
  113. 'blogger__main-image--1 tn-margin-bottom-sm': item.imgList.length === 1,
  114. 'blogger__main-image--2 tn-margin-right-sm tn-margin-bottom-sm': item.imgList.length === 2 || item.imgList.length === 4
  115. }" :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  116. </view>
  117. <view v-else class="tn-padding-top-xs">
  118. <tn-grid hoverClass="none" :col="3">
  119. <block v-for="(image_item,image_index) in item.imgList" :key="image_index">
  120. <!-- #ifndef MP-WEIXIN -->
  121. <tn-grid-item style="width: 30%;margin: 10rpx;">
  122. <image class="blogger__main-image blogger__main-image--3"
  123. @click="showImg(item.imgList,image_index)" :src="image_item.ftpUrl"
  124. mode="aspectFill"></image>
  125. </tn-grid-item>
  126. <!-- #endif-->
  127. <!-- #ifdef MP-WEIXIN -->
  128. <tn-grid-item style="width: 30%;margin: 10rpx;">
  129. <image class="blogger__main-image blogger__main-image--3"
  130. @click="showImg(item.imgList,image_index)" :src="image_item.ftpUrl"
  131. mode="aspectFill"></image>
  132. </tn-grid-item>
  133. <!-- #endif-->
  134. </block>
  135. </tn-grid>
  136. </view>
  137. </block>
  138. <view v-for="file in item.fileDetailList" :key="file.id" v-if="!isImage(file.fileName)">
  139. <view>
  140. <text class="tn-icon-link"></text>
  141. <view style="display: inline-block;margin-left:8px" @click="clickLink(file.ftpUrl,file.fileName)">
  142. {{file.fileName}}
  143. </view>
  144. </view>
  145. </view>
  146. <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-margin-top-xs">
  147. <view class="justify-content-item tn-color-gray tn-text-center">
  148. <view class="tn-padding-right tn-padding-top-xs tn-color-gray">
  149. {{ item.createTime|formatDate }}
  150. </view>
  151. </view>
  152. <view class="justify-content-item tn-flex tn-flex-col-center" v-if="item.status==4&&item.showFlag!='否'">
  153. <button type="warn" plain="true" size="mini" @click="finishItem(item)">结束需求</button>
  154. <!-- <tn-button shadow shape="round" fontColor="tn-color-white" backgroundColor="tn-bg-blue"
  155. :fontSize="24" height="auto" padding="10rpx 18rpx"
  156. @click="finishItem(item)">结束需求</tn-button> -->
  157. </view>
  158. <view class="justify-content-item tn-flex tn-flex-col-center" v-if="item.status==1||item.status==9">
  159. <button type="warn" plain="true" size="mini" @click="editItem(item)">编辑</button>
  160. <!-- <tn-button shadow shape="round" fontColor="tn-color-white" backgroundColor="tn-bg-blue"
  161. :fontSize="24" height="auto" padding="10rpx 18rpx"
  162. @click="finishItem(item)">结束需求</tn-button> -->
  163. </view>
  164. </view>
  165. </view>
  166. <!-- 边距间隔 -->
  167. <view class="tn-strip-bottom" v-if="index != content.length - 1"></view>
  168. </block>
  169. <view v-if="showEmpty" style="margin-top: 32vh;">
  170. <tn-empty mode="data"></tn-empty>
  171. </view>
  172. </view>
  173. <uni-popup ref="alertDialog" type="dialog">
  174. <uni-popup-dialog type="info" cancelText="关闭" confirmText="确定" title="结束确认" content="确定结束需求吗"
  175. @confirm="dialogConfirm"></uni-popup-dialog>
  176. </uni-popup>
  177. </view>
  178. </template>
  179. <script>
  180. import request from '../../utils/request'
  181. export default {
  182. data() {
  183. return {
  184. list: [{
  185. 'tab-name': '已通过'
  186. }, {
  187. 'tab-name': '审核中'
  188. }, {
  189. 'tab-name': '暂存'
  190. }, {
  191. 'tab-name': '已拒绝'
  192. }],
  193. current: 0,
  194. content: [],
  195. showEmpty: false,
  196. curItem: {}
  197. }
  198. },
  199. filters: {
  200. formatDate(value) {
  201. if (!value) return '';
  202. const date = new Date(value);
  203. const today = new Date();
  204. const yesterday = new Date(today); // 昨天的日期
  205. yesterday.setDate(yesterday.getDate() - 1); // 将昨天的日期设置为前一天
  206. if (date.getFullYear() == today.getFullYear() && date.getMonth() == today.getMonth() && date.getDate() ==
  207. today.getDate()) {
  208. return '今天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  209. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  210. }
  211. if (date.getFullYear() == yesterday.getFullYear() && date.getMonth() == yesterday.getMonth() && date
  212. .getDate() == yesterday.getDate()) {
  213. return '昨天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  214. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  215. }
  216. return date.toLocaleDateString() + ' ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  217. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  218. },
  219. },
  220. onLoad(props){
  221. if(props.tab==1){
  222. this.current= 1;
  223. }
  224. if(props.tab==2){
  225. this.current= 2;
  226. }
  227. },
  228. onShow() {
  229. this.loadData();
  230. },
  231. methods: {
  232. showTips(item){
  233. uni.showToast({
  234. title: item.feedback?item.feedback:'已拒绝',
  235. icon: 'none',
  236. })
  237. },
  238. goBack() {
  239. uni.navigateBack();
  240. },
  241. tabChange(index) {
  242. this.current = index;
  243. this.loadData();
  244. },
  245. isImage(fileName) {
  246. const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'ico']
  247. const extension = fileName.split('.').pop().toLowerCase();
  248. return imageExtensions.includes(extension);
  249. },
  250. loadData() {
  251. let that = this;
  252. that.content = [];
  253. request.post('/slbResourceDemand/show/my', {
  254. userNo: uni.getStorageSync('userNo'),
  255. // 状态(1:暂存,2:待处理,3:审核中,4:已通过,9:已拒绝,10:已取消)
  256. status: that.current == 1 ? '3' : that.current == 2 ? '1' : that.current == 3 ? '9' : '4',
  257. limit: 1000,
  258. index: 1
  259. }).then(res => {
  260. if (res && res.success) {
  261. let newList = res.list || [];
  262. for (let i = 0; i < newList.length; i++) {
  263. newList[i].imgList = [];
  264. for (let j = 0; j < newList[i].fileDetailList.length; j++) {
  265. if (that.isImage(newList[i].fileDetailList[j].fileName)) {
  266. newList[i].imgList.push(newList[i].fileDetailList[j]);
  267. }
  268. }
  269. }
  270. that.content = newList;
  271. if (newList.length == 0) {
  272. that.showEmpty = true;
  273. } else {
  274. that.showEmpty = false;
  275. }
  276. }
  277. console.warn(res);
  278. })
  279. },
  280. dialogConfirm() {
  281. let item = this.curItem;
  282. let that = this;
  283. request.post('/slbResourceDemand/offShelf', {
  284. id: item.id,
  285. userNo: uni.getStorageSync('userNo'),
  286. }).then(res => {
  287. if (res.success) {
  288. uni.showToast({
  289. title: '结束成功'
  290. })
  291. that.loadData();
  292. } else {
  293. uni.showToast({
  294. title: res.msg,
  295. icon: 'none'
  296. })
  297. }
  298. })
  299. },
  300. finishItem(item) {
  301. this.curItem = item;
  302. this.$refs.alertDialog.open()
  303. },
  304. showImg(items, index) {
  305. let urls = [];
  306. for (let i = 0; i < items.length; i++) {
  307. urls.push(items[i].ftpUrl);
  308. }
  309. // 预览图片
  310. uni.previewImage({
  311. urls: urls,
  312. current: index,
  313. });
  314. },
  315. clickLink(url,fileName) {
  316. uni.navigateTo({
  317. url:'/pages/webview/web-view?url='+encodeURIComponent('http://slb-m.dev.ml1993.com/webview?title='+fileName+'&url='+ url),
  318. })
  319. uni.navigateTo({
  320. url: '/pages/webview/web-view?url=' + url,
  321. })
  322. },
  323. editItem(item){
  324. uni.setStorageSync(item.bisNo,JSON.stringify(item))
  325. uni.navigateTo({
  326. url: '/circlePages/circle?sid=' + item.bisNo,
  327. })
  328. }
  329. }
  330. }
  331. </script>
  332. <style lang="scss" scoped>
  333. /* 胶囊*/
  334. .tn-custom-nav-bar__back {
  335. width: 60%;
  336. height: 100%;
  337. position: relative;
  338. display: flex;
  339. justify-content: space-evenly;
  340. align-items: center;
  341. box-sizing: border-box;
  342. // background-color: rgba(0, 0, 0, 0.15);
  343. border-radius: 1000rpx;
  344. // border: 1rpx solid rgba(255, 255, 255, 0.5);
  345. // color: #FFFFFF;
  346. font-size: 18px;
  347. .icon {
  348. display: block;
  349. flex: 1;
  350. margin: auto;
  351. text-align: center;
  352. }
  353. &:before {
  354. content: " ";
  355. width: 1rpx;
  356. height: 110%;
  357. position: absolute;
  358. top: 22.5%;
  359. left: 0;
  360. right: 0;
  361. margin: auto;
  362. transform: scale(0.5);
  363. transform-origin: 0 0;
  364. pointer-events: none;
  365. box-sizing: border-box;
  366. opacity: 0.7;
  367. background-color: #FFFFFF;
  368. }
  369. }
  370. /* 文章内容 start*/
  371. .blogger {
  372. &__item {
  373. padding: 30rpx;
  374. }
  375. &__author {
  376. &__btn {
  377. margin-right: -12rpx;
  378. opacity: 0.5;
  379. }
  380. }
  381. &__desc {
  382. line-height: 30rpx;
  383. &__label {
  384. color: #1D2541;
  385. background-color: #F3F2F7;
  386. border-radius: 10rpx;
  387. font-size: 22rpx;
  388. padding: 5rpx 15rpx;
  389. margin: 5rpx 18rpx 0 0;
  390. &--prefix {
  391. font-size: 24rpx;
  392. color: #1D2541;
  393. padding-right: 10rpx;
  394. }
  395. }
  396. &__content {
  397. line-height: 50rpx;
  398. }
  399. }
  400. &__content {
  401. margin-top: 18rpx;
  402. padding-right: 18rpx;
  403. &__data {
  404. line-height: 46rpx;
  405. text-align: justify;
  406. overflow: hidden;
  407. transition: all 0.25s ease-in-out;
  408. }
  409. &__status {
  410. margin-top: 10rpx;
  411. font-size: 26rpx;
  412. color: #82B2FF;
  413. }
  414. }
  415. &__main-image {
  416. border: 1rpx solid #F8F7F8;
  417. border-radius: 16rpx;
  418. &--1 {
  419. max-width: 80%;
  420. max-height: 300rpx;
  421. }
  422. &--2 {
  423. max-width: 260rpx;
  424. max-height: 260rpx;
  425. }
  426. &--3 {
  427. height: 212rpx;
  428. width: 100%;
  429. }
  430. }
  431. &__count-icon {
  432. font-size: 40rpx;
  433. padding-right: 5rpx;
  434. }
  435. &__ad {
  436. width: 100%;
  437. height: 500rpx;
  438. transform: translate3d(0px, 0px, 0px) !important;
  439. ::v-deep .uni-swiper-slide-frame {
  440. transform: translate3d(0px, 0px, 0px) !important;
  441. }
  442. .uni-swiper-slide-frame {
  443. transform: translate3d(0px, 0px, 0px) !important;
  444. }
  445. &__item {
  446. position: absolute;
  447. width: 100%;
  448. height: 100%;
  449. transform-origin: left center;
  450. transform: translate3d(100%, 0px, 0px) scale(1) !important;
  451. transition: transform 0.25s ease-in-out;
  452. z-index: 1;
  453. &--0 {
  454. transform: translate3d(0%, 0px, 0px) scale(1) !important;
  455. z-index: 4;
  456. }
  457. &--1 {
  458. transform: translate3d(13%, 0px, 0px) scale(0.9) !important;
  459. z-index: 3;
  460. }
  461. &--2 {
  462. transform: translate3d(26%, 0px, 0px) scale(0.8) !important;
  463. z-index: 2;
  464. }
  465. }
  466. &__content {
  467. border-radius: 40rpx;
  468. width: 640rpx;
  469. height: 500rpx;
  470. overflow: hidden;
  471. }
  472. &__image {
  473. width: 100%;
  474. height: 100%;
  475. }
  476. }
  477. }
  478. /* 文章内容 end*/
  479. /* 间隔线 start*/
  480. .tn-strip-bottom {
  481. width: 100%;
  482. border-bottom: 20rpx solid rgba(241, 241, 241, 0.8);
  483. }
  484. /* 间隔线 end*/
  485. </style>