medicatedFoodDetails.vue 4.1 KB

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