need.vue 16 KB

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