coll.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  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" @change="change" style="border-bottom: 1rpx solid #f1f1f1cc;"></tn-tabs-swiper>
  14. </uv-sticky>
  15. <view>
  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" @click="tn('')">
  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||(item.contactNickName||item.contactPerson) }}
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. <view v-if="item.validDate&&current==0"
  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: #0000FF;
  40. border-radius: 24px;
  41. border-top-right-radius: 0;">{{item.validDate}}</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. >
  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. <tn-tag margin="-4px 4px 0 0" backgroundColor="#3a96d733" v-if="item.brand" fontColor="#3a96d7" shape="circle">{{ item.brand }}</tn-tag>
  54. <tn-tag margin="-4px 4px 0 0" backgroundColor="#3a96d733" v-if="!item.company"
  55. fontColor="#3a96d7" shape="circle">个人</tn-tag>
  56. <text
  57. class="blogger__desc__content tn-flex-1 tn-text-justify tn-text-df">{{ item.content }}</text>
  58. </view>
  59. <!-- 内容太多疲劳了-->
  60. <!-- <view
  61. v-if="item.content"
  62. class="blogger__content"
  63. :id="`blogger__content--${index}`"
  64. >
  65. <view
  66. class="blogger__content__data clamp-text-2">
  67. {{ item.content }}
  68. </view>
  69. </view> -->
  70. <!-- 内容太多疲劳了-->
  71. <view v-if="item.shareExt&&item.shareExt.length>0" class="blogger__content"
  72. :id="`blogger__content--${index}`">
  73. <basic-table header-row-class-name="basic-table-header" :columns="columns" :border="true"
  74. :stripe="true" :data="item.shareExt">
  75. </basic-table>
  76. </view>
  77. <!-- 内容太多疲劳了-->
  78. <!-- <view
  79. v-if="item.shareExt&&item.shareExt.length>0"
  80. class="blogger__content"
  81. :id="`blogger__content--${index}`"
  82. >
  83. <uni-table border stripe emptyText="暂无更多数据" >
  84. <uni-tr>
  85. <uni-th align="center">产品名称1</uni-th>
  86. <uni-th align="center">规格型号</uni-th>
  87. <uni-th align="left">产品介绍</uni-th>
  88. </uni-tr>
  89. <uni-tr v-for="extItem in item.shareExt">
  90. <uni-td>{{extItem.prodName}}</uni-td>
  91. <uni-td>{{extItem.prodSpec}}</uni-td>
  92. <uni-td>{{extItem.prodDesc}}</uni-td>
  93. </uni-tr>
  94. </uni-table>
  95. </view> -->
  96. <block v-if="item.imgList">
  97. <view v-if="[1,2,4].indexOf(item.imgList.length) != -1" class="tn-padding-top-xs"
  98. @click="tn('')">
  99. <image v-for="(image_item,image_index) in item.imgList" :key="image_index"
  100. class="blogger__main-image" :class="{
  101. 'blogger__main-image--1 tn-margin-bottom-sm': item.imgList.length === 1,
  102. 'blogger__main-image--2 tn-margin-right-sm tn-margin-bottom-sm': item.imgList.length === 2 || item.imgList.length === 4
  103. }" :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  104. </view>
  105. <view v-else class="tn-padding-top-xs" @click="tn('')">
  106. <tn-grid hoverClass="none" :col="3">
  107. <block v-for="(image_item,image_index) in item.imgList" :key="image_index">
  108. <!-- #ifndef MP-WEIXIN -->
  109. <tn-grid-item style="width: 30%;margin: 10rpx;">
  110. <image class="blogger__main-image blogger__main-image--3"
  111. :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  112. </tn-grid-item>
  113. <!-- #endif-->
  114. <!-- #ifdef MP-WEIXIN -->
  115. <tn-grid-item style="width: 30%;margin: 10rpx;">
  116. <image class="blogger__main-image blogger__main-image--3"
  117. aspectFill :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  118. </tn-grid-item>
  119. <!-- #endif-->
  120. </block>
  121. </tn-grid>
  122. </view>
  123. </block>
  124. <view v-for="file in item.fileDetailList" :key="file.id" v-if="!isImage(file.fileName)">
  125. <view>
  126. <text class="tn-icon-link"></text>
  127. <view style="display: inline-block;margin-left:8px" @click="clickLink(file.ftpUrl,file.fileName)">
  128. {{file.fileName}}
  129. </view>
  130. </view>
  131. </view>
  132. <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-margin-top-xs">
  133. <view class="justify-content-item tn-color-gray tn-text-center">
  134. <view class="tn-padding-right tn-padding-top-xs tn-color-gray">
  135. {{ item.createTime2|formatDate }}
  136. </view>
  137. </view>
  138. <view class="justify-content-item tn-flex tn-flex-col-center">
  139. <text class="tn-icon-more-vertical tn-color-gray tn-text-bold tn-text-xxl"
  140. @click="showActionSheet(item)" style="margin-right: 12px;"></text>
  141. <button type="warn" plain="true" style="height: 26px;line-height: 26px" size="mini" @click="delColl(item)"><text style="font-size: 18px;" class="tn-icon-delete"></text></button>
  142. </view>
  143. </view>
  144. </view>
  145. <!-- 边距间隔 -->
  146. <view class="tn-strip-bottom" v-if="index != content.length - 1"></view>
  147. </block>
  148. </view>
  149. <view v-if="showEmpty" style="margin-top: 32vh;">
  150. <tn-empty mode="data"></tn-empty>
  151. </view>
  152. </view>
  153. <!-- 提示窗示例 -->
  154. <uni-popup ref="alertDialog" type="dialog">
  155. <uni-popup-dialog type="info" cancelText="关闭" confirmText="确认" title=" " content="确定取消收藏吗?" @confirm="dialogConfirm"
  156. @close="dialogClose"></uni-popup-dialog>
  157. </uni-popup>
  158. <tn-popup v-model="showSheet" mode="center" closeBtn="true" borderRadius="16">
  159. <view class="content" style="padding: 24px 36px;font-size: 16px;line-height: 24px; width: 320px;"
  160. v-if="!showContact">
  161. <button @click="linkTel()" style="border-radius:30px;color:#fff;background-color: #1d60b1;"><text
  162. class="tn-icon-service" style="margin-right: 12px;"></text> {{current==0?'联系需方':'联系供方'}}</button>
  163. <!-- <view>联系我们帮助对接</view> -->
  164. <!-- <button v-if="!collStatus" @click="addColl"
  165. style="margin-top:10px;border-radius:30px;color:#3a96d7;background-color: #d3e3fd;"><text
  166. class="tn-icon-star" style="margin-right: 12px;"></text>
  167. 收&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;藏</button>
  168. <button v-if="collStatus" @click="delColl"
  169. style="margin-top:10px;border-radius:30px;color:#3a96d7;background-color: #d3e3fd;"><text
  170. class="tn-icon-star-fill" style="margin-right: 12px;"></text> 取消收藏</button> -->
  171. <button open-type="share"
  172. style="margin-top:10px;border-radius:30px;" type="default" plain="true"><text
  173. class="tn-icon-send" style="margin-right: 12px;"></text>
  174. 转&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;发</button>
  175. </view>
  176. <view class="content bg-content" style="padding: 50px 36px;padding-bottom: 32px;font-size: 16px;width:320px;line-height: 24px;"
  177. v-if="showContact">
  178. <view><text style="font-size: 20px;font-weight: bold;" v-if="curContact.company">{{curContact.company}}</text></view>
  179. <view style="margin-top:20px;
  180. font-weight: bold;
  181. font-size: 20px;"><text class="tn-icon-my-formal"></text><text style="margin-left: 6px;">{{curContact.contactPerson}}</text> </view>
  182. <view style="font-size: 20px;font-weight: bold;margin-top:20px" @click="showTel(curContact.contactMethod)"><text class="tn-icon-tel"></text>
  183. <text style="margin-left: 4px;">{{curContact.contactMethod}}</text> </view>
  184. </view>
  185. </tn-popup>
  186. </view>
  187. </template>
  188. <script>
  189. import request from '../../utils/request'
  190. export default {
  191. data() {
  192. return {
  193. list: [{
  194. 'tab-name': '需求'
  195. }, {
  196. 'tab-name': '供应'
  197. }],
  198. current: 0,
  199. showEmpty: false,
  200. content: [],
  201. curItem:{},
  202. showSheet:false,
  203. showContact:false,
  204. curContact:{},
  205. columns: [{
  206. fieldName: 'prodName',
  207. fieldDesc: '产品名称',
  208. }, {
  209. fieldName: 'prodSpec',
  210. fieldDesc: '规格型号',
  211. }, {
  212. fieldName: 'prodDesc',
  213. fieldDesc: '产品介绍',
  214. }],
  215. }
  216. },
  217. filters: {
  218. formatDate(value) {
  219. if (!value) return '';
  220. const date = new Date(value);
  221. const today = new Date();
  222. const yesterday = new Date(today); // 昨天的日期
  223. yesterday.setDate(yesterday.getDate() - 1); // 将昨天的日期设置为前一天
  224. if (date.getFullYear() == today.getFullYear() && date.getMonth() == today.getMonth() && date.getDate() ==
  225. today.getDate()) {
  226. return '今天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  227. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  228. }
  229. if (date.getFullYear() == yesterday.getFullYear() && date.getMonth() == yesterday.getMonth() && date
  230. .getDate() == yesterday.getDate()) {
  231. return '昨天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  232. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  233. }
  234. return date.toLocaleDateString() + ' ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  235. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  236. },
  237. },
  238. onShow() {
  239. this.loadData();
  240. },
  241. methods: {
  242. goBack() {
  243. uni.navigateBack();
  244. },
  245. change(index) {
  246. this.current = index;
  247. this.loadData();
  248. },
  249. isImage(fileName) {
  250. const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'ico']
  251. const extension = fileName.split('.').pop().toLowerCase();
  252. return imageExtensions.includes(extension);
  253. },
  254. loadData() {
  255. let that = this;
  256. that.content = [];
  257. request.post('/slbCollect/show/my', {
  258. userNo: uni.getStorageSync('userNo'),
  259. bisType: that.current == 1 ? '2' : '1',
  260. }).then(res => {
  261. let newList = res.list || [];
  262. if (res.success) {
  263. let cList = [];
  264. for (let i = 0; i < newList.length; i++) {
  265. if (newList[i].fkBisMap) {
  266. newList[i].fkBisMap.collId = newList[i].id;
  267. newList[i].fkBisMap.createTime2 = newList[i].createTime;
  268. newList[i].fkBisMap.imgList = [];
  269. for (let j = 0; j < newList[i].fkBisMap.fileDetailList.length; j++) {
  270. if (that.isImage(newList[i].fkBisMap.fileDetailList[j].fileName)) {
  271. newList[i].fkBisMap.imgList.push(newList[i].fkBisMap.fileDetailList[j]);
  272. }
  273. }
  274. cList.push(newList[i].fkBisMap);
  275. }
  276. }
  277. that.content = cList;
  278. }
  279. if (newList.length == 0) {
  280. that.showEmpty = true;
  281. } else {
  282. that.showEmpty = false;
  283. }
  284. })
  285. },
  286. dialogConfirm(){
  287. let item = this.curItem;
  288. let that = this;
  289. request.post('/slbCollect/del', {
  290. id: item.collId,
  291. userNo: uni.getStorageSync('userNo'),
  292. }).then(res => {
  293. if (res.success) {
  294. uni.showToast({
  295. title: '取消成功'
  296. })
  297. that.loadData();
  298. } else {
  299. uni.showToast({
  300. title: res.msg,
  301. icon: 'none'
  302. })
  303. }
  304. })
  305. },
  306. delColl(item) {
  307. this.curItem = item;
  308. this.$refs.alertDialog.open()
  309. },
  310. showImg(items, index) {
  311. let urls = [];
  312. for (let i = 0; i < items.length; i++) {
  313. urls.push(items[i].ftpUrl);
  314. }
  315. // 预览图片
  316. uni.previewImage({
  317. urls: urls,
  318. current: index,
  319. });
  320. },
  321. clickLink(url,fileName) {
  322. uni.navigateTo({
  323. url:'/pages/webview/web-view?url='+encodeURIComponent('http://slb-m.dev.ml1993.com/webview?title='+fileName+'&url='+ url),
  324. })
  325. // uni.navigateTo({
  326. // url:'/pages/webview/web-view?url='+url,
  327. // })
  328. },
  329. showActionSheet(item) {
  330. let that = this;
  331. console.warn(item);
  332. this.curItem = item;
  333. this.showSheet = true;
  334. that.showContact = false;
  335. },
  336. linkTel() {
  337. if (!uni.getStorageSync('userNo')) {
  338. uni.showToast({
  339. title: '请登录'
  340. })
  341. uni.navigateTo({
  342. url: '/pages/login/login'
  343. })
  344. return false;
  345. }
  346. let that = this;
  347. let params = {};
  348. params.slbBisContact = JSON.stringify({
  349. fkBisNo: that.curItem.bisNo,
  350. bisType: that.current==0?'1':'2',
  351. type: '1',
  352. company: that.curItem.company,
  353. companyNo: that.curItem.companyNo,
  354. userNo: uni.getStorageSync('userNo'),
  355. });
  356. request.post('/slbBisContact/add', params).then(res => {
  357. if (res.success) {
  358. that.showContact = true;
  359. that.curContact.company = that.curItem.company;
  360. that.curContact.contactMethod = res.resultMap.contactMethod;
  361. that.curContact.contactPerson = res.resultMap.contactPerson;
  362. } else {
  363. that.showContact = false;
  364. uni.showToast({
  365. title: res.msg,
  366. icon: 'none'
  367. })
  368. }
  369. })
  370. },
  371. }
  372. }
  373. </script>
  374. <style lang="scss" scoped>
  375. /* 胶囊*/
  376. .tn-custom-nav-bar__back {
  377. width: 60%;
  378. height: 100%;
  379. position: relative;
  380. display: flex;
  381. justify-content: space-evenly;
  382. align-items: center;
  383. box-sizing: border-box;
  384. // background-color: rgba(0, 0, 0, 0.15);
  385. border-radius: 1000rpx;
  386. border: 1rpx solid rgba(255, 255, 255, 0.5);
  387. // color: #FFFFFF;
  388. font-size: 18px;
  389. .icon {
  390. display: block;
  391. flex: 1;
  392. margin: auto;
  393. text-align: center;
  394. }
  395. &:before {
  396. content: " ";
  397. width: 1rpx;
  398. height: 110%;
  399. position: absolute;
  400. top: 22.5%;
  401. left: 0;
  402. right: 0;
  403. margin: auto;
  404. transform: scale(0.5);
  405. transform-origin: 0 0;
  406. pointer-events: none;
  407. box-sizing: border-box;
  408. opacity: 0.7;
  409. background-color: #FFFFFF;
  410. }
  411. }
  412. /* 文章内容 start*/
  413. .blogger {
  414. &__item {
  415. padding: 30rpx;
  416. }
  417. &__author {
  418. &__btn {
  419. margin-right: -12rpx;
  420. opacity: 0.5;
  421. }
  422. }
  423. &__desc {
  424. line-height: 30rpx;
  425. &__label {
  426. color: #1D2541;
  427. background-color: #F3F2F7;
  428. border-radius: 10rpx;
  429. font-size: 22rpx;
  430. padding: 5rpx 15rpx;
  431. margin: 5rpx 18rpx 0 0;
  432. &--prefix {
  433. font-size: 24rpx;
  434. color: #1D2541;
  435. padding-right: 10rpx;
  436. }
  437. }
  438. &__content {
  439. line-height: 50rpx;
  440. }
  441. }
  442. &__content {
  443. margin-top: 18rpx;
  444. padding-right: 18rpx;
  445. &__data {
  446. line-height: 46rpx;
  447. text-align: justify;
  448. overflow: hidden;
  449. transition: all 0.25s ease-in-out;
  450. }
  451. &__status {
  452. margin-top: 10rpx;
  453. font-size: 26rpx;
  454. color: #82B2FF;
  455. }
  456. }
  457. &__main-image {
  458. border: 1rpx solid #F8F7F8;
  459. border-radius: 16rpx;
  460. &--1 {
  461. max-width: 80%;
  462. max-height: 300rpx;
  463. }
  464. &--2 {
  465. max-width: 260rpx;
  466. max-height: 260rpx;
  467. }
  468. &--3 {
  469. height: 212rpx;
  470. width: 100%;
  471. }
  472. }
  473. &__count-icon {
  474. font-size: 40rpx;
  475. padding-right: 5rpx;
  476. }
  477. &__ad {
  478. width: 100%;
  479. height: 500rpx;
  480. transform: translate3d(0px, 0px, 0px) !important;
  481. ::v-deep .uni-swiper-slide-frame {
  482. transform: translate3d(0px, 0px, 0px) !important;
  483. }
  484. .uni-swiper-slide-frame {
  485. transform: translate3d(0px, 0px, 0px) !important;
  486. }
  487. &__item {
  488. position: absolute;
  489. width: 100%;
  490. height: 100%;
  491. transform-origin: left center;
  492. transform: translate3d(100%, 0px, 0px) scale(1) !important;
  493. transition: transform 0.25s ease-in-out;
  494. z-index: 1;
  495. &--0 {
  496. transform: translate3d(0%, 0px, 0px) scale(1) !important;
  497. z-index: 4;
  498. }
  499. &--1 {
  500. transform: translate3d(13%, 0px, 0px) scale(0.9) !important;
  501. z-index: 3;
  502. }
  503. &--2 {
  504. transform: translate3d(26%, 0px, 0px) scale(0.8) !important;
  505. z-index: 2;
  506. }
  507. }
  508. &__content {
  509. border-radius: 40rpx;
  510. width: 640rpx;
  511. height: 500rpx;
  512. overflow: hidden;
  513. }
  514. &__image {
  515. width: 100%;
  516. height: 100%;
  517. }
  518. }
  519. }
  520. /* 文章内容 end*/
  521. /* 间隔线 start*/
  522. .tn-strip-bottom {
  523. width: 100%;
  524. border-bottom: 20rpx solid rgba(241, 241, 241, 0.8);
  525. }
  526. .bg-content{
  527. color: #fff;
  528. background-image: url(./../../static/bg.png);
  529. background-size: cover;
  530. }
  531. /* 间隔线 end*/
  532. </style>