medicatedFoodDetails.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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.foodName}}</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>
  20. </template>
  21. <script>
  22. import {getMedicatedFoodById} from '@/api/index'
  23. export default {
  24. data() {
  25. return {
  26. item:{},
  27. };
  28. },
  29. onLoad(option) {
  30. this.id=option.id;
  31. },
  32. onShow() {
  33. this.getMedicatedFoodById();
  34. },
  35. onShareAppMessage(res) {
  36. if(this.utils.isLogin()){
  37. return {
  38. title: this.item.foodName,
  39. path: '/pages_index/medicatedFoodDetails?id='+this.id,
  40. imageUrl: 'https://beiliyo-2025.obs.cn-north-4.myhuaweicloud.com/fs/20250115/1736944490230.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  41. }
  42. }
  43. },
  44. //分享到朋友圈
  45. onShareTimeline(res) {
  46. if(this.utils.isLogin()){
  47. return {
  48. title: this.item.title,
  49. imageUrl: 'https://beiliyo-2025.obs.cn-north-4.myhuaweicloud.com/fs/20250115/1736944490230.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  50. }
  51. }
  52. },
  53. methods:{
  54. getMedicatedFoodById(){
  55. let data = {id:this.id};
  56. getMedicatedFoodById(data).then(
  57. res => {
  58. if(res.code==200){
  59. this.item=res.data;
  60. }else{
  61. uni.showToast({
  62. icon:'none',
  63. title: "请求失败",
  64. });
  65. }
  66. },
  67. rej => {}
  68. );
  69. },
  70. }
  71. }
  72. </script>
  73. <style lang="scss">
  74. page{
  75. height: 100%;
  76. }
  77. .content{
  78. height: 100%;
  79. image{
  80. height:450rpx;
  81. width:100%;
  82. }
  83. .detail-cont{
  84. flex: 1;
  85. padding: 20upx;
  86. overflow-y: auto;
  87. .title-box{
  88. width: 100%;
  89. display: flex;
  90. justify-content: flex-start;
  91. align-items: center;
  92. .line{
  93. border-radius: 5rpx;
  94. width: 8rpx;
  95. height:30rpx;
  96. background-color: #018C39;
  97. }
  98. .title{
  99. margin-left: 15rpx;
  100. font-size: 40upx;
  101. font-family: PingFang SC;
  102. font-weight: bold;
  103. color: #333;
  104. }
  105. .title-py{
  106. margin-left: 15rpx;
  107. font-size: 32upx;
  108. font-family: PingFang SC;
  109. color: #333;
  110. }
  111. }
  112. .desc{
  113. margin-top: 20rpx;
  114. font-size: 32upx;
  115. font-family: PingFang SC;
  116. color: #333;
  117. }
  118. .line-h{
  119. margin: 15rpx 0rpx;
  120. border-bottom: 1rpx dashed #d4d4d4;
  121. }
  122. .tabs{
  123. width: 100%;
  124. margin: 20rpx 0rpx;
  125. display: flex;
  126. justify-content: space-between;
  127. align-items: center;
  128. // border: 1rpx solid #018C39;
  129. border-radius: 30rpx;
  130. line-height: 60rpx;
  131. .tab1{
  132. border-radius: 30rpx 0rpx 0rpx 30rpx;
  133. width: 25%;
  134. display: flex;
  135. justify-content: center;
  136. align-items: center;
  137. background-color: #fff;
  138. color: #4F575A;
  139. font-size: 28upx;
  140. font-weight: bold;
  141. font-family: PingFang SC;
  142. }
  143. .tab2{
  144. width: 25%;
  145. display: flex;
  146. justify-content: center;
  147. align-items: center;
  148. background-color: #fff;
  149. color: #4F575A;
  150. font-size: 28upx;
  151. font-weight: bold;
  152. font-family: PingFang SC;
  153. }
  154. .tab3{
  155. width: 25%;
  156. display: flex;
  157. justify-content: center;
  158. align-items: center;
  159. background-color: #fff;
  160. color: #4F575A;
  161. font-size: 28upx;
  162. font-weight: bold;
  163. font-family: PingFang SC;
  164. }
  165. .tab4{
  166. border-radius: 0rpx 30rpx 30rpx 0rpx;
  167. width: 25%;
  168. display: flex;
  169. justify-content: center;
  170. align-items: center;
  171. background-color: #fff;
  172. color: #4F575A;
  173. font-size: 28upx;
  174. font-weight: bold;
  175. font-family: PingFang SC;
  176. }
  177. .active{
  178. background-color: #018C39;
  179. color: #fff;
  180. }
  181. }
  182. }
  183. }
  184. </style>