解决冲突

This commit is contained in:
”chenxuelian“
2023-04-18 21:44:35 +08:00
33 changed files with 915 additions and 493 deletions

View File

@@ -9,10 +9,10 @@
<view style="margin-bottom: 20rpx;">
<u-form-item label="姓名" borderBottom>
<u-input v-model="needsPublishForm.name" :border="false" placeholder="请输入您的名称"
placeholder-style="color:#CCCCCC" />
placeholder-style="color:#CCCCCC" :disabled="btnDisabled" disabledColor="#ffffff" />
</u-form-item>
<u-form-item label="城市">
<view class="select-view" @tap="showCityPicker = true">
<view class="select-view" @tap="btnDisabled==true?showCityPicker=false:showCityPicker = true">
<text v-if="needsPublishForm.area_name">{{needsPublishForm.area_name}}</text>
<text v-else style="color:#CCCCCC;">请选择所在城市</text>
<u-icon name="arrow-right" color="#969696" size="14"></u-icon>
@@ -26,39 +26,46 @@
<view v-if="tabCurrent === 1">
<u-form-item label="品名" borderBottom>
<u-input v-model="needsPublishForm.pname" :border="false" placeholder="请输入您的产品名称"
placeholder-style="color:#CCCCCC" />
placeholder-style="color:#CCCCCC" :disabled="btnDisabled" disabledColor="#ffffff" />
</u-form-item>
<u-form-item label="分类" borderBottom>
<view class="select-view" @tap="showCategoryPicker = true">
<view class="select-view"
@tap="btnDisabled==true?showCategoryPicker=false: showCategoryPicker=true">
<text v-if="needsPublishForm.class">{{needsPublishForm.class}}</text>
<text v-else style="color:#CCCCCC;">请选择分类</text>
<u-icon name="arrow-right" color="#969696" size="14"></u-icon>
</view>
<u-picker :show="showCategoryPicker" :columns="categoryPickerList"
@cancel="showCategoryPicker = false" @confirm="getCategoryValue"></u-picker>
@cancel="showCategoryPicker = false" @confirm="getCategoryValue">
</u-picker>
</u-form-item>
</view>
<u-form-item label="产品" borderBottom>
<view class="select-view" @tap="showProductPicker = true">
<view class="select-view"
@tap="btnDisabled==true?showProductPicker=false: showProductPicker = true">
<text v-if="needsPublishForm.product">{{needsPublishForm.product}}</text>
<text v-else style="color:#CCCCCC;">请选择产品类型</text>
<u-icon name="arrow-right" color="#969696" size="14"></u-icon>
</view>
<u-picker :show="showProductPicker" :columns="productPickerColumn"
@cancel="showProductPicker = false" @confirm="getProductValue"></u-picker>
@cancel="showProductPicker = false" @confirm="getProductValue">
</u-picker>
</u-form-item>
<u-form-item label="定位" borderBottom>
<view class="select-view" @tap="showPositionPicker = true">
<view class="select-view"
@tap="btnDisabled==true?showPositionPicker=false:showPositionPicker = true">
<text v-if="needsPublishForm.loc">{{needsPublishForm.loc}}</text>
<text v-else style="color:#CCCCCC;">请选择产品定位</text>
<u-icon name="arrow-right" color="#969696" size="14"></u-icon>
</view>
<u-picker :show=showPositionPicker :columns="positionPickerColumn"
@cancel="showPositionPicker = false" @confirm="getPositionValue"></u-picker>
@cancel="showPositionPicker = false" @confirm="getPositionValue">
</u-picker>
</u-form-item>
<view style="padding: 20rpx 15rpx;background-color: #fff;">
<u-textarea v-model="needsPublishForm.desc" border="surround" placeholder="请输入具体描述(限120字)"
:maxlength="120" placeholder-style="color:#CCCCCC"></u-textarea>
:maxlength="120" placeholder-style="color:#CCCCCC" :disabled="btnDisabled"
disabledColor="#ffffff"></u-textarea>
</view>
</view>
@@ -66,7 +73,7 @@
<u-form-item label="上传图片" labelPosition="top">
<view style="padding-left: 20rpx;margin-top: 20rpx;">
<u-upload :fileList="fileList1" :auto-upload="false" @afterRead="afterRead" @delete="deletePic"
name="1" multiple :maxCount="10"></u-upload>
name="1" multiple :maxCount="10" :disabled="btnDisabled"></u-upload>
</view>
</u-form-item>
</view>
@@ -81,21 +88,23 @@
:customStyle="{marginRight: '16px'}"
label="手机"
name="mobile"
:disabled="btnDisabled"
>
</u-radio>
<u-radio
label="邮箱"
name="email"
:disabled="btnDisabled"
>
</u-radio>
</u-radio-group>
</u-form-item>
<u-form-item v-if="needsPublishForm.contactWay === 'mobile'" label="手机" borderBottom>
<u--input placeholder="请输入手机号" :border="false" v-model="needsPublishForm.mobile"
placeholder-style="color:#CCCCCC"></u--input>
placeholder-style="color:#CCCCCC" :disabled="btnDisabled" disabledColor="#ffffff"></u--input>
</u-form-item>
<u-form-item v-if="needsPublishForm.contactWay === 'email'" label="邮箱" borderBottom>
<u--input placeholder="请输入邮箱地址" :border="false" v-model="needsPublishForm.email"
<u--input placeholder="请输入邮箱地址" :border="false" v-model="needsPublishForm.email" :disabled="btnDisabled"
placeholder-style="color:#CCCCCC"></u--input>
</u-form-item>
<view style="padding: 6rpx 20rpx 0;text-align: left;background-color: #fff;">
@@ -114,12 +123,15 @@
</view>
</u-form-item> -->
<view style="padding: 30rpx;background-color: #fff;">
<u-button color="#0EBB5B" text="确定发布" @tap.stop="submitForm"></u-button>
<u-button color="#0EBB5B" text="确定发布" @tap.stop="submitForm" :disabled="btnDisabled"></u-button>
</view>
<view style="padding: 10rpx 20rpx;text-align: center;background-color: #fff;">
<text style="font-size: 24rpx;font-family: PingFangSC-Regular, PingFang SC;font-weight: 400;color: #C8C8C8;line-height: 28rpx;">
您在确认发布后会由平台管理方经行审核审核通过后予以发布对于用户在本站发表的信息由用户个人承担对应责任本平台不承担任何法律责任
</text>
<view style="padding: 12rpx 30rpx 20rpx 30rpx;background-color: #fff;">
<text
style="font-size: 24rpx;font-family: PingFangSC-Regular, PingFang SC;font-weight: 400;color: #C8C8C8;line-height: 28rpx;"
v-if="tabCurrent === 0">{{claim_r}}</text>
<text
style="font-size: 24rpx;font-family: PingFangSC-Regular, PingFang SC;font-weight: 400;color: #C8C8C8;line-height: 28rpx;"
v-if="tabCurrent === 1">{{claim_c}}</text>
</view>
</view>
</u--form>
@@ -143,6 +155,9 @@
},
data() {
return {
btnDisabled: false,
claim_r: '',
claim_c: '',
tabsList: [{
name: '需求发布'
}, {
@@ -163,18 +178,13 @@
productPickerList: [],
productPickerColumn: [
[]
// {name: '烘焙', val: 'hongbei'}
// {name: '零食', val: 'ls'}
// {name: '饮料', val: 'yl'}
],
positionPickerList: [],
positionPickerColumn: [
[]
],
categoryPickerList: [],
fileList1: [
// uploads/images/20230117/202301172309397deda1543.jpg
],
fileList1: [],
isLoad: true,
cateName: null,
tagName: null,
@@ -183,17 +193,11 @@
}
},
onTabItemTap() {
console.log('----onShow')
// if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
// console.log(uni.getStorageSync('loginToken'))
// this.isLoad = false
// // uni.navigateTo({
// // url: '../../pages/my/login/login'
// // })
// return
// }
this.imgUrl = uni.getStorageSync('img_url')
console.log(this.imgUrl)
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.isLoad = false
return
}
this.isLoad = true
this.token = uni.getStorageSync('loginToken')
this.tabCurrent = 0
@@ -201,23 +205,18 @@
this.needsPublishForm = {}
},
onLoad(options) {
console.log('---onLoad')
console.log(options.item)
this.imgUrl = uni.getStorageSync('img_url')
//我的发布点击修改回显数据
if(options && options.item && uni.getStorageSync(options.item)) {
try{
if (options && options.item && uni.getStorageSync(options.item)) {
try {
let publishFormList = uni.getStorageSync(options.item)
console.log(publishFormList.images)
this.fileList1 = publishFormList.images.map(item => {
console.log(this.imgUrl)
return {
url: item
}
})
console.log(this.fileList1)
this.needsPublishForm = publishFormList
} catch(error) {
} catch (error) {
this.$toast.warn(error)
}
}
@@ -226,6 +225,9 @@
} else if (options.index == 1) {
this.tabCurrent = 1
}
if (options.view == 11) {
this.btnDisabled = true
}
// this.getProductPickerList()
},
onShow() {
@@ -235,20 +237,24 @@
tabChange(data) {
this.tabCurrent = data.index
this.needsPublishForm = {}
this.fileList1 = []
this.btnDisabled = this.btnDisabled == true ? false : false;
},
getFormData() {
this.$apiServe.getIdeasAndNeedsFormdata().then(res => {
console.log(res.data.data)
const formData = res.data.data
this.productPickerColumn[0] = formData.product
this.positionPickerColumn[0] = formData.loc
this.categoryPickerList[0] = formData.class
this.claim_r = formData.claim_r
this.claim_c = formData.claim_c
// this.productPickerList = res.data.data.map((item, index) => {
// temp.push(item.name)
// return item
// })
// this.productPickerColumn[0] = [...temp]
}).finally(_ => {})
}).finally(_ => {
})
},
// getProductPickerList() {
// const data = {}
@@ -279,7 +285,6 @@
// }
// },
getCityValue(data) {
console.log(data)
this.showCityPicker = false
this.needsPublishForm.area_name = data[0].join('-')
this.needsPublishForm.area_code = data[1]
@@ -288,7 +293,6 @@
this.showProductPicker = false
this.showCategoryPicker = false
this.needsPublishForm.product = data.value[0]
// console.log(data)
// const obj = this.productPickerList.find(item => {
// return item.name === data.value[0]
// })
@@ -342,9 +346,6 @@
async afterRead(event) {
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
let lists = [].concat(event.file)
console.log(this.fileList1)
console.log(lists)
console.log(this[`fileList${event.name}`])
let fileListLen = this[`fileList${event.name}`].length
lists.map((item) => {
this[`fileList${event.name}`].push({
@@ -354,7 +355,6 @@
})
})
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, {
@@ -367,16 +367,6 @@
},
uploadFilePromise(url) {
return new Promise((resolve, reject) => {
// const data = {
// file: new File
// }
// let a = apiService.postImage(data).then(res => {
// console.log(res)
// })
console.log('--345')
console.log(url)
console.log(this.token)
console.log(apiService.uploadImgUrl)
let a = uni.uploadFile({
url: apiService.uploadImgUrl,
filePath: url,
@@ -387,8 +377,6 @@
},
success: (res) => {
setTimeout(() => {
console.log('---355')
console.log(JSON.parse(res.data).data.url)
resolve(JSON.parse(res.data).data.url)
}, 1000)
}
@@ -396,7 +384,6 @@
})
},
submitForm() {
console.log(this.fileList1)
if (this.needsPublishForm.contactWay === 'mobile' && !/^1[3456789]\d{9}$/.test(this.needsPublishForm.mobile)) {
this.$toast.warn('请输入正确的手机号')
return false
@@ -406,12 +393,12 @@
}
this.needsPublishForm.type = Number(this.tabCurrent + 1)
this.needsPublishForm.pub_time = this.needsPublishForm.pub_time ? this.needsPublishForm.pub_time :
Math.round(new Date().getTime() / 1000)
Math.round(new Date().getTime() / 1000)
const temp = []
if (this.fileList1.length > 0) {
this.fileList1.map(item => {
const url = item.url
temp.push(url.replace(this.imgUrl+'/', ''))
temp.push(url.replace(this.imgUrl + '/', ''))
})
}
this.needsPublishForm.images = temp.join(';')
@@ -434,10 +421,10 @@
apiService.submitIdeasAndNeeds(data).then(res => {
this.$toast.success('提交成功')
console.log('esf=', res);
if(this.needsPublishForm.id) {
uni.navigateTo({
url: '../../packageMy/myRelease/myRelease?index=' + (this.tabCurrent + 1)
})
if (this.needsPublishForm.id) {
uni.navigateTo({
url: '../../packageMy/myRelease/myRelease?index=' + (this.tabCurrent + 1)
})
}
this.tabCurrent = 0
this.fileList1 = []
@@ -447,41 +434,21 @@
this.$toast.warn(error)
})
},
reOnLoad() {
console.log('----------------true')
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.$toast.warn('登录失败请重试')
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.token = uni.getStorageSync('loginToken')
this.isLoad = true
this.getFormData()
},
failToLoad() {
console.log('----------------false')
this.$toast.warn('登录失败请重试')
uni.reLaunch({
url: '/pages/index/index'
})
// uni.navigateBack({
// success: () => {
// let page = getCurrentPages().pop();
// if (page) {
// page.onLoad(page.options);//执行上个页面的方法
// };
// }
// })
}
}
}
</script>
<style lang="less" scoped>
/deep/.u-textarea--disabled {
background-color: #ffffff !important;
}
.content {
background-color: #F8F8F8;