修改小程序bug

This commit is contained in:
邓洁
2023-02-27 09:54:21 +08:00
parent 055381f224
commit 6a1e71ce8a
8 changed files with 127 additions and 85 deletions

View File

@@ -87,7 +87,7 @@
</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: 12rpx 30rpx 20rpx 30rpx;background-color: #fff;">
<text
@@ -120,6 +120,7 @@
},
data() {
return {
btnDisabled: false,
claim_r: '',
claim_c: '',
tabsList: [{
@@ -192,6 +193,9 @@
this.$toast.warn(error)
}
}
if (options.view == 11) {
this.btnDisabled = true
}
if (options.index == 0) {
this.tabCurrent = 0
} else if (options.index == 1) {
@@ -350,50 +354,53 @@
})
},
submitForm() {
if (!/^1[3456789]\d{9}$/.test(this.needsPublishForm.mobile)) {
this.$toast.warn('请输入正确的手机号')
return false
}
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)
const temp = []
if (this.fileList1.length > 0) {
this.fileList1.map(item => {
const url = item.url
temp.push(url.replace(this.imgUrl + '/', ''))
})
}
this.needsPublishForm.images = temp.join(';')
const data = {
type: null,
name: null,
pname: null,
area_code: null,
area_name: null,
images: null,
mobile: null,
class: null,
product: null,
loc: null,
desc: null,
pub_time: null,
...this.needsPublishForm
}
apiService.submitIdeasAndNeeds(data).then(res => {
this.$toast.success('提交成功')
if (res.data.code == 1) {
uni.navigateTo({
url: '../../packageMy/myRelease/myRelease?index=' + (this.tabCurrent + 1)
if (this.btnDisabled == false) {
if (!/^1[3456789]\d{9}$/.test(this.needsPublishForm.mobile)) {
this.$toast.warn('请输入正确的手机号')
return false
}
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)
const temp = []
if (this.fileList1.length > 0) {
this.fileList1.map(item => {
const url = item.url
temp.push(url.replace(this.imgUrl + '/', ''))
})
}
this.tabCurrent = 0
this.fileList1 = []
this.needsPublishForm = {}
// this.$toast.success(res.data.msg)
}).catch(error => {
this.$toast.warn(error)
})
this.needsPublishForm.images = temp.join(';')
const data = {
type: null,
name: null,
pname: null,
area_code: null,
area_name: null,
images: null,
mobile: null,
class: null,
product: null,
loc: null,
desc: null,
pub_time: null,
...this.needsPublishForm
}
apiService.submitIdeasAndNeeds(data).then(res => {
this.$toast.success('提交成功')
if (res.data.code == 1) {
uni.navigateTo({
url: '../../packageMy/myRelease/myRelease?index=' + (this.tabCurrent + 1)
})
}
this.tabCurrent = 0
this.fileList1 = []
this.needsPublishForm = {}
// this.$toast.success(res.data.msg)
}).catch(error => {
this.$toast.warn(error)
})
}
},
reOnLoad() {
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {

View File

@@ -141,7 +141,6 @@
getBanner() {
this.$apiServe.getBanner().then(res => {
let banner = res.data.data
console.log('轮播图', res.data);
if (banner) {
for (const item of banner) {
item.img = this.imgUrl + item.img
@@ -172,9 +171,7 @@
//获取图片url
getImgUrl() {
this.$apiServe.getImgUrl().then(res => {
console.log('图片url', res.data);
res.data.data.img_url = res.data.data.img_url + '/'
console.log('res.data.data.img_url', res.data.data.img_url);
try {
uni.setStorageSync('img_url', res.data.data.img_url);
this.initStart = true