|
|
<template> <view class="pageBgImg"> <topNavbar title="我要咨询"></topNavbar> <view class="pad"> <!-- 投诉类别 --> <view class="card"> <view class="row"> <view class="label">投诉类别</view> <view class="rightSelect"> <u-radio-group v-model="form.radiovalue1" > <u-radio :customStyle="{marginRight: '24rpx'}" v-for="(item, index) in radiolist1" :key="index" :label="item.name" :name="item.name" > </u-radio> </u-radio-group> </view> </view> </view> <!-- 驾校名称 教练名称 --> <view class="card"> <view class="row"> <view class="label">驾校名称</view> <view @click="showShoolName=true" class="select_row my" > <input v-model="form.classModel" placeholder="请选择" @click="showShoolName=true" disabled/></input> <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon> </view> </view> <view class="row"> <view class="label">教练名称</view> <view @click="showShoolName=true" class="select_row" > <input v-model="form.classModel" placeholder="请选择" @click="showShoolName=true" disabled/></input> <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon> </view> </view> </view> <!-- 投诉类型 --> <view class="card"> <view class="row"> <view class="label">投诉类型</view> <view @click="showShoolName=true" class="select_row" > <input v-model="form.classModel" placeholder="请选择" @click="showShoolName=true" disabled/></input> <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon> </view> </view> </view> <!-- 咨询内容 --> <view class="card" style="padding: 0 24rpx 24rpx 24rpx ;"> <view class="h2">咨询内容</view> <view class="textareaBg"> <view class="flex"> <view class="icon"> <image src="@/static/images/index/edit.png" mode=""></image> </view> <view class="inputBox"> <u-textarea v-model="value" ref="textarea" placeholder="详细说明问题,以便获得更好的回答~"></u-textarea> </view> </view> <view class="phoneBox"> <view class="imgBox"> <view class="img"> <view class="minusCircle"> <u-icon name="close-circle-fill" size="20" color="#b9061d"></u-icon> </view> <image src="../../../../static/logo.png" mode=""></image> </view> </view> <view class="phone" @click="chooseImages"> <view class="phoneIcon"> <image src="@/static/images/index/btn_tupian.png" mode=""></image> </view> <view class="lab">添加图片</view> </view> </view> </view> </view> <view class="card"> <view class="phone_row"> <view class="label">联系电话</view> <view class="uInput my"> <u--input placeholder="输入手机号码,以便我们回复您!" v-model="value" border="none" type="number" fontSize="14"></u--input> </view> </view> </view> <view class="btn active">提交</view> </view> <u-picker :show="showShoolName" :columns="shoolArr" keyName="lab" @confirm="confirmSex" @cancel="showShoolName=false"></u-picker> <!-- <u-picker :show="show" :columns="shoolArr" keyName="lab"></u-picker> --> </view> </template>
<script> import { APP_API, APP_HOST } from '@/site.config.js'; const _url = APP_HOST + APP_API + '/util/manage/uploadFile.do'; export default { data() { return { value: '', imgArr: [], showShoolName: false, shoolArr: [ [ {lab: '翔力驾校',id: 1} ] ], form: { value: '投诉驾校' }, radiolist1: [{ name: '投诉驾校', disabled: false }, { name: '投诉教练', disabled: false }, ], } }, methods: { // 选择驾校
confirmSex(val) { console.log(val) this.showShoolName = false }, //选择图片
chooseImages(type) { let imgNum = 3 - (this.imgArr.length) uni.chooseImage({ count: imgNum, //允许选择的数量
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], //从相册选择
success: res => { uni.showLoading({ title: '图片上传中...' }); res.tempFilePaths.forEach( (item,index)=>{ this.uploadImgApi(item) }) } }) }, uploadImgApi(filePath) { console.log(filePath) let _this = this // 上传图片到服务器
uni.uploadFile({ url: _url,//接口
filePath: filePath,//要上传的图片的本地路径
name: 'file', formData: { fileType: 1, fileSuffix: "png" }, header: { token: uni.getStorageSync("Authorization") || '', }, success(res) { console.log('上传成功') let res2 = JSON.parse(res.data) _this.imgArr.push(res2.data) console.log(res2) uni.hideLoading(); }, complete: ()=> {} }) }, } } </script>
<style lang="scss" scoped> .pageBgImg { .pad {} .card { margin-top: 20rpx; .h2 { font-size: 28rpx; font-weight: 600; line-height: 96rpx; } .textareaBg { min-height: 364rpx; background: #F8F8F8; border-radius: 16rpx; border: 2rpx solid #E8E9EC; display: flex; flex-direction: column; justify-content: space-between; .flex { padding: 20rpx; align-items: flex-start; .icon { width: 24rpx; height: 24rpx; margin: 0 14rpx 0 24rpx; } .inputBox { flex: 1; } /deep/ .inputBox .u-textarea { padding: 0 !important; border: none !important; background: none !important; } } .phoneBox { display: flex; padding: 0 10rpx 20rpx 20rpx; .imgBox { display: flex; .img { margin-right: 14rpx; position: relative; width: 160rpx; height: 160rpx; image { width: 160rpx; height: 160rpx; border-radius: 8rpx; overflow: hidden; } .minusCircle { position: absolute; right: -14rpx; top: -20rpx; z-index: 9; } } } .phone { border: 2rpx dashed #CDCED0; width: 160rpx; height: 160rpx; background: #F8F8F8; border-radius: 8rpx; overflow: hidden; display: flex; align-items: center; justify-content: center; flex-direction: column; .phoneIcon { width: 60rpx; height: 60rpx; } .lab { font-size: 20rpx; color: #686B73; margin-top: 8rpx; } } } } } .phone_row { display: flex; height: 104rpx; padding: 0 28rpx; line-height: 104rpx; .label { font-size: 28rpx; font-weight: 600; margin-right: 50rpx; } .uInput { flex: 1; } } .btn { width: 396rpx; height: 72rpx; background: #D1E7FE; border-radius: 8rpx; font-size: 28rpx; text-align: center; line-height: 72rpx; margin: 100rpx auto 114rpx auto; color: #fff; &.active { background: $themC; } } } .row { height: 120rpx; display: flex; align-items: center; padding-right: 30rpx; .label { font-size: 28rpx; font-weight: 600; width: 184rpx; text-align: center; } .select_row { display: flex; align-items: center; justify-content: space-between; flex: 1; input { font-size: 28rpx; color: #333; } } } </style>
|