vesselDetails.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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, yyb: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://zkzh-2025.oss-cn-beijing.aliyuncs.com/appimgs/minilogo.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://zkzh-2025.oss-cn-beijing.aliyuncs.com/appimgs/minilogo.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/article/vesselDetails?id='+this.id;
  92. this.showShare=true;
  93. //#endif
  94. },
  95. methods:{
  96. handleAdvClick(index){
  97. var ad=this.advs[index];
  98. console.log(ad.appAdvUrl);
  99. if(ad.showType==1){
  100. uni.setStorageSync('url',ad.appAdvUrl);
  101. uni.navigateTo({
  102. url:"h5"
  103. })
  104. }
  105. else if(ad.showType==2){
  106. uni.navigateTo({
  107. url:ad.appAdvUrl
  108. })
  109. }
  110. else if(ad.showType==3){
  111. uni.setStorageSync('content',ad.content);
  112. uni.navigateTo({
  113. url:"content"
  114. })
  115. }
  116. },
  117. getAdvList() {
  118. //联网加载数据
  119. var that = this;
  120. var data = {
  121. advType:5
  122. };
  123. getAdvList(data).then(res => {
  124. if(res.code==200){
  125. that.advImgs=[];
  126. that.advs=[];
  127. res.data.forEach(function(element) {
  128. if(element.imageUrl!=null&&element.imageUrl!=""){
  129. that.advs.push(element);
  130. that.advImgs.push(element.imageUrl);
  131. }
  132. });
  133. }else{
  134. uni.showToast({
  135. icon:'none',
  136. title: "请求失败",
  137. });
  138. }
  139. });
  140. },
  141. getVesselById(){
  142. let data = {id:this.id};
  143. getVesselById(data).then(
  144. res => {
  145. if(res.code==200){
  146. this.item=res.data;
  147. }else{
  148. uni.showToast({
  149. icon:'none',
  150. title: "请求失败",
  151. });
  152. }
  153. },
  154. rej => {}
  155. );
  156. },
  157. }
  158. }
  159. </script>
  160. <style lang="scss" scoped>
  161. page{
  162. height: 100%;
  163. }
  164. .content{
  165. height: 100%;
  166. image{
  167. height:450rpx;
  168. width:100%;
  169. }
  170. .detail-cont{
  171. flex: 1;
  172. padding: 20upx;
  173. overflow-y: auto;
  174. .title-box{
  175. width: 100%;
  176. display: flex;
  177. justify-content: flex-start;
  178. align-items: center;
  179. .line{
  180. border-radius: 5rpx;
  181. width: 8rpx;
  182. height:30rpx;
  183. background-color: #2583EB;
  184. }
  185. .title{
  186. margin-left: 15rpx;
  187. font-size: 40upx;
  188. font-family: PingFang SC;
  189. font-weight: bold;
  190. color: #333;
  191. }
  192. .title-py{
  193. margin-left: 15rpx;
  194. font-size: 32upx;
  195. font-family: PingFang SC;
  196. color: #333;
  197. }
  198. }
  199. .desc{
  200. margin-top: 20rpx;
  201. font-size: 32upx;
  202. font-family: PingFang SC;
  203. color: #333;
  204. }
  205. .line-h{
  206. margin: 15rpx 0rpx;
  207. border-bottom: 1rpx dashed #d4d4d4;
  208. }
  209. .tabs{
  210. width: 100%;
  211. margin: 20rpx 0rpx;
  212. display: flex;
  213. justify-content: space-between;
  214. align-items: center;
  215. // border: 1rpx solid #2583EB;
  216. border-radius: 30rpx;
  217. line-height: 60rpx;
  218. .tab1{
  219. border-radius: 30rpx 0rpx 0rpx 30rpx;
  220. width: 25%;
  221. display: flex;
  222. justify-content: center;
  223. align-items: center;
  224. background-color: #fff;
  225. color: #4F575A;
  226. font-size: 28upx;
  227. font-weight: bold;
  228. font-family: PingFang SC;
  229. }
  230. .tab2{
  231. width: 25%;
  232. display: flex;
  233. justify-content: center;
  234. align-items: center;
  235. background-color: #fff;
  236. color: #4F575A;
  237. font-size: 28upx;
  238. font-weight: bold;
  239. font-family: PingFang SC;
  240. }
  241. .tab3{
  242. width: 25%;
  243. display: flex;
  244. justify-content: center;
  245. align-items: center;
  246. background-color: #fff;
  247. color: #4F575A;
  248. font-size: 28upx;
  249. font-weight: bold;
  250. font-family: PingFang SC;
  251. }
  252. .tab4{
  253. border-radius: 0rpx 30rpx 30rpx 0rpx;
  254. width: 25%;
  255. display: flex;
  256. justify-content: center;
  257. align-items: center;
  258. background-color: #fff;
  259. color: #4F575A;
  260. font-size: 28upx;
  261. font-weight: bold;
  262. font-family: PingFang SC;
  263. }
  264. .active{
  265. background-color: #2583EB;
  266. color: #fff;
  267. }
  268. }
  269. }
  270. .ad{
  271. margin-bottom: 50rpx;
  272. width: 100%;
  273. padding: 15rpx;
  274. }
  275. }
  276. </style>