famousPrescribeDetails.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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 class="ad">
  40. <u-swiper
  41. :list="advImgs"
  42. indicator
  43. indicatorMode="line"
  44. circular
  45. @click="handleAdvClick"
  46. ></u-swiper>
  47. </view>
  48. <!-- 分享弹窗 -->
  49. <u-popup :show="showShare" @close="showShare = false" >
  50. <share-box :shareItem="shareItem" @closeShare='showShare = false' ></share-box>
  51. </u-popup>
  52. <h5-down-app-tip :pageUrl="pageUrl"/>
  53. </view>
  54. </template>
  55. <script>
  56. import {getAdvList} from '@/api/adv.js'
  57. import {getFamousPrescribeById} from '@/api/index'
  58. export default {
  59. data() {
  60. return {
  61. advs:[],
  62. advImgs:[],
  63. tabIndex:1,
  64. id:null,
  65. item:{imgUrl:""},
  66. showShare:false,
  67. shareItem:{ imageUrl:"",title:"",path:"",isMini:true, yyb:true },
  68. pageUrl: ''
  69. };
  70. },
  71. onLoad(option) {
  72. this.id=option.id;
  73. },
  74. onShow() {
  75. if(!this.$isLogin()) {
  76. uni.navigateTo({
  77. url: '/pages/auth/loginIndex'
  78. })
  79. return
  80. }
  81. this.pageUrl = '/pages/article/famousPrescribeDetails?id='+this.id;
  82. this.getAdvList()
  83. this.getFamousPrescribeById();
  84. },
  85. onShareAppMessage(res) {
  86. if(this.$isLogin()){
  87. return {
  88. title: this.item.prescribeName,
  89. path: '/pages_index/famousPrescribeDetails?id='+this.id,
  90. imageUrl: 'https://zkzh-2025.oss-cn-beijing.aliyuncs.com/appimgs/minilogo.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  91. }
  92. }
  93. },
  94. //分享到朋友圈
  95. onShareTimeline(res) {
  96. if(this.$isLogin()){
  97. return {
  98. title: this.item.prescribeName,
  99. path: '/pages_index/famousPrescribeDetails?id='+this.id,
  100. imageUrl: 'https://zkzh-2025.oss-cn-beijing.aliyuncs.com/appimgs/minilogo.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  101. }
  102. }
  103. },
  104. onNavigationBarButtonTap(e) {
  105. //#ifdef APP-PLUS
  106. this.shareItem.healthId= this.id;
  107. this.shareItem.title= this.item.prescribeName;
  108. this.shareItem.imageUrl=this.item.imgUrl;
  109. this.shareItem.compressImage = 1;
  110. this.shareItem.isMini=true;
  111. this.shareItem.path='/pages/article/famousPrescribeDetails?id='+this.id;
  112. this.showShare=true;
  113. //#endif
  114. },
  115. methods:{
  116. handleAdvClick(index){
  117. var ad=this.advs[index];
  118. if(ad.showType==1){
  119. uni.setStorageSync('url',ad.appAdvUrl);
  120. uni.navigateTo({
  121. url:"h5"
  122. })
  123. }
  124. else if(ad.showType==2){
  125. uni.navigateTo({
  126. url:ad.appAdvUrl
  127. })
  128. }
  129. else if(ad.showType==3){
  130. uni.setStorageSync('content',ad.content);
  131. uni.navigateTo({
  132. url:"content"
  133. })
  134. }
  135. },
  136. getAdvList() {
  137. //联网加载数据
  138. var that = this;
  139. var data = {
  140. advType:9
  141. };
  142. getAdvList(data).then(res => {
  143. if(res.code==200){
  144. that.advImgs=[];
  145. that.advs=[];
  146. res.data.forEach(function(element) {
  147. if(element.imageUrl!=null&&element.imageUrl!=""){
  148. that.advs.push(element);
  149. that.advImgs.push(element.imageUrl);
  150. }
  151. });
  152. }else{
  153. uni.showToast({
  154. icon:'none',
  155. title: "请求失败",
  156. });
  157. }
  158. });
  159. },
  160. tabClick(index){
  161. this.tabIndex=index;
  162. },
  163. getFamousPrescribeById(){
  164. let data = {id:this.id};
  165. getFamousPrescribeById(data).then(
  166. res => {
  167. if(res.code==200){
  168. this.item=res.data;
  169. if(!this.item.imgUrl || this.item.imgUrl==""){
  170. this.item.imgUrl="../../static/images/nopic.jpg"
  171. }
  172. }else{
  173. uni.showToast({
  174. icon:'none',
  175. title: "请求失败",
  176. });
  177. }
  178. },
  179. rej => {}
  180. );
  181. },
  182. }
  183. }
  184. </script>
  185. <style lang="scss" scoped>
  186. page{
  187. height: 100%;
  188. }
  189. .content{
  190. height: 100%;
  191. image{
  192. height:450rpx;
  193. width:100%;
  194. }
  195. .detail-cont{
  196. flex: 1;
  197. padding: 20upx;
  198. overflow-y: auto;
  199. .title-box{
  200. width: 100%;
  201. display: flex;
  202. justify-content: flex-start;
  203. align-items: center;
  204. .line{
  205. border-radius: 5rpx;
  206. width: 8rpx;
  207. height:30rpx;
  208. background-color: #2583EB;
  209. }
  210. .title{
  211. margin-left: 15rpx;
  212. font-size: 40upx;
  213. font-family: PingFang SC;
  214. font-weight: bold;
  215. color: #333;
  216. }
  217. .title-py{
  218. margin-left: 15rpx;
  219. font-size: 32upx;
  220. font-family: PingFang SC;
  221. color: #333;
  222. }
  223. }
  224. .desc{
  225. margin-top: 20rpx;
  226. font-size: 32upx;
  227. font-family: PingFang SC;
  228. color: #333;
  229. }
  230. .line-h{
  231. margin: 15rpx 0rpx;
  232. border-bottom: 1rpx dashed #d4d4d4;
  233. }
  234. .tabs{
  235. width: 100%;
  236. margin: 20rpx 0rpx;
  237. display: flex;
  238. justify-content: space-between;
  239. align-items: center;
  240. // border: 1rpx solid #2583EB;
  241. border-radius: 30rpx;
  242. line-height: 60rpx;
  243. .tab1{
  244. border-radius: 30rpx 0rpx 0rpx 30rpx;
  245. width: 25%;
  246. display: flex;
  247. justify-content: center;
  248. align-items: center;
  249. background-color: #fff;
  250. color: #4F575A;
  251. font-size: 28upx;
  252. font-weight: bold;
  253. font-family: PingFang SC;
  254. }
  255. .tab2{
  256. width: 25%;
  257. display: flex;
  258. justify-content: center;
  259. align-items: center;
  260. background-color: #fff;
  261. color: #4F575A;
  262. font-size: 28upx;
  263. font-weight: bold;
  264. font-family: PingFang SC;
  265. }
  266. .tab3{
  267. width: 25%;
  268. display: flex;
  269. justify-content: center;
  270. align-items: center;
  271. background-color: #fff;
  272. color: #4F575A;
  273. font-size: 28upx;
  274. font-weight: bold;
  275. font-family: PingFang SC;
  276. }
  277. .tab4{
  278. border-radius: 0rpx 30rpx 30rpx 0rpx;
  279. width: 25%;
  280. display: flex;
  281. justify-content: center;
  282. align-items: center;
  283. background-color: #fff;
  284. color: #4F575A;
  285. font-size: 28upx;
  286. font-weight: bold;
  287. font-family: PingFang SC;
  288. }
  289. .active{
  290. background-color: #2583EB;
  291. color: #fff;
  292. }
  293. }
  294. }
  295. .ad{
  296. margin-bottom: 50rpx;
  297. width: 100%;
  298. padding: 15rpx;
  299. }
  300. }
  301. </style>