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 {