作者 刘晓艳

合并分支 'wumengyu' 到 'master'

优化申诉上传图片



查看合并请求 !11
... ... @@ -95,15 +95,15 @@ Page({
if (data.code == 20000) {
//服务器返回格式: { "Catalog": "testFolder", "FileName": "1.jpg", "Url": "https://test.com/1.jpg" }
if (current === 0) {
self.setData({image: data.data.url});
self.setData({image: data.data.url,image_params:data.data.local_url});
} else if (current === 1) {
self.setData({image1: data.data.url});
self.setData({image1: data.data.url,image_params1:data.data.local_url});
} else {
self.setData({image2: data.data.url});
self.setData({image2: data.data.url,image_params2:data.data.local_url});
}
const images = [];
const new_images = [];
images.push(self.data.image,self.data.image1,self.data.image2);
images.push(self.data.image_params,self.data.image_params1,self.data.image_params2);
images.map((item)=> {
if(item !== '') {
new_images.push(item)
... ... @@ -111,6 +111,7 @@ Page({
});
self.setData({new_images: new_images.join(',')});
console.log('images',new_images.join(','));
} else {
wx.showModal({
title: '提示',
... ... @@ -159,7 +160,11 @@ Page({
icon: 'success',
success:function () {
setTimeout(function () {
self.setData({image: '',image1: '',imag2: '',current: 1})
self.setData({
image: '',image1: '',imag2: '',
current: 1,examining:[],has_more:true,page_number:1
});
self.getMyComplain(self.data.current)
},500)
}
})
... ... @@ -169,6 +174,7 @@ Page({
},
//我的申诉
getMyComplain(current) {
console.log(this.data.has_more);
if(!this.data.has_more) return;
this.setData({has_more: false});
let url = '/portal/Experiment/user_complain_list';
... ... @@ -188,6 +194,30 @@ Page({
console.log(this.data.examining);
})
},
//取消申诉
cancel(e) {
const id = e.currentTarget.dataset.id;
let url = '/portal/Experiment/user_complain_cancel';
let header = {
"XX-token": wx.getStorageSync('token')
};
let params = {
complain_id: id,//申诉id
};
app.post(url, params, header).then((res) => {
console.log('取消申诉',res);
if(res.is_success == 1) {
wx.showToast({title:'取消成功',icon:'none'});
const current = 1;
this.setData({examining:[],has_more:true,page_number:1});
this.getMyComplain(+current)
}else {
wx.showToast({title:'取消失败,请稍候再试',icon:'none'})
}
// this.setData({examining: this.data.examining.concat(res.list)});
// console.log(this.data.examining);
})
},
//查看原因跳转申诉详情页
listDetail(e) {
const current = +e.currentTarget.dataset.index;
... ...
... ... @@ -55,12 +55,14 @@
<view>提交时间:{{item.create_time}}</view>
<view class='review_content_box'>
<view class='review_img'>
<image src='{{item.images[0]}}'></image>
<image src='{{item.images[0]}}' wx:if="{{item.re_description === ''}}"></image>
<image src='{{item.re_images}}' wx:if="{{item.re_description !== ''}}"></image>
</view>
<view class='review_content'>
<view class='review_info'>{{item.description}}</view>
<view class='review_info' wx:if="{{item.re_description === ''}}" >{{item.description}}</view>
<view class='review_info' wx:if="{{item.re_description !== ''}}">{{item.re_description}}</view>
<view class='review_btn'>
<view class='cancle_btn'>取消申诉</view>
<view class='cancle_btn' catchtap="cancel" data-id="{{item.id}}">取消申诉</view>
<view class='review_state'>审核中</view>
</view>
</view>
... ... @@ -108,6 +110,6 @@
</view>
</view>
</block>
<view class="no-data" wx:if="{{examining.length === 0}}">
<view class="no-data" wx:if="{{examining.length === 0 && current !== 0}}">
<text>暂无数据</text>
</view>
\ No newline at end of file
... ...
... ... @@ -2,10 +2,13 @@
page {
background: #f5f5f5;
overflow: hidden;
/* overflow: hidden; */
}
.tab_box {
position:fixed;
top:0;
left:0;
width: 100%;
height: 100rpx;
background: #fff;
... ... @@ -19,7 +22,9 @@ page {
box-sizing: border-box;
border-bottom: 1rpx solid rgba(0, 0, 0, 0.08);
}
.content_box {
margin-top: 100rpx;
}
.tab_item {
width: 25%;
position: relative;
... ... @@ -167,6 +172,7 @@ page {
.review_box {
padding: 20rpx;
margin-top: 100rpx;
}
.review_item {
... ...
... ... @@ -7,14 +7,16 @@ Page({
*/
data: {
status: 1,//1:审核中,2:已通过,3:未通过
reason: '网络不好',
reason: '',
id: 1,
image: [],
image_params:[],
disabled:true,
},
//补充提交申诉
againSubmit(e) {
const self = this;
console.log(self.data.image.join(','));
console.log(self.data.image.join(','),self.data.new_images);
if (self.data.image.length === 0) {
wx.showToast({title: '请上传申诉照片!', icon: 'none'})
} else {
... ... @@ -24,13 +26,13 @@ Page({
};
let params = {
id: self.data.id,//申诉id
images: self.data.image.join(','),
images: self.data.new_images,
description: this.data.reason,
formId: e.detail.formId,
};
app.post(url, params, header).then((res) => {
console.log('补充提交结果', res);
if (res.is_success) {
if (res.data.is_success) {
wx.showToast({
title: '二次申诉成功',
icon: 'success',
... ... @@ -53,8 +55,9 @@ Page({
const current = +e.currentTarget.dataset.current;
console.log(current);
const self = this;
console.log('status=3才可上传',self.data.detail.status);
// self.setData({current:current})
if (self.data.status === 3) {
if (self.data.detail.status === 3) {
wx.chooseImage({
count: 3, //最多可以选择的图片总数
sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
... ... @@ -87,15 +90,31 @@ Page({
console.log('data',data);
if (data.code == 20000) {
//服务器返回格式: { "Catalog": "testFolder", "FileName": "1.jpg", "Url": "https://test.com/1.jpg" }
self.setData({[`image[${current}]`]: data.data.url});
} else {
if (current === 0) {
self.setData({[`image[${current}]`]: data.data.url,image_params:data.data.local_url});
} else if (current === 1) {
self.setData({[`image[${current}]`]: data.data.url,image_params1:data.data.local_url});
} else {
self.setData({[`image[${current}]`]: data.data.url,image_params2:data.data.local_url});
}
const images = [];
const new_images = [];
images.push(self.data.image_params,self.data.image_params1,self.data.image_params2);
images.map((item)=> {
if(item !== '') {
new_images.push(item)
}
});
self.setData({new_images: new_images.join(',')});
console.log('new_images',new_images.join(','));
}else {
wx.showModal({
title: '提示',
content: data.msg,
showCancel: false
})
}
},
fail: function(res) {
wx.hideToast();
... ... @@ -112,6 +131,10 @@ Page({
})
}
},
//重新输入申诉理由
reasonInput(e) {
this.setData({reason:e.detail.value})
},
//获取申诉详情
getAppealInfo() {
let url = '/portal/Experiment/user_complain_detail';
... ... @@ -126,6 +149,9 @@ Page({
if (res.info.status === 4 || res.info.status === 5 || res.info.status === 6) {
this.setData({detail: res.info, image: res.info.re_images})
} else {
if(res.info.status === 3) {
this.setData({disabled:false})
}
this.setData({detail: res.info, image: res.info.images})
}
})
... ... @@ -137,7 +163,7 @@ Page({
const self = this;
console.log('options', options);
self.setData({
status: +options.status ? +options.status : '',
// status: options.status,
test_name: options.test_name ? options.test_name : '',
id: +options.id ? +options.id : '',
});
... ...
... ... @@ -20,7 +20,10 @@
<view class='item_list' wx:if="{{detail.status !== 4 && detail.status !== 5 && detail.status !== 6 }}">
<view class='list_title'>申诉理由</view>
<view class='list_input'>
<view>{{detail.description}}</view>
<textarea bindinput="reasonInput" value="{{detail.description || reason}}"
disabled="{{disabled}}" wx:if="{{detail.re_description ==''}}"></textarea>
<textarea bindinput="reasonInput" value="{{detail.re_description || reason}}"
disabled="{{disabled}}" wx:if="{{detail.re_description !==''}}"></textarea>
<view class='word_num'>{{detail.create_time}}</view>
</view>
</view>
... ...
... ... @@ -4,6 +4,7 @@
.content_box {
display: flex;
flex-direction: column;
margin-top: 0;
}
.uoload_box {
margin-top: 0;
... ... @@ -17,6 +18,9 @@
padding:0 20rpx;
box-sizing: border-box;
}
.list_input textarea {
border:1rpx solid #f2f2f2;
}
.word_num{
font-size: 28rpx;
color: #6F6F6F;
... ...