优化验证码 以及跳转部分
parent
346eb13d50
commit
8f942bf01e
|
@ -56,7 +56,7 @@
|
||||||
<script>
|
<script>
|
||||||
import api from "@/config/api.js";
|
import api from "@/config/api.js";
|
||||||
import storage from "@/utils/storage.js";
|
import storage from "@/utils/storage.js";
|
||||||
|
import uuid from "@/utils/uuid.modified.js";
|
||||||
const phone = uni.getSystemInfoSync();
|
const phone = uni.getSystemInfoSync();
|
||||||
const l = phone.screenWidth / 750;
|
const l = phone.screenWidth / 750;
|
||||||
export default {
|
export default {
|
||||||
|
@ -65,12 +65,7 @@ export default {
|
||||||
// 可自行调整
|
// 可自行调整
|
||||||
this.scHight = phone.screenHeight / 2 - 200 + "px";
|
this.scHight = phone.screenHeight / 2 - 200 + "px";
|
||||||
this.getCode();
|
this.getCode();
|
||||||
// 监听是否要重新验证
|
|
||||||
uni.$on("vert", (data) => {
|
|
||||||
this.vsr = data;
|
|
||||||
this.vsrtx = "点击进行验证";
|
|
||||||
this.getCode();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
height: {
|
height: {
|
||||||
|
@ -136,10 +131,19 @@ export default {
|
||||||
this.hid = !this.hid;
|
this.hid = !this.hid;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
error() {
|
||||||
|
this.vsr = false;
|
||||||
|
this.hid = false;
|
||||||
|
this.moveX = 0;
|
||||||
|
this.moveCode = 0;
|
||||||
|
},
|
||||||
// 获取验证图片
|
// 获取验证图片
|
||||||
getCode() {
|
getCode() {
|
||||||
this.col = "#b3afae";
|
this.col = "#b3afae";
|
||||||
this.hasImg = "图片加载中...";
|
this.hasImg = "图片加载中...";
|
||||||
|
if (!storage.getUuid()) {
|
||||||
|
storage.setUuid(uuid.v1());
|
||||||
|
}
|
||||||
uni.request({
|
uni.request({
|
||||||
url: api.common + "/slider/" + this.business,
|
url: api.common + "/slider/" + this.business,
|
||||||
header: {
|
header: {
|
||||||
|
@ -472,16 +476,10 @@ export default {
|
||||||
bottom: 70rpx;
|
bottom: 70rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.moneycolor {
|
.moneycolor {
|
||||||
color: #ea5002;
|
color: #ea5002;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.margin-top {
|
.margin-top {
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
}
|
}
|
||||||
|
@ -498,14 +496,10 @@ export default {
|
||||||
margin-left: 20rpx;
|
margin-left: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.margin-right {
|
.margin-right {
|
||||||
margin-right: 20rpx;
|
margin-right: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.main-color {
|
.main-color {
|
||||||
color: #07d188;
|
color: #07d188;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
*/
|
*/
|
||||||
// 开发环境
|
// 开发环境
|
||||||
const dev = {
|
const dev = {
|
||||||
common: "https://common-api.pickmall.cn",
|
// common: "https://common-api.pickmall.cn",
|
||||||
buyer: "https://buyer-api.pickmall.cn",
|
// buyer: "https://buyer-api.pickmall.cn",
|
||||||
// common: "http://192.168.0.109:8890",
|
common: "http://192.168.0.106:8890",
|
||||||
// buyer: "http://192.168.0.109:8888",
|
buyer: "http://192.168.0.106:8888",
|
||||||
};
|
};
|
||||||
// 生产环境
|
// 生产环境
|
||||||
const prod = {
|
const prod = {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="wrapper">
|
<view class="wrapper" v-if="flage">
|
||||||
<div class='goods' v-if="selectedGoods">
|
<div class='goods' v-if="selectedGoods">
|
||||||
<image class="goods-image" :src="selectedGoods.thumbnail" alt="">
|
<image class="goods-image" :src="selectedGoods.thumbnail" alt="">
|
||||||
<p class="goodsName">{{selectedGoods.goodsName}}</p>
|
<p class="goodsName">{{selectedGoods.goodsName}}</p>
|
||||||
|
@ -72,6 +72,7 @@ import popupGoods from "./popup/goods"; //购物车商品的模块
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
flage:false, //判断接口是否正常请求
|
||||||
addr: {
|
addr: {
|
||||||
id: "",
|
id: "",
|
||||||
},
|
},
|
||||||
|
@ -138,7 +139,8 @@ export default {
|
||||||
// 实例化本页面
|
// 实例化本页面
|
||||||
async init(sn, sku) {
|
async init(sn, sku) {
|
||||||
let res = await getPinTuanShare(sn, sku);
|
let res = await getPinTuanShare(sn, sku);
|
||||||
if (res.data.success) {
|
if (res.data.success && res.data.result.promotionGoods) {
|
||||||
|
this.flage = true
|
||||||
this.data = res.data.result;
|
this.data = res.data.result;
|
||||||
this.selectedGoods = res.data.result.promotionGoods;
|
this.selectedGoods = res.data.result.promotionGoods;
|
||||||
let endTime = Date.parse(
|
let endTime = Date.parse(
|
||||||
|
@ -175,12 +177,17 @@ export default {
|
||||||
|
|
||||||
// 获取当前商品是否已经购买
|
// 获取当前商品是否已经购买
|
||||||
if (storage.getUserInfo().id) {
|
if (storage.getUserInfo().id) {
|
||||||
|
|
||||||
let isBuy = res.data.result.pintuanMemberVOS.filter((item) => {
|
let isBuy = res.data.result.pintuanMemberVOS.filter((item) => {
|
||||||
return item.memberId == storage.getUserInfo().id;
|
return item.memberId == storage.getUserInfo().id;
|
||||||
});
|
});
|
||||||
isBuy.length != 0 ? (this.isBuy = true) : (this.isBuy = false);
|
isBuy.length != 0 ? (this.isBuy = true) : (this.isBuy = false);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '当前拼团单有误!请联系管理员重试',
|
||||||
|
duration: 2000,
|
||||||
|
icon:"none"
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 获取商品详情
|
// 获取商品详情
|
||||||
|
|
|
@ -71,6 +71,7 @@ export default {
|
||||||
},
|
},
|
||||||
// 必须要在onReady生命周期setRules,因为onLoad生命周期组件可能尚未创建完毕
|
// 必须要在onReady生命周期setRules,因为onLoad生命周期组件可能尚未创建完毕
|
||||||
mounted() {
|
mounted() {
|
||||||
|
// whetherNavigate();
|
||||||
this.$refs.validateCodeForm.setRules(this.codeRules);
|
this.$refs.validateCodeForm.setRules(this.codeRules);
|
||||||
/**
|
/**
|
||||||
* 条件编译判断当前客户端类型
|
* 条件编译判断当前客户端类型
|
||||||
|
@ -83,15 +84,16 @@ export default {
|
||||||
//#endif
|
//#endif
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
flage(val) {
|
async flage(val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
if (this.$refs.uCode.canGetCode) {
|
if (this.$refs.uCode.canGetCode) {
|
||||||
// 向后端请求验证码
|
// 向后端请求验证码
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: "正在获取验证码",
|
title: "正在获取验证码",
|
||||||
});
|
});
|
||||||
sendMobile(this.codeForm.mobile)
|
|
||||||
.then((res) => {
|
let res = await sendMobile(this.codeForm.mobile);
|
||||||
|
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
// 这里此提示会被this.start()方法中的提示覆盖
|
// 这里此提示会被this.start()方法中的提示覆盖
|
||||||
if (res.data.success) {
|
if (res.data.success) {
|
||||||
|
@ -102,16 +104,13 @@ export default {
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
uni.navigateBack();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
this.flage = false;
|
this.flage = false;
|
||||||
this.codeFlag = true;
|
}
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
this.$u.toast("请倒计时结束后再发送");
|
this.$u.toast("请倒计时结束后再发送");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.$refs.verification.hide();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -217,10 +216,11 @@ export default {
|
||||||
title: "请输入正确手机号",
|
title: "请输入正确手机号",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!this.flage) {
|
if (!this.flage) {
|
||||||
this.$refs.verification.hide();
|
this.$refs.verification.error();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -81,18 +81,17 @@ export function checkBankno(bankno) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export function whetherNavigate(type = "default") {
|
export function whetherNavigate(type = "default") {
|
||||||
|
let navigation = getCurrentPages()[getCurrentPages().length - (getCurrentPages().length ) ];
|
||||||
if (getCurrentPages().length > 1) {
|
if (getCurrentPages().length > 1) {
|
||||||
if ((getCurrentPages().length - 2).route == "pages/passport/login") {
|
console.log(navigation, getCurrentPages());
|
||||||
|
if (navigation.route == "pages/passport/login") {
|
||||||
navigationToBack(type);
|
navigationToBack(type);
|
||||||
} else {
|
} else {
|
||||||
if (
|
if (!navigation.route || navigation.route == "undefined") {
|
||||||
!(getCurrentPages().length - 2).route ||
|
|
||||||
(getCurrentPages().length - 2).route == "undefined"
|
|
||||||
) {
|
|
||||||
navigationToBack(type);
|
navigationToBack(type);
|
||||||
} else {
|
} else {
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
delta: getCurrentPages().length - 2,
|
delta: getCurrentPages().length,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ function cleanStorage() {
|
||||||
storage.setHasLogin(false);
|
storage.setHasLogin(false);
|
||||||
storage.setAccessToken("");
|
storage.setAccessToken("");
|
||||||
storage.setRefreshToken("");
|
storage.setRefreshToken("");
|
||||||
console.log("清空token")
|
console.log("清空token");
|
||||||
storage.setUuid("");
|
storage.setUuid("");
|
||||||
storage.setUserInfo({});
|
storage.setUserInfo({});
|
||||||
|
|
||||||
|
@ -133,8 +133,11 @@ http.interceptors.request.use(
|
||||||
refresh();
|
refresh();
|
||||||
} else {
|
} else {
|
||||||
if (
|
if (
|
||||||
JSON.parse(atob(accessToken.split(".")[1].replace(/-/g, '+').replace(/_/g, '/'))).exp <
|
JSON.parse(
|
||||||
Math.round(new Date() / 1000)
|
atob(
|
||||||
|
accessToken.split(".")[1].replace(/-/g, "+").replace(/_/g, "/")
|
||||||
|
)
|
||||||
|
).exp < Math.round(new Date() / 1000)
|
||||||
) {
|
) {
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
@ -144,6 +147,7 @@ http.interceptors.request.use(
|
||||||
...config.header,
|
...config.header,
|
||||||
uuid: storage.getUuid() || uuid.v1(),
|
uuid: storage.getUuid() || uuid.v1(),
|
||||||
};
|
};
|
||||||
|
console.log(config.header);
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
(config) => {
|
(config) => {
|
||||||
|
@ -151,7 +155,6 @@ http.interceptors.request.use(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
async function refresh() {
|
async function refresh() {
|
||||||
// 本地储存的是过期token了,重新获取
|
// 本地储存的是过期token了,重新获取
|
||||||
const getTokenResult = await refreshToken();
|
const getTokenResult = await refreshToken();
|
||||||
|
|
Loading…
Reference in New Issue