detail.vue 18 KB

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