update:优化推广位部分方法

This commit is contained in:
wwxin 2024-07-30 17:16:19 +08:00
parent 52022e6a0b
commit 50af9c1f53
3 changed files with 16 additions and 47 deletions

View File

@ -274,6 +274,8 @@ const shouye = () => {
}
}
}
const mobile=getQueryParam("mobile");
if(mobile.value&&mobile.value.length > 0) {
if (isRend) {
const keyImages = [
{ id: "coverImg", url: coverImgUrl.value },

View File

@ -144,7 +144,7 @@ import {
import { isMobile, isIOS, showTel } from "@/utils/tools";
import md5 from "js-md5";
import { showDialog } from "vant";
import { useRouter } from "vue-router";
import { useRouter,useRoute } from "vue-router";
const longSpace = "\xa0".repeat(10);
let $router = useRouter();
let htmlLoadFinish = ref(false);
@ -177,6 +177,7 @@ let coverImgUrl = ref("");
let coverBtnImgUrl = ref("");
let isTelOrder = ref(false);
let showNoticeBar = ref(true);
const route=useRoute()
//
const handleAgree = (type) => {
@ -193,26 +194,13 @@ const handleAgree = (type) => {
tipsShow.value = false;
}
};
const getUrlParam = () => {
let url = document.location.toString();
let arrObj = url.split("?");
let params = Object.create(null);
if (arrObj.length > 1) {
arrObj = arrObj[1].split("&");
arrObj.forEach((item) => {
item = item.split("=");
params[item[0]] = item[1];
});
}
return params;
};
//agree
const toAgreePages = (types) => {
let typesparmes = types === "hdRule" ? 1 : types === "ysRule" ? 2 : 3;
$router.push(`/agree?promotionId=${promotionId.value}&type=${typesparmes}`);
};
const shouye = () => {
let param = getUrlParam();
let param=route.query
resourceInfo({promotionCode:promotionCode.value,...param}).then((resp) => {
if (resp.data.code == "S00000") {
const result = resp.data.result;
@ -336,28 +324,19 @@ const submitOrder = () => {
// showToast("");
}
};
/*
* changeURLStatic 修改地址栏URL参数 不跳转
* @param name 参数名
* @param value 参数值
*
* */
//
const changeURLStatic = (name, value) => {
let url = location.href;
let url2 = "";
let reg = eval("/([?|&]" + name + "=)[^&]*/gi");
value = value.toString().replace(/(^\s*)|(\s*$)/g, ""); //
if (!value) {
url2 = url.replace(reg, ""); //
let url = new URL(location.href);
let params = url.searchParams;
value = value.toString().trim();
if (value) {
params.set(name, value);
} else {
if (url.match(reg)) {
url2 = url.replace(reg, "$1" + value); //
} else {
url2 = url + (url.indexOf("?") > -1 ? "&" : "?") + name + "=" + value; //
}
params.delete(name);
}
history.replaceState(null, null, url2); //
history.replaceState(null, null, url.toString());
};
const submitData = async () => {
let mobiles = mobile.value;
@ -605,6 +584,7 @@ onMounted(() => {
margin-bottom: 0.32407rem;
width: 6rem;
border: none;
margin-top:20px;
}
.agreement-view {
align-items: center;

View File

@ -206,19 +206,6 @@ const phoneBlur = () => {
}
}
};
const getUrlParam = () => {
let url = document.location.toString();
let arrObj = url.split("?");
let params = Object.create(null);
if (arrObj.length > 1) {
arrObj = arrObj[1].split("&");
arrObj.forEach((item) => {
item = item.split("=");
params[item[0]] = item[1];
});
}
return params;
};
//agree
const toAgreePages = (types) => {
let typesparmes = types === "hdRule" ? 1 : types === "ysRule" ? 2 : 3;
@ -239,7 +226,7 @@ const toAgreePages = (types) => {
$router.push(`/agree?promotionId=${promotionId.value}&type=${typesparmes}`);
};
const shouye = () => {
let param = getUrlParam();
let param=route.query
resourceInfo({promotionCode:promotionCode.value,...param})
.then((resp) => {
if (resp.data.code == "S00000") {