medicatedFoodDetails.vue 4.2 KB

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