From d7e08753815556c2b3ffe6af48904e14724ccd0c Mon Sep 17 00:00:00 2001 From: gaoxs Date: Wed, 3 Jun 2020 10:58:31 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E7=99=BB=E5=BD=95=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=202.uniapp=E8=AF=84=E4=BB=B7=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=90=8E=E8=A6=81=E8=BF=9E=E9=9C=803-4=E6=AC=A1=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E6=89=8D=E8=83=BD=E5=88=B0=E9=A6=96=E9=A1=B5=EF=BC=88?= =?UTF-8?q?=E4=BD=93=E9=AA=8C=E4=B8=8D=E6=98=AF=E5=BE=88=E5=A5=BD=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/authorization/index.vue | 17 ++++++--- pages/order/MyOrder/index.vue | 31 ++++++++-------- pages/order/OrderSubmission/index.vue | 6 ++-- pages/shop/GoodsCon/index.vue | 6 ++-- pages/shop/GoodsEvaluate/index.vue | 22 ++++++++---- pages/user/User/index.vue | 19 ++++++---- pages/user/promotion/Poster/index.vue | 6 ++-- utils/index.js | 52 +++++++++++++++------------ 8 files changed, 94 insertions(+), 65 deletions(-) diff --git a/pages/authorization/index.vue b/pages/authorization/index.vue index 0479a04..5b0689b 100644 --- a/pages/authorization/index.vue +++ b/pages/authorization/index.vue @@ -2,7 +2,7 @@ - + 您还未允许微信登录授权,请点击下方按钮允许微信授权登录。 @@ -11,7 +11,7 @@ - + 请先登录 @@ -28,17 +28,26 @@ import { mapState, mapMutations, mapActions } from "vuex"; import { wxappAuth, getUser } from "@/api/user"; import dayjs from "dayjs"; import cookie from "@/utils/store/cookie"; -import { login } from "@/utils"; +import { login, authorize } from "@/utils"; export default { data() { - return {}; + return { + authorize: true + }; }, computed: { ...mapState(["isAuthorization", "$deviceType", "token"]) }, onShow() { this.UPDATE_AUTHORIZATIONPAGE(true); + // 先校验用户是否授权,如果没有授权,显示授权按钮 + authorize("userInfo") + .then(() => {}) + .catch(error => { + // 用户未授权,显示授权按钮 + this.authorize = true; + }); }, onHide() { this.UPDATE_AUTHORIZATIONPAGE(false); diff --git a/pages/order/MyOrder/index.vue b/pages/order/MyOrder/index.vue index f6a233f..2895e56 100644 --- a/pages/order/MyOrder/index.vue +++ b/pages/order/MyOrder/index.vue @@ -199,17 +199,19 @@ export default { DataFormat }, computed: mapGetters(["userInfo"]), - watch: { - $yroute(n) { - if (n.name === NAME) { - const type = parseInt(this.$yroute.query.type) || 0; - if (this.type !== type) { - this.changeType(type); - } - this.getOrderData(); - } - }, - type() {} + onShow: function() { + console.log(this) + this.type = parseInt(this.$yroute.query.type) || 0; + this.changeType(this.type); + this.getOrderData(); + this.getOrderList(); + }, + onHide: function() { + this.orderList = []; + this.page = 1; + this.limit = 20; + this.loaded = false; + this.loading = false; }, methods: { goLogistics(order) { @@ -308,11 +310,7 @@ export default { }, toPay() {} }, - mounted() { - this.type = parseInt(this.$yroute.query.type) || 0; - this.getOrderData(); - this.getOrderList(); - }, + mounted() {}, onReachBottom() { !this.loading && this.getOrderList(); } @@ -320,7 +318,6 @@ export default {