comm.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363
  1. <template>
  2. <view class="circle tn-safe-area-inset-bottom">
  3. <!-- 发现 -->
  4. <view class="" v-if="current==0" >
  5. <uv-sticky bgColor="#ffffff">
  6. <view style="width: 100%;" v-if="currentTab==0">
  7. <view style="display: flex; padding: 10px 12px;">
  8. <view
  9. style="flex:1;background-color: #f8f8f8;border-radius: 18px;color: #bbb;line-height: 35px;"
  10. @click="showSearch">
  11. <view>
  12. <uni-icons type="search" color="#bbbbbb" size="18" style="margin: 8px;"></uni-icons>
  13. <text v-if="!searchProdValue">产品名称/品牌/产品型号</text>
  14. <text v-if="searchProdValue">{{searchProdValue}}</text>
  15. </view>
  16. </view>
  17. <view v-if="searchProdValue" @click="clearProd" style="line-height: 36px;margin-left: 10px;">取消
  18. </view>
  19. </view>
  20. </view>
  21. <view style="width: 100%;" v-if="currentTab==1">
  22. <view style="display: flex; padding: 10px 12px;">
  23. <view
  24. style="flex:1;background-color: #f8f8f8;border-radius: 18px;color: #bbb;line-height: 35px;"
  25. @click="showSearch2">
  26. <view>
  27. <uni-icons type="search" color="#bbbbbb" size="18" style="margin: 8px;"></uni-icons>
  28. <text v-if="!searchProdValue2">品牌/服务内容</text>
  29. <text v-if="searchProdValue2">{{searchProdValue2}}</text>
  30. </view>
  31. </view>
  32. <view v-if="searchProdValue2" @click="clearProd2" style="line-height: 36px;margin-left: 10px;">取消
  33. </view>
  34. </view>
  35. </view>
  36. <!-- <uni-search-bar radius="15" placeholder="搜索" v-if="currentTab==1" @confirm="search"
  37. v-model="searchValue" @blur="search" @cancel="cancel" @clear="clear" cancelButton="auto"
  38. clearButton="auto">
  39. </uni-search-bar> -->
  40. <tn-tabs-swiper :list="tabList" :isScroll="false" :current="currentTab" name="tab-name"
  41. @change="changeTab" style="border-bottom: 1rpx solid #f1f1f1cc;">
  42. </tn-tabs-swiper>
  43. </uv-sticky>
  44. <view class="tn-flex tn-flex-direction-column tn-margin-top-sm ">
  45. <!-- 图文信息 -->
  46. <block v-for="(item,index) in content" :key="item.id">
  47. <view class="blogger__item" :key="index">
  48. <view class="blogger__author tn-flex tn-flex-row-between tn-flex-col-center">
  49. <view class="justify__author__info" @click="tn('')">
  50. <view class="tn-flex tn-flex-row-center">
  51. <view class="tn-flex tn-flex-row-center tn-flex-col-center">
  52. <!-- <view class="">
  53. <tn-avatar
  54. class=""
  55. shape="circle"
  56. :src="item.userAvatar"
  57. size="lg">
  58. </tn-avatar>
  59. </view> -->
  60. <view class="tn-padding-right tn-text-ellipsis">
  61. <view class="tn-padding-right tn-color-grey tn-text-lg">
  62. {{ item.company||(item.contactNickName||item.contactPerson) }}
  63. </view>
  64. <!-- <view class="tn-padding-right tn-padding-left-sm tn-padding-top-xs tn-color-gray">{{ item.date }}</view> -->
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <view v-if="1==0"
  70. class="blogger__author__btn justify-content-item tn-flex-col-center tn-flex-row-center">
  71. <text class="" style="background: #3F51B542;font-size: 12px;
  72. padding: 8px;
  73. color: #0000FF;
  74. border-radius: 24px;
  75. border-top-right-radius: 0;">{{item.validDate}}</text>
  76. </view>
  77. </view>
  78. <view
  79. class="blogger__desc tn-margin-top-sm tn-margin-bottom-sm tn-text-justify tn-flex-col-center tn-flex-row-left"
  80. >
  81. <!-- 不用限制长度了,因为发布的时候限制长度了-->
  82. <tn-tag margin="-4px 4px 0 0" backgroundColor="#3a96d733" v-if="item.brand"
  83. fontColor="#3a96d7" shape="circle">{{ item.brand }}</tn-tag>
  84. <tn-tag margin="-4px 4px 0 0" backgroundColor="#3a96d733" v-if="!item.company"
  85. fontColor="#3a96d7" shape="circle">个人</tn-tag>
  86. <text v-if="item.content"
  87. class="blogger__desc__content tn-flex-1 tn-text-justify tn-text-df">{{ item.content }}</text>
  88. </view>
  89. <!-- 内容太多疲劳了-->
  90. <view v-if="item.shareExt&&item.shareExt.length>0" class="blogger__content"
  91. :id="`blogger__content--${index}`">
  92. <basic-table header-row-class-name="basic-table-header" :columns="columns" :border="true"
  93. :stripe="true" :data="item.shareExt">
  94. <template #item="{column,scope,index}">
  95. <view v-if="column.fieldName==='prodDesc'">
  96. <tn-read-more openText="查看全部" :closeBtn="true" closeText="收起" :showHeight="125">
  97. <text>{{scope.prodDesc||''}}</text>
  98. </tn-read-more>
  99. </view>
  100. </template>
  101. </basic-table>
  102. </view>
  103. <block v-if="item.imgList">
  104. <view v-if="[1,2,4].indexOf(item.imgList.length) != -1" class="tn-padding-top-xs"
  105. >
  106. <image v-for="(image_item,image_index) in item.imgList" :key="image_index"
  107. class="blogger__main-image" :class="{
  108. 'blogger__main-image--1 tn-margin-bottom-sm': item.imgList.length === 1,
  109. 'blogger__main-image--2 tn-margin-right-sm tn-margin-bottom-sm': item.imgList.length === 2 || item.imgList.length === 4
  110. }" :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  111. </view>
  112. <view v-else class="tn-padding-top-xs" @click="tn('')">
  113. <tn-grid hoverClass="none" :col="3">
  114. <block v-for="(image_item,image_index) in item.imgList" :key="image_index">
  115. <!-- #ifndef MP-WEIXIN -->
  116. <tn-grid-item style="width: 30%;margin: 10rpx;">
  117. <image class="blogger__main-image blogger__main-image--3"
  118. :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  119. </tn-grid-item>
  120. <!-- #endif-->
  121. <!-- #ifdef MP-WEIXIN -->
  122. <tn-grid-item style="width: 30%;margin: 10rpx;">
  123. <image class="blogger__main-image blogger__main-image--3"
  124. :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  125. </tn-grid-item>
  126. <!-- #endif-->
  127. </block>
  128. </tn-grid>
  129. </view>
  130. </block>
  131. <view v-for="file in item.fileDetailList" :key="file.id" v-if="!isImage(file.fileName)">
  132. <view style="margin-top:10px">
  133. <text class="tn-icon-link"></text>
  134. <view style="display: inline-block;margin-left:8px; white-space: nowrap;
  135. text-overflow: ellipsis;
  136. width: 80%;" @click="clickLink(file.ftpUrl,file.fileName)">
  137. {{file.fileName}}</view>
  138. </view>
  139. </view>
  140. <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-margin-top-xs">
  141. <view class="justify-content-item tn-color-gray tn-text-center">
  142. <view class="tn-padding-right tn-padding-top-xs tn-color-gray">
  143. {{ item.createTime|formatDate }}
  144. </view>
  145. </view>
  146. <view class="justify-content-item tn-flex tn-flex-col-center" style="position: relative">
  147. <text class="tn-icon-more-vertical tn-color-gray tn-text-bold tn-text-xxl"
  148. @click="showActionSheet(item)"></text>
  149. <view v-if="curItem.id==item.id&&showSheet" style="position: absolute;
  150. background: #ddd;
  151. display: block;
  152. right: 10px;
  153. top: 24px;border-radius: 16px;z-index: 900;border-top-right-radius: 0">
  154. <text class="tn-icon-close" style="float: right;padding:8px;color:#333" @click="hideSheet()"></text>
  155. <view class="content" style="padding: 24px 36px;font-size: 16px;line-height: 24px; width: calc(100vw - 52px); border-radius: 16px;
  156. border-top-right-radius: 0;"
  157. v-if="!showContact">
  158. <button @click="linkTel()" style="border-radius:30px;color:#fff;background-color: #1d60b1;"><text
  159. class="tn-icon-service" style="margin-right: 12px;"></text> 联系供方</button>
  160. <!-- <view>联系我们帮助对接</view> -->
  161. <button v-if="!collStatus" @click="addColl"
  162. style="margin-top:10px;border-radius:30px;" type="default" plain="true"><text
  163. class="tn-icon-star" style="margin-right: 12px;"></text>
  164. 收&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;藏</button>
  165. <button v-if="collStatus" @click="delColl"
  166. style="margin-top:10px;border-radius:30px;" type="default" plain="true"><text
  167. class="tn-icon-star-fill" style="margin-right: 12px;"></text> 取消收藏</button>
  168. <button open-type="share"
  169. style="margin-top:10px;border-radius:30px;" type="default" plain="true" :data-coupon="curItem"><text
  170. class="tn-icon-send" style="margin-right: 12px;"></text>
  171. 转&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;发</button>
  172. </view>
  173. <view class="content bg-content" style="padding: 50px 36px;padding-bottom: 32px;font-size: 16px;width: calc(100vw - 52px);line-height: 24px; border-radius: 16px;border-top-right-radius: 0;"
  174. v-if="showContact">
  175. <view><text style="font-size: 20px;font-weight: bold;" v-if="curContact.company">{{curContact.company}}</text></view>
  176. <view style="margin-top:20px;
  177. font-weight: bold;
  178. font-size: 20px;"><text class="tn-icon-my-formal"></text><text style="margin-left: 6px;">{{curContact.contactPerson}}</text> </view>
  179. <view style="margin-top:20px;font-size: 20px;font-weight: bold;" @click="showTel(curContact.contactMethod)"><text class="tn-icon-tel"></text>
  180. <text style="margin-left: 4px;">{{curContact.contactMethod}}</text> </view>
  181. </view>
  182. </view>
  183. </view>
  184. </view>
  185. </view>
  186. <!-- 边距间隔 -->
  187. <view class="tn-strip-bottom" v-if="index != content.length - 1"></view>
  188. </block>
  189. <!-- 边距间隔 -->
  190. <!-- <view class="tn-strip-bottom"></view> -->
  191. <view v-if="showEmpty&&content.length==0" style="margin-top: 32vh;">
  192. <tn-empty mode="list"></tn-empty>
  193. </view>
  194. <!-- 广告 -->
  195. <!-- 结尾 -->
  196. <view v-if="content.length==totalSize&&totalSize!=0&&currentTab==0" style="background-color: #f1f1f1cc;padding: 16px 0;" :style="{paddingTop:showSheet?'216px':'16px'}">
  197. <tn-load-more status="nomore" :loadText="loadText"></tn-load-more>
  198. </view>
  199. <view v-if="content.length==totalSize&&totalSize!=0&&currentTab==1" style="background-color: #f1f1f1cc;padding: 16px 0;" :style="{paddingTop:showSheet?'216px':'16px'}">
  200. <tn-load-more status="nomore" :loadText="loadText2"></tn-load-more>
  201. </view>
  202. </view>
  203. <view class='tn-tabbar-height' :style="{marginTop: vuex_custom_bar_height + 'px'}"></view>
  204. </view>
  205. <tn-popup v-model="showSheet2" mode="center" closeBtn="true" borderRadius="16">
  206. <view class="content" style="padding: 24px 36px;font-size: 16px;line-height: 24px; width: 320px;"
  207. v-if="!showContact">
  208. <button @click="linkTel()" style="border-radius:30px;color:#fff;background-color: #1d60b1;"><text
  209. class="tn-icon-service" style="margin-right: 12px;"></text> 联系供方</button>
  210. <!-- <view>联系我们帮助对接</view> -->
  211. <button v-if="!collStatus" @click="addColl"
  212. style="margin-top:10px;border-radius:30px;" type="default" plain="true"><text
  213. class="tn-icon-star" style="margin-right: 12px;"></text>
  214. 收&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;藏</button>
  215. <button v-if="collStatus" @click="delColl"
  216. style="margin-top:10px;border-radius:30px;" type="default" plain="true"><text
  217. class="tn-icon-star-fill" style="margin-right: 12px;"></text> 取消收藏</button>
  218. <button open-type="share"
  219. style="margin-top:10px;border-radius:30px;" type="default" plain="true" :data-coupon="curItem"><text
  220. class="tn-icon-send" style="margin-right: 12px;"></text>
  221. 转&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;发</button>
  222. </view>
  223. <view class="content bg-content" style="padding: 50px 36px;padding-bottom: 32px;font-size: 16px;width:320px;line-height: 24px;"
  224. v-if="showContact">
  225. <view><text style="font-size: 20px;font-weight: bold;" v-if="curContact.company">{{curContact.company}}</text></view>
  226. <view style="margin-top:20px;
  227. font-weight: bold;
  228. font-size: 20px;"><text class="tn-icon-my-formal"></text><text style="margin-left: 6px;">{{curContact.contactPerson}}</text> </view>
  229. <view style="margin-top:20px;font-size: 20px;font-weight: bold;" @click="showTel(curContact.contactMethod)"><text class="tn-icon-tel"></text>
  230. <text style="margin-left: 4px;">{{curContact.contactMethod}}</text> </view>
  231. </view>
  232. </tn-popup>
  233. <tn-toast ref="toast"></tn-toast>
  234. </view>
  235. </template>
  236. <script>
  237. import request from '../../utils/request'
  238. export default {
  239. name: 'Circle',
  240. data() {
  241. return {
  242. loading: false,
  243. searchProdValue: '',
  244. searchProdValue2:'',
  245. tabList: [{
  246. 'tab-name': '产品'
  247. }, {
  248. 'tab-name': '服务'
  249. }],
  250. loadText: {
  251. loadmore: '下拉加载',
  252. loading: '快速加载中...',
  253. nomore: '恭喜你,已阅读完所有供应信息哦!'
  254. },
  255. loadText2: {
  256. loadmore: '下拉加载',
  257. loading: '快速加载中...',
  258. nomore: '恭喜你,已阅读完所有供应信息哦!'
  259. },
  260. currentTab: 0,
  261. showEmpty: false,
  262. columns: [{
  263. fieldName: 'prodName',
  264. fieldDesc: '产品名称',
  265. }, {
  266. fieldName: 'prodSpec',
  267. fieldDesc: '规格型号',
  268. }, {
  269. fieldName: 'prodDesc',
  270. fieldDesc: '产品介绍',
  271. fieldType:'slot'
  272. }],
  273. showSheet: false,
  274. curItem: {},
  275. collId: '',
  276. showContact: false,
  277. curContact: {},
  278. current: 0,
  279. collStatus: '',
  280. searchValue: '',
  281. // 内容默认隐藏显示的高度
  282. contentHideShowHeight: 0,
  283. content: [],
  284. totalSize: 0,
  285. curIndex: 1,
  286. }
  287. },
  288. onLoad() {
  289. this.initContentData()
  290. this.contentHideShowHeight = uni.upx2px(56) * 3
  291. },
  292. onReady() {
  293. this.$nextTick(() => {
  294. this.fetchData()
  295. })
  296. },
  297. onShow() {
  298. this.fetchData()
  299. },
  300. onHide() {
  301. this.adAutoplay = false
  302. },
  303. filters: {
  304. formatDate(value) {
  305. if (!value) return '';
  306. const date = new Date(value);
  307. const today = new Date();
  308. const yesterday = new Date(today); // 昨天的日期
  309. yesterday.setDate(yesterday.getDate() - 1); // 将昨天的日期设置为前一天
  310. if (date.getFullYear() == today.getFullYear() && date.getMonth() == today.getMonth() && date.getDate() ==
  311. today.getDate()) {
  312. return '今天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  313. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  314. }
  315. if (date.getFullYear() == yesterday.getFullYear() && date.getMonth() == yesterday.getMonth() && date
  316. .getDate() == yesterday.getDate()) {
  317. return '昨天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  318. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  319. }
  320. return date.toLocaleDateString() + ' ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  321. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  322. },
  323. },
  324. methods: {
  325. showSearch(item) {
  326. // 或者可以直接设置body的tabindex属性为-1,然后移除焦点
  327. // 注意:这种方式可能会导致一些浏览器的兼容性问题
  328. uni.navigateTo({
  329. url: '/pages/comm/search'
  330. })
  331. },
  332. showDetail(item){
  333. uni.navigateTo({
  334. url: '/pages/index/detail/detail?id='+item.bisNo+'&isNeed=0'
  335. })
  336. },
  337. showSearch2(item) {
  338. // 或者可以直接设置body的tabindex属性为-1,然后移除焦点
  339. // 注意:这种方式可能会导致一些浏览器的兼容性问题
  340. uni.navigateTo({
  341. url: '/pages/comm/search2'
  342. })
  343. },
  344. isImage(fileName) {
  345. const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'ico']
  346. const extension = fileName.split('.').pop().toLowerCase();
  347. return imageExtensions.includes(extension);
  348. },
  349. addButton() {
  350. if (!uni.getStorageSync('userNo')) {
  351. uni.showToast({
  352. title: '请登录',
  353. icon:'none'
  354. })
  355. uni.navigateTo({
  356. url: '/pages/login/login'
  357. })
  358. return false;
  359. } else {
  360. uni.navigateTo({
  361. url: '/circlePages/addShare'
  362. })
  363. }
  364. },
  365. showImg(items, index) {
  366. let urls = [];
  367. for (let i = 0; i < items.length; i++) {
  368. urls.push(items[i].ftpUrl);
  369. }
  370. // wx.chooseMessageFile({
  371. // count: 3, //默认100
  372. // type:'file',
  373. // extension:['.pdf','.doc'],
  374. // success: function (res) {
  375. // console.error(JSON.stringify(res));
  376. // }
  377. // });
  378. // 预览图片
  379. uni.previewImage({
  380. urls: urls,
  381. current: index,
  382. });
  383. },
  384. clickLink(url,fileName) {
  385. // uni.navigateTo({
  386. // url:'/pages/webview/web-view?url='+encodeURIComponent('https://slb-m.lx-device.com/webview?title='+fileName+'&url='+ url),
  387. // })
  388. uni.downloadFile({
  389. url: url,
  390. filePath: wx.env.USER_DATA_PATH + "/" + fileName,
  391. success: function (res) {
  392. const filePath = res.filePath
  393. uni.openDocument({
  394. filePath: filePath,
  395. showMenu: true,
  396. success: function (res) {
  397. console.log('打开文档成功')
  398. },
  399. fail: function(){
  400. uni.navigateTo({
  401. url:'/pages/webview/web-view?url='+encodeURIComponent('https://slb-m.lx-device.com/webview?title='+fileName+'&url='+ url),
  402. })
  403. }
  404. })
  405. }
  406. })
  407. // uni.navigateTo({
  408. // url: '/pages/webview/web-view?url=' + url,
  409. // })
  410. },
  411. // tab选项卡切换
  412. tabChange(index) {
  413. this.current = index
  414. },
  415. // 跳转
  416. tn(e) {
  417. uni.navigateTo({
  418. url: e,
  419. });
  420. },
  421. // 震动跳转
  422. navEdit(e) {
  423. wx.vibrateLong();
  424. uni.navigateTo({
  425. url: '/circlePages/edit'
  426. })
  427. },
  428. // 震动跳转
  429. navCreate(e) {
  430. wx.vibrateLong();
  431. uni.navigateTo({
  432. url: '/circlePages/create'
  433. })
  434. },
  435. // 震动跳转
  436. navBuild(e) {
  437. wx.vibrateLong();
  438. uni.navigateTo({
  439. url: '/circlePages/build'
  440. })
  441. },
  442. // 处理内容,给内容添加对应的标识信息
  443. initContentData() {
  444. this.content.forEach((item, index) => {
  445. // 是否需要隐藏内容
  446. item.hideContent = false
  447. // 显示所有内容
  448. item.showAllContent = false
  449. // 内容容器的实际高度
  450. item.contentContainerHeight = 0
  451. // 内容容器是否初始化完成
  452. item.contentContainerInit = false
  453. this.$set(this.content, index, item)
  454. })
  455. },
  456. reFetchData() {
  457. this.loading = true;
  458. uni.showToast({
  459. title: '正在刷新...',
  460. icon: 'none'
  461. });
  462. this.fetchData();
  463. },
  464. hideSheet(){
  465. this.curItem = {};
  466. this.showSheet = false;
  467. },
  468. loadMore() {
  469. if (this.totalSize > this.content.length) {
  470. this.fetchData(this.curIndex + 1);
  471. }
  472. console.error('正在加载更多');
  473. },
  474. changeTab(index) {
  475. this.currentTab = index;
  476. this.content = [];
  477. this.fetchData();
  478. },
  479. // 获取内容容器的信息
  480. fetchData(curIndex = 1) {
  481. let that = this;
  482. that.showEmpty = false;
  483. this.curIndex = curIndex;
  484. if (uni.getStorageSync('searchProdValue')) {
  485. that.searchProdValue = uni.getStorageSync('searchProdValue');
  486. }
  487. if (uni.getStorageSync('searchProdValue2')) {
  488. that.searchProdValue2 = uni.getStorageSync('searchProdValue2');
  489. }
  490. request.post('/slbResourceShare/query', {
  491. type: that.currentTab == 1 ? '2' : '1',
  492. index: curIndex,
  493. content: that.currentTab == 1 ? (that.searchProdValue2 ? that.searchProdValue2.split('/')[1]:'') : undefined,
  494. prodSpec: that.currentTab == 0 ? (that.searchProdValue ? that.searchProdValue.split('/')[2] :
  495. '') : undefined,
  496. prodName: that.currentTab == 0 ? (that.searchProdValue ? that.searchProdValue.split('/')[0] :
  497. '') : undefined,
  498. brand: that.currentTab == 0 ? (that.searchProdValue ? that.searchProdValue.split('/')[1] :
  499. '') : that.currentTab == 1 ?(that.searchProdValue2 ? that.searchProdValue2.split('/')[0]:''): undefined,
  500. }).then(res => {
  501. that.loading = false;
  502. if (res && res.success) {
  503. that.totalSize = res.total || 0;
  504. let newList = res.list || [];
  505. for (let i = 0; i < newList.length; i++) {
  506. newList[i].imgList = [];
  507. for (let j = 0; j < newList[i].fileDetailList.length; j++) {
  508. if (that.isImage(newList[i].fileDetailList[j].fileName)) {
  509. newList[i].imgList.push(newList[i].fileDetailList[j]);
  510. }
  511. }
  512. }
  513. if (curIndex == 1) {
  514. that.content = newList || [];
  515. } else {
  516. that.content = that.content.concat(newList || []);
  517. }
  518. }
  519. that.showEmpty = true;
  520. console.warn(res);
  521. })
  522. // let contentRect = {}
  523. // const query = uni.createSelectorQuery().in(this)
  524. // // 筛选出存在内容的数据
  525. // this.content.forEach((item, index) => {
  526. // if (item?.content) {
  527. // query.select(`#blogger__content--${index}`).boundingClientRect()
  528. // contentRect[index] = item
  529. // }
  530. // })
  531. // // 获取所有内容的宽高信息
  532. // query.exec(res => {
  533. // if (!res) {
  534. // setTimeout(() => {
  535. // this.fetchData()
  536. // }, 10)
  537. // return
  538. // }
  539. // // console.log(res);
  540. // res.map((item) => {
  541. // // console.log(item.height, this.contentHideShowHeight);
  542. // // 获取对应的标号
  543. // const id = item.id
  544. // const idIndex = /blogger__content--(\d)/.exec(id)[1]
  545. // let contentItem = this.content[idIndex]
  546. // contentItem.hideContent = item.height > this.contentHideShowHeight
  547. // contentItem.showAllContent = false
  548. // contentItem.contentContainerHeight = item.height
  549. // contentItem.contentContainerInit = true
  550. // this.$set(this.content, idIndex, contentItem)
  551. // // console.log(/blogger__content--(\d)/.exec(id)[1]);
  552. // })
  553. // })
  554. },
  555. showActionSheet(item) {
  556. let that = this;
  557. if(!this.curItem.id){
  558. this.curItem = item;
  559. }else{
  560. this.curItem = {}
  561. this.showSheet = false;
  562. return false;
  563. }
  564. this.collStatus = false;
  565. this.showSheet = true;
  566. that.showContact = false;
  567. if (uni.getStorageSync('userNo')) {
  568. let params = {};
  569. params = {
  570. fkBisNo: that.curItem.bisNo,
  571. userNo: uni.getStorageSync('userNo'),
  572. };
  573. request.post('/slbCollect/query', params).then(res => {
  574. if (res.success) {
  575. if (res.list && res.list.length > 0) {
  576. that.collStatus = true;
  577. that.collId = res.list[0].id;
  578. }
  579. }
  580. })
  581. }
  582. },
  583. linkTel() {
  584. if (!uni.getStorageSync('userNo')) {
  585. uni.showToast({
  586. title: '请登录',
  587. icon:'none'
  588. })
  589. uni.navigateTo({
  590. url: '/pages/login/login'
  591. })
  592. return false;
  593. }
  594. let that = this;
  595. let params = {};
  596. params.slbBisContact = JSON.stringify({
  597. fkBisNo: that.curItem.bisNo,
  598. bisType: '2',
  599. type: '1',
  600. company: that.curItem.company,
  601. companyNo: that.curItem.companyNo,
  602. userNo: uni.getStorageSync('userNo'),
  603. });
  604. request.post('/slbBisContact/add', params).then(res => {
  605. if (res.success) {
  606. that.showContact = true;
  607. that.curContact.company = that.curItem.company;
  608. that.curContact.contactMethod = res.resultMap.contactMethod;
  609. that.curContact.contactPerson = res.resultMap.contactPerson;
  610. } else {
  611. that.showContact = false;
  612. uni.showToast({
  613. title: res.msg,
  614. icon: 'none'
  615. })
  616. }
  617. })
  618. },
  619. addColl() {
  620. if (!uni.getStorageSync('userNo')) {
  621. uni.showToast({
  622. title: '请登录',
  623. icon:'none'
  624. })
  625. uni.navigateTo({
  626. url: '/pages/login/login'
  627. })
  628. return false;
  629. }
  630. let that = this;
  631. let params = {};
  632. params.slbCollect = JSON.stringify({
  633. fkBisNo: that.curItem.bisNo,
  634. bisType: '2',
  635. userNo: uni.getStorageSync('userNo'),
  636. });
  637. request.post('/slbCollect/add', params).then(res => {
  638. if (res.success) {
  639. that.showSheet = false;
  640. that.curItem = {};
  641. uni.showToast({
  642. title: '信息已收藏,请在我的收藏里查看阅读',
  643. icon: 'none',
  644. duration: 2000
  645. })
  646. } else {
  647. uni.showToast({
  648. title: res.msg,
  649. icon:'none'
  650. })
  651. }
  652. })
  653. },
  654. delColl() {
  655. let that = this;
  656. request.post('/slbCollect/del', {
  657. id: that.collId
  658. }).then(res => {
  659. if (res.success) {
  660. that.showSheet = false;
  661. that.curItem = {};
  662. uni.showToast({
  663. title: '此供应信息将不会保存在我的收藏里',
  664. icon: 'none',
  665. duration: 2000
  666. })
  667. } else {
  668. uni.showToast({
  669. title: res.msg,
  670. icon:'none'
  671. })
  672. }
  673. })
  674. },
  675. search() {
  676. this.fetchData();
  677. },
  678. searchProd() {
  679. this.searchProdValue = '';
  680. this.fetchData();
  681. },
  682. cancel() {
  683. this.searchValue = '';
  684. this.fetchData();
  685. },
  686. clear() {
  687. this.searchValue = '';
  688. this.fetchData();
  689. },
  690. clearProd() {
  691. this.searchProdValue = '';
  692. uni.removeStorageSync('searchProdValue');
  693. this.fetchData();
  694. },
  695. clearProd2() {
  696. this.searchProdValue2 = '';
  697. uni.removeStorageSync('searchProdValue2');
  698. this.fetchData();
  699. },
  700. showTel(tel){
  701. uni.makePhoneCall({
  702. phoneNumber: tel,
  703. });
  704. },
  705. }
  706. }
  707. </script>
  708. <style lang="scss" scoped>
  709. .circle {
  710. max-height: 100vh;
  711. }
  712. /* 底部安全边距 start*/
  713. .tn-tabbar-height {
  714. min-height: 120rpx;
  715. height: calc(140rpx + env(safe-area-inset-bottom) / 2);
  716. height: calc(140rpx + constant(safe-area-inset-bottom));
  717. }
  718. /* 自定义导航栏内容 start */
  719. .custom-nav {
  720. height: 100%;
  721. &__back {
  722. margin: auto 5rpx;
  723. font-size: 40rpx;
  724. margin-right: 10rpx;
  725. margin-left: 30rpx;
  726. flex-basis: 5%;
  727. }
  728. &__search {
  729. flex-basis: 60%;
  730. width: 100%;
  731. height: 100%;
  732. &__box {
  733. width: 100%;
  734. height: 70%;
  735. padding: 10rpx 0;
  736. margin: 0 30rpx;
  737. border-radius: 60rpx 60rpx 0 60rpx;
  738. font-size: 24rpx;
  739. }
  740. &__icon {
  741. padding-right: 10rpx;
  742. margin-left: 20rpx;
  743. font-size: 30rpx;
  744. }
  745. &__text {
  746. color: #AAAAAA;
  747. }
  748. }
  749. }
  750. .logo-image {
  751. width: 60rpx;
  752. height: 60rpx;
  753. position: relative;
  754. margin-top: -15rpx;
  755. }
  756. .logo-pic {
  757. background-size: cover;
  758. background-repeat: no-repeat;
  759. // background-attachment:fixed;
  760. background-position: top;
  761. border-radius: 50%;
  762. }
  763. /* 自定义导航栏内容 end */
  764. /* 博主头像 start*/
  765. .image-circle {
  766. // padding: 95rpx;
  767. width: 190rpx;
  768. height: 190rpx;
  769. font-size: 40rpx;
  770. font-weight: 300;
  771. position: relative;
  772. }
  773. .image-pic {
  774. border: 1rpx solid #F8F7F8;
  775. background-size: cover;
  776. background-repeat: no-repeat;
  777. // background-attachment:fixed;
  778. background-position: top;
  779. border-radius: 10rpx;
  780. }
  781. .tn-color-cat {
  782. color: #1D2541;
  783. }
  784. .tn-bg-cat {
  785. background-color: #1D2541;
  786. }
  787. /* 文章内容 start*/
  788. .blogger {
  789. &__item {
  790. padding: 30rpx;
  791. }
  792. &__author {
  793. &__btn {
  794. margin-right: -12rpx;
  795. opacity: 0.5;
  796. }
  797. }
  798. &__desc {
  799. line-height: 30rpx;
  800. &__label {
  801. color: #1D2541;
  802. background-color: #F3F2F7;
  803. border-radius: 10rpx;
  804. font-size: 22rpx;
  805. padding: 5rpx 15rpx;
  806. margin: 5rpx 18rpx 0 0;
  807. &--prefix {
  808. font-size: 24rpx;
  809. color: #1D2541;
  810. padding-right: 10rpx;
  811. }
  812. }
  813. &__content {
  814. line-height: 50rpx;
  815. }
  816. }
  817. &__content {
  818. margin-top: 18rpx;
  819. padding-right: 18rpx;
  820. &__data {
  821. line-height: 46rpx;
  822. text-align: justify;
  823. overflow: hidden;
  824. transition: all 0.25s ease-in-out;
  825. }
  826. &__status {
  827. margin-top: 10rpx;
  828. font-size: 26rpx;
  829. color: #82B2FF;
  830. }
  831. }
  832. &__main-image {
  833. border: 1rpx solid #F8F7F8;
  834. border-radius: 16rpx;
  835. &--1 {
  836. max-width: 80%;
  837. max-height: 300rpx;
  838. }
  839. &--2 {
  840. max-width: 260rpx;
  841. max-height: 260rpx;
  842. }
  843. &--3 {
  844. height: 212rpx;
  845. width: 100%;
  846. }
  847. }
  848. &__count-icon {
  849. font-size: 40rpx;
  850. padding-right: 5rpx;
  851. }
  852. &__ad {
  853. width: 100%;
  854. height: 500rpx;
  855. transform: translate3d(0px, 0px, 0px) !important;
  856. ::v-deep .uni-swiper-slide-frame {
  857. transform: translate3d(0px, 0px, 0px) !important;
  858. }
  859. .uni-swiper-slide-frame {
  860. transform: translate3d(0px, 0px, 0px) !important;
  861. }
  862. &__item {
  863. position: absolute;
  864. width: 100%;
  865. height: 100%;
  866. transform-origin: left center;
  867. transform: translate3d(100%, 0px, 0px) scale(1) !important;
  868. transition: transform 0.25s ease-in-out;
  869. z-index: 1;
  870. &--0 {
  871. transform: translate3d(0%, 0px, 0px) scale(1) !important;
  872. z-index: 4;
  873. }
  874. &--1 {
  875. transform: translate3d(13%, 0px, 0px) scale(0.9) !important;
  876. z-index: 3;
  877. }
  878. &--2 {
  879. transform: translate3d(26%, 0px, 0px) scale(0.8) !important;
  880. z-index: 2;
  881. }
  882. }
  883. &__content {
  884. border-radius: 40rpx;
  885. width: 640rpx;
  886. height: 500rpx;
  887. overflow: hidden;
  888. }
  889. &__image {
  890. width: 100%;
  891. height: 100%;
  892. }
  893. }
  894. }
  895. /* 文章内容 end*/
  896. /* 间隔线 start*/
  897. .tn-strip-bottom {
  898. width: 100%;
  899. border-bottom: 20rpx solid rgba(241, 241, 241, 0.8);
  900. }
  901. /* 间隔线 end*/
  902. /* 广告内容 start */
  903. .ad-image {
  904. width: 80rpx;
  905. height: 80rpx;
  906. position: relative;
  907. }
  908. .ad-pic {
  909. background-size: cover;
  910. background-repeat: no-repeat;
  911. // background-attachment:fixed;
  912. background-position: top;
  913. border-radius: 20%;
  914. }
  915. /* 自定义导航栏内容 end */
  916. /* 全屏轮播 start*/
  917. .card-swiper {
  918. height: 100vh !important;
  919. }
  920. .card-swiper swiper-item {
  921. width: 750rpx !important;
  922. left: 0rpx;
  923. box-sizing: border-box;
  924. overflow: initial;
  925. }
  926. .card-swiper swiper-item .swiper-item {
  927. width: 100%;
  928. display: block;
  929. height: 100vh;
  930. border-radius: 0rpx;
  931. transform: scale(1);
  932. transition: all 0.2s ease-in 0s;
  933. overflow: hidden;
  934. }
  935. .card-swiper swiper-item.cur .swiper-item {
  936. transform: none;
  937. transition: all 0.2s ease-in 0s;
  938. }
  939. .card-swiper swiper-item .swiper-item-png {
  940. margin-top: -50vh;
  941. width: 100%;
  942. display: block;
  943. border-radius: 0rpx;
  944. transform: translate(1040rpx, 20rpx) scale(0.5, 0.5);
  945. transition: all 0.6s ease 0s;
  946. // overflow: hidden;
  947. }
  948. .card-swiper swiper-item.cur .swiper-item-png {
  949. margin-top: -100vh;
  950. width: 900rpx;
  951. transform: translate(-80rpx, 0rpx) scale(1, 1);
  952. transition: all 0.6s ease 0s;
  953. }
  954. .image-banner {
  955. display: flex;
  956. align-items: center;
  957. justify-content: center;
  958. }
  959. .image-banner image {
  960. width: 100%;
  961. }
  962. /* 轮播指示点 start*/
  963. .indication {
  964. z-index: 9999;
  965. width: 100%;
  966. height: 36rpx;
  967. position: fixed;
  968. // display:flex;
  969. display: block;
  970. flex-direction: row;
  971. align-items: center;
  972. justify-content: center;
  973. }
  974. .spot {
  975. background-color: #000;
  976. opacity: 0.3;
  977. width: 10rpx;
  978. height: 10rpx;
  979. border-radius: 20rpx;
  980. margin: 20rpx 0 !important;
  981. left: 95vw;
  982. top: -60vh;
  983. position: relative;
  984. }
  985. .spot.active {
  986. opacity: 0.6;
  987. height: 30rpx;
  988. background-color: #000;
  989. }
  990. /* 资讯主图 start*/
  991. .image-article {
  992. border-radius: 8rpx;
  993. border: 1rpx solid #F8F7F8;
  994. width: 200rpx;
  995. height: 200rpx;
  996. position: relative;
  997. }
  998. .image-pic {
  999. background-size: cover;
  1000. background-repeat: no-repeat;
  1001. // background-attachment:fixed;
  1002. background-position: top;
  1003. border-radius: 10rpx;
  1004. }
  1005. .article-shadow {
  1006. border-radius: 15rpx;
  1007. box-shadow: 0rpx 0rpx 50rpx 0rpx rgba(0, 0, 0, 0.07);
  1008. }
  1009. /* 文字截取*/
  1010. .clamp-text-1 {
  1011. -webkit-line-clamp: 1;
  1012. display: -webkit-box;
  1013. -webkit-box-orient: vertical;
  1014. text-overflow: ellipsis;
  1015. overflow: hidden;
  1016. }
  1017. .clamp-text-2 {
  1018. -webkit-line-clamp: 2;
  1019. display: -webkit-box;
  1020. -webkit-box-orient: vertical;
  1021. text-overflow: ellipsis;
  1022. overflow: hidden;
  1023. }
  1024. /* 标签内容 start*/
  1025. .tn-tag-content {
  1026. &__item {
  1027. display: inline-block;
  1028. line-height: 35rpx;
  1029. color: #1D2541;
  1030. background-color: #F3F2F7;
  1031. border-radius: 10rpx;
  1032. font-size: 22rpx;
  1033. padding: 5rpx 15rpx;
  1034. &--prefix {
  1035. padding-right: 10rpx;
  1036. }
  1037. }
  1038. }
  1039. /* 图标容器9 start */
  1040. .icon9 {
  1041. &__item {
  1042. width: 30%;
  1043. background-color: #FFFFFF;
  1044. border-radius: 10rpx;
  1045. padding: 30rpx;
  1046. margin: 20rpx 10rpx;
  1047. transform: scale(1);
  1048. transition: transform 0.3s linear;
  1049. transform-origin: center center;
  1050. &--icon {
  1051. width: 110rpx;
  1052. height: 110rpx;
  1053. font-size: 65rpx;
  1054. border-radius: 50%;
  1055. margin: 20rpx 40rpx;
  1056. position: relative;
  1057. z-index: 1;
  1058. &::after {
  1059. content: " ";
  1060. position: absolute;
  1061. z-index: -1;
  1062. width: 100%;
  1063. height: 100%;
  1064. left: 0;
  1065. bottom: 0;
  1066. border-radius: inherit;
  1067. opacity: 1;
  1068. transform: scale(1, 1);
  1069. background-size: 100% 100%;
  1070. background-image: url(https://resource.tuniaokj.com/images/cool_bg_image/icon_bg5.png);
  1071. }
  1072. }
  1073. }
  1074. }
  1075. /* 悬浮 */
  1076. .tnxuanfu {
  1077. animation: suspension 3s ease-in-out infinite;
  1078. }
  1079. @keyframes suspension {
  1080. 0%,
  1081. 100% {
  1082. transform: translateY(0);
  1083. }
  1084. 50% {
  1085. transform: translateY(-0.8rem);
  1086. }
  1087. }
  1088. /* 悬浮按钮 */
  1089. .button-shop {
  1090. width: 90rpx;
  1091. height: 90rpx;
  1092. display: flex;
  1093. flex-direction: row;
  1094. position: fixed;
  1095. /* bottom:200rpx;
  1096. right: 20rpx; */
  1097. left: 5rpx;
  1098. top: 5rpx;
  1099. z-index: 1001;
  1100. border-radius: 100px;
  1101. opacity: 0.9;
  1102. }
  1103. /* 按钮 */
  1104. .edit {
  1105. bottom: 300rpx;
  1106. right: 75rpx;
  1107. position: fixed;
  1108. z-index: 9999;
  1109. }
  1110. .pa,
  1111. .pa0 {
  1112. position: absolute
  1113. }
  1114. .pa0 {
  1115. left: 0;
  1116. top: 0
  1117. }
  1118. .bg0 {
  1119. width: 100rpx;
  1120. height: 100rpx;
  1121. top: 50%;
  1122. left: 50%;
  1123. transform: translate(-50%, -50%);
  1124. }
  1125. .bg1 {
  1126. width: 100%;
  1127. height: 100%;
  1128. }
  1129. .hx-box {
  1130. top: 50%;
  1131. left: 50%;
  1132. width: 100rpx;
  1133. height: 100rpx;
  1134. transform-style: preserve-3d;
  1135. transform: translate(-50%, -50%) rotateY(75deg) rotateZ(10deg);
  1136. }
  1137. .hx-box .pr {
  1138. width: 100rpx;
  1139. height: 100rpx;
  1140. transform-style: preserve-3d;
  1141. animation: hxz 20s linear infinite;
  1142. }
  1143. @keyframes hxz {
  1144. 0% {
  1145. transform: rotateX(0deg);
  1146. }
  1147. 100% {
  1148. transform: rotateX(-360deg);
  1149. }
  1150. }
  1151. .hx-box .pr .pa0 {
  1152. width: 100rpx;
  1153. height: 100rpx;
  1154. /* border: 4px solid #5ec0ff; */
  1155. border-radius: 1000px;
  1156. }
  1157. .hx-box .pr .pa0 .span {
  1158. display: block;
  1159. width: 100%;
  1160. height: 100%;
  1161. background: url(https://resource.tuniaokj.com/images/cool_bg_image/arc4.png) no-repeat center center;
  1162. background-size: 100% 100%;
  1163. animation: hx 4s linear infinite;
  1164. }
  1165. @keyframes hx {
  1166. to {
  1167. transform: rotate(360deg);
  1168. }
  1169. }
  1170. .hx-k1 {
  1171. transform: rotateX(-60deg) rotateZ(-60deg)
  1172. }
  1173. .hx-k2 {
  1174. transform: rotateX(-30deg) rotateZ(-30deg)
  1175. }
  1176. .hx-k3 {
  1177. transform: rotateX(0deg) rotateZ(0deg)
  1178. }
  1179. .hx-k4 {
  1180. transform: rotateX(30deg) rotateZ(30deg)
  1181. }
  1182. .hx-k5 {
  1183. transform: rotateX(60deg) rotateZ(60deg)
  1184. }
  1185. .hx-k6 {
  1186. transform: rotateX(90deg) rotateZ(90deg)
  1187. }
  1188. /deep/ .basic-table-header {
  1189. background-color: #edeeee;
  1190. }
  1191. .bg-content{
  1192. color: #fff;
  1193. background-image: url(./../../static/bg.png);
  1194. background-size: cover;
  1195. }
  1196. </style>