faq.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <s-layout class="set-wrap" title="常见问题" :bgStyle="{ color: '#FFF' }">
  3. <uni-collapse>
  4. <uni-collapse-item v-for="(item, index) in state.list" :key="item">
  5. <template v-slot:title>
  6. <view class="ss-flex ss-col-center header">
  7. <view class="ss-m-l-20 ss-m-r-20 icon">
  8. <view class="rectangle">
  9. <view class="num ss-flex ss-row-center ss-col-center">
  10. {{ index + 1 < 10 ? '0' + (index + 1) : index + 1 }}
  11. </view>
  12. </view>
  13. <view class="triangle"> </view>
  14. </view>
  15. <view class="title ss-m-t-36 ss-m-b-36">
  16. {{ item.title }}
  17. </view>
  18. </view>
  19. </template>
  20. <view class="content ss-p-l-78 ss-p-r-40 ss-p-b-50 ss-p-t-20">
  21. <text class="text">{{ item.content }}</text>
  22. </view>
  23. </uni-collapse-item>
  24. </uni-collapse>
  25. <s-empty
  26. v-if="state.list.length === 0 && !state.loading"
  27. text="暂无常见问题"
  28. icon="/static/collect-empty.png"
  29. />
  30. </s-layout>
  31. </template>
  32. <script setup>
  33. import { onLoad } from '@dcloudio/uni-app';
  34. import { reactive } from 'vue';
  35. import sheep from '@/sheep';
  36. const state = reactive({
  37. list: [],
  38. loading: true,
  39. });
  40. async function getFaqList() {
  41. const { error, data } = await sheep.$api.data.faq();
  42. if (error === 0) {
  43. state.list = data;
  44. state.loading = false;
  45. }
  46. }
  47. onLoad(() => {
  48. getFaqList();
  49. });
  50. </script>
  51. <style lang="scss" scoped>
  52. .header {
  53. .title {
  54. font-size: 28rpx;
  55. font-weight: 500;
  56. color: #333333;
  57. line-height: 30rpx;
  58. max-width: 688rpx;
  59. }
  60. .icon {
  61. position: relative;
  62. width: 40rpx;
  63. height: 40rpx;
  64. .rectangle {
  65. position: absolute;
  66. left: 0;
  67. top: 0;
  68. width: 40rpx;
  69. height: 36rpx;
  70. background: var(--ui-BG-Main);
  71. border-radius: 4px;
  72. .num {
  73. width: 100%;
  74. height: 100%;
  75. font-size: 24rpx;
  76. font-weight: 500;
  77. color: var(--ui-BG);
  78. line-height: 32rpx;
  79. }
  80. }
  81. .triangle {
  82. width: 0;
  83. height: 0;
  84. border-left: 4rpx solid transparent;
  85. border-right: 4rpx solid transparent;
  86. border-top: 8rpx solid var(--ui-BG-Main);
  87. position: absolute;
  88. left: 16rpx;
  89. bottom: -4rpx;
  90. }
  91. }
  92. }
  93. .content {
  94. border-bottom: 1rpx solid #dfdfdf;
  95. .text {
  96. font-size: 26rpx;
  97. color: #666666;
  98. }
  99. }
  100. </style>