⏪ fallback: 回退落地页解析openId代码
This commit is contained in:
parent
7f44aeecd4
commit
ecab2f94af
35
index.html
35
index.html
|
@ -84,7 +84,6 @@
|
||||||
describe: {},
|
describe: {},
|
||||||
ftcolor: '',
|
ftcolor: '',
|
||||||
bgcolor: '#333',
|
bgcolor: '#333',
|
||||||
entryLink: '',
|
|
||||||
promttip: '',
|
promttip: '',
|
||||||
promtshow: false,
|
promtshow: false,
|
||||||
tiptext: '提示信息',
|
tiptext: '提示信息',
|
||||||
|
@ -123,14 +122,7 @@
|
||||||
let linkId = this.getQueryString('id');
|
let linkId = this.getQueryString('id');
|
||||||
let keyCode = this.getQueryString('key');
|
let keyCode = this.getQueryString('key');
|
||||||
let openid = this.getQueryString('openid');
|
let openid = this.getQueryString('openid');
|
||||||
if (openid) {
|
openid && localStorage.setItem('openid', openid);
|
||||||
localStorage.setItem('openid', openid);
|
|
||||||
/* 截取openid防止重定向 */
|
|
||||||
this.entryLink = this.removeLastParamFromUrl(location.href);
|
|
||||||
} else {
|
|
||||||
this.entryLink = location.href;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!linkId) {//地址栏无携带id
|
if (!linkId) {//地址栏无携带id
|
||||||
let path = window.location.pathname;
|
let path = window.location.pathname;
|
||||||
let parmas = path.split('/');
|
let parmas = path.split('/');
|
||||||
|
@ -173,7 +165,7 @@
|
||||||
localStorage.setItem('token', res.data.token);
|
localStorage.setItem('token', res.data.token);
|
||||||
localStorage.setItem('haskey', keyCode);
|
localStorage.setItem('haskey', keyCode);
|
||||||
this.openDialog('正在加载商品...');
|
this.openDialog('正在加载商品...');
|
||||||
localStorage.setItem('entryLink', this.entryLink);//存储起始页链接
|
localStorage.setItem('entryLink', window.location.href);//存储起始页链接
|
||||||
let clr = setTimeout(() => {
|
let clr = setTimeout(() => {
|
||||||
if (this.pageType === 4 || this.pageType === 8) {
|
if (this.pageType === 4 || this.pageType === 8) {
|
||||||
window.location.replace('/coupon/couponCollection.html');
|
window.location.replace('/coupon/couponCollection.html');
|
||||||
|
@ -224,25 +216,6 @@
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 截取路径上的最后一个参数的函数
|
|
||||||
removeLastParamFromUrl (url) {
|
|
||||||
// 找到问号后的路径部分
|
|
||||||
var pathIndex = url.indexOf('?');
|
|
||||||
var path = url.substring(pathIndex + 1);
|
|
||||||
|
|
||||||
// 将路径部分拆分为参数数组
|
|
||||||
var params = path.split('&');
|
|
||||||
|
|
||||||
// 如果存在参数,移除最后一个参数
|
|
||||||
if (params.length > 0) {
|
|
||||||
params.pop(); // 移除最后一个参数
|
|
||||||
}
|
|
||||||
|
|
||||||
// 重构URL
|
|
||||||
var updatedUrl = url.substring(0, pathIndex + 1) + params.join('&');
|
|
||||||
|
|
||||||
return updatedUrl;
|
|
||||||
},
|
|
||||||
|
|
||||||
//获取白名单验证码
|
//获取白名单验证码
|
||||||
getcode () {
|
getcode () {
|
||||||
|
@ -300,7 +273,7 @@
|
||||||
localStorage.setItem('key', self.key);
|
localStorage.setItem('key', self.key);
|
||||||
localStorage.setItem('token', res.data.token);
|
localStorage.setItem('token', res.data.token);
|
||||||
this.openDialog('正在加载商品...');
|
this.openDialog('正在加载商品...');
|
||||||
localStorage.setItem('entryLink', this.entryLink);//存储起始页链接
|
localStorage.setItem('entryLink', window.location.href);//存储起始页链接
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.pageType === 4 || this.pageType === 8) {
|
if (this.pageType === 4 || this.pageType === 8) {
|
||||||
window.location.href = './coupon/couponCollection.html';
|
window.location.href = './coupon/couponCollection.html';
|
||||||
|
@ -354,7 +327,7 @@
|
||||||
if (istoGoods) {
|
if (istoGoods) {
|
||||||
localStorage.setItem('getTokenList', JSON.stringify(getTokenList));
|
localStorage.setItem('getTokenList', JSON.stringify(getTokenList));
|
||||||
this.openDialog('正在加载商品...');
|
this.openDialog('正在加载商品...');
|
||||||
localStorage.setItem('entryLink', this.entryLink);//存储起始页链接
|
localStorage.setItem('entryLink', window.location.href);//存储起始页链接
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.pageType === 4 || this.pageType === 8) {
|
if (this.pageType === 4 || this.pageType === 8) {
|
||||||
window.location.href = './coupon/couponCollection.html';
|
window.location.href = './coupon/couponCollection.html';
|
||||||
|
|
Loading…
Reference in New Issue