help.vue 2.5 KB

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