coll.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  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. import {
  191. uniShowModal
  192. } from '../../utils/uni_api'
  193. export default {
  194. data() {
  195. return {
  196. list: [{
  197. 'tab-name': '需求'
  198. }, {
  199. 'tab-name': '供应'
  200. }],
  201. current: 0,
  202. showEmpty: false,
  203. content: [],
  204. curItem:{},
  205. showSheet:false,
  206. showContact:false,
  207. curContact:{},
  208. columns: [{
  209. fieldName: 'prodName',
  210. fieldDesc: '产品名称',
  211. }, {
  212. fieldName: 'prodSpec',
  213. fieldDesc: '规格型号',
  214. }, {
  215. fieldName: 'prodDesc',
  216. fieldDesc: '产品介绍',
  217. }],
  218. }
  219. },
  220. filters: {
  221. formatDate(value) {
  222. if (!value) return '';
  223. const date = new Date(value);
  224. const today = new Date();
  225. const yesterday = new Date(today); // 昨天的日期
  226. yesterday.setDate(yesterday.getDate() - 1); // 将昨天的日期设置为前一天
  227. if (date.getFullYear() == today.getFullYear() && date.getMonth() == today.getMonth() && date.getDate() ==
  228. today.getDate()) {
  229. return '今天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  230. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  231. }
  232. if (date.getFullYear() == yesterday.getFullYear() && date.getMonth() == yesterday.getMonth() && date
  233. .getDate() == yesterday.getDate()) {
  234. return '昨天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  235. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  236. }
  237. return date.toLocaleDateString() + ' ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  238. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  239. },
  240. },
  241. onShow() {
  242. this.loadData();
  243. },
  244. methods: {
  245. goBack() {
  246. uni.navigateBack();
  247. },
  248. change(index) {
  249. this.current = index;
  250. this.loadData();
  251. },
  252. isImage(fileName) {
  253. const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'ico']
  254. const extension = fileName.split('.').pop().toLowerCase();
  255. return imageExtensions.includes(extension);
  256. },
  257. loadData() {
  258. let that = this;
  259. that.content = [];
  260. request.post('/slbCollect/show/my', {
  261. userNo: uni.getStorageSync('userNo'),
  262. bisType: that.current == 1 ? '2' : '1',
  263. }).then(res => {
  264. let newList = res.list || [];
  265. if (res.success) {
  266. let cList = [];
  267. for (let i = 0; i < newList.length; i++) {
  268. if (newList[i].fkBisMap) {
  269. newList[i].fkBisMap.collId = newList[i].id;
  270. newList[i].fkBisMap.createTime2 = newList[i].createTime;
  271. newList[i].fkBisMap.imgList = [];
  272. for (let j = 0; j < newList[i].fkBisMap.fileDetailList.length; j++) {
  273. if (that.isImage(newList[i].fkBisMap.fileDetailList[j].fileName)) {
  274. newList[i].fkBisMap.imgList.push(newList[i].fkBisMap.fileDetailList[j]);
  275. }
  276. }
  277. cList.push(newList[i].fkBisMap);
  278. }
  279. }
  280. that.content = cList;
  281. }
  282. if (newList.length == 0) {
  283. that.showEmpty = true;
  284. } else {
  285. that.showEmpty = false;
  286. }
  287. })
  288. },
  289. dialogConfirm(){
  290. let item = this.curItem;
  291. let that = this;
  292. request.post('/slbCollect/del', {
  293. id: item.collId,
  294. userNo: uni.getStorageSync('userNo'),
  295. }).then(res => {
  296. if (res.success) {
  297. uni.showToast({
  298. title: '取消成功'
  299. })
  300. that.loadData();
  301. } else {
  302. uni.showToast({
  303. title: res.msg,
  304. icon: 'none'
  305. })
  306. }
  307. })
  308. },
  309. delColl(item) {
  310. this.curItem = item;
  311. let that = this;
  312. // this.$refs.alertDialog.open()
  313. uniShowModal('确定取消收藏吗?', '', {
  314. showCancel: true,
  315. confirmText:'确定',
  316. success: (res) => {
  317. if(res.confirm){
  318. that.dialogConfirm();
  319. }
  320. }
  321. })
  322. },
  323. showImg(items, index) {
  324. let urls = [];
  325. for (let i = 0; i < items.length; i++) {
  326. urls.push(items[i].ftpUrl);
  327. }
  328. // 预览图片
  329. uni.previewImage({
  330. urls: urls,
  331. current: index,
  332. });
  333. },
  334. clickLink(url,fileName) {
  335. uni.navigateTo({
  336. url:'/pages/webview/web-view?url='+encodeURIComponent('http://slb-m.dev.ml1993.com/webview?title='+fileName+'&url='+ url),
  337. })
  338. // uni.navigateTo({
  339. // url:'/pages/webview/web-view?url='+url,
  340. // })
  341. },
  342. showActionSheet(item) {
  343. let that = this;
  344. console.warn(item);
  345. this.curItem = item;
  346. this.showSheet = true;
  347. that.showContact = false;
  348. },
  349. linkTel() {
  350. if (!uni.getStorageSync('userNo')) {
  351. uni.showToast({
  352. title: '请登录'
  353. })
  354. uni.navigateTo({
  355. url: '/pages/login/login'
  356. })
  357. return false;
  358. }
  359. let that = this;
  360. let params = {};
  361. params.slbBisContact = JSON.stringify({
  362. fkBisNo: that.curItem.bisNo,
  363. bisType: that.current==0?'1':'2',
  364. type: '1',
  365. company: that.curItem.company,
  366. companyNo: that.curItem.companyNo,
  367. userNo: uni.getStorageSync('userNo'),
  368. });
  369. request.post('/slbBisContact/add', params).then(res => {
  370. if (res.success) {
  371. that.showContact = true;
  372. that.curContact.company = that.curItem.company;
  373. that.curContact.contactMethod = res.resultMap.contactMethod;
  374. that.curContact.contactPerson = res.resultMap.contactPerson;
  375. } else {
  376. that.showContact = false;
  377. uni.showToast({
  378. title: res.msg,
  379. icon: 'none'
  380. })
  381. }
  382. })
  383. },
  384. }
  385. }
  386. </script>
  387. <style lang="scss" scoped>
  388. /* 胶囊*/
  389. .tn-custom-nav-bar__back {
  390. width: 60%;
  391. height: 100%;
  392. position: relative;
  393. display: flex;
  394. justify-content: space-evenly;
  395. align-items: center;
  396. box-sizing: border-box;
  397. // background-color: rgba(0, 0, 0, 0.15);
  398. border-radius: 1000rpx;
  399. border: 1rpx solid rgba(255, 255, 255, 0.5);
  400. // color: #FFFFFF;
  401. font-size: 18px;
  402. .icon {
  403. display: block;
  404. flex: 1;
  405. margin: auto;
  406. text-align: center;
  407. }
  408. &:before {
  409. content: " ";
  410. width: 1rpx;
  411. height: 110%;
  412. position: absolute;
  413. top: 22.5%;
  414. left: 0;
  415. right: 0;
  416. margin: auto;
  417. transform: scale(0.5);
  418. transform-origin: 0 0;
  419. pointer-events: none;
  420. box-sizing: border-box;
  421. opacity: 0.7;
  422. background-color: #FFFFFF;
  423. }
  424. }
  425. /* 文章内容 start*/
  426. .blogger {
  427. &__item {
  428. padding: 30rpx;
  429. }
  430. &__author {
  431. &__btn {
  432. margin-right: -12rpx;
  433. opacity: 0.5;
  434. }
  435. }
  436. &__desc {
  437. line-height: 30rpx;
  438. &__label {
  439. color: #1D2541;
  440. background-color: #F3F2F7;
  441. border-radius: 10rpx;
  442. font-size: 22rpx;
  443. padding: 5rpx 15rpx;
  444. margin: 5rpx 18rpx 0 0;
  445. &--prefix {
  446. font-size: 24rpx;
  447. color: #1D2541;
  448. padding-right: 10rpx;
  449. }
  450. }
  451. &__content {
  452. line-height: 50rpx;
  453. }
  454. }
  455. &__content {
  456. margin-top: 18rpx;
  457. padding-right: 18rpx;
  458. &__data {
  459. line-height: 46rpx;
  460. text-align: justify;
  461. overflow: hidden;
  462. transition: all 0.25s ease-in-out;
  463. }
  464. &__status {
  465. margin-top: 10rpx;
  466. font-size: 26rpx;
  467. color: #82B2FF;
  468. }
  469. }
  470. &__main-image {
  471. border: 1rpx solid #F8F7F8;
  472. border-radius: 16rpx;
  473. &--1 {
  474. max-width: 80%;
  475. max-height: 300rpx;
  476. }
  477. &--2 {
  478. max-width: 260rpx;
  479. max-height: 260rpx;
  480. }
  481. &--3 {
  482. height: 212rpx;
  483. width: 100%;
  484. }
  485. }
  486. &__count-icon {
  487. font-size: 40rpx;
  488. padding-right: 5rpx;
  489. }
  490. &__ad {
  491. width: 100%;
  492. height: 500rpx;
  493. transform: translate3d(0px, 0px, 0px) !important;
  494. ::v-deep .uni-swiper-slide-frame {
  495. transform: translate3d(0px, 0px, 0px) !important;
  496. }
  497. .uni-swiper-slide-frame {
  498. transform: translate3d(0px, 0px, 0px) !important;
  499. }
  500. &__item {
  501. position: absolute;
  502. width: 100%;
  503. height: 100%;
  504. transform-origin: left center;
  505. transform: translate3d(100%, 0px, 0px) scale(1) !important;
  506. transition: transform 0.25s ease-in-out;
  507. z-index: 1;
  508. &--0 {
  509. transform: translate3d(0%, 0px, 0px) scale(1) !important;
  510. z-index: 4;
  511. }
  512. &--1 {
  513. transform: translate3d(13%, 0px, 0px) scale(0.9) !important;
  514. z-index: 3;
  515. }
  516. &--2 {
  517. transform: translate3d(26%, 0px, 0px) scale(0.8) !important;
  518. z-index: 2;
  519. }
  520. }
  521. &__content {
  522. border-radius: 40rpx;
  523. width: 640rpx;
  524. height: 500rpx;
  525. overflow: hidden;
  526. }
  527. &__image {
  528. width: 100%;
  529. height: 100%;
  530. }
  531. }
  532. }
  533. /* 文章内容 end*/
  534. /* 间隔线 start*/
  535. .tn-strip-bottom {
  536. width: 100%;
  537. border-bottom: 20rpx solid rgba(241, 241, 241, 0.8);
  538. }
  539. .bg-content{
  540. color: #fff;
  541. background-image: url(./../../static/bg.png);
  542. background-size: cover;
  543. }
  544. /* 间隔线 end*/
  545. </style>