修改小程序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 let tags = res.data.data
if (tags) { if (tags) {
for (const item of tags) { for (const item of tags) {
console.log('item.cover', item.cover);
let tag = item.tags let tag = item.tags
this.tagsArray = tag.split(',') this.tagsArray = tag.split(',')
item.tags = this.tagsArray[0] item.tags = this.tagsArray[0]

View File

@@ -52,6 +52,7 @@
}, },
methods: { methods: {
handleSureClick() { handleSureClick() {
if (this.btnDisabled == false) {
let name = this.$refs.nameAndphone.model.userInfo.name let name = this.$refs.nameAndphone.model.userInfo.name
let phone = this.$refs.nameAndphone.model.userInfo.phone let phone = this.$refs.nameAndphone.model.userInfo.phone
if (!/^1[3456789]\d{9}$/.test(phone)) { if (!/^1[3456789]\d{9}$/.test(phone)) {
@@ -71,6 +72,8 @@
this.$toast.warn('请完善数据') this.$toast.warn('请完善数据')
} }
}).finally(_ => {}) }).finally(_ => {})
}
}, },
confirm() { confirm() {
uni.reLaunch({ uni.reLaunch({

View File

@@ -15,11 +15,15 @@
<text v-else>{{item.pub_time}}</text> <text v-else>{{item.pub_time}}</text>
</view> </view>
<view style="display: flex;"> <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> <u-icon name="edit-pen" color="#15CA65" size="20"></u-icon>
<text class="btn_text">修改</text> <text class="btn_text">修改</text>
</view> </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> <u-icon name="trash" color="#15CA65" size="20"></u-icon>
<text class="btn_text">删除</text> <text class="btn_text">删除</text>
</view> </view>
@@ -38,11 +42,15 @@
<text v-else>{{item.pub_time}}</text> <text v-else>{{item.pub_time}}</text>
</view> </view>
<view style="display: flex;"> <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> <u-icon name="edit-pen" color="#15CA65" size="20"></u-icon>
<text class="btn_text">修改</text> <text class="btn_text">修改</text>
</view> </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> <u-icon name="trash" color="#15CA65" size="20"></u-icon>
<text class="btn_text">删除</text> <text class="btn_text">删除</text>
</view> </view>
@@ -95,6 +103,7 @@
getIdeasAndNeeds() { getIdeasAndNeeds() {
this.$apiServe.getIdeasAndNeeds(this.type).then(res => { this.$apiServe.getIdeasAndNeeds(this.type).then(res => {
let data = res.data.data let data = res.data.data
console.log('创意需求发布数据', res.data);
for (const item of data) { for (const item of data) {
item.pub_time = dateFormatXwDetail(item.pub_time) item.pub_time = dateFormatXwDetail(item.pub_time)
item.update_time = dateFormatXwDetail(item.update_time) item.update_time = dateFormatXwDetail(item.update_time)
@@ -123,6 +132,20 @@
} }
this.getIdeasAndNeeds() 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) { editIdeasAndNeeds(item) {
const tabCurrent = this.tabCurrent const tabCurrent = this.tabCurrent

View File

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

View File

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

View File

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

View File

@@ -87,7 +87,7 @@
</view> </view>
</u-form-item> --> </u-form-item> -->
<view style="padding: 30rpx;background-color: #fff;"> <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>
<view style="padding: 12rpx 30rpx 20rpx 30rpx;background-color: #fff;"> <view style="padding: 12rpx 30rpx 20rpx 30rpx;background-color: #fff;">
<text <text
@@ -120,6 +120,7 @@
}, },
data() { data() {
return { return {
btnDisabled: false,
claim_r: '', claim_r: '',
claim_c: '', claim_c: '',
tabsList: [{ tabsList: [{
@@ -192,6 +193,9 @@
this.$toast.warn(error) this.$toast.warn(error)
} }
} }
if (options.view == 11) {
this.btnDisabled = true
}
if (options.index == 0) { if (options.index == 0) {
this.tabCurrent = 0 this.tabCurrent = 0
} else if (options.index == 1) { } else if (options.index == 1) {
@@ -350,6 +354,8 @@
}) })
}, },
submitForm() { submitForm() {
if (this.btnDisabled == false) {
if (!/^1[3456789]\d{9}$/.test(this.needsPublishForm.mobile)) { if (!/^1[3456789]\d{9}$/.test(this.needsPublishForm.mobile)) {
this.$toast.warn('请输入正确的手机号') this.$toast.warn('请输入正确的手机号')
return false return false
@@ -394,6 +400,7 @@
}).catch(error => { }).catch(error => {
this.$toast.warn(error) this.$toast.warn(error)
}) })
}
}, },
reOnLoad() { reOnLoad() {
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) { if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {

View File

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