share.vue 14 KB

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