detail.nvue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <view class="page">
  3. <scroll-view class="scroll-content" scroll-y="true">
  4. <image class="detail-img" src="/static/home/detail.png" mode="aspectFill"></image>
  5. <view class="back-btn" @click="goBack">
  6. <image class="back-img" src="/static/public/back.png" mode="aspectFill"></image>
  7. </view>
  8. <view class="detail-box">
  9. <text class="detail-title">{{form.title}}</text>
  10. <text class="detail-author">{{form.createUserName || '无名氏'}}</text>
  11. <view class="detail-btn" @click="isShowDrawer = true">
  12. <text class="detail-btn-txt">立即体验</text>
  13. </view>
  14. <view class="line"></view>
  15. <!-- 简介 -->
  16. <text class="section-title">简介</text>
  17. <view class="detail-info" :style="{height: isExpanded ? '84rpx' : 'auto'}">
  18. <text class="detail-info-text">{{form.detail || '暂无'}}</text>
  19. <view class="more-btn-box" @click="toggle">
  20. <text class="more-btn">{{isExpanded ? '展开' : '收缩'}}</text>
  21. <text class="more-arrow" :class="[isExpanded ? '' : 'collapse']">▼</text>
  22. </view>
  23. </view>
  24. <!-- 艾灸穴位 -->
  25. <text class="section-title">艾灸穴位</text>
  26. <view class="acupoint-box">
  27. <view v-for="(itm, inx) in points" :key="inx">
  28. <text class="line-info">{{inx + 1}}.{{itm.name}}</text>
  29. <text class="line-info emsp">定位:{{itm.position}}</text>
  30. <text class="line-info emsp">作用:{{itm.effect}}</text>
  31. </view>
  32. </view>
  33. <!-- 适用人群 -->
  34. <text class="section-title">适用人群</text>
  35. <view class="people-box">
  36. <text class="line-info" v-for="(itm, inx) in peoples" :key="inx">{{inx + 1}}.{{itm}}</text>
  37. </view>
  38. <!-- 注意事项 -->
  39. <text class="section-title">注意事项</text>
  40. <view class="tips-box">
  41. <text class="line-info" v-for="(itm, inx) in atts" :key="inx">{{inx + 1}}.{{itm}}</text>
  42. </view>
  43. </view>
  44. </scroll-view>
  45. <customPopup :isShow="isShowDrawer" @closePop="isShowDrawer = false">
  46. <text class="popup-tips">确认添加到我的方案?</text>
  47. <view class="popup-btns">
  48. <view class="popup-btn" @click="isShowDrawer = false">
  49. <text class="popup-btn-text">取消</text>
  50. </view>
  51. <view class="popup-btn popup-btn-confirm" @click="confirmAdd">
  52. <text class="popup-btn-text popup-btn-text-confirm">确认</text>
  53. </view>
  54. </view>
  55. </customPopup>
  56. </view>
  57. </template>
  58. <script>
  59. import customPopup from '@/components/customPopup/customPopup.nvue'
  60. export default {
  61. components: {
  62. customPopup
  63. },
  64. data() {
  65. return {
  66. id: '',
  67. isExpanded: true,
  68. isShowDrawer: false,
  69. form: {
  70. title: '',
  71. createUserName: '',
  72. detail: ''
  73. },
  74. peoples: [],
  75. atts: [],
  76. points: []
  77. }
  78. },
  79. onLoad(options) {
  80. this.id = options.id || ''
  81. // 使用传入的标题
  82. if (options.title) {
  83. this.form.title = decodeURIComponent(options.title)
  84. }
  85. this.init()
  86. },
  87. methods: {
  88. init() {
  89. // TODO: 等后端接口出来后替换为真实请求
  90. // 暂时使用模拟数据展示
  91. this.form = {
  92. title: this.form.title || '春季艾灸养生方案',
  93. createUserName: '研年健康',
  94. detail: '本方案针对春季阳气初升、湿寒未退的时节特点,通过温补督脉、健脾祛湿等艾灸手法,帮助调理身体,增强免疫力。适合久坐办公、体寒怕冷的人群。'
  95. }
  96. this.points = [
  97. { name: '大椎穴', position: '第七颈椎棘突下凹陷中', effect: '通阳解表,缓解颈肩疼痛' },
  98. { name: '肩井穴', position: '大椎与肩峰端连线的中点', effect: '疏通经络,缓解肩颈僵硬' },
  99. { name: '足三里', position: '外膝眼下3寸,胫骨前嵴外1横指', effect: '健脾和胃,扶正培元' }
  100. ]
  101. this.peoples = [
  102. '久坐办公室',
  103. '低头族',
  104. '体寒阳虚体质者',
  105. '慢性颈肩疼痛患者'
  106. ]
  107. this.atts = [
  108. '艾灸前30分钟避免剧烈运动',
  109. '每个穴位建议艾灸10-20分钟',
  110. '灸后30分钟内避免洗澡',
  111. '皮肤发红或起泡应立即停止艾灸'
  112. ]
  113. },
  114. toggle() {
  115. this.isExpanded = !this.isExpanded
  116. },
  117. goBack() {
  118. uni.navigateBack()
  119. },
  120. confirmAdd() {
  121. // TODO: 等后端接口出来后替换为真实请求
  122. uni.showToast({
  123. icon: 'none',
  124. title: '已加入我的方案'
  125. })
  126. this.isShowDrawer = false
  127. }
  128. }
  129. }
  130. </script>
  131. <style>
  132. .page {
  133. flex: 1;
  134. background-color: #FFFFFF;
  135. }
  136. .scroll-content {
  137. flex: 1;
  138. }
  139. .detail-img {
  140. width: 750rpx;
  141. height: 560rpx;
  142. }
  143. .back-btn {
  144. position: absolute;
  145. left: 30rpx;
  146. top: 142rpx;
  147. }
  148. .back-img {
  149. width: 50rpx;
  150. height: 50rpx;
  151. }
  152. .detail-box {
  153. width: 750rpx;
  154. margin-top: -88rpx;
  155. border-top-left-radius: 30rpx;
  156. border-top-right-radius: 30rpx;
  157. background-color: #FFFFFF;
  158. padding-top: 40rpx;
  159. padding-bottom: 40rpx;
  160. padding-left: 60rpx;
  161. padding-right: 60rpx;
  162. }
  163. .detail-title {
  164. font-weight: bold;
  165. font-size: 40rpx;
  166. color: #545F71;
  167. lines: 2;
  168. text-overflow: ellipsis;
  169. margin-bottom: 4rpx;
  170. }
  171. .detail-author {
  172. font-size: 32rpx;
  173. color: #545F71;
  174. line-height: 44rpx;
  175. }
  176. .detail-btn {
  177. background-color: #389588;
  178. height: 66rpx;
  179. border-radius: 20rpx;
  180. margin-top: 26rpx;
  181. margin-bottom: 26rpx;
  182. justify-content: center;
  183. align-items: center;
  184. }
  185. .detail-btn-txt {
  186. color: #FFFFFF;
  187. font-size: 28rpx;
  188. }
  189. .line {
  190. height: 1px;
  191. background-color: #ECECEC;
  192. margin-bottom: 32rpx;
  193. }
  194. .section-title {
  195. font-weight: bold;
  196. font-size: 32rpx;
  197. color: #545F71;
  198. line-height: 44rpx;
  199. margin-bottom: 16rpx;
  200. }
  201. .detail-info {
  202. position: relative;
  203. margin-bottom: 24rpx;
  204. padding-bottom: 32rpx;
  205. }
  206. .detail-info-text {
  207. font-size: 28rpx;
  208. color: #545F71;
  209. line-height: 44rpx;
  210. }
  211. .more-btn-box {
  212. position: absolute;
  213. right: 0;
  214. bottom: 0;
  215. background-color: #FFFFFF;
  216. flex-direction: row;
  217. align-items: center;
  218. padding-left: 6rpx;
  219. padding-right: 6rpx;
  220. }
  221. .more-btn {
  222. font-size: 28rpx;
  223. color: #389588;
  224. line-height: 40rpx;
  225. margin-right: 4rpx;
  226. }
  227. .more-arrow {
  228. color: #389588;
  229. font-size: 20rpx;
  230. }
  231. .collapse {
  232. transform: rotateZ(180deg);
  233. }
  234. .acupoint-box {
  235. margin-bottom: 24rpx;
  236. }
  237. .people-box {
  238. margin-bottom: 24rpx;
  239. }
  240. .tips-box {
  241. margin-bottom: 24rpx;
  242. }
  243. .line-info {
  244. line-height: 44rpx;
  245. color: #545F71;
  246. font-size: 28rpx;
  247. margin-left: 20rpx;
  248. }
  249. .emsp {
  250. padding-left: 40rpx;
  251. }
  252. .popup-tips {
  253. text-align: center;
  254. margin-top: 48rpx;
  255. margin-bottom: 48rpx;
  256. font-size: 32rpx;
  257. color: #545F71;
  258. }
  259. .popup-btns {
  260. flex-direction: row;
  261. justify-content: space-between;
  262. padding-left: 20rpx;
  263. padding-right: 20rpx;
  264. }
  265. .popup-btn {
  266. width: 296rpx;
  267. height: 88rpx;
  268. background-color: #F3F3F3;
  269. border-radius: 20rpx;
  270. justify-content: center;
  271. align-items: center;
  272. }
  273. .popup-btn-confirm {
  274. background-color: #389588;
  275. margin-left: 20rpx;
  276. }
  277. .popup-btn-text {
  278. font-size: 30rpx;
  279. color: #545F71;
  280. }
  281. .popup-btn-text-confirm {
  282. color: #FFFFFF;
  283. }
  284. </style>