help.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <view>
  3. <ujp-navbar title="操作指南"></ujp-navbar>
  4. <view class="collapse">
  5. <!-- -->
  6. <u-collapse :activeStyle='activeStyle' :itemStyle="itemStyle" :headStyle="headerStyle" :bodyStyle="bodyStyle" v-if="itemList.length" >
  7. <u-collapse-item :title="item.title" v-for="(item, index) in itemList" :key="index">
  8. <!-- <textarea maxlength="-1" :auto-height="true" v-model="item.content" readonly ></textarea>
  9. --> <view v-html="item.content"></view>
  10. </u-collapse-item>
  11. </u-collapse>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import * as API from '@/apis/user.js'
  17. export default {
  18. data() {
  19. return {
  20. elderMode:false,
  21. activeStyle:{
  22. 'font-size':'24rpx'
  23. },
  24. headerStyle:{
  25. 'font-size':'30rpx'
  26. },
  27. bodyStyle:{
  28. 'font-size':'24rpx'
  29. },
  30. itemStyle:{
  31. 'font-size':'24rpx'
  32. },
  33. itemList: [],
  34. }
  35. },
  36. onReady() {
  37. this.elderMode = this.carhelp.get('getElderModeClass') == '长辈模式';
  38. if(this.elderMode)
  39. this.theme('elder')
  40. else
  41. this.theme('standard')
  42. this.getHomePage()
  43. },
  44. methods: {
  45. theme(type) {
  46. if(type == 'elder')
  47. {
  48. document.getElementsByTagName('body')[0].setAttribute('data-theme',type);
  49. let activeStyle = {
  50. 'font-size':'28rpx'
  51. };
  52. let headerStyle ={
  53. 'font-size':'34rpx'
  54. };
  55. let bodyStyle ={
  56. 'font-size':'28rpx'
  57. } ;
  58. let itemStyle = {
  59. 'font-size':'28rpx'
  60. };
  61. this.activeStyle = activeStyle;
  62. this.headerStyle = headerStyle;
  63. this.bodyStyle = bodyStyle;
  64. this.itemStyle = itemStyle;
  65. }
  66. else
  67. {
  68. document.getElementsByTagName('body')[0].setAttribute('data-theme',type);
  69. let activeStyle = {
  70. 'font-size':'24rpx'
  71. };
  72. let headerStyle ={
  73. 'font-size':'30rpx'
  74. };
  75. let bodyStyle ={
  76. 'font-size':'24rpx'
  77. } ;
  78. let itemStyle = {
  79. 'font-size':'24rpx'
  80. };
  81. this.activeStyle = activeStyle;
  82. this.headerStyle = headerStyle;
  83. this.bodyStyle = bodyStyle;
  84. this.itemStyle = itemStyle;
  85. }
  86. },
  87. getHomePage(){
  88. uni.showLoading({
  89. title: "加载中",
  90. mask: true,
  91. })
  92. API.helpList({
  93. category:2
  94. }).then((res) => {
  95. this.itemList = res.data.helpList
  96. uni.hideLoading()
  97. }).catch(error => {
  98. uni.showToast({
  99. title: error
  100. })
  101. })
  102. }
  103. }
  104. }
  105. </script>
  106. <style>
  107. page{
  108. background-color: #F7F7F7;
  109. }
  110. </style>
  111. <style lang="scss" scoped>
  112. @import "@/_theme.scss";
  113. .collapse{
  114. background-color: #fff;
  115. padding:10px;
  116. }
  117. </style>