need.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  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">
  148. <view class="tn-padding-right tn-padding-top-xs tn-color-gray">
  149. {{ item.createTime|formatDate }}
  150. <view style="color: red;display: inline;margin-left:8px" v-if="item.status==9&&item.feedback">
  151. 反馈意见:{{item.feedback||'--'}}
  152. </view>
  153. </view>
  154. </view>
  155. <view class="justify-content-item tn-flex tn-flex-col-center" v-if="item.status==4&&item.showFlag!='否'">
  156. <button type="warn" plain="true" size="mini" @click="finishItem(item)">结束需求</button>
  157. <!-- <tn-button shadow shape="round" fontColor="tn-color-white" backgroundColor="tn-bg-blue"
  158. :fontSize="24" height="auto" padding="10rpx 18rpx"
  159. @click="finishItem(item)">结束需求</tn-button> -->
  160. </view>
  161. <view class="justify-content-item tn-flex tn-flex-col-center" style="flex: none;" v-if="item.status==1||item.status==9">
  162. <button type="warn" plain="true" size="mini" @click="editItem(item)">编辑</button>
  163. <!-- <tn-button shadow shape="round" fontColor="tn-color-white" backgroundColor="tn-bg-blue"
  164. :fontSize="24" height="auto" padding="10rpx 18rpx"
  165. @click="finishItem(item)">结束需求</tn-button> -->
  166. </view>
  167. </view>
  168. </view>
  169. <!-- 边距间隔 -->
  170. <view class="tn-strip-bottom" v-if="index != content.length - 1"></view>
  171. </block>
  172. <view v-if="showEmpty" style="margin-top: 32vh;">
  173. <tn-empty mode="data"></tn-empty>
  174. </view>
  175. </view>
  176. <uni-popup ref="alertDialog" type="dialog">
  177. <uni-popup-dialog type="info" cancelText="关闭" confirmText="确定" title="结束确认" content="确定结束需求吗"
  178. @confirm="dialogConfirm"></uni-popup-dialog>
  179. </uni-popup>
  180. </view>
  181. </template>
  182. <script>
  183. import request from '../../utils/request'
  184. export default {
  185. data() {
  186. return {
  187. list: [{
  188. 'tab-name': '已通过'
  189. }, {
  190. 'tab-name': '审核中'
  191. }, {
  192. 'tab-name': '暂存'
  193. }, {
  194. 'tab-name': '已拒绝'
  195. }],
  196. current: 0,
  197. content: [],
  198. showEmpty: false,
  199. curItem: {}
  200. }
  201. },
  202. filters: {
  203. formatDate(value) {
  204. if (!value) return '';
  205. const date = new Date(value);
  206. const today = new Date();
  207. const yesterday = new Date(today); // 昨天的日期
  208. yesterday.setDate(yesterday.getDate() - 1); // 将昨天的日期设置为前一天
  209. if (date.getFullYear() == today.getFullYear() && date.getMonth() == today.getMonth() && date.getDate() ==
  210. today.getDate()) {
  211. return '今天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  212. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  213. }
  214. if (date.getFullYear() == yesterday.getFullYear() && date.getMonth() == yesterday.getMonth() && date
  215. .getDate() == yesterday.getDate()) {
  216. return '昨天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  217. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  218. }
  219. return date.toLocaleDateString() + ' ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  220. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  221. },
  222. },
  223. onLoad(props){
  224. if(props.tab==1){
  225. this.current= 1;
  226. }
  227. if(props.tab==2){
  228. this.current= 2;
  229. }
  230. },
  231. onShow() {
  232. this.loadData();
  233. },
  234. methods: {
  235. showTips(item){
  236. uni.showToast({
  237. title: item.feedback?item.feedback:'已拒绝',
  238. icon: 'none',
  239. })
  240. },
  241. goBack() {
  242. uni.navigateBack();
  243. },
  244. tabChange(index) {
  245. this.current = index;
  246. this.loadData();
  247. },
  248. isImage(fileName) {
  249. const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'ico']
  250. const extension = fileName.split('.').pop().toLowerCase();
  251. return imageExtensions.includes(extension);
  252. },
  253. loadData() {
  254. let that = this;
  255. that.content = [];
  256. request.post('/slbResourceDemand/show/my', {
  257. userNo: uni.getStorageSync('userNo'),
  258. // 状态(1:暂存,2:待处理,3:审核中,4:已通过,9:已拒绝,10:已取消)
  259. status: that.current == 1 ? '3' : that.current == 2 ? '1' : that.current == 3 ? '9' : '4',
  260. limit: 1000,
  261. index: 1
  262. }).then(res => {
  263. if (res && res.success) {
  264. let newList = res.list || [];
  265. for (let i = 0; i < newList.length; i++) {
  266. newList[i].imgList = [];
  267. for (let j = 0; j < newList[i].fileDetailList.length; j++) {
  268. if (that.isImage(newList[i].fileDetailList[j].fileName)) {
  269. newList[i].imgList.push(newList[i].fileDetailList[j]);
  270. }
  271. }
  272. }
  273. that.content = newList;
  274. if (newList.length == 0) {
  275. that.showEmpty = true;
  276. } else {
  277. that.showEmpty = false;
  278. }
  279. }
  280. console.warn(res);
  281. })
  282. },
  283. dialogConfirm() {
  284. let item = this.curItem;
  285. let that = this;
  286. request.post('/slbResourceDemand/offShelf', {
  287. id: item.id,
  288. userNo: uni.getStorageSync('userNo'),
  289. }).then(res => {
  290. if (res.success) {
  291. uni.showToast({
  292. title: '结束成功'
  293. })
  294. that.loadData();
  295. } else {
  296. uni.showToast({
  297. title: res.msg,
  298. icon: 'none'
  299. })
  300. }
  301. })
  302. },
  303. finishItem(item) {
  304. this.curItem = item;
  305. this.$refs.alertDialog.open()
  306. },
  307. showImg(items, index) {
  308. let urls = [];
  309. for (let i = 0; i < items.length; i++) {
  310. urls.push(items[i].ftpUrl);
  311. }
  312. // 预览图片
  313. uni.previewImage({
  314. urls: urls,
  315. current: index,
  316. });
  317. },
  318. clickLink(url,fileName) {
  319. uni.navigateTo({
  320. url:'/pages/webview/web-view?url='+encodeURIComponent('http://slb-m.dev.ml1993.com/webview?title='+fileName+'&url='+ url),
  321. })
  322. uni.navigateTo({
  323. url: '/pages/webview/web-view?url=' + url,
  324. })
  325. },
  326. editItem(item){
  327. uni.setStorageSync(item.bisNo,JSON.stringify(item))
  328. uni.navigateTo({
  329. url: '/circlePages/circle?sid=' + item.bisNo,
  330. })
  331. }
  332. }
  333. }
  334. </script>
  335. <style lang="scss" scoped>
  336. /* 胶囊*/
  337. .tn-custom-nav-bar__back {
  338. width: 60%;
  339. height: 100%;
  340. position: relative;
  341. display: flex;
  342. justify-content: space-evenly;
  343. align-items: center;
  344. box-sizing: border-box;
  345. // background-color: rgba(0, 0, 0, 0.15);
  346. border-radius: 1000rpx;
  347. // border: 1rpx solid rgba(255, 255, 255, 0.5);
  348. // color: #FFFFFF;
  349. font-size: 18px;
  350. .icon {
  351. display: block;
  352. flex: 1;
  353. margin: auto;
  354. text-align: center;
  355. }
  356. &:before {
  357. content: " ";
  358. width: 1rpx;
  359. height: 110%;
  360. position: absolute;
  361. top: 22.5%;
  362. left: 0;
  363. right: 0;
  364. margin: auto;
  365. transform: scale(0.5);
  366. transform-origin: 0 0;
  367. pointer-events: none;
  368. box-sizing: border-box;
  369. opacity: 0.7;
  370. background-color: #FFFFFF;
  371. }
  372. }
  373. /* 文章内容 start*/
  374. .blogger {
  375. &__item {
  376. padding: 30rpx;
  377. }
  378. &__author {
  379. &__btn {
  380. margin-right: -12rpx;
  381. opacity: 0.5;
  382. }
  383. }
  384. &__desc {
  385. line-height: 30rpx;
  386. &__label {
  387. color: #1D2541;
  388. background-color: #F3F2F7;
  389. border-radius: 10rpx;
  390. font-size: 22rpx;
  391. padding: 5rpx 15rpx;
  392. margin: 5rpx 18rpx 0 0;
  393. &--prefix {
  394. font-size: 24rpx;
  395. color: #1D2541;
  396. padding-right: 10rpx;
  397. }
  398. }
  399. &__content {
  400. line-height: 50rpx;
  401. }
  402. }
  403. &__content {
  404. margin-top: 18rpx;
  405. padding-right: 18rpx;
  406. &__data {
  407. line-height: 46rpx;
  408. text-align: justify;
  409. overflow: hidden;
  410. transition: all 0.25s ease-in-out;
  411. }
  412. &__status {
  413. margin-top: 10rpx;
  414. font-size: 26rpx;
  415. color: #82B2FF;
  416. }
  417. }
  418. &__main-image {
  419. border: 1rpx solid #F8F7F8;
  420. border-radius: 16rpx;
  421. &--1 {
  422. max-width: 80%;
  423. max-height: 300rpx;
  424. }
  425. &--2 {
  426. max-width: 260rpx;
  427. max-height: 260rpx;
  428. }
  429. &--3 {
  430. height: 212rpx;
  431. width: 100%;
  432. }
  433. }
  434. &__count-icon {
  435. font-size: 40rpx;
  436. padding-right: 5rpx;
  437. }
  438. &__ad {
  439. width: 100%;
  440. height: 500rpx;
  441. transform: translate3d(0px, 0px, 0px) !important;
  442. ::v-deep .uni-swiper-slide-frame {
  443. transform: translate3d(0px, 0px, 0px) !important;
  444. }
  445. .uni-swiper-slide-frame {
  446. transform: translate3d(0px, 0px, 0px) !important;
  447. }
  448. &__item {
  449. position: absolute;
  450. width: 100%;
  451. height: 100%;
  452. transform-origin: left center;
  453. transform: translate3d(100%, 0px, 0px) scale(1) !important;
  454. transition: transform 0.25s ease-in-out;
  455. z-index: 1;
  456. &--0 {
  457. transform: translate3d(0%, 0px, 0px) scale(1) !important;
  458. z-index: 4;
  459. }
  460. &--1 {
  461. transform: translate3d(13%, 0px, 0px) scale(0.9) !important;
  462. z-index: 3;
  463. }
  464. &--2 {
  465. transform: translate3d(26%, 0px, 0px) scale(0.8) !important;
  466. z-index: 2;
  467. }
  468. }
  469. &__content {
  470. border-radius: 40rpx;
  471. width: 640rpx;
  472. height: 500rpx;
  473. overflow: hidden;
  474. }
  475. &__image {
  476. width: 100%;
  477. height: 100%;
  478. }
  479. }
  480. }
  481. /* 文章内容 end*/
  482. /* 间隔线 start*/
  483. .tn-strip-bottom {
  484. width: 100%;
  485. border-bottom: 20rpx solid rgba(241, 241, 241, 0.8);
  486. }
  487. /* 间隔线 end*/
  488. </style>