comm.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966
  1. <template>
  2. <view class="circle tn-safe-area-inset-bottom" style="background: #f7f7f7;min-height: 100vh;">
  3. <tn-nav-bar customBack>
  4. <view slot="back" class='tn-custom-nav-bar__back'>
  5. <image style="width: 28px;height: 28px;margin-left:4px" @click="reFetchData()" src="../../static/tu/reload.png"></image>
  6. <image style="width: 28px;height: 28px;margin-left:12px" @click="addButton()" src="../../static/tu/add.png"></image>
  7. </view>
  8. <view slot="default" style="display: flex;">
  9. <view style="flex:1;">
  10. <text :style="{fontSize:(wxFontSize)+'px'}">我有什么</text>
  11. </view>
  12. </view>
  13. </tn-nav-bar>
  14. <scroll-view class="custom-tabbar-page" style="height: 100vh;" :style="{paddingTop: vuex_custom_bar_height + 'px'}" scroll-y :refresher-enabled="true" :refresher-triggered="triggered" lower-threshold="60" @refresherrestore="onRestore" @refresherrefresh="onRefresh" @refresherpulling="onPulling" enable-back-to-top @scrolltolower="tabbarPageScrollLower">
  15. <!-- 发现 -->
  16. <view class="" v-if="current==0" >
  17. <uv-sticky bgColor="#f7f7f7">
  18. <view style="width: 100%;" v-if="currentTab==0">
  19. <view style="display: flex; padding: 16px;">
  20. <view
  21. style="flex:1;background-color: #fff;border-radius: 15px;color: #999;line-height: 36px;"
  22. @click="showSearch">
  23. <view>
  24. <image src="../../static/tu/search.png" style="width: 26px;height: 26px;vertical-align: middle; margin-left:8px; margin-right: 12px;margin-top: -2px;"></image>
  25. <text :style="{fontSize:(wxFontSize-2)+'px'}" v-if="!searchProdValue">设备名称/设备型号/制造厂家</text>
  26. <text :style="{fontSize:(wxFontSize-2)+'px'}" v-if="searchProdValue">{{searchProdValue}}</text>
  27. </view>
  28. </view>
  29. <view v-if="searchProdValue" @click="clearProd" style="line-height: 36px;margin-left: 10px;color: #333;" :style="{fontSize:(wxFontSize-2)+'px'}">取消
  30. </view>
  31. </view>
  32. </view>
  33. <view style="width: 100%;" v-if="currentTab==1">
  34. <view style="display: flex; padding: 16px;">
  35. <view
  36. style="flex:1;background-color: #fff;border-radius: 15px;color: #999;line-height: 36px;"
  37. @click="showSearch2">
  38. <view>
  39. <image src="../../static/tu/search.png" style="width: 26px;height: 26px;vertical-align: middle; margin-left:8px;margin-right: 12px;margin-top: -2px;"></image>
  40. <text v-if="!searchProdValue2" :style="{fontSize:(wxFontSize-2)+'px'}">品牌/服务内容</text>
  41. <text v-if="searchProdValue2" :style="{fontSize:(wxFontSize-2)+'px'}">{{searchProdValue2}}</text>
  42. </view>
  43. </view>
  44. <view v-if="searchProdValue2" @click="clearProd2" style="line-height: 36px;margin-left: 10px;color: #333;" :style="{fontSize:(wxFontSize-2)+'px'}">取消
  45. </view>
  46. </view>
  47. </view>
  48. <!-- <tn-tabs-swiper :list="tabList" :isScroll="false" :fontSize="(wxFontSize+12)" :barWidth="wxFontSize+50" :current="currentTab" name="tab-name" activeColor="#005DA6" inactiveColor="#333"
  49. @change="changeTab">
  50. </tn-tabs-swiper> -->
  51. </uv-sticky>
  52. <view class="tn-flex tn-flex-direction-column tn-margin-top-sm ">
  53. <!-- 图文信息 -->
  54. <block v-for="(item,index) in content" :key="item.id">
  55. <view class="blogger__item" style="border-radius: 12px;margin: 0px 16px 12px 16px; background-color: #fff;" :key="index">
  56. <view class="blogger__author tn-flex tn-flex-row-between tn-flex-col-center">
  57. <view class="justify__author__info">
  58. <view class="tn-flex tn-flex-row-center">
  59. <view class="tn-flex tn-flex-row-center tn-flex-col-center">
  60. <view class="" style="width: 5px;height: 5px;background: #E18730;border-radius: 50%;margin-right: 4px;">
  61. </view>
  62. <view class="tn-padding-right">
  63. <view class="tn-text-lg" style="color:#333;font-weight: 600;" :style="{fontSize:(wxFontSize)+'px'}">
  64. {{ item.company||(item.contactNickName||item.contactPerson) }}
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <view
  72. class="blogger__desc tn-margin-top-sm tn-margin-bottom-sm tn-text-justify tn-flex-col-center tn-flex-row-left"
  73. >
  74. <tn-tag margin="-4px 4px 0 0" backgroundColor="#005da61a" v-if="item.brand"
  75. fontColor="#005DA6" shape="circle" :fontSize="wxFontSize+8" @click="showBrand('品牌:'+item.brand)">{{ item.brand }}</tn-tag>
  76. <tn-tag margin="-4px 4px 0 0" backgroundColor="#005da61a" v-if="!item.company"
  77. fontColor="#005DA6" shape="circle" :fontSize="wxFontSize+8" @click="showBrand('个人发布')">个人</tn-tag>
  78. </view>
  79. <view style="border-radius: 0px 0px 0px 0px;width:calc(100% + 32px);margin-left:-16px;border-bottom: 1px solid #E6E6E6;"></view>
  80. <view v-if="item.content" style="padding: 12px 12px 5px 5px;">
  81. <text
  82. class="blogger__desc__content tn-flex-1 tn-text-justify tn-text-df" style="color:#747E87" :style="{fontSize:(wxFontSize-2)+'px'}">{{ item.content }}</text>
  83. </view>
  84. <!-- 内容太多疲劳了-->
  85. <view v-if="item.shareExt&&item.shareExt.length>0" :id="`blogger__content--${index}`" @click="showDetail(item)">
  86. <view v-for="(sitem,index) in item.shareExt" :key="sitem.id">
  87. <view style="padding: 12px 0 8px 5px;color:#005DA6;" :style="{fontSize:(wxFontSize-3)+'px'}">
  88. {{sitem.deviceName}}
  89. </view>
  90. <view style="padding: 0px 8px 0 5px;color:#333;display: flex;" :style="{fontSize:(wxFontSize-3)+'px'}">
  91. <text style="color: #777;white-space: nowrap;">设备型号:</text>{{sitem.deviceModel}}
  92. </view>
  93. <view style="padding: 8px 8px 0 5px;color:#333;display: flex;" :style="{fontSize:(wxFontSize-3)+'px'}">
  94. <text style="color: #777;white-space: nowrap;">设备编号:</text><text>{{sitem.deviceId}}</text>
  95. </view>
  96. <view style="padding: 8px 8px 0 5px;color:#333;display: flex;" v-if="sitem.manufacturer" :style="{fontSize:(wxFontSize-3)+'px'}">
  97. <text style="color: #777;white-space: nowrap;">制造厂家:</text><text>{{sitem.manufacturer}}</text>
  98. </view>
  99. </view>
  100. </view>
  101. <block v-if="item.imgList&&item.imgList.length>0">
  102. <view v-if="[1,2,4].indexOf(item.imgList.length) != -1" class="tn-padding-top-xs">
  103. <image v-for="(image_item,image_index) in item.imgList" :key="image_index"
  104. class="blogger__main-image" :class="{
  105. 'blogger__main-image--1 tn-margin-bottom-sm': item.imgList.length === 1,
  106. 'blogger__main-image--2 tn-margin-right-sm tn-margin-bottom-sm': item.imgList.length === 2 || item.imgList.length === 4
  107. }" :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  108. </view>
  109. <view v-else class="tn-padding-top-xs" @click="tn('')">
  110. <tn-grid hoverClass="none" :col="3">
  111. <block v-for="(image_item,image_index) in item.imgList" :key="image_index">
  112. <!-- #ifndef MP-WEIXIN -->
  113. <tn-grid-item style="width: 30%;margin: 10rpx;">
  114. <image class="blogger__main-image blogger__main-image--3"
  115. :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  116. </tn-grid-item>
  117. <!-- #endif-->
  118. <!-- #ifdef MP-WEIXIN -->
  119. <tn-grid-item style="width: 30%;margin: 10rpx;">
  120. <image class="blogger__main-image blogger__main-image--3"
  121. :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  122. </tn-grid-item>
  123. <!-- #endif-->
  124. </block>
  125. </tn-grid>
  126. </view>
  127. </block>
  128. <view v-for="(file,fIndex) in item.fileDetailList" :style="{marginTop:item.imgList&&item.imgList.length==0&&fIndex==0?'8px':'0'}" style="background-color:#005da60d ;margin-bottom: 4px;padding: 4px 8px;border-radius: 4px;" :key="file.id" v-if="!isImage(file.fileName)" @click="clickLink(file.ftpUrl,file.fileName)">
  129. <view>
  130. <image src="../../static/tu/link.png" style="width: 18px;height: 18px;vertical-align: bottom;"></image>
  131. <view style="display: inline;margin-left:8px;color:#005DA6;" :style="{fontSize:(wxFontSize-3)+'px'}">
  132. {{file.fileName}}</view>
  133. </view>
  134. </view>
  135. <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-margin-top-xs">
  136. <view class="justify-content-item tn-color-gray tn-text-center">
  137. <view class="tn-padding-right tn-padding-top-xs" :style="{fontSize:(wxFontSize-3)+'px',color:'#777'}">
  138. {{ item.createTime|formatDate }}
  139. </view>
  140. </view>
  141. <view class="justify-content-item tn-flex tn-flex-col-center" style="position: relative">
  142. <image style="width: 30px;height:30px;" @click="showActionSheet(item)" src="../../static/tu/more.png"></image>
  143. <view v-if="curItem.id==item.id&&showSheet" class="pop-dia" style="position: absolute;background: #E4F1FB;display: block;right: 10px;top: 24px;border-radius: 6px;z-index: 900;">
  144. <view class="content" style="padding: 8px;font-size: 16px;line-height: 24px; width: 180px;border-radius: 6px;"
  145. v-if="!showContact">
  146. <button @click="linkTel()" style="border: none;border-radius: 0;color: #333333;background-color: #E4F1FB;border-bottom: 1px solid rgb(0 93 166 / 0.2);">
  147. <image src="../../static/tu/call.png" style="width: 26px;height: 26px;margin-right:10px;vertical-align: middle;"> 联系供方</button>
  148. <!-- <view>联系我们帮助对接</view> -->
  149. <button v-if="!collStatus" @click="addColl"
  150. style="border: none;border-radius: 0;color: #333333;background-color: #E4F1FB;border-bottom: 1px solid rgb(0 93 166 / 0.2);" type="default" plain="true">
  151. <image src="../../static/tu/coll.png" style="width: 26px;height: 26px;margin-right:10px;vertical-align: sub;">
  152. 收&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;藏</button>
  153. <button v-if="collStatus" @click="delColl"
  154. style="border: none;border-radius: 0;color: #333333;background-color: #E4F1FB;border-bottom: 1px solid rgb(0 93 166 / 0.2);" type="default" plain="true">
  155. <image src="../../static/tu/coll.png" style="width: 26px;height: 26px;margin-right:10px;vertical-align: sub;"> 取消收藏</button>
  156. <button open-type="share"
  157. style="border: none;border-radius: 0;color: #333333;background-color: #E4F1FB;" type="default" plain="true" :data-coupon="curItem">
  158. <image src="../../static/tu/share.png" style="width: 26px;height: 26px;margin-right:10px;vertical-align: sub;">
  159. 转&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;发</button>
  160. </view>
  161. <view class="content " style="position: relative;background: linear-gradient( 180deg, #DAECFA 0%, #FFFFFF 27%, #FFFFFF 100%);padding: 24px 40px;padding-bottom: 32px;font-size: 16px;width: calc(100vw - 80px);line-height: 24px;border-radius: 12px;"
  162. v-if="showContact">
  163. <view><text style="font-size: 19px;font-weight: bold;color: #333;" v-if="curContact.company">{{curContact.company}}</text></view>
  164. <view style="margin-top:10px;font-size: 17px;text-align: center;color:#333">
  165. <image src="../../static/tu/person.png" style="width: 24px;height: 24px;vertical-align: sub;">
  166. <text style="margin-left: 6px;">{{curContact.contactPerson}}</text> </view>
  167. <view style="margin-top:10px;font-size: 17px;text-align: center;color:#333" @click="showTel(curContact.contactMethod)">
  168. <image src="../../static/tu/tel.png" style="width: 24px;height: 24px;vertical-align: middle;">
  169. <text style="margin-left: 4px;">{{curContact.contactMethod}}</text>
  170. </view>
  171. <image src="../../static/tu/close.png" style="width: 40px;height: 40px;position: absolute; left: calc(50vw - 60px);bottom: -64px;" @click="hideSheet()"></image>
  172. </view>
  173. <view style="position: fixed;top: 0;left: 0;height: 100000vh;width: 100%;background: rgb(0 0 0 / 0.5);z-index: -1;" @click="hideSheet()" v-if="showContact"></view>
  174. </view>
  175. </view>
  176. </view>
  177. </view>
  178. </block>
  179. <view v-if="showEmpty&&content.length==0" style="margin-top: 32vh;">
  180. <tn-empty mode="list"></tn-empty>
  181. </view>
  182. <!-- 结尾 -->
  183. <view v-if="content.length==totalSize&&totalSize!=0&&currentTab==0" style="background-color: #f7f7f7;padding: 16px 0;" :style="{paddingTop:showSheet?'166px':'16px'}">
  184. <tn-load-more status="nomore" :loadText="loadText" :fontSize="(wxFontSize+11)"></tn-load-more>
  185. </view>
  186. <view v-if="content.length==totalSize&&totalSize!=0&&currentTab==1" style="background-color: #f7f7f7;padding: 16px 0;" :style="{paddingTop:showSheet?'166px':'16px'}">
  187. <tn-load-more status="nomore" :loadText="loadText2" :fontSize="(wxFontSize+11)"></tn-load-more>
  188. </view>
  189. </view>
  190. <!-- <view class='tn-tabbar-height'></view> -->
  191. </view>
  192. </scroll-view>
  193. </view>
  194. </template>
  195. <script>
  196. import request from '../../utils/request'
  197. export default {
  198. name: 'Circle',
  199. data() {
  200. return {
  201. loading: false,
  202. searchProdValue: '',
  203. searchProdValue2:'',
  204. tabList: [{
  205. 'tab-name': '产品'
  206. }, {
  207. 'tab-name': '服务'
  208. }],
  209. loadText: {
  210. loadmore: '下拉加载',
  211. loading: '快速加载中...',
  212. nomore: '恭喜你,已阅读完所有供应信息哦!'
  213. },
  214. loadText2: {
  215. loadmore: '下拉加载',
  216. loading: '快速加载中...',
  217. nomore: '恭喜你,已阅读完所有供应信息哦!'
  218. },
  219. currentTab: 0,
  220. showEmpty: false,
  221. showSheet: false,
  222. curItem: {},
  223. collId: '',
  224. showContact: false,
  225. curContact: {},
  226. current: 0,
  227. collStatus: '',
  228. searchValue: '',
  229. content: [],
  230. totalSize: 0,
  231. curIndex: 1,
  232. wxFontSize:17,
  233. triggered: false,
  234. _freshing: false,
  235. shareData:{}
  236. }
  237. },
  238. onReady() {
  239. const appBaseInfo = wx.getAppBaseInfo();
  240. this.wxFontSize = uni.getStorageSync('fontSize')||appBaseInfo.fontSizeSetting||17;
  241. },
  242. onShow() {
  243. this.$nextTick(() => {
  244. this.fetchData()
  245. })
  246. },
  247. onHide() {
  248. this.adAutoplay = false
  249. },
  250. filters: {
  251. formatDate(value) {
  252. if (!value) return '';
  253. const date = new Date(value);
  254. const today = new Date();
  255. const yesterday = new Date(today); // 昨天的日期
  256. yesterday.setDate(yesterday.getDate() - 1); // 将昨天的日期设置为前一天
  257. if (date.getFullYear() == today.getFullYear() && date.getMonth() == today.getMonth() && date.getDate() ==
  258. today.getDate()) {
  259. return '今天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  260. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  261. }
  262. if (date.getFullYear() == yesterday.getFullYear() && date.getMonth() == yesterday.getMonth() && date
  263. .getDate() == yesterday.getDate()) {
  264. return '昨天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  265. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  266. }
  267. return date.toLocaleDateString() + ' ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  268. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  269. },
  270. },
  271. methods: {
  272. // 瀑布流导航页面滚动到底部
  273. tabbarPageScrollLower(e) {
  274. this.loadMore();
  275. },
  276. onPulling(e) {
  277. console.log("onpulling", e);
  278. if(e.detail.deltaY<0){
  279. return
  280. }
  281. this.triggered = true
  282. },
  283. onRefresh(){
  284. if (this._freshing) return;
  285. this._freshing = true;
  286. this.reFetchData();
  287. setTimeout(() => {
  288. this.triggered = false;
  289. this._freshing = false;
  290. }, 1000)
  291. },
  292. onRestore() {
  293. this.triggered = false; // 需要重置
  294. },
  295. addLog(shareData){
  296. const that = this;
  297. let params= {
  298. bisNo:shareData.bisNo,
  299. bisType:'2',
  300. userNo:uni.getStorageSync('userNo')
  301. };
  302. request.post('/slbForward/add',{slbForward:JSON.stringify(params)},{
  303. headers: {
  304. 'Content-Type': 'application/json', // 默认值
  305. },
  306. }).then(res=>{
  307. })
  308. },
  309. sleep(time) {
  310. return new Promise((resolve) => setTimeout(resolve, time));
  311. },
  312. onShareAppMessage: function(option) {
  313. if(option.from=="button"){
  314. this.hideSheet();
  315. this.shareData=option.target.dataset.coupon;
  316. this.addLog(this.shareData);
  317. const promise = new Promise(async (resolve) => {
  318. await this.sleep(500);
  319. resolve({
  320. // title: `速立保`,
  321. path: `/pages/index/detail/detail?id=`+this.shareData.bisNo+'&isNeed=0',
  322. // imageUrl: url,
  323. });
  324. });
  325. // 默认参数
  326. return {
  327. // title: `速立保`,
  328. path: `/pages/index/detail/detail?id=`+this.shareData.bisNo+'&isNeed=0',
  329. promise,
  330. };
  331. }else{
  332. return {
  333. // title: '速立保',
  334. path: '/pages/index/index',
  335. };
  336. }
  337. },
  338. showSearch(item) {
  339. // 或者可以直接设置body的tabindex属性为-1,然后移除焦点
  340. // 注意:这种方式可能会导致一些浏览器的兼容性问题
  341. uni.navigateTo({
  342. url: '/pages/comm/search'
  343. })
  344. },
  345. // showDetail(item){
  346. // uni.navigateTo({
  347. // url: '/pages/index/detail/detail?id='+item.bisNo+'&isNeed=0'
  348. // })
  349. // },
  350. showDetail(item){
  351. uni.setStorageSync(item.bisNo,JSON.stringify(item))
  352. uni.navigateTo({
  353. url: '/circlePages/shareDeatail?sid=' + item.bisNo,
  354. })
  355. },
  356. showSearch2(item) {
  357. // 或者可以直接设置body的tabindex属性为-1,然后移除焦点
  358. // 注意:这种方式可能会导致一些浏览器的兼容性问题
  359. uni.navigateTo({
  360. url: '/pages/comm/search2'
  361. })
  362. },
  363. isImage(fileName) {
  364. const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'ico']
  365. const extension = fileName.split('.').pop().toLowerCase();
  366. return imageExtensions.includes(extension);
  367. },
  368. addButton() {
  369. if (!uni.getStorageSync('userNo')) {
  370. uni.showToast({
  371. title: '请登录',
  372. icon:'none'
  373. })
  374. uni.navigateTo({
  375. url: '/pages/login/login'
  376. })
  377. return false;
  378. } else {
  379. uni.navigateTo({
  380. url: '/circlePages/addShare'
  381. })
  382. }
  383. },
  384. showImg(items, index) {
  385. let urls = [];
  386. for (let i = 0; i < items.length; i++) {
  387. urls.push(items[i].ftpUrl);
  388. }
  389. // wx.chooseMessageFile({
  390. // count: 3, //默认100
  391. // type:'file',
  392. // extension:['.pdf','.doc'],
  393. // success: function (res) {
  394. // console.error(JSON.stringify(res));
  395. // }
  396. // });
  397. // 预览图片
  398. uni.previewImage({
  399. urls: urls,
  400. current: index,
  401. });
  402. },
  403. clickLink(url,fileName) {
  404. // uni.navigateTo({
  405. // url:'/pages/webview/web-view?url='+encodeURIComponent('https://slb-m.lx-device.com/webview?title='+fileName+'&url='+ url),
  406. // })
  407. uni.downloadFile({
  408. url: url,
  409. filePath: wx.env.USER_DATA_PATH + "/" + fileName,
  410. success: function (res) {
  411. const filePath = res.filePath
  412. uni.openDocument({
  413. filePath: filePath,
  414. showMenu: true,
  415. success: function (res) {
  416. console.log('打开文档成功')
  417. },
  418. fail: function(){
  419. uni.navigateTo({
  420. url:'/pages/webview/web-view?url='+encodeURIComponent('https://slb-m.lx-device.com/webview?title='+fileName+'&url='+ url),
  421. })
  422. }
  423. })
  424. }
  425. })
  426. // uni.navigateTo({
  427. // url: '/pages/webview/web-view?url=' + url,
  428. // })
  429. },
  430. // tab选项卡切换
  431. tabChange(index) {
  432. this.current = index
  433. },
  434. // 跳转
  435. tn(e) {
  436. uni.navigateTo({
  437. url: e,
  438. });
  439. },
  440. // 震动跳转
  441. navEdit(e) {
  442. wx.vibrateLong();
  443. uni.navigateTo({
  444. url: '/circlePages/edit'
  445. })
  446. },
  447. // 震动跳转
  448. navCreate(e) {
  449. wx.vibrateLong();
  450. uni.navigateTo({
  451. url: '/circlePages/create'
  452. })
  453. },
  454. // 震动跳转
  455. navBuild(e) {
  456. wx.vibrateLong();
  457. uni.navigateTo({
  458. url: '/circlePages/build'
  459. })
  460. },
  461. reFetchData() {
  462. this.loading = true;
  463. uni.showToast({
  464. title: '正在刷新...',
  465. icon: 'none'
  466. });
  467. this.content = [];
  468. this.fetchData();
  469. },
  470. hideSheet(){
  471. this.curItem = {};
  472. this.showSheet = false;
  473. },
  474. loadMore() {
  475. if (this.totalSize > this.content.length) {
  476. this.fetchData(this.curIndex + 1);
  477. }
  478. console.error('正在加载更多');
  479. },
  480. changeTab(index) {
  481. this.currentTab = index;
  482. this.content = [];
  483. this.fetchData();
  484. },
  485. // 获取内容容器的信息
  486. fetchData(curIndex = 1) {
  487. let that = this;
  488. that.showEmpty = false;
  489. this.curIndex = curIndex;
  490. if (uni.getStorageSync('searchProdValue')) {
  491. that.searchProdValue = uni.getStorageSync('searchProdValue');
  492. }else{
  493. that.searchProdValue = ''
  494. }
  495. if (uni.getStorageSync('searchProdValue2')) {
  496. that.searchProdValue2 = uni.getStorageSync('searchProdValue2');
  497. }else{
  498. that.searchProdValue2 = ''
  499. }
  500. request.post('/slbResourceShare/query', {
  501. type: that.currentTab == 1 ? '2' : '1',
  502. index: curIndex,
  503. content: that.currentTab == 1 ? (that.searchProdValue2 ? that.searchProdValue2.split('/')[1]:'') : undefined,
  504. manufacturer: that.currentTab == 0 ? (that.searchProdValue ? that.searchProdValue.split('/')[2] :
  505. '') : undefined,
  506. deviceName: that.currentTab == 0 ? (that.searchProdValue ? that.searchProdValue.split('/')[0] :
  507. '') : undefined,
  508. deviceModel: that.currentTab == 0 ? (that.searchProdValue ? that.searchProdValue.split('/')[1] :
  509. '') : that.currentTab == 1 ?(that.searchProdValue2 ? that.searchProdValue2.split('/')[0]:''): undefined,
  510. }).then(res => {
  511. that.loading = false;
  512. uni.hideToast();
  513. if (res && res.success) {
  514. that.totalSize = res.total || 0;
  515. let newList = res.list || [];
  516. for (let i = 0; i < newList.length; i++) {
  517. newList[i].imgList = [];
  518. for (let j = 0; j < newList[i].fileDetailList.length; j++) {
  519. if (that.isImage(newList[i].fileDetailList[j].fileName)) {
  520. newList[i].imgList.push(newList[i].fileDetailList[j]);
  521. }
  522. }
  523. for(let k = 0;newList[i].shareExt&&k<newList[i].shareExt.length;k++){
  524. newList[i].shareExt[k].fontSize= this.wxFontSize;
  525. }
  526. }
  527. if (curIndex == 1) {
  528. that.content = newList || [];
  529. } else {
  530. that.content = that.content.concat(newList || []);
  531. }
  532. }
  533. that.showEmpty = true;
  534. console.warn(res);
  535. })
  536. },
  537. showActionSheet(item) {
  538. let that = this;
  539. if(!this.curItem.id){
  540. this.curItem = item;
  541. }else{
  542. if(this.curItem.id!=item.id){
  543. this.curItem = item;
  544. }else{
  545. this.curItem = {}
  546. this.showSheet = false;
  547. return false;
  548. }
  549. }
  550. this.collStatus = false;
  551. this.showSheet = true;
  552. that.showContact = false;
  553. if (uni.getStorageSync('userNo')) {
  554. let params = {};
  555. params = {
  556. fkBisNo: that.curItem.bisNo,
  557. userNo: uni.getStorageSync('userNo'),
  558. };
  559. request.post('/slbCollect/query', params).then(res => {
  560. if (res.success) {
  561. if (res.list && res.list.length > 0) {
  562. that.collStatus = true;
  563. that.collId = res.list[0].id;
  564. }
  565. }
  566. })
  567. }
  568. },
  569. linkTel() {
  570. if (!uni.getStorageSync('userNo')) {
  571. uni.showToast({
  572. title: '请登录',
  573. icon:'none'
  574. })
  575. uni.navigateTo({
  576. url: '/pages/login/login'
  577. })
  578. return false;
  579. }
  580. let that = this;
  581. let params = {};
  582. params.slbBisContact = JSON.stringify({
  583. fkBisNo: that.curItem.bisNo,
  584. bisType: '2',
  585. type: '1',
  586. company: that.curItem.company,
  587. companyNo: that.curItem.companyNo,
  588. userNo: uni.getStorageSync('userNo'),
  589. });
  590. request.post('/slbBisContact/add', params).then(res => {
  591. if (res.success) {
  592. that.showContact = true;
  593. that.curContact.company = that.curItem.company;
  594. that.curContact.contactMethod = res.resultMap.contactMethod;
  595. that.curContact.contactPerson = res.resultMap.contactPerson;
  596. } else {
  597. that.showContact = false;
  598. uni.showToast({
  599. title: res.msg,
  600. icon: 'none'
  601. })
  602. }
  603. })
  604. },
  605. showBrand(text){
  606. uni.showToast({
  607. title: text,
  608. icon: 'none'
  609. })
  610. },
  611. addColl() {
  612. if (!uni.getStorageSync('userNo')) {
  613. uni.showToast({
  614. title: '请登录',
  615. icon:'none'
  616. })
  617. uni.navigateTo({
  618. url: '/pages/login/login'
  619. })
  620. return false;
  621. }
  622. let that = this;
  623. let params = {};
  624. params.slbCollect = JSON.stringify({
  625. fkBisNo: that.curItem.bisNo,
  626. bisType: '2',
  627. userNo: uni.getStorageSync('userNo'),
  628. });
  629. request.post('/slbCollect/add', params).then(res => {
  630. if (res.success) {
  631. that.showSheet = false;
  632. that.curItem = {};
  633. uni.showToast({
  634. title: '信息已收藏,请在我的收藏里查看阅读',
  635. icon: 'none',
  636. duration: 2000
  637. })
  638. } else {
  639. uni.showToast({
  640. title: res.msg,
  641. icon:'none'
  642. })
  643. }
  644. })
  645. },
  646. delColl() {
  647. let that = this;
  648. request.post('/slbCollect/del', {
  649. id: that.collId
  650. }).then(res => {
  651. if (res.success) {
  652. that.showSheet = false;
  653. that.curItem = {};
  654. uni.showToast({
  655. title: '此供应信息将不会保存在我的收藏里',
  656. icon: 'none',
  657. duration: 2000
  658. })
  659. } else {
  660. uni.showToast({
  661. title: res.msg,
  662. icon:'none'
  663. })
  664. }
  665. })
  666. },
  667. search() {
  668. this.fetchData();
  669. },
  670. searchProd() {
  671. this.searchProdValue = '';
  672. this.fetchData();
  673. },
  674. cancel() {
  675. this.searchValue = '';
  676. this.fetchData();
  677. },
  678. clear() {
  679. this.searchValue = '';
  680. this.fetchData();
  681. },
  682. clearProd() {
  683. this.searchProdValue = '';
  684. uni.removeStorageSync('searchProdValue');
  685. this.fetchData();
  686. },
  687. clearProd2() {
  688. this.searchProdValue2 = '';
  689. uni.removeStorageSync('searchProdValue2');
  690. this.fetchData();
  691. },
  692. showTel(tel){
  693. uni.makePhoneCall({
  694. phoneNumber: tel,
  695. });
  696. },
  697. }
  698. }
  699. </script>
  700. <style lang="scss" scoped>
  701. .circle {
  702. max-height: 100vh;
  703. }
  704. /* 底部安全边距 start*/
  705. .tn-tabbar-height {
  706. min-height: 120rpx;
  707. height: calc(140rpx + env(safe-area-inset-bottom) / 2);
  708. height: calc(140rpx + constant(safe-area-inset-bottom));
  709. }
  710. /* 自定义导航栏内容 start */
  711. .custom-nav {
  712. height: 100%;
  713. &__back {
  714. margin: auto 5rpx;
  715. font-size: 40rpx;
  716. margin-right: 10rpx;
  717. margin-left: 30rpx;
  718. flex-basis: 5%;
  719. }
  720. &__search {
  721. flex-basis: 60%;
  722. width: 100%;
  723. height: 100%;
  724. &__box {
  725. width: 100%;
  726. height: 70%;
  727. padding: 10rpx 0;
  728. margin: 0 30rpx;
  729. border-radius: 60rpx 60rpx 0 60rpx;
  730. font-size: 24rpx;
  731. }
  732. &__icon {
  733. padding-right: 10rpx;
  734. margin-left: 20rpx;
  735. font-size: 30rpx;
  736. }
  737. &__text {
  738. color: #AAAAAA;
  739. }
  740. }
  741. }
  742. /* 自定义导航栏内容 end */
  743. /* 文章内容 start*/
  744. .blogger {
  745. &__item {
  746. padding: 30rpx;
  747. }
  748. &__author {
  749. &__btn {
  750. margin-right: -12rpx;
  751. opacity: 0.5;
  752. }
  753. }
  754. &__desc {
  755. line-height: 30rpx;
  756. &__label {
  757. color: #1D2541;
  758. background-color: #F3F2F7;
  759. border-radius: 10rpx;
  760. font-size: 22rpx;
  761. padding: 5rpx 15rpx;
  762. margin: 5rpx 18rpx 0 0;
  763. &--prefix {
  764. font-size: 24rpx;
  765. color: #1D2541;
  766. padding-right: 10rpx;
  767. }
  768. }
  769. &__content {
  770. line-height: 50rpx;
  771. }
  772. }
  773. &__content {
  774. margin-top: 18rpx;
  775. padding-right: 18rpx;
  776. &__data {
  777. line-height: 46rpx;
  778. text-align: justify;
  779. overflow: hidden;
  780. transition: all 0.25s ease-in-out;
  781. }
  782. &__status {
  783. margin-top: 10rpx;
  784. font-size: 26rpx;
  785. color: #82B2FF;
  786. }
  787. }
  788. &__main-image {
  789. border: 1rpx solid #F8F7F8;
  790. border-radius: 16rpx;
  791. &--1 {
  792. max-width: 80%;
  793. max-height: 300rpx;
  794. }
  795. &--2 {
  796. max-width: 260rpx;
  797. max-height: 260rpx;
  798. }
  799. &--3 {
  800. height: 212rpx;
  801. width: 100%;
  802. }
  803. }
  804. &__count-icon {
  805. font-size: 40rpx;
  806. padding-right: 5rpx;
  807. }
  808. &__ad {
  809. width: 100%;
  810. height: 500rpx;
  811. transform: translate3d(0px, 0px, 0px) !important;
  812. ::v-deep .uni-swiper-slide-frame {
  813. transform: translate3d(0px, 0px, 0px) !important;
  814. }
  815. .uni-swiper-slide-frame {
  816. transform: translate3d(0px, 0px, 0px) !important;
  817. }
  818. &__item {
  819. position: absolute;
  820. width: 100%;
  821. height: 100%;
  822. transform-origin: left center;
  823. transform: translate3d(100%, 0px, 0px) scale(1) !important;
  824. transition: transform 0.25s ease-in-out;
  825. z-index: 1;
  826. &--0 {
  827. transform: translate3d(0%, 0px, 0px) scale(1) !important;
  828. z-index: 4;
  829. }
  830. &--1 {
  831. transform: translate3d(13%, 0px, 0px) scale(0.9) !important;
  832. z-index: 3;
  833. }
  834. &--2 {
  835. transform: translate3d(26%, 0px, 0px) scale(0.8) !important;
  836. z-index: 2;
  837. }
  838. }
  839. &__content {
  840. border-radius: 40rpx;
  841. width: 640rpx;
  842. height: 500rpx;
  843. overflow: hidden;
  844. }
  845. &__image {
  846. width: 100%;
  847. height: 100%;
  848. }
  849. }
  850. }
  851. /* 文章内容 end*/
  852. /* 自定义导航栏内容 end */
  853. /* 标签内容 start*/
  854. .tn-tag-content {
  855. &__item {
  856. display: inline-block;
  857. line-height: 35rpx;
  858. color: #1D2541;
  859. background-color: #F3F2F7;
  860. border-radius: 10rpx;
  861. font-size: 22rpx;
  862. padding: 5rpx 15rpx;
  863. &--prefix {
  864. padding-right: 10rpx;
  865. }
  866. }
  867. }
  868. </style>