faq.vue 2.8 KB

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