需求发布

This commit is contained in:
”chenxuelian“
2023-01-10 09:26:31 +08:00
parent e561054b6f
commit 7b474b06ef
4 changed files with 114 additions and 31 deletions

View File

@@ -73,7 +73,7 @@
<view style="background-color: #fff;">
<u-form-item label="手机" borderBottom>
<u--input placeholder="请输入手机号" :border="false" v-model="needsPublishForm.phone"
<u--input placeholder="请输入手机号" :border="false" v-model="needsPublishForm.mobile"
placeholder-style="color:#CCCCCC"></u--input>
</u-form-item>
<!-- <u-form-item label="验证" borderBottom>
@@ -95,7 +95,7 @@
</view>
</view>
</u--form>
<view>
<view style="margin:0 20rpx;">
<u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay>
@@ -105,7 +105,8 @@
</template>
<script>
import login from '../my/login/login.vue'
import { apiService } from '../../service/request'
import login from '../my/login/login.vue'
export default {
components: {
login
@@ -171,8 +172,10 @@
this.needsPublishForm = {}
},
getCityValue(data) {
console.log(data)
this.showCityPicker = false
this.needsPublishForm.area_name = data.join('/')
this.needsPublishForm.area_name = data[0].join('-')
this.needsPublishForm.area_code = data[1]
},
getProductValue(data) {
this.showProductPicker = false
@@ -223,6 +226,7 @@
})
})
for (let i = 0; i < lists.length; i++) {
console.log(lists[i])
const result = await this.uploadFilePromise(lists[i].url)
let item = this[`fileList${event.name}`][fileListLen]
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
@@ -234,24 +238,48 @@
}
},
uploadFilePromise(url) {
// return new Promise((resolve, reject) => {
// let a = uni.uploadFile({
// url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
// filePath: url,
// name: 'file',
// formData: {
// user: 'test'
// },
// success: (res) => {
// setTimeout(() => {
// resolve(res.data.data)
// }, 1000)
// }
// });
// })
return new Promise((resolve, reject) => {
const data = {
file: new File
}
let a = apiService.postImage(data).then(res => {
console.log(res)
})
// let a = uni.uploadFile({
// url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
// filePath: url,
// name: 'file',
// formData: {
// user: 'test'
// },
// success: (res) => {
// setTimeout(() => {
// resolve(res.data.data)
// }, 1000)
// }
// });
})
},
//BlobUrl转blob数据
objectURLToBlob(blodurl) {
return new Promise((resolve, reject) => {
var http = new XMLHttpRequest();
http.open('GET', blodurl, true);
http.responseType = 'blob';
http.onload = function(e) {
if (this.status == 200 || this.status === 0) {
// console.log('blod数据',this.response);
// 在将blod数据转为file
let files = new window.File([this.response], 'file.name', { type: 'image' });
// console.log('blod数据转换file',files);
resolve(files);
}
};
http.send();
});
},
submitForm() {
if (!/^1[3456789]\d{9}$/.test(this.needsPublishForm.phone)) {
if (!/^1[3456789]\d{9}$/.test(this.needsPublishForm.mobile)) {
this.$toast.warn('请输入正确的手机号')
return false
}