修改小程序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

@@ -62,7 +62,6 @@
let tags = res.data.data
if (tags) {
for (const item of tags) {
console.log('item.cover', item.cover);
let tag = item.tags
this.tagsArray = tag.split(',')
item.tags = this.tagsArray[0]

View File

@@ -52,25 +52,28 @@
},
methods: {
handleSureClick() {
let name = this.$refs.nameAndphone.model.userInfo.name
let phone = this.$refs.nameAndphone.model.userInfo.phone
if (!/^1[3456789]\d{9}$/.test(phone)) {
this.$toast.warn('请输入正确的手机号')
return false
}
this.$apiServe.bindComponyAndUpdate({
uid: 1,
type: 2,
companyName: name,
companyPhone: phone
}).then(res => {
console.log('升级VIP', res.data);
if (res.data.code == 20003) {
this.showM = true
} else if (res.data.code == 20005) {
this.$toast.warn('请完善数据')
if (this.btnDisabled == false) {
let name = this.$refs.nameAndphone.model.userInfo.name
let phone = this.$refs.nameAndphone.model.userInfo.phone
if (!/^1[3456789]\d{9}$/.test(phone)) {
this.$toast.warn('请输入正确的手机号')
return false
}
}).finally(_ => {})
this.$apiServe.bindComponyAndUpdate({
uid: 1,
type: 2,
companyName: name,
companyPhone: phone
}).then(res => {
console.log('升级VIP', res.data);
if (res.data.code == 20003) {
this.showM = true
} else if (res.data.code == 20005) {
this.$toast.warn('请完善数据')
}
}).finally(_ => {})
}
},
confirm() {
uni.reLaunch({

View File

@@ -15,11 +15,15 @@
<text v-else>{{item.pub_time}}</text>
</view>
<view style="display: flex;">
<view class="btn" @click="editIdeasAndNeeds(item)">
<view class="btn" @click="viewIdeasOrNeeds(item)" v-if="item.status==1">
<u-icon name="eye" color="#15CA65" size="20"></u-icon>
<text class="btn_text">查看</text>
</view>
<view class="btn" @click="editIdeasAndNeeds(item)" v-if="item.status==0">
<u-icon name="edit-pen" color="#15CA65" size="20"></u-icon>
<text class="btn_text">修改</text>
</view>
<view class="btn" @click="deleteIdeasAndNeeds(item)">
<view class="btn" @click="deleteIdeasAndNeeds(item)" v-if="item.status==0">
<u-icon name="trash" color="#15CA65" size="20"></u-icon>
<text class="btn_text">删除</text>
</view>
@@ -38,11 +42,15 @@
<text v-else>{{item.pub_time}}</text>
</view>
<view style="display: flex;">
<view class="btn" @click="editIdeasAndNeeds(item)">
<view class="btn" @click="viewIdeasOrNeeds(item)" v-if="item.status==1">
<u-icon name="eye" color="#15CA65" size="20"></u-icon>
<text class="btn_text">查看</text>
</view>
<view class="btn" @click="editIdeasAndNeeds(item)" v-if="item.status==0">
<u-icon name="edit-pen" color="#15CA65" size="20"></u-icon>
<text class="btn_text">修改</text>
</view>
<view class="btn" @click="deleteIdeasAndNeeds(item)">
<view class="btn" @click="deleteIdeasAndNeeds(item)" v-if="item.status==0">
<u-icon name="trash" color="#15CA65" size="20"></u-icon>
<text class="btn_text">删除</text>
</view>
@@ -95,6 +103,7 @@
getIdeasAndNeeds() {
this.$apiServe.getIdeasAndNeeds(this.type).then(res => {
let data = res.data.data
console.log('创意需求发布数据', res.data);
for (const item of data) {
item.pub_time = dateFormatXwDetail(item.pub_time)
item.update_time = dateFormatXwDetail(item.update_time)
@@ -123,6 +132,20 @@
}
this.getIdeasAndNeeds()
},
//查看需求发布或创意发布
viewIdeasOrNeeds(item) {
const tabCurrent = this.tabCurrent
uni.removeStorage({ //删除Storage
key: 'update_item',
success: () => {
uni.setStorageSync('update_item', item);
uni.reLaunch({
url: '/pages/ideasAndNeeds/ideasAndNeeds?item=update_item' + '&index=' +
tabCurrent + '&view=' + 11
})
}
})
},
//修改我的需求
editIdeasAndNeeds(item) {
const tabCurrent = this.tabCurrent

View File

@@ -15,7 +15,7 @@
</view>
</view>
</view>
<view v-if="cjsShow" class="no-data">已经到底啦</view>
<view v-if="cjsShow==0" class="no-data">已经到底啦</view>
</view>
</template>
@@ -23,11 +23,11 @@
export default {
data() {
return {
cjsShow: true,
cjsShow: '',
cjsList: [],
imgUrl: '',
pageNum: 1, // 当前页
pageSize: 4, // 每页条数
pageSize: 12, // 每页条数
}
},
onLoad() {
@@ -35,8 +35,11 @@
this.getCertifiedCj()
},
onReachBottom() {
this.pageNum++
this.getCertifiedCj()
console.log('触底下拉');
if (this.cjsShow !== 0) {
this.pageNum++
this.getCertifiedCj()
}
},
methods: {
// 获取认证厂家列表
@@ -45,7 +48,12 @@
pageSize: this.pageSize,
pageNum: this.pageNum
}).then(res => {
// console.log('认证厂家', res)
console.log('认证厂家', res)
let cjsData = res.data.data
for (const item of cjsData) {
this.cjsShow = item.length
console.log('this.cjsShow', this.cjsShow);
}
this.cjsList = [...this.cjsList, ...res.data.data]
}).finally(_ => {})
},

View File

@@ -17,7 +17,7 @@
</view>
</view>
</view>
<view v-if="newsShow" class="no-data">已经到底啦</view>
<view v-if="newsShow==0" class="no-data">已经到底啦</view>
</view>
</template>
@@ -28,20 +28,23 @@
export default {
data() {
return {
newsShow: true,
newsShow: '',
imgUrl: '',
newsList: [],
pageNum: 1, // 当前页
pageSize: 4, // 每页条数
pageSize: 12, // 每页条数
}
},
onLoad() {
this.imgUrl = uni.getStorageSync('img_url')
this.imgUrl = uni.getStorageSync('img_url')
this.getNews()
},
onReachBottom() {
this.pageNum++
this.getNews()
console.log('触底下拉');
if (this.newsShow !== 0) {
this.pageNum++
this.getNews()
}
},
methods: {
getNews() {
@@ -49,10 +52,12 @@
pageSize: this.pageSize,
pageNum: this.pageNum
}).then(res => {
// console.log('行业新闻', res.data.data)
console.log('行业新闻', res.data)
let newsData = res.data.data
for (const item of newsData) {
item.pub_time_str = dateFormat(item.pub_time_str)
this.newsShow = item.length
console.log('this.newsShow', this.newsShow);
}
this.newsList = [...this.newsList, ...newsData]
}).finally(_ => {})

View File

@@ -160,7 +160,7 @@
"navigationBarTitleText": "行内新闻",
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#12CA64",
"enablePullDownRefresh": false
"enablePullDownRefresh": true
}
}, {
"path": "certifiedCj/certifiedCj",
@@ -168,7 +168,7 @@
"navigationBarTitleText": "认证厂家",
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#12CA64",
"enablePullDownRefresh": false
"enablePullDownRefresh": true
}
}, {
"path": "newsDetail/newsDetail",
@@ -193,7 +193,7 @@
"navigationBarTitleText": "新品发布",
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#12CA64",
"enablePullDownRefresh": false
"enablePullDownRefresh": true
}
}

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