detail.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  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('https://slb-m.lx-device.com/webview?title='+fileName+'&url='+ url),
  255. // })
  256. uni.downloadFile({
  257. url: url,
  258. filePath: wx.env.USER_DATA_PATH + "/" + fileName,
  259. success: function (res) {
  260. const filePath = res.filePath
  261. uni.openDocument({
  262. filePath: filePath,
  263. showMenu: true,
  264. success: function (res) {
  265. console.log('打开文档成功')
  266. },
  267. fail: function(){
  268. uni.navigateTo({
  269. url:'/pages/webview/web-view?url='+encodeURIComponent('https://slb-m.lx-device.com/webview?title='+fileName+'&url='+ url),
  270. })
  271. }
  272. })
  273. }
  274. })
  275. // uni.navigateTo({
  276. // url: '/pages/webview/web-view?url=' + url,
  277. // })
  278. },
  279. hideSheet(){
  280. this.showSheet = false;
  281. },
  282. showActionSheet(item) {
  283. let that = this;
  284. console.warn(item);
  285. this.curItem = item;
  286. this.curItem.isNeed = 1;
  287. this.collStatus = false;
  288. this.showSheet = true;
  289. that.showContact = false;
  290. if (uni.getStorageSync('userNo')) {
  291. let params = {};
  292. params = {
  293. fkBisNo: that.curItem.bisNo,
  294. userNo: uni.getStorageSync('userNo'),
  295. };
  296. request.post('/slbCollect/query', params).then(res => {
  297. if (res.success) {
  298. if (res.list && res.list.length > 0) {
  299. that.collStatus = true;
  300. that.collId = res.list[0].id;
  301. }
  302. }
  303. })
  304. }
  305. },
  306. linkTel() {
  307. if (!uni.getStorageSync('userNo')) {
  308. uni.showToast({
  309. title: '请登录'
  310. })
  311. uni.navigateTo({
  312. url: '/pages/login/login'
  313. })
  314. return false;
  315. }
  316. let that = this;
  317. let params = {};
  318. params.slbBisContact = JSON.stringify({
  319. fkBisNo: that.curItem.bisNo,
  320. bisType: that.isNeed==1?'1':'2',
  321. type: '1',
  322. company: that.curItem.company,
  323. companyNo: that.curItem.companyNo,
  324. userNo: uni.getStorageSync('userNo'),
  325. });
  326. request.post('/slbBisContact/add', params).then(res => {
  327. if (res.success) {
  328. that.showContact = true;
  329. that.curContact.company = that.curItem.company;
  330. that.curContact.contactMethod = res.resultMap.contactMethod;
  331. that.curContact.contactPerson = res.resultMap.contactPerson;
  332. } else {
  333. that.showContact = false;
  334. uni.showToast({
  335. title: res.msg,
  336. icon: 'none'
  337. })
  338. }
  339. })
  340. },
  341. addColl() {
  342. if (!uni.getStorageSync('userNo')) {
  343. uni.showToast({
  344. title: '请登录'
  345. })
  346. uni.navigateTo({
  347. url: '/pages/login/login'
  348. })
  349. return false;
  350. }
  351. let that = this;
  352. let params = {};
  353. params.slbCollect = JSON.stringify({
  354. fkBisNo: that.curItem.bisNo,
  355. bisType: that.isNeed==1?'1':'2',
  356. userNo: uni.getStorageSync('userNo'),
  357. });
  358. request.post('/slbCollect/add', params).then(res => {
  359. if (res.success) {
  360. that.$refs.toast.show({
  361. title: '信息已收藏,请在我的收藏里查看阅读',
  362. image: '',
  363. duration: 2000
  364. })
  365. that.showSheet = false;
  366. } else {
  367. uni.showToast({
  368. title: res.msg
  369. })
  370. }
  371. })
  372. },
  373. delColl() {
  374. let that = this;
  375. request.post('/slbCollect/del', {
  376. id: that.collId
  377. }).then(res => {
  378. if (res.success) {
  379. that.$refs.toast.show({
  380. title: '此'+(that.isNeed==1?'需求':'供应')+'信息将不会保存在我的收藏里',
  381. image: '',
  382. duration: 2000
  383. })
  384. that.showSheet = false;
  385. } else {
  386. uni.showToast({
  387. title: res.msg
  388. })
  389. }
  390. })
  391. },
  392. loadData(){
  393. let that = this;
  394. request.post(that.isNeed==1?'/slbResourceDemand/query':'/slbResourceShare/query', {
  395. bisNo: that.bisNo
  396. }).then(res => {
  397. if (res.success) {
  398. let newList = res.list || [];
  399. for (let i = 0; i < newList.length; i++) {
  400. newList[i].imgList = [];
  401. for (let j = 0; j < newList[i].fileDetailList.length; j++) {
  402. if (that.isImage(newList[i].fileDetailList[j].fileName)) {
  403. newList[i].imgList.push(newList[i].fileDetailList[j]);
  404. }
  405. }
  406. }
  407. if (1 == 1) {
  408. that.content = newList || [];
  409. } else {
  410. that.content = that.content.concat(newList || []);
  411. }
  412. // that.showEmpty = true;
  413. }
  414. console.warn(res);
  415. })
  416. },
  417. sleep(time) {
  418. return new Promise((resolve) => setTimeout(resolve, time));
  419. },
  420. onShareAppMessage: function(option) {
  421. this.addLog(this.curItem)
  422. this.showSheet = false;
  423. this.sleep(1500);
  424. return;
  425. },
  426. addLog(shareData){
  427. const that = this;
  428. let params= {
  429. bisNo:shareData.bisNo,
  430. bisType:that.isNeed==1?'1':'2',
  431. company: shareData.company,
  432. companyNo: shareData.companyNo,
  433. userNo:uni.getStorageSync('userNo')
  434. };
  435. request.post('/slbForward/add',{slbForward:JSON.stringify(params)},{
  436. headers: {
  437. 'Content-Type': 'application/json', // 默认值
  438. },
  439. }).then(res=>{
  440. })
  441. },
  442. },
  443. onLoad(props) {
  444. this.bisNo = props.id;
  445. this.isNeed = props.isNeed;
  446. this.loadData();
  447. }
  448. }
  449. </script>
  450. <style lang="scss" scoped>
  451. /* 胶囊*/
  452. .tn-custom-nav-bar__back {
  453. width: 60%;
  454. height: 100%;
  455. position: relative;
  456. display: flex;
  457. justify-content: space-evenly;
  458. align-items: center;
  459. box-sizing: border-box;
  460. // background-color: rgba(0, 0, 0, 0.15);
  461. border-radius: 1000rpx;
  462. border: 1rpx solid rgba(255, 255, 255, 0.5);
  463. // color: #FFFFFF;
  464. font-size: 18px;
  465. .icon {
  466. display: block;
  467. flex: 1;
  468. margin: auto;
  469. text-align: center;
  470. }
  471. &:before {
  472. content: " ";
  473. width: 1rpx;
  474. height: 110%;
  475. position: absolute;
  476. top: 22.5%;
  477. left: 0;
  478. right: 0;
  479. margin: auto;
  480. transform: scale(0.5);
  481. transform-origin: 0 0;
  482. pointer-events: none;
  483. box-sizing: border-box;
  484. opacity: 0.7;
  485. background-color: #FFFFFF;
  486. }
  487. }
  488. /* 文章内容 start*/
  489. .blogger {
  490. &__item {
  491. padding: 30rpx;
  492. }
  493. &__author {
  494. &__btn {
  495. margin-right: -12rpx;
  496. opacity: 0.5;
  497. }
  498. }
  499. &__desc {
  500. line-height: 30rpx;
  501. &__label {
  502. color: #1D2541;
  503. background-color: #F3F2F7;
  504. border-radius: 10rpx;
  505. font-size: 22rpx;
  506. padding: 5rpx 15rpx;
  507. margin: 5rpx 18rpx 0 0;
  508. &--prefix {
  509. font-size: 24rpx;
  510. color: #1D2541;
  511. padding-right: 10rpx;
  512. }
  513. }
  514. &__content {
  515. line-height: 50rpx;
  516. }
  517. }
  518. &__content {
  519. margin-top: 18rpx;
  520. padding-right: 18rpx;
  521. &__data {
  522. line-height: 46rpx;
  523. text-align: justify;
  524. overflow: hidden;
  525. transition: all 0.25s ease-in-out;
  526. }
  527. &__status {
  528. margin-top: 10rpx;
  529. font-size: 26rpx;
  530. color: #82B2FF;
  531. }
  532. }
  533. &__main-image {
  534. border: 1rpx solid #F8F7F8;
  535. border-radius: 16rpx;
  536. &--1 {
  537. max-width: 80%;
  538. max-height: 300rpx;
  539. }
  540. &--2 {
  541. max-width: 260rpx;
  542. max-height: 260rpx;
  543. }
  544. &--3 {
  545. height: 212rpx;
  546. width: 100%;
  547. }
  548. }
  549. &__count-icon {
  550. font-size: 40rpx;
  551. padding-right: 5rpx;
  552. }
  553. &__ad {
  554. width: 100%;
  555. height: 500rpx;
  556. transform: translate3d(0px, 0px, 0px) !important;
  557. ::v-deep .uni-swiper-slide-frame {
  558. transform: translate3d(0px, 0px, 0px) !important;
  559. }
  560. .uni-swiper-slide-frame {
  561. transform: translate3d(0px, 0px, 0px) !important;
  562. }
  563. &__item {
  564. position: absolute;
  565. width: 100%;
  566. height: 100%;
  567. transform-origin: left center;
  568. transform: translate3d(100%, 0px, 0px) scale(1) !important;
  569. transition: transform 0.25s ease-in-out;
  570. z-index: 1;
  571. &--0 {
  572. transform: translate3d(0%, 0px, 0px) scale(1) !important;
  573. z-index: 4;
  574. }
  575. &--1 {
  576. transform: translate3d(13%, 0px, 0px) scale(0.9) !important;
  577. z-index: 3;
  578. }
  579. &--2 {
  580. transform: translate3d(26%, 0px, 0px) scale(0.8) !important;
  581. z-index: 2;
  582. }
  583. }
  584. &__content {
  585. border-radius: 40rpx;
  586. width: 640rpx;
  587. height: 500rpx;
  588. overflow: hidden;
  589. }
  590. &__image {
  591. width: 100%;
  592. height: 100%;
  593. }
  594. }
  595. }
  596. .bg-content{
  597. color: #fff;
  598. background-image: url(./../../../static/bg.png);
  599. background-size: cover;
  600. }
  601. </style>