famousPrescribeDetails.vue 5.0 KB

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