famousPrescribeDetails.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  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:{},
  66. showShare:false,
  67. shareItem:{ imageUrl:"",title:"",path:"",isMini: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://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.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://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.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_index/famousPrescribeDetails?id='+this.id;
  112. let cdn=uni.getStorageSync('h5Path');
  113. this.shareItem.url=cdn+'/pages/article/famousPrescribeDetails?id='+this.id;
  114. this.showShare=true;
  115. //#endif
  116. },
  117. methods:{
  118. handleAdvClick(index){
  119. var ad=this.advs[index];
  120. if(ad.showType==1){
  121. uni.setStorageSync('url',ad.appAdvUrl);
  122. uni.navigateTo({
  123. url:"h5"
  124. })
  125. }
  126. else if(ad.showType==2){
  127. uni.navigateTo({
  128. url:ad.appAdvUrl
  129. })
  130. }
  131. else if(ad.showType==3){
  132. uni.setStorageSync('content',ad.content);
  133. uni.navigateTo({
  134. url:"content"
  135. })
  136. }
  137. },
  138. getAdvList() {
  139. //联网加载数据
  140. var that = this;
  141. var data = {
  142. advType:9
  143. };
  144. getAdvList(data).then(res => {
  145. if(res.code==200){
  146. that.advImgs=[];
  147. that.advs=[];
  148. res.data.forEach(function(element) {
  149. if(element.imageUrl!=null&&element.imageUrl!=""){
  150. that.advs.push(element);
  151. that.advImgs.push(element.imageUrl);
  152. }
  153. });
  154. }else{
  155. uni.showToast({
  156. icon:'none',
  157. title: "请求失败",
  158. });
  159. }
  160. });
  161. },
  162. tabClick(index){
  163. this.tabIndex=index;
  164. },
  165. getFamousPrescribeById(){
  166. let data = {id:this.id};
  167. getFamousPrescribeById(data).then(
  168. res => {
  169. if(res.code==200){
  170. this.item=res.data;
  171. }else{
  172. uni.showToast({
  173. icon:'none',
  174. title: "请求失败",
  175. });
  176. }
  177. },
  178. rej => {}
  179. );
  180. },
  181. }
  182. }
  183. </script>
  184. <style lang="scss" scoped>
  185. page{
  186. height: 100%;
  187. }
  188. .content{
  189. height: 100%;
  190. image{
  191. height:450rpx;
  192. width:100%;
  193. }
  194. .detail-cont{
  195. flex: 1;
  196. padding: 20upx;
  197. overflow-y: auto;
  198. .title-box{
  199. width: 100%;
  200. display: flex;
  201. justify-content: flex-start;
  202. align-items: center;
  203. .line{
  204. border-radius: 5rpx;
  205. width: 8rpx;
  206. height:30rpx;
  207. background-color: #FF5C03;
  208. }
  209. .title{
  210. margin-left: 15rpx;
  211. font-size: 40upx;
  212. font-family: PingFang SC;
  213. font-weight: bold;
  214. color: #333;
  215. }
  216. .title-py{
  217. margin-left: 15rpx;
  218. font-size: 32upx;
  219. font-family: PingFang SC;
  220. color: #333;
  221. }
  222. }
  223. .desc{
  224. margin-top: 20rpx;
  225. font-size: 32upx;
  226. font-family: PingFang SC;
  227. color: #333;
  228. }
  229. .line-h{
  230. margin: 15rpx 0rpx;
  231. border-bottom: 1rpx dashed #d4d4d4;
  232. }
  233. .tabs{
  234. width: 100%;
  235. margin: 20rpx 0rpx;
  236. display: flex;
  237. justify-content: space-between;
  238. align-items: center;
  239. // border: 1rpx solid #C39A58;
  240. border-radius: 30rpx;
  241. line-height: 60rpx;
  242. .tab1{
  243. border-radius: 30rpx 0rpx 0rpx 30rpx;
  244. width: 25%;
  245. display: flex;
  246. justify-content: center;
  247. align-items: center;
  248. background-color: #fff;
  249. color: #4F575A;
  250. font-size: 28upx;
  251. font-weight: bold;
  252. font-family: PingFang SC;
  253. }
  254. .tab2{
  255. width: 25%;
  256. display: flex;
  257. justify-content: center;
  258. align-items: center;
  259. background-color: #fff;
  260. color: #4F575A;
  261. font-size: 28upx;
  262. font-weight: bold;
  263. font-family: PingFang SC;
  264. }
  265. .tab3{
  266. width: 25%;
  267. display: flex;
  268. justify-content: center;
  269. align-items: center;
  270. background-color: #fff;
  271. color: #4F575A;
  272. font-size: 28upx;
  273. font-weight: bold;
  274. font-family: PingFang SC;
  275. }
  276. .tab4{
  277. border-radius: 0rpx 30rpx 30rpx 0rpx;
  278. width: 25%;
  279. display: flex;
  280. justify-content: center;
  281. align-items: center;
  282. background-color: #fff;
  283. color: #4F575A;
  284. font-size: 28upx;
  285. font-weight: bold;
  286. font-family: PingFang SC;
  287. }
  288. .active{
  289. background-color: #FF5C03;
  290. color: #fff;
  291. }
  292. }
  293. }
  294. .ad{
  295. margin-bottom: 50rpx;
  296. width: 100%;
  297. padding: 15rpx;
  298. }
  299. }
  300. </style>