From 7d0b6274f190f6dec157205ebaf54d40b33fe23a Mon Sep 17 00:00:00 2001 From: clay <209192278@qq.com> Date: Wed, 18 Jan 2023 17:02:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8F=E8=A7=88=E8=AE=B0=E5=BD=95=E7=A7=BB?= =?UTF-8?q?=E9=99=A4,=20=E6=88=91=E7=9A=84=E5=8F=91=E5=B8=83=E5=88=97?= =?UTF-8?q?=E8=A1=A8,=E4=BF=AE=E6=94=B9=E5=9B=9E=E6=98=BE=E5=8F=8A?= =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/productsBtn/productsBtn.vue | 45 +++--- packageMy/myRelease/myRelease.vue | 129 +++++++++++------- .../certifiedCjDetail/certifiedCjDetail.vue | 2 +- pages/ideasAndNeeds/ideasAndNeeds.vue | 17 ++- pages/index/index.vue | 30 ++++ pages/my/login/login.vue | 13 +- 6 files changed, 152 insertions(+), 84 deletions(-) diff --git a/components/productsBtn/productsBtn.vue b/components/productsBtn/productsBtn.vue index a05fb37..e5b011a 100644 --- a/components/productsBtn/productsBtn.vue +++ b/components/productsBtn/productsBtn.vue @@ -29,13 +29,15 @@ - - + + + + - - + --> 暂无更多浏览记录 @@ -57,7 +59,7 @@ imgUrl: '', tagsArray: [], productList: [], - showM: false, + // showM: false, content: '您确定移除吗?', productList: [] } @@ -83,26 +85,31 @@ item.tags = this.tagsArray[0] item.create_time = dateFormatHistory(item.create_time) } - // console.log('获取历史记录', res.data); - this.productId = data.id + // console.log('获取历史记录', data); this.productList = data }).finally(_ => { }) }, //移除按钮 - showModal() { - this.showM = true - }, - confirm() { - this.showM = false - this.$apiServe.deleteHistoryOrCollection(this.productId).then(res => { - // console.log('删除历史记录或收藏', res.data); - this.productList.splice(this.productId, 1) - }).finally(_ => {}) - }, - cancel() { - this.showM = false + deleteProduct(item) { + 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('取消删除') + } + } + }) } } } diff --git a/packageMy/myRelease/myRelease.vue b/packageMy/myRelease/myRelease.vue index c0c2aaf..5de7506 100644 --- a/packageMy/myRelease/myRelease.vue +++ b/packageMy/myRelease/myRelease.vue @@ -4,11 +4,32 @@ - + - {{item.desc}} - {{item.pname}} + {{item.desc}} + + + + {{item.pub_time}} + + + + + 修改 + + + + 删除 + + + + + + + + {{item.pname}} {{item.pub_time}} @@ -26,15 +47,16 @@ - - - + + 暂无更多记录 + 暂无更多记录 @@ -51,40 +73,22 @@ data() { return { isLoad: true, - id: '', - showM: false, + // id: '', + // showM: false, content: '您确定删除吗?', tabCurrent: 0, - type: '', - desc: '', - pname: '', - pub_time: '', + type: 1, tabsList: [{ name: '需求发布' }, { name: '创意发布' }], - needsList: [ - // { - // id: 1, - // desc: '需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述描述需求描述描...', - // pname: '产品名称产品名称产品名称', - // pub_time: '2022-12-03 09:59', - // }, { - // id: 2, - // desc: '需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述需求描述描述需求描述描...', - // pname: '产品名称产品名称产品名称', - // pub_time: '2022-12-03 09:59', - // }, - ] + needsList: [], + ideasList: [] } }, onLoad() { - if (this.tabCurrent == 0) { - this.type = 2 - } else if (this.tabCurrent == 1) { - this.type = 1 - } + console.log(uni.getStorageSync('token')); this.getIdeasAndNeeds() if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) { console.log(uni.getStorageSync('token')) @@ -99,44 +103,67 @@ methods: { //获取创意发布 getIdeasAndNeeds() { + console.log('this.type', this.type); this.$apiServe.getIdeasAndNeeds(this.type).then(res => { - console.log('获取创意发布&需求发布', res.data); + console.log('获取创意发布&需求发布', res.data.data); let data = res.data.data for (const item of data) { - item.pub_time = dateFormatXwDetail(pub_time) - this.id = item.id + item.pub_time = dateFormatXwDetail(item.pub_time) + 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(_ => { }) }, + //切换需求发布和创意发布 tabChange(data) { 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() }, - //修改我的需求或创意 + //修改我的需求 editIdeasAndNeeds(item) { 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) { - this.showM = true - }, - //删除确认按钮 - confirm() { - this.showM = false - // this.$apiServe.deleteIdeasAndNeeds(this.id).then(res => { - // console.log('删除发布', res.data); - // // this.needsList.splice(this.needsList.id, 1) - // }).finally(_ => { + var that = this + uni.showModal({ + title: '提示', + content: '你确定要删除吗', + success: function(res) { + if (res.confirm) { + that.$apiServe.deleteIdeasAndNeeds(item.id).then(res => { + console.log('删除发布', res); + if (res.data.code == 1) { + that.$toast.warn('删除成功') + } + that.getIdeasAndNeeds() + }).finally(_ => { - // }) - }, - cancel() { - this.showM = false + }) + } else if (res.cancel) { + that.$toast.warn('取消删除') + } + } + }) }, reOnLoad() { console.log('----------------true') diff --git a/packageReport/certifiedCjDetail/certifiedCjDetail.vue b/packageReport/certifiedCjDetail/certifiedCjDetail.vue index c170f4f..b84c1c0 100644 --- a/packageReport/certifiedCjDetail/certifiedCjDetail.vue +++ b/packageReport/certifiedCjDetail/certifiedCjDetail.vue @@ -65,7 +65,7 @@ //获取认证厂家详情 getCertifiedCjDetail() { this.$apiServe.getCertifiedCjDetail(this.id).then(res => { - // console.log('认证厂家详情页', res.data) + console.log('认证厂家详情页', res.data) if (res.data.data) { let data = res.data.data data.images = data.images.split(';') diff --git a/pages/ideasAndNeeds/ideasAndNeeds.vue b/pages/ideasAndNeeds/ideasAndNeeds.vue index b61fd06..3b45be3 100644 --- a/pages/ideasAndNeeds/ideasAndNeeds.vue +++ b/pages/ideasAndNeeds/ideasAndNeeds.vue @@ -44,8 +44,8 @@ 请选择产品类型 - + @@ -149,14 +149,17 @@ fileList1: [], isLoad: true, cateName: null, - tagName: null + tagName: null, } }, 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 - } else if (options.index == 2) { + } else if (options.index == 1) { this.tabCurrent = 1 } if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) { @@ -194,7 +197,7 @@ }).finally(_ => {}) }, getPositionPickerList() { - if(this.needsPublishForm.cate_id) { + if (this.needsPublishForm.cate_id) { const data = { pid: this.needsPublishForm.cate_id } diff --git a/pages/index/index.vue b/pages/index/index.vue index 1dfb68d..8584e81 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -76,12 +76,42 @@ } }, onLoad() { + // this.login() this.getCategories() this.getBanner() this.getImgUrl() this.imgUrl = uni.getStorageSync('img_url') }, 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 getTimeLength(e) { this.reachBottomLength = e diff --git a/pages/my/login/login.vue b/pages/my/login/login.vue index 8fffa5a..1c9a80f 100644 --- a/pages/my/login/login.vue +++ b/pages/my/login/login.vue @@ -5,8 +5,8 @@ 取消 - 登录 + 登录 + @@ -101,13 +101,14 @@ /deep/.u-button { width: 40% !important; } + .login-content { width: 100%; - position:absolute; - top:50%; + position: absolute; + top: 50%; left: 50%; - padding: 50rpx 30rpx; + padding: 50rpx 30rpx; background-color: #fff; - transform:translate(-50%,-50%); + transform: translate(-50%, -50%); }