famousPrescribeDetails.vue 4.9 KB

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