123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- <template>
- <view class="center">
- <view class="flex row form_css">
- <view class="left-text">被举报车队</view>
- <view class="right-text">
- <u-avatar :src="formData.coverUrl" size="24" class="img_css"></u-avatar>
- <view class="">
- {{formData.fleetName}}
- </view>
- </view>
- </view>
- <!-- <view class="">被举报车队</view> -->
- <view class="">举报信息</view>
- <view class="textarea">
- <u--textarea v-model="reportInfo.content" placeholder="输入要举报的内容,10-300字" maxlength="300" height="100"></u--textarea>
- </view>
- <u-upload class="uview-upload" :fileList="fileList1" @afterRead="afterRead($event)" @delete="deletePic"
- name="1" multiple :maxCount="1" style="z-index: 9999;"></u-upload>
- <u-toast ref="uToast"></u-toast>
- <u-modal :show="tipsShow" :title="alertTitle" :closeOnClickOverlay='true' :showCancelButton='true'
- confirmColor='#2772FB' @confirm="confirmClick" @close="cancelClick" @cancel="cancelClick"></u-modal>
- <u-button type="primary" text="提交" class="btn_css" @click="$u.throttle(submit, 1000)"></u-button>
- </view>
- </template>
- <script>
- import uploadImage from '@/components/ossutil/uploadFile.js';
- import permision from "@/js_sdk/wa-permission/permission.js";
- export default{
- data(){
- return{
- fileList1:[],
- content:"",
- textNumber:300,
- formData:{},
- fleetId:"",
- reportInfo:{},
- tipsShow:false,
- alertTitle:""
- }
- },
- onShow(){},
- onLoad(options){
- this.fleetId = options.id
- this.get_camera_permission()
- this.getList()
- },
- methods:{
- async get_camera_permission() {
- var photol=await permision.requestAndroidPermission("android.permission.CAMERA")
- if(photol == false){
- uni.showModal({
- title: '提示',
- content: '您已经关闭相册权限,去设置',
- success: function (res) {
- if (res.confirm) {
- permision.gotoAppPermissionSetting()
- // plus.runtime.openURL("app-settings:");
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- }
- },
- submit(){
- if (!this.reportInfo.content) {
- this.$refs.uToast.show({
- type: 'error',
- message: "请输入要举报的内容!",
- })
- return
- }
- if (this.reportInfo.content.length < 10) {
- this.$refs.uToast.show({
- type: 'error',
- message: "举报内容不能小于10个字!",
- })
- return
- }
- if (this.fileList1.length == 0) {
- this.$refs.uToast.show({
- type: 'error',
- message: "请上传图片!",
- })
- return
- }
- this.reportInfo.id = uni.getStorageSync("firstAuthentication").commonId
- this.reportInfo.name = uni.getStorageSync("firstAuthentication").driverName
- this.reportInfo.flag = 3
- this.alertTitle="确定要举报该车队"
- this.tipsShow = true
- },
- cancelClick(){
- this.tipsShow = false
- },
- confirmClick(){
- this.tipsShow = false
- this.$request.baseRequest('post', '/feedbackReport/api/addInfo', this.reportInfo).then(res => {
- if(res.code == 200){
-
- this.$refs.uToast.show({
- type: 'success',
- message: "队员删除成功!",
- complete() {
- uni.navigateBack({
- delta: 1
- });
- }
- })
- }else{
- this.$refs.uToast.show({
- type: 'error',
- message: res.message,
- })
- }
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- },
- getList() {
- this.$request.baseRequest('get', '/fleetInfo/getFleetInfo', {
- id: this.fleetId
- }).then(res => {
- this.formData = res.data
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- },
- // 删除图片
- deletePic(event) {
- console.log(this[`fileList${event.name}`])
- this[`fileList${event.name}`].splice(event.index, 1)
- },
- // 新增图片
- async afterRead(event) {
- // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
- let lists = [].concat(event.file)
- let fileListLen = this[`fileList${event.name}`].length
- lists.map((item) => {
- this[`fileList${event.name}`].push({
- ...item,
- status: 'uploading',
- message: '上传中'
- })
- })
- for (let i = 0; i < lists.length; i++) {
- const result = await this.uploadFilePromise(lists[i].url)
- let item = this[`fileList${event.name}`][fileListLen]
- this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
- status: 'success',
- message: '',
- url: result
- }))
- fileListLen++
- }
- },
- uploadFilePromise(url) {
- uploadImage('image',url, 'appData/',
- result => {
- // 上传成功回调函数
- this.reportInfo.url = result
- }
- )
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .center{
- padding: 30rpx;
- }
- .form_css {
- width: 100%;
- display: flex;
- margin: 30rpx 0;
- height: 80rpx;
- border-bottom: 1px solid #eeeeee;
-
- .left-text {
- width: 50%;
- text-align: left;
- }
-
- .right-text {
- width: 50%;
- justify-content: flex-end;
- display: flex;
- text-align: right;
- color: #363636;
- // font-size: 28rpx;
- .img_css{
- margin: 0 10rpx;
- }
- }
- }
- .textarea{
- margin: 30rpx 0;
- }
- .btn_css{
- margin-top: 40rpx;
- }
- </style>
|