填写日志bug
This commit is contained in:
@@ -169,10 +169,8 @@ export default {
|
||||
}&partyOrgId=${this.user.partyOrgId}&size=${10000}`
|
||||
)
|
||||
.then((res) => {
|
||||
if (res.code == 0) {
|
||||
if (res.data.records == null) {
|
||||
this.list = [];
|
||||
} else {
|
||||
if (res?.data) {
|
||||
if (res.data?.records) {
|
||||
this.list = res.data.records;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,13 @@
|
||||
<view class="main">
|
||||
<div class="textarea">
|
||||
<div class="color-333"><span class="color-red">*</span>活动总结</div>
|
||||
<textarea type="textarea" placeholder="填写本次活动参与心得体会(200字以内)" v-model="baseInfo.content" adjust-position="false" maxlength="200"></textarea>
|
||||
<textarea
|
||||
type="textarea"
|
||||
placeholder="填写本次活动参与心得体会(200字以内)"
|
||||
v-model="baseInfo.content"
|
||||
adjust-position="false"
|
||||
maxlength="200"
|
||||
></textarea>
|
||||
</div>
|
||||
<view class="uni-uploader">
|
||||
<view class="title-box title-box-margin">
|
||||
@@ -15,11 +21,26 @@
|
||||
<view class="uni-uploader__files">
|
||||
<block v-for="(image, index) in imageList" :key="index">
|
||||
<view class="uni-uploader__file">
|
||||
<image class="uni-uploader__img" :src="image.accessUrl" :data-index="index" @tap="previewImage"></image>
|
||||
<AiUniIcon type="clear" class="icon" color="#8f8f94" size="20" @click="deleteImage(index)"></AiUniIcon>
|
||||
<image
|
||||
class="uni-uploader__img"
|
||||
:src="image.accessUrl"
|
||||
:data-index="index"
|
||||
@tap="previewImage"
|
||||
></image>
|
||||
<AiUniIcon
|
||||
type="clear"
|
||||
class="icon"
|
||||
color="#8f8f94"
|
||||
size="20"
|
||||
@click="deleteImage(index)"
|
||||
></AiUniIcon>
|
||||
</view>
|
||||
</block>
|
||||
<view class="pre-view" @tap="chooseImageType" v-if="imageList.length < 9">
|
||||
<view
|
||||
class="pre-view"
|
||||
@tap="chooseImageType"
|
||||
v-if="imageList.length < 9"
|
||||
>
|
||||
<text class="pre-label">+</text>
|
||||
<text class="add-image">添加照片</text>
|
||||
</view>
|
||||
@@ -33,57 +54,62 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from "@/utils/axios.js"
|
||||
import settings from "@/utils/config"
|
||||
import {mapState} from 'vuex'
|
||||
export default {
|
||||
name: "fillLog",
|
||||
data() {
|
||||
return {
|
||||
reportId:'',
|
||||
reportId: "",
|
||||
baseInfo: {
|
||||
content:'',
|
||||
content: "",
|
||||
fileIds: [],
|
||||
reportId:'',
|
||||
id:''
|
||||
reportId: "",
|
||||
id: "",
|
||||
},
|
||||
imageList: [],
|
||||
sourceTypeIndex: 2,
|
||||
sourceType:[ // 图片来源类型
|
||||
['camera'],
|
||||
['album'],
|
||||
sourceType: [
|
||||
// 图片来源类型
|
||||
["camera"],
|
||||
["album"],
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
uni.setNavigationBarColor({
|
||||
frontColor: "#ffffff",
|
||||
backgroundColor: "#e60012",
|
||||
})
|
||||
});
|
||||
this.baseInfo.reportId = options.reportId;
|
||||
this.baseInfo.id = options.signupId;
|
||||
options.signupContent ? this.logReport() : null;
|
||||
},
|
||||
computed: {
|
||||
...mapState(['user']),
|
||||
},
|
||||
methods: {
|
||||
// 选择照片类型
|
||||
chooseImageType() {
|
||||
let that = this
|
||||
let that = this;
|
||||
uni.showActionSheet({
|
||||
itemList:['拍照','从相册选择'],
|
||||
itemList: ["拍照", "从相册选择"],
|
||||
success: function (res) {
|
||||
that.sourceTypeIndex = res.tapIndex
|
||||
that.chooseImage()
|
||||
}
|
||||
})
|
||||
that.sourceTypeIndex = res.tapIndex;
|
||||
that.chooseImage();
|
||||
},
|
||||
});
|
||||
},
|
||||
showModel(title) {
|
||||
uni.showModal({
|
||||
title: '温馨提示',
|
||||
title: "温馨提示",
|
||||
content: title,
|
||||
showCancel: false,
|
||||
confirmColor: "#135AB8",
|
||||
})
|
||||
});
|
||||
},
|
||||
chooseImage: async function () {
|
||||
let that = this
|
||||
let that = this;
|
||||
if (that.imageList.length === 9) {
|
||||
let isContinue = await that.isFullImg();
|
||||
if (!isContinue) {
|
||||
@@ -97,15 +123,15 @@
|
||||
count: 9,
|
||||
success: (res) => {
|
||||
// 图片的本地文件路径列表
|
||||
that.tempFilePaths = res.tempFilePaths
|
||||
that.tempFilePaths = res.tempFilePaths;
|
||||
// console.log(res.tempFilePaths)
|
||||
for (let i = 0; i < that.tempFilePaths.length; i++) {
|
||||
let str = ''
|
||||
let token = uni.getStorageSync("token")
|
||||
let str = "";
|
||||
let token = uni.getStorageSync("token");
|
||||
// console.log('token',token)
|
||||
let params = {
|
||||
token: token,
|
||||
}
|
||||
};
|
||||
// url String 是 开发者服务器 url
|
||||
// files Aarry 否 需要上传的文件列表。使用 files 时,filePath 和 name 不生效。 5+App
|
||||
// filePath String 是 要上传文件资源的路径。
|
||||
@@ -116,47 +142,50 @@
|
||||
// fail Function 否 接口调用失败的回调函数
|
||||
// complete Function 否 接口调用结束的回调函数(调用成功、失败都会执行)
|
||||
uni.uploadFile({
|
||||
url: axios.baseURL + '/admin/file/add',
|
||||
url: settings.baseUrl + "/admin/file/add",
|
||||
filePath: that.tempFilePaths[i],
|
||||
name: 'file',
|
||||
name: "file",
|
||||
// formData:params,
|
||||
header: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
'access_token': token,
|
||||
"Authorization": token
|
||||
access_token: token,
|
||||
Authorization: token,
|
||||
},
|
||||
success(res) {
|
||||
str = JSON.stringify(JSON.parse(res.data).data[0]).replace(/\"/g, "")
|
||||
str = JSON.stringify(JSON.parse(res.data).data[0]).replace(
|
||||
/\"/g,
|
||||
""
|
||||
);
|
||||
var temp = {
|
||||
fileId: str.split(";")[1],
|
||||
accessUrl: str.split(";")[0],
|
||||
}
|
||||
that.imageList = that.imageList.concat(temp)
|
||||
};
|
||||
that.imageList = that.imageList.concat(temp);
|
||||
if (that.imageList.length > 9) {
|
||||
that.imageList = that.imageList.slice(0, 9)
|
||||
that.imageList = that.imageList.slice(0, 9);
|
||||
uni.showToast({
|
||||
title: '图片最多只能上传9张',
|
||||
icon: "none"
|
||||
})
|
||||
title: "图片最多只能上传9张",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
that.imgUrl = JSON.stringify(that.imageList)
|
||||
that.imgUrl = JSON.stringify(that.imageList);
|
||||
},
|
||||
fail(res) {
|
||||
console.log('error',res)
|
||||
console.log("error", res);
|
||||
},
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
});
|
||||
},
|
||||
// 预览图片(大图预览)
|
||||
previewImage: function (e) {
|
||||
let that = this
|
||||
var current = e.target.dataset.index
|
||||
let that = this;
|
||||
var current = e.target.dataset.index;
|
||||
|
||||
var tempList = []
|
||||
var tempList = [];
|
||||
for (var i in that.imageList) {
|
||||
tempList.push(that.imageList[i].accessUrl)
|
||||
tempList.push(that.imageList[i].accessUrl);
|
||||
}
|
||||
|
||||
uni.previewImage({
|
||||
@@ -164,15 +193,15 @@
|
||||
current: tempList[current],
|
||||
urls: tempList,
|
||||
longPressActions: {
|
||||
itemList: ['发送给朋友', '保存图片', '收藏'],
|
||||
itemList: ["发送给朋友", "保存图片", "收藏"],
|
||||
success: function (data) {
|
||||
// console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
|
||||
},
|
||||
fail: function (err) {
|
||||
// console.log(err.errMsg);
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(err.errMsg);
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
// 删除照片
|
||||
deleteImage(index) {
|
||||
@@ -181,59 +210,63 @@
|
||||
report() {
|
||||
let arr = [];
|
||||
if (!this.baseInfo.content) {
|
||||
this.showModel('请填写活动总结')
|
||||
return false
|
||||
};
|
||||
this.showModel("请填写活动总结");
|
||||
return false;
|
||||
}
|
||||
this.imageList.map((e) => {
|
||||
arr.push(e.fileId);
|
||||
})
|
||||
});
|
||||
this.baseInfo.fileIds = arr;
|
||||
this.$instance.post(`/app/apppartyreport/log-add`,this.baseInfo,null).then(res => {
|
||||
this.$instance
|
||||
.post(`/app/apppartyreport/log-add`, this.baseInfo)
|
||||
.then((res) => {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
title: '提交',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
title: "提交",
|
||||
icon: "success",
|
||||
duration: 2000,
|
||||
});
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
delta: 1,
|
||||
});
|
||||
}
|
||||
}).catch(err=>{
|
||||
})
|
||||
.catch((err) => {
|
||||
uni.showToast({
|
||||
title: err,
|
||||
icon: "none",
|
||||
duration:1000
|
||||
})
|
||||
})
|
||||
duration: 1000,
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
logReport() {
|
||||
const userInfo = uni.getStorageSync("userInfo") ;
|
||||
this.$instance.post(`/app/apppartyreport/log-report?partyId=${userInfo.partyId}&reportId=${this.baseInfo.reportId}`)
|
||||
this.$instance
|
||||
.post(
|
||||
`/app/apppartyreport/log-report?partyId=${this.user.partyId}&reportId=${this.baseInfo.reportId}`
|
||||
)
|
||||
.then((res) => {
|
||||
if (res.code == 0 && res.data) {
|
||||
this.baseInfo.content = res.data.content;
|
||||
this.baseInfo.fileIds = res.data.fileIds;
|
||||
res.data.files.map((e) => {
|
||||
this.imageList.push({ accessUrl: e.accessUrl, fileId: e.id });
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
header {
|
||||
width: 100%;
|
||||
height: 112rpx;
|
||||
background-color: #E60012;
|
||||
background-color: #e60012;
|
||||
}
|
||||
.form {
|
||||
width: 100%;
|
||||
@@ -275,7 +308,7 @@
|
||||
align-items: center;
|
||||
color: #999999;
|
||||
font-size: 32rpx;
|
||||
background-color: #FFFFFF;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.picker > .AiArea {
|
||||
background-color: #fff !important;
|
||||
@@ -302,7 +335,6 @@
|
||||
background-color: #fff;
|
||||
line-height: 48rpx;
|
||||
padding: 0;
|
||||
|
||||
}
|
||||
|
||||
button::after {
|
||||
@@ -330,7 +362,7 @@
|
||||
justify-content: space-between;
|
||||
}
|
||||
.uni-uploader-info {
|
||||
color: #B2B2B2;
|
||||
color: #b2b2b2;
|
||||
}
|
||||
.uni-uploader-body {
|
||||
margin-top: 16rpx;
|
||||
@@ -354,10 +386,10 @@
|
||||
}
|
||||
.pre-label {
|
||||
font-size: 80rpx;
|
||||
color: #DDDDDD;
|
||||
color: #dddddd;
|
||||
}
|
||||
.add-image {
|
||||
color: #DDDDDD;
|
||||
color: #dddddd;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.pre-view {
|
||||
@@ -368,14 +400,13 @@
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
border-radius: 8rpx;
|
||||
border: 2rpx solid #DDDDDD;
|
||||
border: 2rpx solid #dddddd;
|
||||
}
|
||||
.icon {
|
||||
position: absolute;
|
||||
top: -15rpx;
|
||||
right: -10rpx;
|
||||
}
|
||||
|
||||
}
|
||||
.report {
|
||||
position: fixed;
|
||||
@@ -387,8 +418,6 @@
|
||||
text-align: center;
|
||||
background: rgba(230, 0, 18, 1);
|
||||
color: #fff;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -186,6 +186,11 @@ export default {
|
||||
url: `./partyDetail?id=${e.id}&listType=${this.navId}`
|
||||
})
|
||||
},
|
||||
goToLog(e) {
|
||||
uni.navigateTo({
|
||||
url: `./fillLog?signupId=${e.signupId}&reportId=${e.id}&signupContent=${e.signupContent}`
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user