|
@@ -50,15 +50,7 @@
|
|
|
<p>上传礼物照片</p>
|
|
|
|
|
|
<div style="margin-bottom: 10px">
|
|
|
- <!--<form method="POST" enctype="multipart/form-data"-->
|
|
|
- <!--action="https://gift-server.niimei.com/fileserver/upload?sign=abcdefg">-->
|
|
|
- <!--<add-photo v-model="hasPhoto"/>-->
|
|
|
- <!--<button type="submit" value="Upload"-->
|
|
|
- <!--class="van-button van-button--primary van-button--large submit_button"-->
|
|
|
- <!--@click="publishPresent">下一步-->
|
|
|
- <!--</button>-->
|
|
|
- <!--</form>-->
|
|
|
- <add-photo v-model="photo"/>
|
|
|
+ <add-photo :photoURL="imgUrl" @onRead="onRead"/>
|
|
|
<van-button type="primary" class="submit_button" @click="publishPresent">下一步</van-button>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -133,49 +125,51 @@
|
|
|
console.log(this.photo);
|
|
|
let formData = new FormData();
|
|
|
formData.append('file', this.photo);
|
|
|
+ let imgURL = '';
|
|
|
+ let that = this;
|
|
|
BasicFunction.get_data("fileserver/upload?sign=abcdefg", function (res) {
|
|
|
console.log('----- upload photo result -----');
|
|
|
console.log(res);
|
|
|
if (res.ret === '10000') {
|
|
|
- console.log('success');
|
|
|
+ imgURL = res.model;
|
|
|
+ console.log('img:' + imgURL);
|
|
|
+ let present = [{
|
|
|
+ goodid: that.presentId,
|
|
|
+ name: that.presentName,
|
|
|
+ goodsNo: "0", modelId: "0",
|
|
|
+ ownerId: userId.toString(),
|
|
|
+ goodFirstKind: gender,
|
|
|
+ goodSecondKind: tag.toString(),
|
|
|
+ sellPrice: "0.0", marketPrice: "0.0", costPrice: "0.0",
|
|
|
+ upTime: getNowFormatDate(), downTime: getNowFormatDate(), createTime: getNowFormatDate(),
|
|
|
+ storeNums: "0",
|
|
|
+ img: imgURL,
|
|
|
+ isDel: "0", content: "none", keywords: "none",
|
|
|
+ description: that.desc,
|
|
|
+ searchWords: "", weight: "0.0", point: "0", unit: "0", brandId: "0",
|
|
|
+ visit: "0", favorite: "0", sort: "0", listImg: "xx.jpg",
|
|
|
+ smallImg: "xx.jpg", specArray: "{}", exp: "0"
|
|
|
+ }];
|
|
|
+ console.log(present);
|
|
|
+ let url = "updateBatch";
|
|
|
+ if (that.presentId === '') url = "saveBatch";
|
|
|
+ BasicFunction.get_data("smartGoods/" + url, function (response) {
|
|
|
+ console.log("------ Data Rcvd in PresentReg --------");
|
|
|
+ console.log(response);
|
|
|
+ if (response.ret === "10000") {
|
|
|
+ that.$router.push('index');
|
|
|
+ } else {
|
|
|
+ Toast.fail("上传失败,请检查网络");
|
|
|
+ }
|
|
|
+ }, present);
|
|
|
} else {
|
|
|
Toast.fail('上传图片失败,请检查网络');
|
|
|
}
|
|
|
}, formData);
|
|
|
|
|
|
- let present = [{
|
|
|
- goodid: this.presentId,
|
|
|
- name: this.presentName,
|
|
|
- goodsNo: "0", modelId: "0",
|
|
|
- ownerId: userId.toString(),
|
|
|
- goodFirstKind: gender,
|
|
|
- goodSecondKind: tag.toString(),
|
|
|
- sellPrice: "0.0", marketPrice: "0.0", costPrice: "0.0",
|
|
|
- upTime: getNowFormatDate(), downTime: getNowFormatDate(), createTime: getNowFormatDate(),
|
|
|
- storeNums: "0",
|
|
|
- img: this.photo.name,
|
|
|
- isDel: "0", content: "none", keywords: "none",
|
|
|
- description: this.desc,
|
|
|
- searchWords: "", weight: "0.0", point: "0", unit: "0", brandId: "0",
|
|
|
- visit: "0", favorite: "0", sort: "0", listImg: "xx.jpg",
|
|
|
- smallImg: "xx.jpg", specArray: "{}", exp: "0"
|
|
|
- }];
|
|
|
- console.log(present);
|
|
|
- let that = this;
|
|
|
- let url = "updateBatch";
|
|
|
- if (this.presentId === '') url = "saveBatch";
|
|
|
- BasicFunction.get_data("smartGoods/" + url, function (response) {
|
|
|
- console.log("------ Data Rcvd in PresentReg --------");
|
|
|
- console.log(response);
|
|
|
- if(response.ret === "10000"){
|
|
|
- that.$router.push('index');
|
|
|
- } else {
|
|
|
- Toast.fail("上传失败,请检查网络");
|
|
|
- }
|
|
|
- }, present);
|
|
|
},
|
|
|
- onRead: function () {
|
|
|
- this.hasPhoto = true;
|
|
|
+ onRead: function (e) {
|
|
|
+ this.photo = e;
|
|
|
}
|
|
|
},
|
|
|
created: function () {
|
|
@@ -185,17 +179,14 @@
|
|
|
}
|
|
|
if(this.$route.query.present) {
|
|
|
let present = this.$route.query.present;
|
|
|
+ console.log('----- Present Info -----');
|
|
|
console.log(present);
|
|
|
this.presentId = present.id;
|
|
|
this.radio = present.gender.toString();
|
|
|
- this.presentName = present.presentName;
|
|
|
- this.desc = present.presentDesc;
|
|
|
- let tags = present.tags;
|
|
|
- let j = 13;
|
|
|
- for (let i = tags.length - 1; i >= 0; i--) {
|
|
|
- if (tags.charAt(i) === '1') this.result.push(j);
|
|
|
- j--;
|
|
|
- }
|
|
|
+ this.presentName = present.name;
|
|
|
+ this.desc = present.desc_long;
|
|
|
+ this.tag = present.tags;
|
|
|
+ this.imgUrl = present.imgUrl;
|
|
|
}
|
|
|
}
|
|
|
}
|