vesselDetails.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <view class="content" v-if="item!=null">
  3. <view class="image">
  4. <image mode="aspectFill" :src="item.imgUrl"></image>
  5. </view>
  6. <view class="detail-cont">
  7. <view class="title-box">
  8. <view class="line"></view>
  9. <view class="title">{{item.vesselName}}</view>
  10. <view class="title-py">{{item.pinyin}}</view>
  11. </view>
  12. <view class="desc">
  13. {{item.actionTitle}}
  14. </view>
  15. <view class="line-h"></view>
  16. <view class="content" v-html="item.descs">
  17. </view>
  18. </view>
  19. <view class="ad">
  20. <u-swiper
  21. :list="advImgs"
  22. indicator
  23. indicatorMode="line"
  24. circular
  25. @click="handleAdvClick"
  26. ></u-swiper>
  27. </view>
  28. <!-- 分享弹窗 -->
  29. <u-popup :show="showShare" @close="showShare = false" >
  30. <share-box :shareItem="shareItem" @closeShare='showShare = false' ></share-box>
  31. </u-popup>
  32. <h5-down-app-tip :pageUrl="pageUrl"/>
  33. </view>
  34. </template>
  35. <script>
  36. import {getAdvList} from '@/api/adv.js'
  37. import {getVesselById} from '@/api/index'
  38. export default {
  39. data() {
  40. return {
  41. advs:[],
  42. advImgs:[],
  43. tabIndex:1,
  44. item:{},
  45. showShare:false,
  46. shareItem:{ imageUrl:"",title:"",path:"",isMini:true },
  47. pageUrl: ''
  48. };
  49. },
  50. onLoad(option) {
  51. this.id=option.id;
  52. },
  53. onShow() {
  54. if(!this.$isLogin()) {
  55. uni.navigateTo({
  56. url: '/pages/auth/loginIndex'
  57. })
  58. return
  59. }
  60. this.pageUrl = '/pages/article/vesselDetails?id='+this.id;
  61. this.getAdvList();
  62. this.getVesselById();
  63. },
  64. //发送给朋友
  65. onShareAppMessage(res) {
  66. if(this.$isLogin()){
  67. return {
  68. title: this.item.vesselName,
  69. path: '/pages_index/vesselDetails?id='+this.id,
  70. imageUrl: 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  71. }
  72. }
  73. },
  74. //分享到朋友圈
  75. onShareTimeline(res) {
  76. if(this.$isLogin()){
  77. return {
  78. title: this.item.vesselName,
  79. path: '/pages_index/vesselDetails?id='+this.id,
  80. imageUrl: 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  81. }
  82. }
  83. },
  84. onNavigationBarButtonTap(e) {
  85. //#ifdef APP-PLUS
  86. this.shareItem.healthId= this.id;
  87. this.shareItem.title= this.item.vesselName;
  88. this.shareItem.imageUrl=this.item.imgUrl;
  89. this.shareItem.compressImage = 1
  90. this.shareItem.isMini=true;
  91. this.shareItem.path='/pages_index/vesselDetails?id='+this.id;
  92. let cdn=uni.getStorageSync('h5Path');
  93. this.shareItem.url=cdn+'/pages/article/vesselDetails?id='+this.id;
  94. this.showShare=true;
  95. //#endif
  96. },
  97. methods:{
  98. handleAdvClick(index){
  99. var ad=this.advs[index];
  100. console.log(ad.appAdvUrl);
  101. if(ad.showType==1){
  102. uni.setStorageSync('url',ad.appAdvUrl);
  103. uni.navigateTo({
  104. url:"h5"
  105. })
  106. }
  107. else if(ad.showType==2){
  108. uni.navigateTo({
  109. url:ad.appAdvUrl
  110. })
  111. }
  112. else if(ad.showType==3){
  113. uni.setStorageSync('content',ad.content);
  114. uni.navigateTo({
  115. url:"content"
  116. })
  117. }
  118. },
  119. getAdvList() {
  120. //联网加载数据
  121. var that = this;
  122. var data = {
  123. advType:5
  124. };
  125. getAdvList(data).then(res => {
  126. if(res.code==200){
  127. that.advImgs=[];
  128. that.advs=[];
  129. res.data.forEach(function(element) {
  130. if(element.imageUrl!=null&&element.imageUrl!=""){
  131. that.advs.push(element);
  132. that.advImgs.push(element.imageUrl);
  133. }
  134. });
  135. }else{
  136. uni.showToast({
  137. icon:'none',
  138. title: "请求失败",
  139. });
  140. }
  141. });
  142. },
  143. getVesselById(){
  144. let data = {id:this.id};
  145. getVesselById(data).then(
  146. res => {
  147. if(res.code==200){
  148. this.item=res.data;
  149. }else{
  150. uni.showToast({
  151. icon:'none',
  152. title: "请求失败",
  153. });
  154. }
  155. },
  156. rej => {}
  157. );
  158. },
  159. }
  160. }
  161. </script>
  162. <style lang="scss" scoped>
  163. page{
  164. height: 100%;
  165. }
  166. .content{
  167. height: 100%;
  168. image{
  169. height:450rpx;
  170. width:100%;
  171. }
  172. .detail-cont{
  173. flex: 1;
  174. padding: 20upx;
  175. overflow-y: auto;
  176. .title-box{
  177. width: 100%;
  178. display: flex;
  179. justify-content: flex-start;
  180. align-items: center;
  181. .line{
  182. border-radius: 5rpx;
  183. width: 8rpx;
  184. height:30rpx;
  185. background-color: #C39A58;
  186. }
  187. .title{
  188. margin-left: 15rpx;
  189. font-size: 40upx;
  190. font-family: PingFang SC;
  191. font-weight: bold;
  192. color: #333;
  193. }
  194. .title-py{
  195. margin-left: 15rpx;
  196. font-size: 32upx;
  197. font-family: PingFang SC;
  198. color: #333;
  199. }
  200. }
  201. .desc{
  202. margin-top: 20rpx;
  203. font-size: 32upx;
  204. font-family: PingFang SC;
  205. color: #333;
  206. }
  207. .line-h{
  208. margin: 15rpx 0rpx;
  209. border-bottom: 1rpx dashed #d4d4d4;
  210. }
  211. .tabs{
  212. width: 100%;
  213. margin: 20rpx 0rpx;
  214. display: flex;
  215. justify-content: space-between;
  216. align-items: center;
  217. // border: 1rpx solid #C39A58;
  218. border-radius: 30rpx;
  219. line-height: 60rpx;
  220. .tab1{
  221. border-radius: 30rpx 0rpx 0rpx 30rpx;
  222. width: 25%;
  223. display: flex;
  224. justify-content: center;
  225. align-items: center;
  226. background-color: #fff;
  227. color: #4F575A;
  228. font-size: 28upx;
  229. font-weight: bold;
  230. font-family: PingFang SC;
  231. }
  232. .tab2{
  233. width: 25%;
  234. display: flex;
  235. justify-content: center;
  236. align-items: center;
  237. background-color: #fff;
  238. color: #4F575A;
  239. font-size: 28upx;
  240. font-weight: bold;
  241. font-family: PingFang SC;
  242. }
  243. .tab3{
  244. width: 25%;
  245. display: flex;
  246. justify-content: center;
  247. align-items: center;
  248. background-color: #fff;
  249. color: #4F575A;
  250. font-size: 28upx;
  251. font-weight: bold;
  252. font-family: PingFang SC;
  253. }
  254. .tab4{
  255. border-radius: 0rpx 30rpx 30rpx 0rpx;
  256. width: 25%;
  257. display: flex;
  258. justify-content: center;
  259. align-items: center;
  260. background-color: #fff;
  261. color: #4F575A;
  262. font-size: 28upx;
  263. font-weight: bold;
  264. font-family: PingFang SC;
  265. }
  266. .active{
  267. background-color: #C39A58;
  268. color: #fff;
  269. }
  270. }
  271. }
  272. .ad{
  273. margin-bottom: 50rpx;
  274. width: 100%;
  275. padding: 15rpx;
  276. }
  277. }
  278. </style>