share.vue 15 KB

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