Feat(时令尝鲜):接口对接
This commit is contained in:
@@ -32,23 +32,33 @@
|
||||
</view>
|
||||
<view class="textarea">
|
||||
<textarea placeholder="商品满足你的期待么?说说你的想法,分享给想买的他们吧~" v-model="expect"></textarea>
|
||||
<view class="list acea-row row-middle">
|
||||
<view
|
||||
class="pictrue"
|
||||
v-for="(item, uploadPicturesIndex) in uploadPictures"
|
||||
:key="uploadPicturesIndex"
|
||||
>
|
||||
<image :src="item"/>
|
||||
<text
|
||||
class="iconfont icon-guanbi1 font-color-red"
|
||||
@click="uploadPictures.splice(uploadPicturesIndex, 1)"
|
||||
></text>
|
||||
</view>
|
||||
<view class="pictrue uploadBnt acea-row row-center-wrapper row-column" @tap="chooseImage">
|
||||
<text class="iconfont icon-icon25201"></text>
|
||||
<view>上传图片</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<u-upload
|
||||
:fileList="uploadPictures"
|
||||
@afterRead="afterRead"
|
||||
@delete="deletePic"
|
||||
name="uploadPictures"
|
||||
multiple
|
||||
:maxCount="9"
|
||||
></u-upload>
|
||||
<!-- <view class="list acea-row row-middle">-->
|
||||
<!-- <view-->
|
||||
<!-- class="pictrue"-->
|
||||
<!-- v-for="(item, uploadPicturesIndex) in uploadPictures"-->
|
||||
<!-- :key="uploadPicturesIndex"-->
|
||||
<!-- >-->
|
||||
<!-- <image :src="item"/>-->
|
||||
<!-- <text-->
|
||||
<!-- class="iconfont icon-guanbi1 font-color-red"-->
|
||||
<!-- @click="uploadPictures.splice(uploadPicturesIndex, 1)"-->
|
||||
<!-- ></text>-->
|
||||
<!-- </view>-->
|
||||
<!-- <view class="pictrue uploadBnt acea-row row-center-wrapper row-column" @tap="chooseImage">-->
|
||||
<!-- <text class="iconfont icon-icon25201"></text>-->
|
||||
<!-- <view>上传图片</view>-->
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
|
||||
</view>
|
||||
<view class="evaluateBnt bg-color-red" @click="submit">立即评价</view>
|
||||
</view>
|
||||
@@ -61,7 +71,7 @@
|
||||
</style>
|
||||
<script>
|
||||
import {postOrderComment, postOrderProduct} from "@/api/store";
|
||||
import {chooseImage, trim} from "@/utils";
|
||||
import {trim, uploadImage} from "@/utils";
|
||||
import {required} from "@/utils/validate";
|
||||
import {validatorDefaultCatch} from "@/utils/dialog";
|
||||
|
||||
@@ -124,10 +134,26 @@ export default {
|
||||
stars: function (indexn, indexw) {
|
||||
this.scoreList[indexw].index = indexn;
|
||||
},
|
||||
chooseImage() {
|
||||
chooseImage(img => {
|
||||
this.uploadPictures.push(img);
|
||||
});
|
||||
// chooseImage() {
|
||||
// chooseImage(img => {
|
||||
// this.uploadPictures.push(img);
|
||||
// });
|
||||
// },
|
||||
|
||||
// 删除图片
|
||||
deletePic(event) {
|
||||
this[`${event.name}`].splice(event.index, 1)
|
||||
},
|
||||
|
||||
afterRead(event) {
|
||||
let that = this;
|
||||
if (event.file.length > 0) {
|
||||
event.file.map(item => {
|
||||
uploadImage(item.url, img => {
|
||||
that.uploadPictures.push({url: img})
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
async submit() {
|
||||
const expect = trim(this.expect),
|
||||
@@ -154,11 +180,14 @@ export default {
|
||||
} catch (e) {
|
||||
return validatorDefaultCatch(e);
|
||||
}
|
||||
|
||||
let temp = this.uploadPictures.map(item => item.url)
|
||||
let pics = temp.join(",")
|
||||
postOrderComment({
|
||||
productScore: product_score,
|
||||
serviceScore: service_score,
|
||||
unique: this.unique,
|
||||
pics: this.uploadPictures.join(","),
|
||||
pics,
|
||||
comment: expect
|
||||
})
|
||||
.then(() => {
|
||||
|
||||
Reference in New Issue
Block a user