need.vue 15 KB

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