Commit 6da768ba authored by 何毅恒's avatar 何毅恒

c

parent a371c696
<script setup lang="ts">
import { onMounted, computed } from "vue";
import { useRouter } from "vue-router";
onMounted(() => {
detectDeviceType(machineType.value);
});
const router = useRouter();
const machineType = computed(() => {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent
)
? "Mobile"
: "Desktop";
});
const detectDeviceType = (machineType): void => {
if (machineType == "Mobile") {
router.push("/mobile");
} else {
router.push("/pc");
}
};
// import { onMounted, computed } from "vue";
// import { useRouter } from "vue-router";
// onMounted(() => {
// detectDeviceType(machineType.value);
// });
// const router = useRouter();
// const machineType = computed(() => {
// return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
// navigator.userAgent
// )
// ? "Mobile"
// : "Desktop";
// });
// const detectDeviceType = (machineType): void => {
// if (machineType == "Mobile") {
// router.push("/mobile");
// } else {
// router.push("/pc");
// }
// };
</script>
<template>
......
......@@ -3,24 +3,24 @@
</template>
<script lang="ts" setup>
// import { onMounted } from "vue";
// import { useRouter } from "vue-router";
// onMounted(() => {
// detectDeviceType();
// });
// const router = useRouter();
// const detectDeviceType = (): void => {
// const machineType =
// /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
// navigator.userAgent
// )
// ? "Mobile"
// : "Desktop";
// if (machineType == "Mobile") {
// router.push("/mobile");
// } else {
// router.push("/pc");
// }
// };
import { onMounted } from "vue";
import { useRouter } from "vue-router";
onMounted(() => {
detectDeviceType();
});
const router = useRouter();
const detectDeviceType = (): void => {
const machineType =
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent
)
? "Mobile"
: "Desktop";
if (machineType == "Mobile") {
router.push("/mobile");
} else {
router.push("/pc");
}
};
</script>
<style scoped lang="scss"></style>
......@@ -52,6 +52,14 @@ const getInformationDetail = async (id) => {
'<img style="width:100%"'
);
wxJssdk();
wx.miniProgram.postMessage({
data: {
url:
"https://testhelp.gelifood.com/index.html#/articleDetails?id=" + id,
title: informationDetail.value.title,
imageUrl: imgUrl + informationDetail.value.promotional_image,
},
});
}
};
const downLoad = () => {
......
......@@ -67,6 +67,18 @@ import { useRouter } from "vue-router";
onMounted(() => {
getInformationCategory();
let script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://res.wx.qq.com/open/js/jweixin-1.3.2.js";
document.body.appendChild(script);
wx.miniProgram.postMessage({
data: {
url: "https://testhelp.gelifood.com/index.html",
title: "自定义帮助中心首页",
},
});
});
const ArticleItem = defineAsyncComponent(
() => import("@/components/ArticleItem.vue")
......@@ -131,6 +143,14 @@ const getInformationList = async () => {
let res: any = await post("information/informationList", data);
if (res.code == 0) {
informationList.value = res.data.list;
wx.miniProgram.postMessage({
data: {
url: "https://testhelp.gelifood.com/index.html#/mobile",
title: "格利帮助中心",
imageUrl: "../../assets/img/helpImg.png",
},
});
}
};
......
......@@ -12,7 +12,7 @@ class wxJssdk{
let res:any = await post('Information/getTicket',{url})
if (res.code == 0) {
wx.config({
debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: res.data.appid, // 必填,公众号的唯一标识
timestamp: res.data.timestamp, // 必填,生成签名的时间戳
nonceStr: res.data.noncestr, // 必填,生成签名的随机串
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment