1.优化登录流程
2.uniapp评价完成后要连需3-4次返回才能到首页(体验不是很好)
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
<view class="container">
|
<view class="container">
|
||||||
<view v-if="!token">
|
<view v-if="!token">
|
||||||
<!-- 小程序 -->
|
<!-- 小程序 -->
|
||||||
<view v-if="$deviceType == 'routine'">
|
<view v-if="$deviceType == 'routine'&&!authorize">
|
||||||
<view class="getUserInfo">
|
<view class="getUserInfo">
|
||||||
<text>您还未允许微信登录授权,请点击下方按钮允许微信授权登录。</text>
|
<text>您还未允许微信登录授权,请点击下方按钮允许微信授权登录。</text>
|
||||||
<button type="primary" open-type="getUserInfo" @getuserinfo="getUserInfo">允许微信登录授权</button>
|
<button type="primary" open-type="getUserInfo" @getuserinfo="getUserInfo">允许微信登录授权</button>
|
||||||
@ -11,7 +11,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- app -->
|
<!-- app -->
|
||||||
<view v-if="$deviceType == 'app'">
|
<view v-if="$deviceType == 'app'&&!authorize">
|
||||||
<view class="getUserInfo">
|
<view class="getUserInfo">
|
||||||
<text>请先登录</text>
|
<text>请先登录</text>
|
||||||
<button type="primary" @click="this.toLogin">去登录</button>
|
<button type="primary" @click="this.toLogin">去登录</button>
|
||||||
@ -28,17 +28,26 @@ import { mapState, mapMutations, mapActions } from "vuex";
|
|||||||
import { wxappAuth, getUser } from "@/api/user";
|
import { wxappAuth, getUser } from "@/api/user";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import cookie from "@/utils/store/cookie";
|
import cookie from "@/utils/store/cookie";
|
||||||
import { login } from "@/utils";
|
import { login, authorize } from "@/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {};
|
return {
|
||||||
|
authorize: true
|
||||||
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["isAuthorization", "$deviceType", "token"])
|
...mapState(["isAuthorization", "$deviceType", "token"])
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.UPDATE_AUTHORIZATIONPAGE(true);
|
this.UPDATE_AUTHORIZATIONPAGE(true);
|
||||||
|
// 先校验用户是否授权,如果没有授权,显示授权按钮
|
||||||
|
authorize("userInfo")
|
||||||
|
.then(() => {})
|
||||||
|
.catch(error => {
|
||||||
|
// 用户未授权,显示授权按钮
|
||||||
|
this.authorize = true;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
onHide() {
|
onHide() {
|
||||||
this.UPDATE_AUTHORIZATIONPAGE(false);
|
this.UPDATE_AUTHORIZATIONPAGE(false);
|
||||||
|
@ -199,17 +199,19 @@ export default {
|
|||||||
DataFormat
|
DataFormat
|
||||||
},
|
},
|
||||||
computed: mapGetters(["userInfo"]),
|
computed: mapGetters(["userInfo"]),
|
||||||
watch: {
|
onShow: function() {
|
||||||
$yroute(n) {
|
console.log(this)
|
||||||
if (n.name === NAME) {
|
this.type = parseInt(this.$yroute.query.type) || 0;
|
||||||
const type = parseInt(this.$yroute.query.type) || 0;
|
this.changeType(this.type);
|
||||||
if (this.type !== type) {
|
this.getOrderData();
|
||||||
this.changeType(type);
|
this.getOrderList();
|
||||||
}
|
},
|
||||||
this.getOrderData();
|
onHide: function() {
|
||||||
}
|
this.orderList = [];
|
||||||
},
|
this.page = 1;
|
||||||
type() {}
|
this.limit = 20;
|
||||||
|
this.loaded = false;
|
||||||
|
this.loading = false;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
goLogistics(order) {
|
goLogistics(order) {
|
||||||
@ -308,11 +310,7 @@ export default {
|
|||||||
},
|
},
|
||||||
toPay() {}
|
toPay() {}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {},
|
||||||
this.type = parseInt(this.$yroute.query.type) || 0;
|
|
||||||
this.getOrderData();
|
|
||||||
this.getOrderList();
|
|
||||||
},
|
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
!this.loading && this.getOrderList();
|
!this.loading && this.getOrderList();
|
||||||
}
|
}
|
||||||
@ -320,7 +318,6 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
|
|
||||||
.noCart {
|
.noCart {
|
||||||
margin-top: 0.17 * 100rpx;
|
margin-top: 0.17 * 100rpx;
|
||||||
padding-top: 0.1 * 100rpx;
|
padding-top: 0.1 * 100rpx;
|
||||||
|
@ -482,9 +482,9 @@
|
|||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: "生成订单中"
|
title: "生成订单中"
|
||||||
});
|
});
|
||||||
let form = {}
|
let from = {}
|
||||||
if (this.$deviceType == 'app') {
|
if (this.$deviceType == 'app') {
|
||||||
form.form = 'app'
|
from.from = 'app'
|
||||||
}
|
}
|
||||||
createOrder(this.orderGroupInfo.orderKey, {
|
createOrder(this.orderGroupInfo.orderKey, {
|
||||||
realName: this.contacts,
|
realName: this.contacts,
|
||||||
@ -500,7 +500,7 @@
|
|||||||
from: this.from,
|
from: this.from,
|
||||||
mark: this.mark || "",
|
mark: this.mark || "",
|
||||||
shippingType: parseInt(shipping_type) + 1,
|
shippingType: parseInt(shipping_type) + 1,
|
||||||
...form
|
...from
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
|
@ -340,12 +340,12 @@ export default {
|
|||||||
//产品详情接口;
|
//产品详情接口;
|
||||||
productCon: function() {
|
productCon: function() {
|
||||||
let that = this;
|
let that = this;
|
||||||
let form = {};
|
let from = {};
|
||||||
if (this.$deviceType == "app") {
|
if (this.$deviceType == "app") {
|
||||||
form.form = "app";
|
from.from = "app";
|
||||||
}
|
}
|
||||||
uni.showLoading({ title: "加载中", mask: true });
|
uni.showLoading({ title: "加载中", mask: true });
|
||||||
getProductDetail(that.id, form)
|
getProductDetail(that.id, from)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
that.$set(that, "storeInfo", res.data.storeInfo);
|
that.$set(that, "storeInfo", res.data.storeInfo);
|
||||||
// 给 attr 赋值,将请求回来的规格赋值给 attr
|
// 给 attr 赋值,将请求回来的规格赋值给 attr
|
||||||
|
@ -196,12 +196,22 @@
|
|||||||
icon: "success",
|
icon: "success",
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
this.$yrouter.push({
|
|
||||||
path: "/pages/order/OrderDetails/index",
|
// ? 回跳到上一页
|
||||||
query: {
|
this.$yrouter.back()
|
||||||
id: this.orderCon.orderId
|
|
||||||
}
|
// ? 默认跳转到详情页
|
||||||
});
|
// this.$yrouter.push({
|
||||||
|
// path: "/pages/order/OrderDetails/index",
|
||||||
|
// query: {
|
||||||
|
// id: this.orderCon.orderId
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
// ? 可选重定向到详情页,这时左上角会有一个返回首页的图标
|
||||||
|
// this.$yrouter.reLaunch({
|
||||||
|
// path: "/pages/home/index",
|
||||||
|
// });
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
@ -291,9 +291,14 @@ export default {
|
|||||||
},
|
},
|
||||||
MenuUser: function() {
|
MenuUser: function() {
|
||||||
let that = this;
|
let that = this;
|
||||||
getMenuUser().then(res => {
|
getMenuUser()
|
||||||
that.MyMenus = res.data.routine_my_menus;
|
.then(res => {
|
||||||
});
|
uni.hideLoading();
|
||||||
|
that.MyMenus = res.data.routine_my_menus;
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
goPages: function(index) {
|
goPages: function(index) {
|
||||||
let url = this.MyMenus[index].uniapp_url;
|
let url = this.MyMenus[index].uniapp_url;
|
||||||
@ -335,9 +340,11 @@ export default {
|
|||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
if (this.$store.getters.token) {
|
if (this.$store.getters.token) {
|
||||||
//
|
//
|
||||||
this.$store.dispatch('getUser', true)
|
uni.showLoading({
|
||||||
|
title: "绑定中"
|
||||||
|
});
|
||||||
|
this.$store.dispatch("getUser", true);
|
||||||
this.MenuUser();
|
this.MenuUser();
|
||||||
this.isWeixin = isWeixin();
|
this.isWeixin = isWeixin();
|
||||||
}
|
}
|
||||||
|
@ -64,11 +64,11 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
getIndex: function() {
|
getIndex: function() {
|
||||||
let that = this;
|
let that = this;
|
||||||
let form = {};
|
let from = {};
|
||||||
if (this.$deviceType == "app") {
|
if (this.$deviceType == "app") {
|
||||||
form.form = "app";
|
from.from = "app";
|
||||||
}
|
}
|
||||||
getSpreadImg(form).then(
|
getSpreadImg(from).then(
|
||||||
res => {
|
res => {
|
||||||
that.info = res.data;
|
that.info = res.data;
|
||||||
},
|
},
|
||||||
|
@ -403,7 +403,7 @@ export const handleLoginStatus = (location, complete, fail, success) => {
|
|||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
export function routerPermissions(url) {
|
export function routerPermissions(url, type) {
|
||||||
let path = url
|
let path = url
|
||||||
if (!path) {
|
if (!path) {
|
||||||
path = getCurrentPageUrlWithArgs()
|
path = getCurrentPageUrlWithArgs()
|
||||||
@ -416,9 +416,15 @@ export function routerPermissions(url) {
|
|||||||
// 自动登录
|
// 自动登录
|
||||||
login().then(res => {
|
login().then(res => {
|
||||||
// 登录成功,跳转到需要跳转的页面
|
// 登录成功,跳转到需要跳转的页面
|
||||||
push({
|
if (type == 'reLaunch') {
|
||||||
path,
|
reLaunch({
|
||||||
})
|
path,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
push({
|
||||||
|
path,
|
||||||
|
})
|
||||||
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: error,
|
title: error,
|
||||||
@ -687,9 +693,7 @@ export const handleLoginFailure = () => {
|
|||||||
// cookie.set("spread", url.spread || 0);
|
// cookie.set("spread", url.spread || 0);
|
||||||
} else {
|
} else {
|
||||||
console.log('是拼团进来的,但是没有获取到参数')
|
console.log('是拼团进来的,但是没有获取到参数')
|
||||||
switchTab({
|
handleNoParameters()
|
||||||
path: '/pages/home/index',
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -697,15 +701,6 @@ export const handleLoginFailure = () => {
|
|||||||
if (getCurrentPageUrl() == 'pages/activity/DargainDetails/index' && handleQrCode()) {
|
if (getCurrentPageUrl() == 'pages/activity/DargainDetails/index' && handleQrCode()) {
|
||||||
console.log('是扫描的砍价海报进来的')
|
console.log('是扫描的砍价海报进来的')
|
||||||
let url = handleQrCode();
|
let url = handleQrCode();
|
||||||
console.log(url)
|
|
||||||
// bargainId: "36"
|
|
||||||
// bargainUserUid: 1404
|
|
||||||
|
|
||||||
// bargainId: "36"
|
|
||||||
// codeType: "routine"
|
|
||||||
// pageType: "dargain"
|
|
||||||
// spread: "1404"
|
|
||||||
// uid: "1404"
|
|
||||||
if (url) {
|
if (url) {
|
||||||
path = parseUrl({
|
path = parseUrl({
|
||||||
path: `/${getCurrentPageUrl()}`,
|
path: `/${getCurrentPageUrl()}`,
|
||||||
@ -716,10 +711,9 @@ export const handleLoginFailure = () => {
|
|||||||
})
|
})
|
||||||
// cookie.set("spread", url.spread || 0);
|
// cookie.set("spread", url.spread || 0);
|
||||||
} else {
|
} else {
|
||||||
|
handleNoParameters()
|
||||||
console.log('是扫描的砍价海报进来的,但是没有获取到参数')
|
console.log('是扫描的砍价海报进来的,但是没有获取到参数')
|
||||||
switchTab({
|
|
||||||
path: '/pages/home/index',
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -736,12 +730,24 @@ export const handleLoginFailure = () => {
|
|||||||
})
|
})
|
||||||
cookie.set("spread", url.spread || 0);
|
cookie.set("spread", url.spread || 0);
|
||||||
} else {
|
} else {
|
||||||
switchTab({
|
handleNoParameters()
|
||||||
path: '/pages/home/index',
|
|
||||||
});
|
|
||||||
console.log('是扫描的商品详情进来的,但是没有获取到参数')
|
console.log('是扫描的商品详情进来的,但是没有获取到参数')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
routerPermissions(path)
|
routerPermissions(path, 'reLaunch')
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleNoParameters = () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '未获取到必要参数,即将跳转首页',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
clearTimeout()
|
||||||
|
switchTab({
|
||||||
|
path: '/pages/home/index',
|
||||||
|
});
|
||||||
|
}, 1500)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user