need.vue 12 KB

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