<template>
	<!-- 帮助与反馈 -->
	<view class="help">
		<navbar title="帮助与反馈"  leftClick @leftClick="$utils.navigateBack" />
		<view class="help-box">
			<view>
				<view class="help-issue">
					<text>问题和意见</text>
					<text style="color: #BD3624;">*</text>
				</view>
				<uv-textarea v-model="value" :count="true" border="none" height="400"
					placeholder="请把发现的问题提交给我们，感谢您的参与(必填)" 
					:text-style="{color:'#BCB7B7',fontSize:'28rpx'}" />
			</view>

			<view>
				<view class="help-issue">
					<text>问题截图</text>
					<text style="color: #BD3624;">*</text>
				</view>

				<view class="help-screenshot">
					<uv-upload :fileList="fileList" multiple :maxCount="3" width="180rpx"
						height="180rpx" multiple @afterRead="afterRead" @delete="deleteImage">
						<image src="../static/help/uploading.png" mode="aspectFill"
							style="width: 180rpx;height: 180rpx;" />
					</uv-upload>
				</view>
			</view>

			<!-- <view>
				<view class="help-issue">
					<text>联系方式</text>
					<text style="color: #BD3624;">*</text>
				</view>
				<uv-input placeholder="请输入联系方式" fontSize="24rpx" border="bottom"
					:custom-style="{backgroundColor: '#fff'}">
					<template #prefix>
						<uv-text text="联系姓名" size="24rpx" margin="20rpx 10rpx 20rpx 10rpx" />
					</template>
				</uv-input>
				<uv-input placeholder="请输入联系姓名" border="none" fontSize="24rpx"
					:custom-style="{backgroundColor: '#fff'}">
					<template #prefix>
						<uv-text text="联系方式" size="24rpx" margin="20rpx 10rpx 20rpx 10rpx" />
					</template>
				</uv-input>
			</view> -->
			<view class="help-button">
				<view>确认</view>
			</view>
		</view>
	</view>
</template>
<template>
  <view class="page">

    <navbar  title="帮助与反馈" leftClick @leftClick="$utils.navigateBack"/>

    <view class="frame">
      <!--帮助与反馈-->
      <view class="helpFeedback">
        <view class="title"> 问题和意见 <span style="color: red;">*</span></view>
        <view class="desc">
          <textarea placeholder="请把发现的问题提交给我们，感谢您的参与(必填)"/>
        </view>
      </view>

      <!--问题截图-->
      <view class="problemImg">
        <view class="title">问题截图<span style="color: red;">*</span></view>
        <view class="img">
          <uv-upload
              :fileList="fileList"
              :maxCount="5"
              multiple
              width="150rpx"
              height="150rpx"
              @delete="deleteImage"
              @afterRead="afterRead"
              :previewFullImage="true">
          </uv-upload>
        </view>
      </view>

      <!--联系方式-->
      <view class="name_phone">
        <view class="title">联系方式<span style="color: red;">*</span></view>
        <view class="items">
          <view class="item">
            <view>联系姓名</view>
            <view>
              <input  placeholder="请输入联系姓名" clearable></input>
            </view>
          </view>
          <view class="item">
            <view>联系电话</view>
            <view>
              <input placeholder="请输入联系电话" clearable></input>
            </view>
          </view>
        </view>
      </view>

      <!--提交反馈-->
      <view class="btns">
        <view @click="submitFeedback" class="btn">
          提交反馈
        </view>
      </view>
    </view>

  </view>
</template>
<script>
import topbar from "@/components/base/topbar.vue";
import tabber from "@/components/base/tabbar.vue";

export default {
  name: "helpFeedback",
  components: {tabber, topbar},
  data() {
    return {
      fileList: [],
    }
  },
  methods: {

    // 提交反馈
    submitFeedback() {

    },

    deleteImage(e) {
      this.fileList.splice(e.index, 1)
    },
    afterRead(e) {
      let self = this
      e.file.forEach(file => {
        self.$Oss.ossUpload(file.url).then(url => {
          self.fileList.push({
            url
          })
        })
      })
    },
  },
}
</script>


<style scoped lang="scss">
.page {
  height: 100vh;
  background-color: #f2f5f5;

  .frame {
    padding: 40rpx;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 40rpx;

    .helpFeedback {
      .title {

      }

      .desc {
        margin-top: 20rpx;
        height: 300rpx;
        border-radius: 40rpx;
        overflow: hidden;
        padding: 20rpx;
        font-size: 28rpx;
        background-color: #fff;
      }
    }

    .problemImg {

      .img {
        margin-top: 20rpx;
        height: 150rpx;
        border-radius: 40rpx;
        overflow: hidden;
        padding: 20rpx;
        font-size: 28rpx;
        background-color: #fff;
      }
    }

    .name_phone {

      .title {

      }

      .items {
        margin-top: 20rpx;

        .item {
          display: flex;
          align-items: center;
          background-color: #FFF;
          height: 80rpx;
          padding: 10rpx 0 0 20rpx;
          border-bottom: 1px solid #efefef;

          > view:nth-of-type(1) {
            width: 30%;
            // font-weight: 700;
          }

          > view:nth-of-type(2) {
            width: 70%;
            border-radius: 10rpx;
            overflow: hidden;


            input {
              background-color: #FFF;
              font-size: 28rpx;
              padding: 16rpx 8rpx 16rpx 15rpx;
            }
          }
        }
      }
    }

    .btns {
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 20rpx;

      .btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 500rpx;
        height: 70rpx;
        border-radius: 40rpx;
        color: #FFF;
        font-size: 28rpx;
        margin: 20rpx 10rpx 0 0;
        background: $uni-color;
        //margin-top: 20rpx;
        border-radius: 40rpx;
      }
    }

  }
}
</style>
<script>
	export default {
		data() {
			return {
				value: "",
				fileList: []
			}
		},
		onLoad(args) {

		},
		methods: {
			deleteImage(e){
				this.fileList.splice(e.index, 1)
			},
			afterRead(e){
				let self = this
				e.file.forEach(file => {
					self.$Oss.ossUpload(file.url).then(url => {
						self.fileList.push({
							url
						})
					})
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.help {
		.help-box {
			width: 92%;
			margin-left: 4%;

			.help-issue {
				margin: 20rpx;
				font-size: 28rpx;
				font-weight: 600;
				color: #333333;
			}

			.help-screenshot {
				display: flex;
				align-items: center;
				background-color: #fff;
				padding: 20rpx;
			}

			.help-button {
				display: flex;
				justify-content: center;
				font-size: 24rpx;
				flex-shrink: 0;
				margin-top: 60rpx;

				view {
					padding: 14rpx 120rpx;
					border-radius: 38rpx;
				}

				view:nth-child(1) {
					background: $uni-color;
					color: #fff;
				}

				view:nth-child(2) {
					color: #FFFDF6;
					background-color: #C83741;
				}
			}
		}
	}
</style>