|
@@ -5,8 +5,8 @@
|
|
|
<h3><strong>礼物匹配</strong></h3>
|
|
|
<p>希望对方的性别是</p>
|
|
|
<van-radio-group v-model="gender">
|
|
|
- <van-radio name="0" checked-color="#fd6740" style="float: left; margin-right: 20px">男</van-radio>
|
|
|
- <van-radio name="1" checked-color="#fd6740">女</van-radio>
|
|
|
+ <van-radio name="1" checked-color="#fd6740" style="float: left; margin-right: 20px">男</van-radio>
|
|
|
+ <van-radio name="2" checked-color="#fd6740">女</van-radio>
|
|
|
</van-radio-group>
|
|
|
<p>礼物名称</p>
|
|
|
<van-field
|
|
@@ -33,34 +33,42 @@
|
|
|
</van-cell-group>
|
|
|
|
|
|
<p>礼物标签</p>
|
|
|
- <div style="margin-bottom: 20px">
|
|
|
- <van-radio-group v-model="tag">
|
|
|
- <van-radio
|
|
|
- v-for="(item, index) in tags"
|
|
|
- :key="index"
|
|
|
- :name="index"
|
|
|
- checked-color="#fd6740"
|
|
|
- :style="(index+1) % 4 === 0 ? br : nobr">{{item}}
|
|
|
- </van-radio>
|
|
|
- </van-radio-group>
|
|
|
- </div>
|
|
|
+ <van-radio-group v-model="tag">
|
|
|
+ <div
|
|
|
+ v-for="i in [0, 1 , 2, 3]"
|
|
|
+ :key="i"
|
|
|
+ style="height: 40px"
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ v-for="j in [0, 1, 2, 3]"
|
|
|
+ :key="j"
|
|
|
+ style="float: left; width: 25%"
|
|
|
+ >
|
|
|
+ <van-radio
|
|
|
+ v-if="i * 4 + j < tags.length"
|
|
|
+ :name="i * 4 + j"
|
|
|
+ checked-color="#fd6740"
|
|
|
+ >{{tags[i * 4 + j]}}
|
|
|
+ </van-radio>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </van-radio-group>
|
|
|
|
|
|
</div>
|
|
|
- <div class="card" style="margin-bottom: 70px">
|
|
|
+ <div class="card" style="margin-bottom: 10px">
|
|
|
<p>上传礼物照片</p>
|
|
|
-
|
|
|
<div style="margin-bottom: 10px">
|
|
|
<add-photo :photoURL="imgUrl" @onRead="onRead"/>
|
|
|
- <van-button
|
|
|
- type="primary"
|
|
|
- class="submit_button"
|
|
|
- @click="publishPresent"
|
|
|
- :loading="loading"
|
|
|
- >下一步
|
|
|
- </van-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
+ <van-button
|
|
|
+ type="primary"
|
|
|
+ class="submit_button"
|
|
|
+ @click="publishPresent"
|
|
|
+ :loading="loading"
|
|
|
+ >下一步
|
|
|
+ </van-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -91,7 +99,7 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- gender: '0',
|
|
|
+ gender: '1',
|
|
|
presentId: '',
|
|
|
presentName: '',
|
|
|
pnError: false,
|
|
@@ -104,8 +112,6 @@
|
|
|
],
|
|
|
tag: 0,
|
|
|
photo: null,
|
|
|
- nobr: "float: left; margin-right: 5px",
|
|
|
- br: "",
|
|
|
loading: false
|
|
|
}
|
|
|
},
|
|
@@ -134,52 +140,106 @@
|
|
|
|
|
|
console.log('------- photo -------');
|
|
|
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') {
|
|
|
- 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('share');
|
|
|
- } else {
|
|
|
- Toast.fail("上传失败,请检查网络");
|
|
|
- that.loading = false;
|
|
|
- }
|
|
|
- }, present);
|
|
|
- } else {
|
|
|
- Toast.fail('上传图片失败,请检查网络');
|
|
|
- that.loading = false;
|
|
|
- }
|
|
|
- }, formData);
|
|
|
|
|
|
+ let that = this;
|
|
|
+ // 如果没有改变图片,直接上传
|
|
|
+ if (this.imgUrl && this.imgUrl === this.photo) {
|
|
|
+ let imgURL = this.imgUrl;
|
|
|
+ imgURL = '/' + imgURL.split('/')[3] + '/' + imgURL.split('/')[4] + '/' + imgURL.split('/')[5];
|
|
|
+ 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: 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('share');
|
|
|
+ } else {
|
|
|
+ Toast.fail("上传失败,请检查网络");
|
|
|
+ that.loading = false;
|
|
|
+ }
|
|
|
+ }, present);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ let formData = new FormData();
|
|
|
+ formData.append('file', this.photo);
|
|
|
+ let imgURL = '';
|
|
|
+ // 先上传图片
|
|
|
+ BasicFunction.get_data("fileserver/upload?sign=abcdefg", function (res) {
|
|
|
+ console.log('----- upload photo result -----');
|
|
|
+ console.log(res);
|
|
|
+ if (res.ret === '10000') {
|
|
|
+ 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('share');
|
|
|
+ } else {
|
|
|
+ Toast.fail("上传失败,请检查网络");
|
|
|
+ that.loading = false;
|
|
|
+ }
|
|
|
+ }, present);
|
|
|
+ } else {
|
|
|
+ Toast.fail('上传图片失败,请检查网络');
|
|
|
+ that.loading = false;
|
|
|
+ }
|
|
|
+ }, formData);
|
|
|
+ }
|
|
|
},
|
|
|
onRead: function (e) {
|
|
|
this.photo = e;
|
|
@@ -195,11 +255,12 @@
|
|
|
console.log('----- Present Info -----');
|
|
|
console.log(present);
|
|
|
this.presentId = present.id;
|
|
|
- this.radio = present.gender.toString();
|
|
|
+ this.gender = present.gender.toString();
|
|
|
this.presentName = present.name;
|
|
|
this.desc = present.desc_long;
|
|
|
this.tag = present.tags;
|
|
|
this.imgUrl = present.imgUrl;
|
|
|
+ this.photo = present.imgUrl;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -249,15 +310,10 @@
|
|
|
padding: 15px;
|
|
|
text-align: left;
|
|
|
}
|
|
|
-
|
|
|
.submit_button {
|
|
|
margin-bottom: 10px;
|
|
|
margin-left: auto;
|
|
|
margin-right: auto;
|
|
|
- position: fixed;
|
|
|
- bottom: 0;
|
|
|
- left: 0;
|
|
|
- right: 0;
|
|
|
background-color: #fd6740;
|
|
|
border-color: #fd6740;
|
|
|
width: 85%;
|