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) { if (isRend) {
const keyImages = [ const keyImages = [
{ id: "coverImg", url: coverImgUrl.value }, { id: "coverImg", url: coverImgUrl.value },

View File

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