From a87f96323ace06337b538a27d13f259ca8b5a539 Mon Sep 17 00:00:00 2001 From: fanfan Date: Mon, 11 Nov 2024 20:06:04 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ext.json | 2 +- manifest.json | 2 +- pages/squareDynamic/index.vue | 273 +++++++++++++++++++++------------- project.config.json | 2 +- 4 files changed, 170 insertions(+), 109 deletions(-) diff --git a/ext.json b/ext.json index b05e423..9c6326d 100644 --- a/ext.json +++ b/ext.json @@ -1,6 +1,6 @@ { "extEnable": true, - "extAppid": "wx8dc1c2620cfd953a", + "extAppid": "wx3f1dcf2e2ac45e7c", "ext": { "store_id": 10048 } diff --git a/manifest.json b/manifest.json index c585bcf..4437fc2 100644 --- a/manifest.json +++ b/manifest.json @@ -92,7 +92,7 @@ "quickapp" : {}, /* 小程序特有相关 */ "mp-weixin" : { - "appid" : "wx8dc1c2620cfd953a", + "appid" : "wx3f1dcf2e2ac45e7c", "libVersion" : "latest", "setting" : { // 是否检查安全域名和 TLS 版本 diff --git a/pages/squareDynamic/index.vue b/pages/squareDynamic/index.vue index 037cd2f..b090302 100644 --- a/pages/squareDynamic/index.vue +++ b/pages/squareDynamic/index.vue @@ -5,27 +5,34 @@ - {{ item }} + {{ item }} - + - + - + {{ item.content }} - {{ showFullCont.includes(index) ? '收起' : '全文' }} + + {{ showFullCont.includes(index) ? '收起' : '全文' }} - + - + {{ solveFileName(file.file_name) }} @@ -51,7 +58,8 @@ 删除文案 - + 下载图片 @@ -65,23 +73,18 @@ {{ loadTitle }} - 暂无动态 - 暂无动态 + 暂无动态 + 暂无动态 - + @touchmove.stop.prevent="touchmove" @touchend="touchend" @click="publish" + :class="{transition: !isMove }"> 发布 - + + @@ -91,10 +94,9 @@ checkLogin } from '@/core/app' import * as UserApi from '@/api/user'; - + export default { - components: { - }, + components: {}, data() { return { tabList: ['推荐', '精选', '晒单', '日常', '文章'], @@ -106,8 +108,8 @@ loading: false, finished: false, showFullCont: [], - top:0, - left:0, + top: 0, + left: 0, width: 0, height: 0, offsetWidth: 0, @@ -130,6 +132,25 @@ this.getDynamicList(); }, }, + /** + * 分享当前页面 + */ + onShareAppMessage() { + return { + + } + }, + + /** + * 分享到朋友圈 + * 本接口为 Beta 版本,暂只在 Android 平台支持,详见分享到朋友圈 (Beta) + * https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html + */ + onShareTimeline() { + return { + + } + }, onLoad() { uni.setNavigationBarColor({ frontColor: '#000000', @@ -167,7 +188,7 @@ } }, onReachBottom() { - this.getDynamicList(); + this.getDynamicList(); }, methods: { // 刷新页面 @@ -185,7 +206,7 @@ }) .then(result => { let data = result.data.userInfo - + that.userInfo = data uni.setStorageSync('userInfo', that.userInfo) resolve(that.userInfo) @@ -201,15 +222,15 @@ }) }, getDynamicList() { - if (this.loading || this.finished) { - return; - } - this.loadTitle = ""; + if (this.loading || this.finished) { + return; + } + this.loadTitle = ""; Api.getDynamic({ - cate: this.activeTab, - page: this.page++, - pageSize: this.limit, - }) + cate: this.activeTab, + page: this.page++, + pageSize: this.limit, + }) .then(result => { const data = result.data.data; this.dynamicList = this.dynamicList.concat(data); @@ -228,7 +249,7 @@ .finally(() => this.loading = false) }, getHeight(item, index) { - this.$nextTick(() => { + this.$nextTick(() => { const query = uni.createSelectorQuery().in(this); query.select(`.cont${index}`).boundingClientRect(data => { if (data) { @@ -248,30 +269,30 @@ }, clipCont(cont) { uni.setClipboardData({ - data: cont + data: cont }); }, - downloadSingleImage(url) { -   return new Promise((resolve, reject) => { -     uni.downloadFile({ -       url: url, -       success: (res) => { -         if (res.statusCode === 200) { -           resolve(res.tempFilePath) -         } else { -           reject(new Error('下载失败')) -         } -       }, -       fail: (err) => { -         reject(new Error('下载失败')) -       } -     }) -   }) + downloadSingleImage(url) { + return new Promise((resolve, reject) => { + uni.downloadFile({ + url: url, + success: (res) => { + if (res.statusCode === 200) { + resolve(res.tempFilePath) + } else { + reject(new Error('下载失败')) + } + }, + fail: (err) => { + reject(new Error('下载失败')) + } + }) + }) }, - downloadMultipleImages(urls) { -   let tasks = [] -   urls.forEach((url, k) => { -     tasks.push(this.downloadSingleImage(url.external_url).then(e => { + downloadMultipleImages(urls) { + let tasks = [] + urls.forEach((url, k) => { + tasks.push(this.downloadSingleImage(url.external_url).then(e => { uni.saveImageToPhotosAlbum({ filePath: e, }); @@ -282,32 +303,32 @@ }) } })); -   }) -   return Promise.all(tasks) + }) + return Promise.all(tasks) }, previewFile(url) { uni.downloadFile({ -       url, -       success: (res) => { -         if (res.statusCode === 200) { + url, + success: (res) => { + if (res.statusCode === 200) { this.isPreview = true; uni.openDocument({ filePath: res.tempFilePath, }); -         } else { -         uni.showToast({ + } else { + uni.showToast({ icon: 'error', title: '下载失败!' }) -         } -       }, -       fail: (err) => { -         uni.showToast({ + } + }, + fail: (err) => { + uni.showToast({ icon: 'error', title: '下载失败!' }) -       } -     }) + } + }) }, solveFileName(name) { if (name.indexOf('.xlsx')) { @@ -317,8 +338,8 @@ }, togggleLike(item, index) { Api.dynamicLike({ - id: item.square_id, - }) + id: item.square_id, + }) .then(res => { if (item.isLike) { item.isLike = false; @@ -337,17 +358,16 @@ url: '/pages/squareDynamic/publish', }) }, - spred(e){ + spred(e) { const animation = uni.createAnimation({ duration: 200, timingFunction: 'ease', }); this.animationData = animation.export(); - - if(this.isShow){ + + if (this.isShow) { animation.rotate(135).step(); - } - else{ + } else { animation.rotate(0).step(); } this.animationData = animation.export(); @@ -358,7 +378,7 @@ return false; } this.isMove = true; - this.isShow=false + this.isShow = false this.spred() this.left = e.touches[0].clientX - this.offsetWidth; let clientX = e.touches[0].clientX; @@ -380,31 +400,31 @@ } else { this.top = clientY } - + }, touchend(e) { if (this.isDock) { let edgeRigth = this.windowWidth - this.width - this.edge; - + if (this.left < this.windowWidth / 2 - this.offsetWidth) { this.left = this.edge; } else { this.left = edgeRigth; } - if(this.left>200){ - this.postitionName=false - }else{ - this.postitionName=true + if (this.left > 200) { + this.postitionName = false + } else { + this.postitionName = true } } - + this.isMove = false; }, - + previewImages(idx, images) { const arr = []; images.forEach(v => { - arr.push(v.external_url); + arr.push(v.external_url); }) uni.previewImage({ current: idx, @@ -434,8 +454,8 @@ }, deleteDynamic(item) { Api.deleteDynamic({ - squareId: item.square_id - }) + squareId: item.square_id + }) .then(result => { uni.showToast({ icon: 'success', @@ -456,6 +476,7 @@ .container { background: #F7F8FA; padding-top: 292rpx; + .head { height: 450rpx; width: 100%; @@ -463,6 +484,7 @@ top: -88rpx; background: linear-gradient(0deg, #F7F8FA, #E0EFFD); z-index: 0; + >image { position: absolute; top: 138rpx; @@ -472,14 +494,17 @@ height: 221rpx; } } + .box { position: relative; width: 100%; // top: 292rpx; padding: 24rpx; + .tab-list { display: flex; justify-content: space-between; + .tab-item { width: 130rpx; height: 80rpx; @@ -490,31 +515,38 @@ color: #999999; line-height: 80rpx; text-align: center; + &.active { - box-shadow: 0rpx 4rpx 12rpx 0rpx rgba(32,39,76,0.1); + box-shadow: 0rpx 4rpx 12rpx 0rpx rgba(32, 39, 76, 0.1); opacity: 1; color: #333333; } } } + .list { margin-top: 30rpx; + .dynamic-item { width: 100%; background: #FFFFFF; border-radius: 20rpx; padding: 30rpx; margin-bottom: 20rpx; + &:last-child { margin-bottom: 0; } + .user { display: flex; + >image { width: 80rpx; height: 80rpx; margin-right: 24rpx; } + .user-info { .name { font-size: 30rpx; @@ -522,6 +554,7 @@ line-height: 30rpx; margin-bottom: 26rpx; } + .time { font-size: 24rpx; color: #999999; @@ -529,6 +562,7 @@ } } } + .cont { margin-top: 30rpx; font-size: 28rpx; @@ -537,6 +571,7 @@ color: #222222; word-break: break-word; white-space: pre-line; + &.close { max-height: 240rpx; overflow: hidden; @@ -546,29 +581,35 @@ -webkit-box-orient: vertical; } } + .show-more { font-size: 28rpx; line-height: 40rpx; color: #F34A40; text-align: right; } + .pic-list { margin-top: 24rpx; + >image { width: 210rpx; height: 210rpx; margin-right: 6rpx; margin-bottom: 6rpx; border-radius: 10rpx; + &:nth-child(3n) { margin-right: 0; } } } + .file-list { display: block; padding: 30rpx 0; height: fit-content; + .file-box { border-bottom: 1px solid #ddd; display: flex; @@ -577,15 +618,18 @@ padding: 10rpx 20rpx; height: 80rpx; margin-bottom: 20rpx; + &:last-child { border-bottom: none; } + >image { width: 60rpx; height: 60rpx; margin: 0 10rpx 0 0; flex-shrink: 0; } + >text { width: calc(100% - 70rpx); overflow: hidden; @@ -594,36 +638,44 @@ } } } + .goods { background: #f5f5f5; padding: 20rpx; margin-top: 24rpx; } + .goods-box { display: flex; background: #fff; padding: 20rpx 0; + >image { width: 100rpx; height: 100rpx; margin-right: 20rpx; } + .goods-info { width: calc(100% - 120rpx); display: flex; flex-direction: column; justify-content: space-between; + .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } + .price { display: flex; + >text { &:first-child { color: #F34A40; } + &:last-child { height: 40rpx; line-height: 40rpx; @@ -640,10 +692,12 @@ } } } + .btns { margin-top: 20rpx; display: flex; justify-content: flex-end; + .btn { display: flex; flex-direction: column; @@ -652,16 +706,19 @@ line-height: 24rpx; color: #999999; margin-left: 40rpx; + image { width: 40rpx; height: 40rpx; margin-bottom: 10rpx; } + ::v-deep { .delete { margin-bottom: 10rpx; + .uni-icons { - font-size: 40rpx!important; + font-size: 40rpx !important; font-weight: bold; line-height: 40rpx; } @@ -671,27 +728,30 @@ } } } + .finished, .loading { - font-size: 28rpx; - line-height: 100rpx; - text-align: center; - color: #bbb; + font-size: 28rpx; + line-height: 100rpx; + text-align: center; + color: #bbb; } + .empty { - margin-top: 100rpx; - font-size: 28rpx; - text-align: center; - color: #bbb; + margin-top: 100rpx; + font-size: 28rpx; + text-align: center; + color: #bbb; } - + .empty image { - display: block; - width: 414rpx; - height: 305rpx; - margin: 0 auto 20rpx; - pointer-events: none; + display: block; + width: 414rpx; + height: 305rpx; + margin: 0 auto 20rpx; + pointer-events: none; } + .publish { position: fixed; left: 626rpx; @@ -707,6 +767,7 @@ flex-direction: column; align-items: center; justify-content: center; + >image { width: 35rpx; height: 28rpx; @@ -715,4 +776,4 @@ } } } - \ No newline at end of file + diff --git a/project.config.json b/project.config.json index 7d6cf1c..07f3f64 100644 --- a/project.config.json +++ b/project.config.json @@ -1,5 +1,5 @@ { - "appid": "wx8dc1c2620cfd953a", + "appid": "wx3f1dcf2e2ac45e7c", "compileType": "miniprogram", "libVersion": "3.3.3", "packOptions": {