share.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  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="change" style="border-bottom: 1rpx solid #f1f1f1cc;"></tn-tabs-swiper>
  15. </uv-sticky>
  16. <view class="tn-flex tn-flex-direction-column tn-margin-top-sm tn-margin-bottom">
  17. <!-- 图文信息 -->
  18. <block v-for="(item,index) in content">
  19. <view class="blogger__item" :key="index">
  20. <view class="blogger__author tn-flex tn-flex-row-between tn-flex-col-center">
  21. <view class="justify__author__info" @click="tn('')">
  22. <view class="tn-flex tn-flex-row-center">
  23. <view class="tn-flex tn-flex-row-center tn-flex-col-center">
  24. <!-- <view class="">
  25. <tn-avatar
  26. class=""
  27. shape="circle"
  28. :src="item.userAvatar"
  29. size="lg">
  30. </tn-avatar>
  31. </view> -->
  32. <view class="tn-padding-right tn-text-ellipsis">
  33. <view class="tn-padding-right tn-text-bold tn-text-lg">
  34. {{ item.company||(item.contactNickName||item.contactPerson)}} </view>
  35. <!-- <view class="tn-padding-right tn-padding-left-sm tn-padding-top-xs tn-color-gray">{{ item.date }}</view> -->
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <view v-if="item.status=='4'&&item.showFlag=='否'"
  41. class="blogger__author__btn justify-content-item tn-flex-col-center tn-flex-row-center">
  42. <text class="" style="background: #3F51B542;font-size: 12px;
  43. padding: 8px;
  44. color: #333333;
  45. border-radius: 24px;
  46. ">已下架</text>
  47. </view>
  48. <!-- <view class="blogger__author__btn justify-content-item tn-flex-col-center tn-flex-row-center">
  49. <text class="tn-icon-more-vertical tn-color-gray tn-text-bold tn-text-xxl"></text>
  50. </view> -->
  51. </view>
  52. <view
  53. class="blogger__desc tn-margin-top-sm tn-margin-bottom-sm tn-text-justify tn-flex-col-center tn-flex-row-left"
  54. @click="tn('')">
  55. <!-- <view v-for="(label_item,label_index) in item.label" :key="label_index" class="blogger__desc__label tn-float-left tn-margin-right">
  56. <text class="blogger__desc__label--prefix tn-icon-topics-fill"></text>
  57. <text class="tn-text-df">{{ label_item }}</text>
  58. </view> -->
  59. <tn-tag margin="-4px 4px 0 0" backgroundColor="#3a96d733" v-if="item.brand" fontColor="#3a96d7" shape="circle">{{ item.brand }}</tn-tag>
  60. <tn-tag margin="-4px 4px 0 0" backgroundColor="#3a96d733" v-if="!item.company"
  61. fontColor="#3a96d7" shape="circle">个人</tn-tag>
  62. <!-- 不用限制长度了,因为发布的时候限制长度了-->
  63. <text v-if="item.content"
  64. class="blogger__desc__content tn-flex-1 tn-text-justify tn-text-df">{{ item.content }}</text>
  65. </view>
  66. <!-- 内容太多疲劳了-->
  67. <view v-if="item.shareExt&&item.shareExt.length>0" class="blogger__content"
  68. :id="`blogger__content--${index}`">
  69. <basic-table header-row-class-name="basic-table-header" :columns="columns" :border="true"
  70. :stripe="true" :data="item.shareExt">
  71. </basic-table>
  72. </view>
  73. <!-- 内容太多疲劳了-->
  74. <!-- <view v-if="item.shareExt&&item.shareExt.length>0" class="blogger__content" :id="`blogger__content--${index}`">
  75. <uni-table border stripe emptyText="暂无更多数据">
  76. <uni-tr>
  77. <uni-th align="center">产品名称</uni-th>
  78. <uni-th align="center">规格型号</uni-th>
  79. <uni-th align="left">产品介绍</uni-th>
  80. </uni-tr>
  81. <uni-tr v-for="extItem in item.shareExt">
  82. <uni-td>{{extItem.prodName}}</uni-td>
  83. <uni-td>{{extItem.prodSpec}}</uni-td>
  84. <uni-td>{{extItem.prodDesc}}</uni-td>
  85. </uni-tr>
  86. </uni-table>
  87. </view> -->
  88. <block v-if="item.imgList">
  89. <view v-if="[1,2,4].indexOf(item.imgList.length) != -1" class="tn-padding-top-xs"
  90. @click="tn('')">
  91. <image v-for="(image_item,image_index) in item.imgList" :key="image_index"
  92. class="blogger__main-image" :class="{
  93. 'blogger__main-image--1 tn-margin-bottom-sm': item.imgList.length === 1,
  94. 'blogger__main-image--2 tn-margin-right-sm tn-margin-bottom-sm': item.imgList.length === 2 || item.imgList.length === 4
  95. }" :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  96. </view>
  97. <view v-else class="tn-padding-top-xs">
  98. <tn-grid hoverClass="none" :col="3">
  99. <block v-for="(image_item,image_index) in item.imgList" :key="image_index">
  100. <!-- #ifndef MP-WEIXIN -->
  101. <tn-grid-item style="width: 30%;margin: 10rpx;">
  102. <image class="blogger__main-image blogger__main-image--3"
  103. :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  104. </tn-grid-item>
  105. <!-- #endif-->
  106. <!-- #ifdef MP-WEIXIN -->
  107. <tn-grid-item style="width: 30%;margin: 10rpx;">
  108. <image class="blogger__main-image blogger__main-image--3"
  109. :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  110. </tn-grid-item>
  111. <!-- #endif-->
  112. </block>
  113. </tn-grid>
  114. </view>
  115. </block>
  116. <view v-for="file in item.fileDetailList" :key="file.id" v-if="!isImage(file.fileName)">
  117. <view>
  118. <text class="tn-icon-link"></text>
  119. <view style="display: inline-block;margin-left:8px" @click="clickLink(file.ftpUrl,file.fileName)">
  120. {{file.fileName}}</view>
  121. </view>
  122. </view>
  123. <view v-if="item.status==9&&item.feedback">
  124. <view>
  125. <view>
  126. 反馈意见:{{item.feedback||'--'}}
  127. </view>
  128. </view>
  129. </view>
  130. <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-margin-top-xs">
  131. <view class="justify-content-item tn-color-gray tn-text-center">
  132. <view class="tn-padding-right tn-padding-top-xs tn-color-gray">
  133. {{ item.createTime|formatDate }}
  134. </view>
  135. </view>
  136. <view class="justify-content-item tn-flex tn-flex-col-center">
  137. <view class="justify-content-item tn-flex tn-flex-col-center" v-if="item.showFlag!='否'">
  138. <!-- <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> -->
  139. <button type="warn" plain="true" size="mini" @click="finishItem(item)">下架供应</button>
  140. </view>
  141. </view>
  142. </view>
  143. </view>
  144. <!-- 边距间隔 -->
  145. <view class="tn-strip-bottom" v-if="index != content.length - 1"></view>
  146. </block>
  147. <!-- 边距间隔 -->
  148. <!-- <view class="tn-strip-bottom"></view> -->
  149. <!-- 广告 -->
  150. </view>
  151. </view>
  152. <tn-modal v-model="showModel" @click="clickModel" :title="titleModel" :content="contentModel" :button="buttonModel"></tn-modal>
  153. <view class='tn-tabbar-height'></view>
  154. <view v-if="showEmpty" style="margin-top: 32vh;">
  155. <tn-empty mode="data"></tn-empty>
  156. </view>
  157. </view>
  158. </template>
  159. <script>
  160. import request from '../../utils/request'
  161. export default {
  162. data() {
  163. return {
  164. showModel:false,
  165. titleModel:'下架供应提示',
  166. contentModel:'下架之后内容不再展示在供应页面里, 是否继续?',
  167. buttonModel:[{
  168. text: '取消',
  169. plain: true,
  170. shape: 'round'
  171. },
  172. {
  173. text: '继续',
  174. backgroundColor: 'tn-bg-indigo',
  175. fontColor: '#FFFFFF'
  176. }],
  177. list: [{
  178. 'tab-name': '已通过'
  179. }, {
  180. 'tab-name': '审核中'
  181. }, {
  182. 'tab-name': '暂存'
  183. }, {
  184. 'tab-name': '已拒绝'
  185. }],
  186. current: 0,
  187. showEmpty: false,
  188. content:[],
  189. curItem:{},
  190. columns: [{
  191. fieldName: 'prodName',
  192. fieldDesc: '产品名称',
  193. }, {
  194. fieldName: 'prodSpec',
  195. fieldDesc: '规格型号',
  196. }, {
  197. fieldName: 'prodDesc',
  198. fieldDesc: '产品介绍',
  199. }],
  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. goBack() {
  236. uni.navigateBack();
  237. },
  238. change(index) {
  239. this.current = index;
  240. this.loadData();
  241. },
  242. isImage(fileName) {
  243. const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'ico']
  244. const extension = fileName.split('.').pop().toLowerCase();
  245. return imageExtensions.includes(extension);
  246. },
  247. loadData() {
  248. let that = this;
  249. that.content = [];
  250. request.post('/slbResourceShare/show/my', {
  251. userNo: uni.getStorageSync('userNo'),
  252. // 状态(1:暂存,2:待处理,3:审核中,4:已通过,9:已拒绝,10:已取消)
  253. status: that.current == 1 ? '3' : that.current == 2 ? '1' : that.current == 3 ? '9' : '4',
  254. }).then(res => {
  255. let newList = res.list || [];
  256. if (res.success) {
  257. let newList = res.list || [];
  258. for (let i = 0; i < newList.length; i++) {
  259. newList[i].imgList = [];
  260. for (let j = 0; j < newList[i].fileDetailList.length; j++) {
  261. if (that.isImage(newList[i].fileDetailList[j].fileName)) {
  262. newList[i].imgList.push(newList[i].fileDetailList[j]);
  263. }
  264. }
  265. }
  266. that.content = newList;
  267. if (newList.length == 0) {
  268. that.showEmpty = true;
  269. } else {
  270. that.showEmpty = false;
  271. }
  272. }
  273. console.warn(res);
  274. })
  275. },
  276. showImg(items, index) {
  277. let urls = [];
  278. for (let i = 0; i < items.length; i++) {
  279. urls.push(items[i].ftpUrl);
  280. }
  281. // 预览图片
  282. uni.previewImage({
  283. urls: urls,
  284. current: index,
  285. });
  286. },
  287. clickLink(url,fileName) {
  288. uni.navigateTo({
  289. url:'/pages/webview/web-view?url='+encodeURIComponent('http://slb-m.dev.ml1993.com/webview?title='+fileName+'&url='+ url),
  290. })
  291. // uni.navigateTo({
  292. // url:'/pages/webview/web-view?url='+url,
  293. // })
  294. },
  295. finishItem(item){
  296. this.curItem = item;
  297. this.showModel = true;
  298. return false;
  299. },
  300. clickModel(e){
  301. if(e.index==1){
  302. this.showModel = false;
  303. this.finishNext(this.curItem)
  304. }else{
  305. this.showModel = false;
  306. }
  307. },
  308. finishNext(item){
  309. let that = this;
  310. request.post('/slbResourceShare/offShelf', {
  311. id: item.id,
  312. userNo: uni.getStorageSync('userNo'),
  313. }).then(res => {
  314. if (res.success) {
  315. uni.showToast({
  316. title: '下架成功'
  317. })
  318. that.loadData();
  319. } else {
  320. uni.showToast({
  321. title: res.msg,
  322. icon: 'none'
  323. })
  324. }
  325. })
  326. },
  327. }
  328. }
  329. </script>
  330. <style lang="scss" scoped>
  331. /* 胶囊*/
  332. .tn-custom-nav-bar__back {
  333. width: 60%;
  334. height: 100%;
  335. position: relative;
  336. display: flex;
  337. justify-content: space-evenly;
  338. align-items: center;
  339. box-sizing: border-box;
  340. // background-color: rgba(0, 0, 0, 0.15);
  341. border-radius: 1000rpx;
  342. // border: 1rpx solid rgba(255, 255, 255, 0.5);
  343. // color: #FFFFFF;
  344. font-size: 18px;
  345. .icon {
  346. display: block;
  347. flex: 1;
  348. margin: auto;
  349. text-align: center;
  350. }
  351. &:before {
  352. content: " ";
  353. width: 1rpx;
  354. height: 110%;
  355. position: absolute;
  356. top: 22.5%;
  357. left: 0;
  358. right: 0;
  359. margin: auto;
  360. transform: scale(0.5);
  361. transform-origin: 0 0;
  362. pointer-events: none;
  363. box-sizing: border-box;
  364. opacity: 0.7;
  365. background-color: #FFFFFF;
  366. }
  367. }
  368. /* 文章内容 start*/
  369. .blogger {
  370. &__item {
  371. padding: 30rpx;
  372. }
  373. &__author {
  374. &__btn {
  375. margin-right: -12rpx;
  376. opacity: 0.5;
  377. }
  378. }
  379. &__desc {
  380. line-height: 30rpx;
  381. &__label {
  382. color: #1D2541;
  383. background-color: #F3F2F7;
  384. border-radius: 10rpx;
  385. font-size: 22rpx;
  386. padding: 5rpx 15rpx;
  387. margin: 5rpx 18rpx 0 0;
  388. &--prefix {
  389. font-size: 24rpx;
  390. color: #1D2541;
  391. padding-right: 10rpx;
  392. }
  393. }
  394. &__content {
  395. line-height: 50rpx;
  396. }
  397. }
  398. &__content {
  399. margin-top: 18rpx;
  400. padding-right: 18rpx;
  401. &__data {
  402. line-height: 46rpx;
  403. text-align: justify;
  404. overflow: hidden;
  405. transition: all 0.25s ease-in-out;
  406. }
  407. &__status {
  408. margin-top: 10rpx;
  409. font-size: 26rpx;
  410. color: #82B2FF;
  411. }
  412. }
  413. &__main-image {
  414. border: 1rpx solid #F8F7F8;
  415. border-radius: 16rpx;
  416. &--1 {
  417. max-width: 80%;
  418. max-height: 300rpx;
  419. }
  420. &--2 {
  421. max-width: 260rpx;
  422. max-height: 260rpx;
  423. }
  424. &--3 {
  425. height: 212rpx;
  426. width: 100%;
  427. }
  428. }
  429. &__count-icon {
  430. font-size: 40rpx;
  431. padding-right: 5rpx;
  432. }
  433. &__ad {
  434. width: 100%;
  435. height: 500rpx;
  436. transform: translate3d(0px, 0px, 0px) !important;
  437. ::v-deep .uni-swiper-slide-frame {
  438. transform: translate3d(0px, 0px, 0px) !important;
  439. }
  440. .uni-swiper-slide-frame {
  441. transform: translate3d(0px, 0px, 0px) !important;
  442. }
  443. &__item {
  444. position: absolute;
  445. width: 100%;
  446. height: 100%;
  447. transform-origin: left center;
  448. transform: translate3d(100%, 0px, 0px) scale(1) !important;
  449. transition: transform 0.25s ease-in-out;
  450. z-index: 1;
  451. &--0 {
  452. transform: translate3d(0%, 0px, 0px) scale(1) !important;
  453. z-index: 4;
  454. }
  455. &--1 {
  456. transform: translate3d(13%, 0px, 0px) scale(0.9) !important;
  457. z-index: 3;
  458. }
  459. &--2 {
  460. transform: translate3d(26%, 0px, 0px) scale(0.8) !important;
  461. z-index: 2;
  462. }
  463. }
  464. &__content {
  465. border-radius: 40rpx;
  466. width: 640rpx;
  467. height: 500rpx;
  468. overflow: hidden;
  469. }
  470. &__image {
  471. width: 100%;
  472. height: 100%;
  473. }
  474. }
  475. }
  476. /* 文章内容 end*/
  477. /* 间隔线 start*/
  478. .tn-strip-bottom {
  479. width: 100%;
  480. border-bottom: 20rpx solid rgba(241, 241, 241, 0.8);
  481. }
  482. /* 间隔线 end*/
  483. </style>