<template>
  <view class="help-container">
    <view v-for="(item, findex) in list" :key="findex" class="help-section">
      <view class="section-header">
        <view class="header-icon" :style="{ background: findex === 0 ? 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)' : 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)' }">
          <uni-icons :type="findex === 0 ? 'help' : 'info'" size="20" color="#ffffff"></uni-icons>
        </view>
        <text class="section-title">{{ item.title }}</text>
      </view>
      
      <view class="qa-card">
        <view v-for="(child, zindex) in item.childList" :key="zindex" class="qa-item">
          <view class="question-row">
            <view class="q-badge">Q</view>
            <text class="question-text">{{ child.title }}</text>
          </view>
          <view class="answer-row">
            <view class="a-badge">A</view>
            <text class="answer-text">{{ child.content }}</text>
          </view>
          <view class="divider" v-if="zindex !== item.childList.length - 1"></view>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup>
	import { ref } from "vue";
	
	const list =ref([{
            title: '智聪网络科技问题',
            childList: [{
              title: '智聪网络科技平台免费吗？',
              content: '免费'
            }, {
              title: '智聪网络科技官网地址是？',
              content: 'http://www.qdintc.com'
            }, {
              title: '智聪网络科技文档地址？',
              content: 'http://www.qdintc.com/resource'
            }]
          },
          {
            title: '其他问题',
            childList: [{
              title: '如何退出登录？',
              content: '请点击[我的] - [应用设置] - [退出登录]即可退出登录',
            }, {
              title: '如何修改用户头像？',
              content: '请点击[我的] - [选择头像] - [点击提交]即可更换用户头像',
            }, {
              title: '如何修改登录密码？',
              content: '请点击[我的] - [应用设置] - [修改密码]即可修改登录密码',
            }]
          }
        ])
	
	function handleText(item) {
		uni.navigateTo({
			url: `/pages/common/textview/index?title=${item.title}&content=${item.content}`
		});
	}
</script>

<style lang="scss" scoped>
page {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background-color: #f5f7fa;
  min-height: 100%;
  height: auto;
}

.help-container {
  padding: 24rpx;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  
  /* 隐藏滚动条 */
  &::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.help-section {
  margin-bottom: 24rpx;
  
  &:last-child {
    margin-bottom: 0;
  }
}

.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 16rpx;
  
  .header-icon {
    width: 52rpx;
    height: 52rpx;
    border-radius: 12rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12rpx;
    box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
  }
  
  .section-title {
    color: #303133;
    font-size: 30rpx;
    font-weight: 600;
  }
}

.qa-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fb 100%);
  border-radius: 20rpx;
  padding: 12rpx 0;
  box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.08);
}

.qa-item {
  padding: 20rpx;
}

.question-row {
  display: flex;
  align-items: flex-start;
  margin-bottom: 12rpx;
  
  .q-badge {
    width: 36rpx;
    height: 36rpx;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 22rpx;
    font-weight: 600;
    margin-right: 12rpx;
    flex-shrink: 0;
  }
  
  .question-text {
    flex: 1;
    color: #303133;
    font-size: 26rpx;
    font-weight: 500;
    line-height: 36rpx;
  }
}

.answer-row {
  display: flex;
  align-items: flex-start;
  
  .a-badge {
    width: 36rpx;
    height: 36rpx;
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    border-radius: 8rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 22rpx;
    font-weight: 600;
    margin-right: 12rpx;
    flex-shrink: 0;
  }
  
  .answer-text {
    flex: 1;
    color: #606266;
    font-size: 24rpx;
    line-height: 36rpx;
  }
}

.divider {
  height: 1rpx;
  background: linear-gradient(90deg, transparent, #e8edf3 20%, #e8edf3 80%, transparent);
  margin: 20rpx 0;
}
</style>
