update:调整普通推广位

This commit is contained in:
wwxin 2024-07-30 16:43:18 +08:00
parent 55b05faf28
commit 52022e6a0b
4 changed files with 96 additions and 194 deletions

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);
@ -178,7 +178,7 @@ let coverImgUrl = ref("");
let coverBtnImgUrl = ref("");
let isTelOrder = ref(false);
let showNoticeBar = ref(true);
const route = useRoute()
//
const handleAgree = (type) => {
if (type === "agree") {
@ -208,19 +208,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;
@ -240,7 +227,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") {
const result = resp.data.result;
@ -276,8 +263,8 @@ const shouye = () => {
accTxt.value = "开通VIP会员";
}
let isRend = true;
if (getQueryVariable("phnumber")) {
const mobile = getQueryVariable("phnumber");
if (route.query.phnumber) {
const mobile = getQueryParam("phnumber");
if (mobile && mobile.length > 0) {
if (isMobile(mobile)) {
isCheck.value = true;
@ -346,17 +333,11 @@ const maidian = () => {
);
});
};
const getQueryVariable = (variable) => {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
return false;
};
//
const getQueryParam = (variable='') => {
return route.query[variable] || '';
}
const submitOrder = () => {
if (isCheck.value) {
submitData();
@ -365,28 +346,20 @@ 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 () => {
if (!isMobile(mobile.value)) {
showToast("请输入正确的手机号码");
@ -396,8 +369,9 @@ const submitData = async () => {
try {
$refs.myInput.blur();
} catch {}
let xiayou = getQueryVariable("param");
let extra = getQueryVariable("extra");
let xiayou = getQueryParam("param");
console.log(getQueryParam("param"));
let extra = getQueryParam("extra");
//sim
if (extra != "" && xiayou != "") {
xiayou = '{"url" : "' + xiayou + '" , "id" : "' + extra + '"}';
@ -406,10 +380,10 @@ const submitData = async () => {
xiayou = window.location.search.substring(1);
}
if (callbackUrl.value == "jietingche") {
xiayou = getQueryVariable("jtcAdRequestId");
xiayou = getQueryParam("jtcAdRequestId");
}
if (callbackUrl.value == "pp") {
xiayou = getQueryVariable("push_id");
xiayou = getQueryParam("push_id");
}
let text = `mobile=${ mobile.value}promotionCode=${promotionCode.value}`
if (!isTelOrder.value) {
@ -507,7 +481,7 @@ const hrefurl = (p, payMethod, ios) => {
}
};
onMounted(() => {
promotionCode.value = getQueryVariable("promotionCode");
promotionCode.value = getQueryParam("promotionCode");
if (promotionCode.value != "RZpJsF") {
ntext = showTel();
} else {

View File

@ -146,7 +146,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);
@ -174,15 +174,16 @@ let agreementOne = ref("");
let agreementTwo = ref("");
let agreementThree = ref("");
let mobile = ref("");
let isCheck = $ref(false);
let overlayShow = $ref(false);
let coverImgUrl = $ref("");
let coverBtnImgUrl = $ref("");
let isTelOrder = $ref(false);
let isCheck = ref(false);
let overlayShow = ref(false);
let coverImgUrl = ref("");
let coverBtnImgUrl = ref("");
let isTelOrder = ref(false);
const route = useRoute()
//
const handleAgree = (type) => {
if (type === "agree") {
isCheck = true;
isCheck.value = true;
tipsShow.value = false;
if (isMobile(mobile)) {
resourceArea({ promotionCode: promotionCode.value, tel: mobile })
@ -195,10 +196,10 @@ const handleAgree = (type) => {
};
const phoneBlur = () => {
if (isMobile(mobile) && autoSelect.value == "1") {
if (isCheck == false) {
if (isCheck.value == false) {
tipsShow.value = true;
} else {
isCheck = true;
isCheck.value = true;
resourceArea({ promotionCode: promotionCode.value, tel: mobile })
.then((resp) => {});
submitOrder();
@ -246,12 +247,12 @@ const shouye = () => {
document.title = result.name;
//
const cdnBaseUrl = "https://prom-cdn.xtl10.fun/";
coverImgUrl = cdnBaseUrl + result.backImg;
coverImgUrl.value = cdnBaseUrl + result.backImg;
img1.value = cdnBaseUrl + result.logoImg;
img2.value = cdnBaseUrl + result.imgOne;
img3.value = cdnBaseUrl + result.imgTwo;
img4.value = cdnBaseUrl + result.imgThree;
coverBtnImgUrl = cdnBaseUrl + result.imgXxBtn;
coverBtnImgUrl.value = cdnBaseUrl + result.imgXxBtn;
//
payMethod.value = result.payMethod;
@ -276,12 +277,12 @@ const shouye = () => {
promotionId.value = result.promotionId;
mobile.value = result.tepn;
let isRend = true;
if (getQueryVariable("phnumber")) {
const mobile = getQueryVariable("phnumber");
if (route.query.phnumber) {
const mobile = getQueryParam("phnumber");
if (mobile && mobile.length > 0) {
if (isMobile(mobile)) {
isCheck = true;
isTelOrder = true;
isCheck.value = true;
isTelOrder.value = true;
submitData();
isRend = false;
}
@ -289,7 +290,7 @@ const shouye = () => {
}
if (isRend) {
const keyImages = [
{ id: "coverImg", url: coverImgUrl },
{ id: "coverImg", url: coverImgUrl.value },
{ id: "img1", url: img1.value },
{ id: "img2", url: img2.value },
];
@ -344,46 +345,29 @@ const maidian = () => {
.then((resp) => {});
});
};
const getQueryVariable = (variable) => {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
return false;
};
//
const getQueryParam = (variable='') => {
return route.query[variable] || '';
}
const submitOrder = () => {
if (isCheck) {
if (isCheck.value) {
submitData();
} else {
tipsShow.value = true;
// 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;
@ -395,8 +379,8 @@ const submitData = async () => {
try {
$refs.myInput.blur();
} catch {}
let xiayou = getQueryVariable("param");
let extra = getQueryVariable("extra");
let xiayou = getQueryParam("param");
let extra = getQueryParam("extra");
//sim
if (extra != "" && xiayou != "") {
xiayou = '{"url" : "' + xiayou + '" , "id" : "' + extra + '"}';
@ -405,14 +389,14 @@ const submitData = async () => {
xiayou = window.location.search.substring(1);
}
if (callbackUrl.value == "jietingche") {
xiayou = getQueryVariable("jtcAdRequestId");
xiayou = getQueryParam("jtcAdRequestId");
}
if (callbackUrl.value == "pp") {
xiayou = getQueryVariable("push_id");
xiayou = getQueryParam("push_id");
}
let text = "mobile=" + mobiles + "promotionCode=" + promotionCode.value;
if (!isTelOrder) {
overlayShow = true;
if (!isTelOrder.value) {
overlayShow.value = true;
}
let param = {
mobile: mobiles,
@ -464,7 +448,7 @@ proOrder(param)
})
.finally(() => {
setTimeout(function () {
overlayShow = false;
overlayShow.value = false;
}, 1500);
});
};
@ -503,7 +487,7 @@ const hrefurl = (p, payMethod, ios) => {
}
};
onMounted(() => {
promotionCode.value= getQueryVariable("promotionCode");
promotionCode.value= getQueryParam("promotionCode");
if (promotionCode.value != "RZpJsF") {
ntext = showTel();
} else {

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 overlayShow = ref(false);
let coverImgUrl = ref("");
let coverBtnImgUrl = ref("");
let isTelOrder = ref(false);
const route = useRoute()
//
const handleAgree = (type) => {
if (type === "agree") {
@ -205,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;
@ -237,7 +225,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") {
const result = resp.data.result;
@ -286,8 +274,8 @@ const shouye = () => {
promotionId.value = result.promotionId;
mobile.value = result.tepn;
let isRend = true;
if (getQueryVariable("phnumber")) {
mobile.value = getQueryVariable("phnumber");
if (route.query.phnumber) {
mobile.value = getQueryParam("phnumber");
if (mobile.value && mobile.length > 0) {
if (isMobile(mobile.value)) {
isCheck.value = true;
@ -356,17 +344,10 @@ const maidian = () => {
);
});
};
const getQueryVariable = (variable) => {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
return false;
};
//
const getQueryParam = (variable='') => {
return route.query[variable] || '';
}
const submitOrder = () => {
if (isCheck.value) {
submitData();
@ -375,27 +356,17 @@ 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;
@ -407,8 +378,8 @@ const submitData = async () => {
try {
$refs.myInput.blur();
} catch {}
let xiayou = getQueryVariable("param");
let extra = getQueryVariable("extra");
let xiayou = getQueryParam("param");
let extra = getQueryParam("extra");
//sim
if (extra != "" && xiayou != "") {
xiayou = '{"url" : "' + xiayou + '" , "id" : "' + extra + '"}';
@ -417,10 +388,10 @@ const submitData = async () => {
xiayou = window.location.search.substring(1);
}
if (callbackUrl.value == "jietingche") {
xiayou = getQueryVariable("jtcAdRequestId");
xiayou = getQueryParam("jtcAdRequestId");
}
if (callbackUrl.value == "pp") {
xiayou = getQueryVariable("push_id");
xiayou = getQueryParam("push_id");
}
let text = "mobile=" + mobiles + "promotionCode=" + promotionCode.value;
if (!isTelOrder.value) {
@ -518,7 +489,7 @@ const hrefurl = (p, payMethod, ios) => {
}
};
onMounted(() => {
promotionCode.value = getQueryVariable("promotionCode");
promotionCode.value = getQueryParam("promotionCode");
if (promotionCode.value != "RZpJsF") {
ntext = showTel();
} else {

View File

@ -27,7 +27,7 @@
maxlength="11"
v-model="codeValue"
/>
<div class="code">获取验证码</div>
<div class="code" @click="handleSendCode">{{ codeBtnWord }}</div>
</div>
<button
class="trasition-btns"
@ -110,6 +110,7 @@ import { useRouter } from "vue-router";
let $router = useRouter();
let tipsShow = ref(false);
const promotionCode = ref("");
let codeBtnWord = ref("获取验证码");
let priceTips = ref("");
let img1 = ref("");
let img2 = ref("");
@ -222,6 +223,14 @@ const submitOrder = () => {
// showToast("");
}
};
//
const handleSendCode=() => {
if (!isMobile(mobile.value)) {
showToast("请输入正确的手机号");
return;
}
}
const submitData = async () => {
if (!isMobile(mobile.value)) {
showToast("请输入正确的手机号");
@ -232,42 +241,6 @@ const submitData = async () => {
return;
}
};
//
const hrefurl = (p, payMethod, ios) => {
if (ios) {
if (payMethod == "0") {
window.location.href =
"https://ulink.alipay.com/?scheme=" +
encodeURIComponent(
`alipays://platformapi/startapp?appId=60000157&appClearTop=false&startMultApp=YES&sign_params=${encodeURIComponent(
p
)}`
);
} else {
window.location.href =
"https://ulink.alipay.com/?scheme=" +
encodeURIComponent(
`alipays://platformapi/startapp?appId=20000067&url=${encodeURIComponent(
p
)}`
);
}
} else {
let traceId = localStorage.getItem("traceId");
var link = document.createElement("a");
link.href = `${
location.protocol + "//" + location.host
}/static/wechatUrls.txt?url=${encodeURIComponent(p)}&promotionCode=${
promotionCode.value
}`;
link.textContent = "点击这里下载PDF文件";
link.download = "wechatUrls.txt";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
return;
}
};
onMounted(() => {
promotionCode.value = getQueryVariable("promotionCode");
maidian();