From 2927f9590f02ac6093917d47dc6bb6c3e60c626e Mon Sep 17 00:00:00 2001
From: Enzo <1284707383@qq.com>
Date: Thu, 30 Sep 2021 15:15:19 +0800
Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E7=B3=BB=E5=88=97=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/discover/discover.vue | 8 +-
pages/discover/discoverdetails.vue | 30 +++---
pages/discover/publish.vue | 148 +++++++++++++++++------------
pages/shop/seckillList.vue | 4 +-
pages/user/my/center.vue | 2 +-
5 files changed, 108 insertions(+), 84 deletions(-)
diff --git a/pages/discover/discover.vue b/pages/discover/discover.vue
index 51ccb7f..77038f0 100644
--- a/pages/discover/discover.vue
+++ b/pages/discover/discover.vue
@@ -33,16 +33,16 @@
-
-
+
+
{{item.likes_count}}
-
+
{{item.view_count}}
-
+
{{item.comments_count}}
diff --git a/pages/discover/discoverdetails.vue b/pages/discover/discoverdetails.vue
index ac14e46..a5b8691 100644
--- a/pages/discover/discoverdetails.vue
+++ b/pages/discover/discoverdetails.vue
@@ -24,16 +24,16 @@
-
-
+
+
{{discover_details.likes_count}}
-
+
{{discover_details.view_count}}
-
+
{{discover_details.comments_count}}
@@ -59,8 +59,8 @@
-
-
+
+
{{commentitem.likes_count}}
@@ -91,8 +91,8 @@
-
-
+
+
{{subitem.likes_count}}
@@ -110,17 +110,17 @@
-
-
-
+
+
+
{{discover_details.likes_count}}
-
-
+
+
{{discover_details.view_count}}
-
-
+
+
{{discover_details.comments_count}}
diff --git a/pages/discover/publish.vue b/pages/discover/publish.vue
index 3d840e4..aa57af7 100644
--- a/pages/discover/publish.vue
+++ b/pages/discover/publish.vue
@@ -30,7 +30,9 @@
image_count: 6,
content: '',
backInquiry: false,
- uploadImg: []
+ uploadImg: [],
+ p_list: [],
+ tempFilesList: []
}
},
watch: {
@@ -51,66 +53,83 @@
this.$msg('请输入文字内容!');
return
}
- if(this.uploadImg.length == 0) {
+ if(this.tempFilesList.length == 0) {
this.$msg('请上传图片!');
return
}
- this.$http
- .post({
- api: 'api/discover/create',
- data: {
- images: this.uploadImg,
- content: this.content
- },
- header: {
- Authorization: this.$cookieStorage.get('user_token')
- },
- })
- .then(res => {
- if (res.data.code == 200) {
- if (res.data.status) {
- this.$msg('发布成功',{duration: 2500}).then(() => {
- this.$toBack();
- })
- } else {
- wx.showModal({
- content: res.data.message || '发布失败,请稍后尝试!',
- showCancel: false
- });
- }
- } else {
- wx.showModal({
- content: res.data.message || '发布失败,请稍后尝试!',
- showCancel: false
- });
- }
- wx.hideLoading();
- })
- .catch(() => {
- wx.hideLoading();
- wx.showModal({
- content: '请求失败',
- showCancel: false
- });
- });
+
+ let p_list = [];
+
+
+ this.tempFilesList.forEach((item,index) => {
+ p_list.push(this.uploadDiscover(item.path))
+ })
+
+ this.p_list = p_list;
+
+ Promise.all(this.p_list).then(result => {
+ this.$http
+ .post({
+ api: 'api/discover/create',
+ data: {
+ images: result,
+ content: this.content
+ },
+ header: {
+ Authorization: this.$cookieStorage.get('user_token')
+ },
+ })
+ .then(res => {
+ if (res.data.code == 200) {
+ if (res.data.status) {
+ this.content = '';
+ this.image_list = [];
+ this.$msg('发布成功',{duration: 2500}).then(() => {
+ this.$toBack();
+ })
+ } else {
+ wx.showModal({
+ content: res.data.message || '发布失败,请稍后尝试!',
+ showCancel: false
+ });
+ }
+ } else {
+ wx.showModal({
+ content: res.data.message || '发布失败,请稍后尝试!',
+ showCancel: false
+ });
+ }
+ wx.hideLoading();
+ })
+ .catch(() => {
+ wx.hideLoading();
+ wx.showModal({
+ content: '请求失败',
+ showCancel: false
+ });
+ });
+ })
},
uploadDiscover(img) {
- uni.uploadFile({
- header: {
- Authorization: this.$cookieStorage.get('user_token')
- },
- url: this.$config.GLOBAL.baseUrl+'api/discover/upload_image',
- filePath: img,
- fileType: 'image',
- name: 'image',
- success: res => {
- var result = JSON.parse(res.data).data.url;
- this.uploadImg.push(result)
- console.log('上传后的图片路径',this.uploadImg)
- },
- fail: err => {
- console.log(err)
- }
+ console.log('=========',img)
+ return new Promise((resolve, reject) => {
+ uni.uploadFile({
+ header: {
+ Authorization: this.$cookieStorage.get('user_token')
+ },
+ url: this.$config.GLOBAL.baseUrl+'api/discover/upload_image',
+ filePath: img,
+ fileType: 'image',
+ name: 'image',
+ success: res => {
+ var result = JSON.parse(res.data).data.url;
+ resolve(result);
+ },
+ fail: err => {
+ console.log(err)
+ reject(err)
+ }
+ })
})
},
// 上传凭证图片
@@ -142,9 +161,7 @@
})
}
this.image_list.push(...image_list);
- this.uploadDiscover(tempFiles[0].path)
-
- console.log('当前选择的图片列表',this.image_list);
+ this.tempFilesList.push(...tempFiles);
}
})
},
@@ -160,9 +177,16 @@
},
// 移除图片
removeInage(current){
- this.image_list.splice(current, 1);
- this.uploadImg.splice(current, 1);
- console.log('删除的图片列表',this.uploadImg);
+ uni.showModal({
+ title: '提示',
+ content: '即将取消上传这张图片,请确认?',
+ success: e => {
+ if (!e.confirm) return;
+ this.image_list.splice(current, 1);
+ this.uploadImg.splice(current, 1);
+ this.tempFilesList.splice(current, 1);
+ }
+ });
}
}
}
diff --git a/pages/shop/seckillList.vue b/pages/shop/seckillList.vue
index fe4d2b0..4dee43a 100644
--- a/pages/shop/seckillList.vue
+++ b/pages/shop/seckillList.vue
@@ -20,7 +20,7 @@
{{item.seckill.end_left_time[0]}}天{{item.seckill.end_left_time[1]}}时{{item.seckill.end_left_time[2]}}分{{item.seckill.end_left_time[3]}}秒
-->
距离结束还剩余
-
+
{{ day >= 10 ? day : "0" + day }}
@@ -36,7 +36,7 @@
距离开始还剩余
-
+
{{ day >= 10 ? day : "0" + day }}
diff --git a/pages/user/my/center.vue b/pages/user/my/center.vue
index 8c6fa32..7cf518f 100644
--- a/pages/user/my/center.vue
+++ b/pages/user/my/center.vue
@@ -31,7 +31,7 @@
余额(元)
- {{centerInfo.coupon || 0}}
+ {{centerInfo.couponCount || 0}}
优惠券