Merge branch 'dev' into chenxuelian

This commit is contained in:
”chenxuelian“
2023-01-28 20:40:37 +08:00
8 changed files with 187 additions and 91 deletions

View File

@@ -29,13 +29,15 @@
</view> </view>
</view> </view>
</view> </view>
<u-button v-if="type==1" type="success" text="移除" color="#0EBB5B" @click="showModal()"></u-button> <u-button v-if="type==1" type="success" text="移除" color="#0EBB5B" @click="deleteProduct(item)">
<u-button v-if="type==2" type="success" text="取消收藏" color="#0EBB5B" @click="showModal()"></u-button> </u-button>
<u-button v-if="type==2" type="success" text="取消收藏" color="#0EBB5B" @click="cancelCollect(item)">
</u-button>
</u-grid-item> </u-grid-item>
</u-grid> </u-grid>
<u-modal :show="showM" :content="content" showCancelButton closeOnClickOverlay="false" @confirm="confirm" <!-- <u-modal :show="showM" :content="content" showCancelButton closeOnClickOverlay="false" @confirm="confirm"
@cancel="cancel"> @cancel="cancel">
</u-modal> </u-modal> -->
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;" <view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
v-if="type==1&&productList.length==0"> v-if="type==1&&productList.length==0">
暂无更多浏览记录</view> 暂无更多浏览记录</view>
@@ -57,7 +59,7 @@
imgUrl: '', imgUrl: '',
tagsArray: [], tagsArray: [],
productList: [], productList: [],
showM: false, // showM: false,
content: '您确定移除吗?', content: '您确定移除吗?',
productList: [] productList: []
} }
@@ -75,6 +77,7 @@
methods: { methods: {
//获取历史记录 //获取历史记录
getHistoryOrCollection() { getHistoryOrCollection() {
console.log(uni.getStorageSync('token'));
this.$apiServe.getHistoryOrCollection(this.type).then(res => { this.$apiServe.getHistoryOrCollection(this.type).then(res => {
let data = res.data.data let data = res.data.data
for (const item of data) { for (const item of data) {
@@ -83,27 +86,52 @@
item.tags = this.tagsArray[0] item.tags = this.tagsArray[0]
item.create_time = dateFormatHistory(item.create_time) item.create_time = dateFormatHistory(item.create_time)
} }
// console.log('获取历史记录', res.data); console.log('获取历史记录', data);
this.productId = data.id
this.productList = data this.productList = data
}).finally(_ => { }).finally(_ => {
}) })
}, },
//移除按钮 //移除按钮
showModal() { deleteProduct(item) {
this.showM = true var that = this
uni.showModal({
title: '提示',
content: '你确定要移除吗',
success: function(res) {
if (res.confirm) {
that.$apiServe.deleteHistoryOrCollection(item.id).then(res => {
if (res.data.code == 1) {
that.$toast.warn('移除成功')
}
that.getHistoryOrCollection()
}).finally(_ => {})
} else if (res.cancel) {
that.$toast.warn('取消移除')
}
}
})
}, },
confirm() { //取消收藏按钮
this.showM = false cancelCollect(item) {
this.$apiServe.deleteHistoryOrCollection(this.productId).then(res => { var that = this
// console.log('删除历史记录或收藏', res.data); uni.showModal({
this.productList.splice(this.productId, 1) title: '提示',
}).finally(_ => {}) content: '你确定要取消收藏吗',
success: function(res) {
if (res.confirm) {
that.$apiServe.deleteHistoryOrCollection(item.id).then(res => {
if (res.data.code == 1) {
that.$toast.warn('取消收藏成功')
}
that.getHistoryOrCollection()
}).finally(_ => {})
} else if (res.cancel) {
that.$toast.warn('取消操作')
}
}
})
}, },
cancel() {
this.showM = false
}
} }
} }
</script> </script>

View File

@@ -4,11 +4,32 @@
<u-tabs :list="tabsList" :scrollable="false" lineColor="#0A994A" color="#969696" <u-tabs :list="tabsList" :scrollable="false" lineColor="#0A994A" color="#969696"
activeStyle="color:#15CA65;font-weight: bold;" :current="tabCurrent" @change="tabChange"></u-tabs> activeStyle="color:#15CA65;font-weight: bold;" :current="tabCurrent" @change="tabChange"></u-tabs>
</view> </view>
<view style="background-color: #fff;"> <view v-if="tabCurrent == 0" style="background-color: #fff;">
<view v-for="(item,index) in needsList" :key="index" class="my_line" <view v-for="(item,index) in needsList" :key="index" class="my_line"
style="padding: 24rpx 19rpx;border-bottom: 1px solid #EEEEEE;"> style="padding: 24rpx 19rpx;border-bottom: 1px solid #EEEEEE;">
<text v-if="tabCurrent == 0" class="needs_text">{{item.desc}}</text> <text class="needs_text">{{item.desc}}</text>
<text v-if="tabCurrent == 1" class="needs_text">{{item.pname}}</text>
<view class="time_line">
<view class="release_time">
<text>{{item.pub_time}}</text>
</view>
<view style="display: flex;">
<view class="btn" @click="editIdeasAndNeeds(item)">
<u-icon name="edit-pen" color="#15CA65" size="20"></u-icon>
<text class="btn_text">修改</text>
</view>
<view class="btn" @click="deleteIdeasAndNeeds(item)">
<u-icon name="trash" color="#15CA65" size="20"></u-icon>
<text class="btn_text">删除</text>
</view>
</view>
</view>
</view>
</view>
<view v-if="tabCurrent == 1" style="background-color: #fff;">
<view v-for="(item,index) in ideasList" :key="index" class="my_line"
style="padding: 24rpx 19rpx;border-bottom: 1px solid #EEEEEE;">
<text class="needs_text">{{item.pname}}</text>
<view class="time_line"> <view class="time_line">
<view class="release_time"> <view class="release_time">
<text>{{item.pub_time}}</text> <text>{{item.pub_time}}</text>
@@ -26,15 +47,16 @@
</view> </view>
</view> </view>
</view> </view>
<u-modal :show="showM" :content="content" showCancelButton closeOnClickOverlay="false" @confirm="confirm"
@cancel="cancel">
</u-modal>
<view style="margin:0 20rpx;"> <view style="margin:0 20rpx;">
<u-overlay :show="!isLoad"> <u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login> <login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay> </u-overlay>
</view> </view>
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;" v-if="needsList.length==0"> <view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
v-if="needsList.length==0&&tabCurrent == 0">
暂无更多记录</view>
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
v-if="ideasList.length==0&&tabCurrent == 1">
暂无更多记录</view> 暂无更多记录</view>
</view> </view>
</template> </template>
@@ -51,40 +73,22 @@
data() { data() {
return { return {
isLoad: true, isLoad: true,
id: '', // id: '',
showM: false, // showM: false,
content: '您确定删除吗?', content: '您确定删除吗?',
tabCurrent: 0, tabCurrent: 0,
type: '', type: 1,
desc: '',
pname: '',
pub_time: '',
tabsList: [{ tabsList: [{
name: '需求发布' name: '需求发布'
}, { }, {
name: '创意发布' name: '创意发布'
}], }],
needsList: [ needsList: [],
// { ideasList: []
// id: 1,
// desc: '需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述描述需求描述描...',
// pname: '产品名称产品名称产品名称',
// pub_time: '2022-12-03 09:59',
// }, {
// id: 2,
// desc: '需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述描述需求描述描...',
// pname: '产品名称产品名称产品名称',
// pub_time: '2022-12-03 09:59',
// },
]
} }
}, },
onLoad() { onLoad() {
if (this.tabCurrent == 0) { console.log(uni.getStorageSync('token'));
this.type = 2
} else if (this.tabCurrent == 1) {
this.type = 1
}
this.getIdeasAndNeeds() this.getIdeasAndNeeds()
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) { if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
console.log(uni.getStorageSync('token')) console.log(uni.getStorageSync('token'))
@@ -99,44 +103,67 @@
methods: { methods: {
//获取创意发布 //获取创意发布
getIdeasAndNeeds() { getIdeasAndNeeds() {
console.log('this.type', this.type);
this.$apiServe.getIdeasAndNeeds(this.type).then(res => { this.$apiServe.getIdeasAndNeeds(this.type).then(res => {
console.log('获取创意发布&需求发布', res.data); console.log('获取创意发布&需求发布', res.data.data);
let data = res.data.data let data = res.data.data
for (const item of data) { for (const item of data) {
item.pub_time = dateFormatXwDetail(pub_time) item.pub_time = dateFormatXwDetail(item.pub_time)
this.id = item.id item.images = item.images.split(';')
item.images = item.images.map(item1 => {
item1 = uni.getStorageSync('img_url') + item1
return item1
})
}
if (this.type == 1) {
this.needsList = data
} else if (this.type == 2) {
this.ideasList = data
} }
// this.productList = data
}).finally(_ => { }).finally(_ => {
}) })
}, },
//切换需求发布和创意发布
tabChange(data) { tabChange(data) {
this.tabCurrent = data.index this.tabCurrent = data.index
console.log('data.index', data.index);
if (data.index == 0) {
this.type = 1
} else if (data.index == 1) {
this.type = 2
}
this.getIdeasAndNeeds() this.getIdeasAndNeeds()
}, },
//修改我的需求或创意 //修改我的需求
editIdeasAndNeeds(item) { editIdeasAndNeeds(item) {
uni.reLaunch({ uni.reLaunch({
url: '/pages/ideasAndNeeds/ideasAndNeeds?item=' + JSON.stringify(item) + '&index=' + this.type url: '/pages/ideasAndNeeds/ideasAndNeeds?item=' + JSON.stringify(item) + '&index=' + this
.tabCurrent
}) })
}, },
//删除我的需求或创意 //二次确认删除我的需求或创意
deleteIdeasAndNeeds(item) { deleteIdeasAndNeeds(item) {
this.showM = true var that = this
}, uni.showModal({
//删除确认按钮 title: '提示',
confirm() { content: '你确定要删除吗',
this.showM = false success: function(res) {
// this.$apiServe.deleteIdeasAndNeeds(this.id).then(res => { if (res.confirm) {
// console.log('删除发布', res.data); that.$apiServe.deleteIdeasAndNeeds(item.id).then(res => {
// // this.needsList.splice(this.needsList.id, 1) console.log('删除发布', res);
// }).finally(_ => { if (res.data.code == 1) {
that.$toast.warn('删除成功')
}
that.getIdeasAndNeeds()
}).finally(_ => {
// }) })
}, } else if (res.cancel) {
cancel() { that.$toast.warn('取消删除')
this.showM = false }
}
})
}, },
reOnLoad() { reOnLoad() {
console.log('----------------true') console.log('----------------true')

View File

@@ -65,7 +65,7 @@
//获取认证厂家详情 //获取认证厂家详情
getCertifiedCjDetail() { getCertifiedCjDetail() {
this.$apiServe.getCertifiedCjDetail(this.id).then(res => { this.$apiServe.getCertifiedCjDetail(this.id).then(res => {
// console.log('认证厂家详情页', res.data) console.log('认证厂家详情页', res.data)
if (res.data.data) { if (res.data.data) {
let data = res.data.data let data = res.data.data
data.images = data.images.split(';') data.images = data.images.split(';')

View File

@@ -5,10 +5,10 @@
</u-image> </u-image>
<view class="collect" @click="starTap"> <view class="collect" @click="starTap">
<view class="star"> <view class="star">
<u-image v-if="detailList.type==0" src="/static/detail/xp_icon_wstar.png" width="28rpx" <u-image v-if="detailList.is_fav==0" src="/static/detail/xp_icon_wstar.png" width="28rpx"
height="28rpx"> height="28rpx">
</u-image> </u-image>
<u-image v-if="detailList.type==1" src="/static/detail/xp_icon_star.png" width="28rpx" <u-image v-if="detailList.is_fav==1" src="/static/detail/xp_icon_star.png" width="28rpx"
height="28rpx"> height="28rpx">
</u-image> </u-image>
</view> </view>
@@ -100,6 +100,7 @@
methods: { methods: {
//获取详情信息 //获取详情信息
getProductDetail() { getProductDetail() {
console.log(this.id);
this.$apiServe.getProductDetail(this.id).then(res => { this.$apiServe.getProductDetail(this.id).then(res => {
console.log('产品详情页', res.data) console.log('产品详情页', res.data)
if (res.data.data.thumb) { if (res.data.data.thumb) {
@@ -119,16 +120,15 @@
}, },
//收藏按钮 //收藏按钮
starTap() { starTap() {
this.detailList.type = !this.detailList.type this.$apiServe.collect(this.id).then(res => {
// this.$apiServe.collect(this.id).then(res => { console.log('收藏成功', res.data)
// console.log('收藏成功', res.data) if (res.data.code == 1) {
// if (res.data.code == 1) { this.detailList.is_fav = 1
// this.detailList.type = 1 this.$toast.warn('收藏成功')
// this.$toast.warn('收藏成功') } else {
// } else { this.$toast.warn('收藏失败')
// this.$toast.warn('收藏失败') }
// } }).finally(_ => {})
// }).finally(_ => {})
}, },
//点赞按钮 //点赞按钮
heartTap() { heartTap() {

View File

@@ -156,10 +156,13 @@
} }
}, },
onLoad(options) { onLoad(options) {
console.log(options) //我的发布点击修改回显数据
if (options.index == 1) { let publishFormList = JSON.parse(options.item)
this.fileList1 = publishFormList.images
this.needsPublishForm = publishFormList
if (options.index == 0) {
this.tabCurrent = 0 this.tabCurrent = 0
} else if (options.index == 2) { } else if (options.index == 1) {
this.tabCurrent = 1 this.tabCurrent = 1
} }
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) { if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {

View File

@@ -76,12 +76,42 @@
} }
}, },
onLoad() { onLoad() {
// this.login()
this.getCategories() this.getCategories()
this.getBanner() this.getBanner()
this.getImgUrl() this.getImgUrl()
this.imgUrl = uni.getStorageSync('img_url') this.imgUrl = uni.getStorageSync('img_url')
}, },
methods: { methods: {
// login() {
// var that = this
// uni.login({
// "provider": "weixin",
// "onlyAuthorize": true, // 微信登录仅请求授权认证
// success: function(event) {
// const {
// code
// } = event
// that.$apiServe.login({
// code: code
// }).then(res => {
// var data = res.data.data
// console.log('登录code换取的信息', data);
// // uni.setStorageSync('token', data.token);
// // that.$toast.success('登录成功')
// // that.$emit('success')
// //登录完成后使用手机code换取手机号,调用/user/getMobileByMnp接口
// //接口详细链接 https://docs.apipost.cn/preview/468be606f65cae75/3f2f988ddf82dd8e
// // const codeData = {
// // code: e.detail.code
// // }
// // apiService.postMobileByMnp(codeData).then(res => {
// // console.log(res)
// // })
// })
// },
// })
// },
//获取按上架时间排列的产品列表length //获取按上架时间排列的产品列表length
getTimeLength(e) { getTimeLength(e) {
this.reachBottomLength = e this.reachBottomLength = e

View File

@@ -5,8 +5,8 @@
</view> </view>
<view style="padding-left: 30rpx;padding-right: 30rpx;display: flex;"> <view style="padding-left: 30rpx;padding-right: 30rpx;display: flex;">
<u-button type="info" :plain="true" size="nomal" @click="$emit('fail')">取消</u-button> <u-button type="info" :plain="true" size="nomal" @click="$emit('fail')">取消</u-button>
<u-button open-type="getPhoneNumber" size="nomal" @getphonenumber="getphonenumber" <u-button open-type="getPhoneNumber" size="nomal" @getphonenumber="getphonenumber" color='#12CA64'>登录
color='#12CA64'>登录</u-button> </u-button>
</view> </view>
</view> </view>
</template> </template>
@@ -101,13 +101,14 @@
/deep/.u-button { /deep/.u-button {
width: 40% !important; width: 40% !important;
} }
.login-content { .login-content {
width: 100%; width: 100%;
position:absolute; position: absolute;
top:50%; top: 50%;
left: 50%; left: 50%;
padding: 50rpx 30rpx; padding: 50rpx 30rpx;
background-color: #fff; background-color: #fff;
transform:translate(-50%,-50%); transform: translate(-50%, -50%);
} }
</style> </style>

View File

@@ -326,6 +326,13 @@ const apiService = {
resolve(service.get(url)) resolve(service.get(url))
}) })
}, },
//修改个人信息
getUser() {
const url = `/center/userinfo`
return new Promise((resolve, reject) => {
resolve(service.get(url))
})
},
// 获取首页分类Tag // 获取首页分类Tag
getTags(data) { getTags(data) {
const url = `/home/tags` const url = `/home/tags`