medicatedFoodDetails.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <view class="content" v-if="item!=null">
  3. <!-- #ifdef APP -->
  4. <u-navbar
  5. :title="item.foodName"
  6. :autoBack="true"
  7. ></u-navbar>
  8. <view class="image" style="margin-top: 174rpx;">
  9. <image mode="aspectFill" :src="item.imgUrl"></image>
  10. </view>
  11. <!-- #endif -->
  12. <!-- #ifndef APP -->
  13. <view class="image">
  14. <image mode="aspectFill" :src="item.imgUrl"></image>
  15. </view>
  16. <!-- #endif -->
  17. <view class="detail-cont">
  18. <view class="title-box">
  19. <view class="line"></view>
  20. <view class="title">{{item.foodName}}</view>
  21. <view class="title-py">{{item.pinyin}}</view>
  22. </view>
  23. <view class="desc">
  24. {{item.actionTitle}}
  25. </view>
  26. <view class="line-h"></view>
  27. <view class="content" v-html="item.descs">
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import {getMedicatedFoodById} from '@/api/index'
  34. export default {
  35. data() {
  36. return {
  37. item:{},
  38. };
  39. },
  40. onLoad(option) {
  41. this.id=option.id;
  42. },
  43. onShow() {
  44. this.getMedicatedFoodById();
  45. },
  46. onShareAppMessage(res) {
  47. if(this.utils.isLogin()){
  48. return {
  49. title: this.item.foodName,
  50. path: '/pages_index/medicatedFoodDetails?id='+this.id,
  51. imageUrl: 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20241018/b810f26926904253ae46ea4e93b71dee.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  52. }
  53. }
  54. },
  55. //分享到朋友圈
  56. onShareTimeline(res) {
  57. if(this.utils.isLogin()){
  58. return {
  59. title: this.item.title,
  60. imageUrl: 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20241018/b810f26926904253ae46ea4e93b71dee.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  61. }
  62. }
  63. },
  64. methods:{
  65. getMedicatedFoodById(){
  66. let data = {id:this.id};
  67. getMedicatedFoodById(data).then(
  68. res => {
  69. if(res.code==200){
  70. this.item=res.data;
  71. }else{
  72. uni.showToast({
  73. icon:'none',
  74. title: "请求失败",
  75. });
  76. }
  77. },
  78. rej => {}
  79. );
  80. },
  81. }
  82. }
  83. </script>
  84. <style lang="scss">
  85. page{
  86. height: 100%;
  87. }
  88. .content{
  89. height: 100%;
  90. image{
  91. height:450rpx;
  92. width:100%;
  93. }
  94. .detail-cont{
  95. flex: 1;
  96. padding: 20upx;
  97. overflow-y: auto;
  98. .title-box{
  99. width: 100%;
  100. display: flex;
  101. justify-content: flex-start;
  102. align-items: center;
  103. .line{
  104. border-radius: 5rpx;
  105. width: 8rpx;
  106. height:30rpx;
  107. background-color: #018C39;
  108. }
  109. .title{
  110. margin-left: 15rpx;
  111. font-size: 40upx;
  112. font-family: PingFang SC;
  113. font-weight: bold;
  114. color: #333;
  115. }
  116. .title-py{
  117. margin-left: 15rpx;
  118. font-size: 32upx;
  119. font-family: PingFang SC;
  120. color: #333;
  121. }
  122. }
  123. .desc{
  124. margin-top: 20rpx;
  125. font-size: 32upx;
  126. font-family: PingFang SC;
  127. color: #333;
  128. }
  129. .line-h{
  130. margin: 15rpx 0rpx;
  131. border-bottom: 1rpx dashed #d4d4d4;
  132. }
  133. .tabs{
  134. width: 100%;
  135. margin: 20rpx 0rpx;
  136. display: flex;
  137. justify-content: space-between;
  138. align-items: center;
  139. // border: 1rpx solid #018C39;
  140. border-radius: 30rpx;
  141. line-height: 60rpx;
  142. .tab1{
  143. border-radius: 30rpx 0rpx 0rpx 30rpx;
  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. .tab2{
  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. .tab3{
  166. width: 25%;
  167. display: flex;
  168. justify-content: center;
  169. align-items: center;
  170. background-color: #fff;
  171. color: #4F575A;
  172. font-size: 28upx;
  173. font-weight: bold;
  174. font-family: PingFang SC;
  175. }
  176. .tab4{
  177. border-radius: 0rpx 30rpx 30rpx 0rpx;
  178. width: 25%;
  179. display: flex;
  180. justify-content: center;
  181. align-items: center;
  182. background-color: #fff;
  183. color: #4F575A;
  184. font-size: 28upx;
  185. font-weight: bold;
  186. font-family: PingFang SC;
  187. }
  188. .active{
  189. background-color: #018C39;
  190. color: #fff;
  191. }
  192. }
  193. }
  194. }
  195. </style>