vesselDetails.vue 5.3 KB

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