Merge pull request '修改小程序bug' (#100) from dengjie into dev

Reviewed-on: http://git.hchyun.com/feashow/pupil/pulls/100
This commit is contained in:
odjbin
2023-02-27 02:04:01 +00:00
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,25 +52,28 @@
}, },
methods: { methods: {
handleSureClick() { handleSureClick() {
let name = this.$refs.nameAndphone.model.userInfo.name if (this.btnDisabled == false) {
let phone = this.$refs.nameAndphone.model.userInfo.phone let name = this.$refs.nameAndphone.model.userInfo.name
if (!/^1[3456789]\d{9}$/.test(phone)) { let phone = this.$refs.nameAndphone.model.userInfo.phone
this.$toast.warn('请输入正确的手机号') if (!/^1[3456789]\d{9}$/.test(phone)) {
return false 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('请完善数据')
} }
}).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() { 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() {
this.pageNum++ console.log('触底下拉');
this.getCertifiedCj() if (this.cjsShow !== 0) {
this.pageNum++
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,20 +28,23 @@
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() {
this.imgUrl = uni.getStorageSync('img_url') this.imgUrl = uni.getStorageSync('img_url')
this.getNews() this.getNews()
}, },
onReachBottom() { onReachBottom() {
this.pageNum++ console.log('触底下拉');
this.getNews() if (this.newsShow !== 0) {
this.pageNum++
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,50 +354,53 @@
}) })
}, },
submitForm() { submitForm() {
if (!/^1[3456789]\d{9}$/.test(this.needsPublishForm.mobile)) { if (this.btnDisabled == false) {
this.$toast.warn('请输入正确的手机号')
return false if (!/^1[3456789]\d{9}$/.test(this.needsPublishForm.mobile)) {
} this.$toast.warn('请输入正确的手机号')
this.needsPublishForm.type = Number(this.tabCurrent + 1) return false
this.needsPublishForm.pub_time = this.needsPublishForm.pub_time ? this.needsPublishForm.pub_time : }
Math.round(new Date().getTime() / 1000) this.needsPublishForm.type = Number(this.tabCurrent + 1)
const temp = [] this.needsPublishForm.pub_time = this.needsPublishForm.pub_time ? this.needsPublishForm.pub_time :
if (this.fileList1.length > 0) { Math.round(new Date().getTime() / 1000)
this.fileList1.map(item => { const temp = []
const url = item.url if (this.fileList1.length > 0) {
temp.push(url.replace(this.imgUrl + '/', '')) 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)
}) })
} }
this.tabCurrent = 0 this.needsPublishForm.images = temp.join(';')
this.fileList1 = [] const data = {
this.needsPublishForm = {} type: null,
// this.$toast.success(res.data.msg) name: null,
}).catch(error => { pname: null,
this.$toast.warn(error) 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() { 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