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

c

parent a371c696
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, computed } from "vue"; // import { onMounted, computed } from "vue";
import { useRouter } from "vue-router"; // import { useRouter } from "vue-router";
onMounted(() => { // onMounted(() => {
detectDeviceType(machineType.value); // detectDeviceType(machineType.value);
}); // });
const router = useRouter(); // const router = useRouter();
const machineType = computed(() => { // const machineType = computed(() => {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( // return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent // navigator.userAgent
) // )
? "Mobile" // ? "Mobile"
: "Desktop"; // : "Desktop";
}); // });
const detectDeviceType = (machineType): void => { // const detectDeviceType = (machineType): void => {
if (machineType == "Mobile") { // if (machineType == "Mobile") {
router.push("/mobile"); // router.push("/mobile");
} else { // } else {
router.push("/pc"); // router.push("/pc");
} // }
}; // };
</script> </script>
<template> <template>
......
...@@ -3,24 +3,24 @@ ...@@ -3,24 +3,24 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// import { onMounted } from "vue"; import { onMounted } from "vue";
// import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
// onMounted(() => { onMounted(() => {
// detectDeviceType(); detectDeviceType();
// }); });
// const router = useRouter(); const router = useRouter();
// const detectDeviceType = (): void => { const detectDeviceType = (): void => {
// const machineType = const machineType =
// /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
// navigator.userAgent navigator.userAgent
// ) )
// ? "Mobile" ? "Mobile"
// : "Desktop"; : "Desktop";
// if (machineType == "Mobile") { if (machineType == "Mobile") {
// router.push("/mobile"); router.push("/mobile");
// } else { } else {
// router.push("/pc"); router.push("/pc");
// } }
// }; };
</script> </script>
<style scoped lang="scss"></style> <style scoped lang="scss"></style>
...@@ -52,6 +52,14 @@ const getInformationDetail = async (id) => { ...@@ -52,6 +52,14 @@ const getInformationDetail = async (id) => {
'<img style="width:100%"' '<img style="width:100%"'
); );
wxJssdk(); 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 = () => { const downLoad = () => {
......
...@@ -67,6 +67,18 @@ import { useRouter } from "vue-router"; ...@@ -67,6 +67,18 @@ import { useRouter } from "vue-router";
onMounted(() => { onMounted(() => {
getInformationCategory(); 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( const ArticleItem = defineAsyncComponent(
() => import("@/components/ArticleItem.vue") () => import("@/components/ArticleItem.vue")
...@@ -131,6 +143,14 @@ const getInformationList = async () => { ...@@ -131,6 +143,14 @@ const getInformationList = async () => {
let res: any = await post("information/informationList", data); let res: any = await post("information/informationList", data);
if (res.code == 0) { if (res.code == 0) {
informationList.value = res.data.list; 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{ ...@@ -12,7 +12,7 @@ class wxJssdk{
let res:any = await post('Information/getTicket',{url}) let res:any = await post('Information/getTicket',{url})
if (res.code == 0) { if (res.code == 0) {
wx.config({ wx.config({
debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: res.data.appid, // 必填,公众号的唯一标识 appId: res.data.appid, // 必填,公众号的唯一标识
timestamp: res.data.timestamp, // 必填,生成签名的时间戳 timestamp: res.data.timestamp, // 必填,生成签名的时间戳
nonceStr: res.data.noncestr, // 必填,生成签名的随机串 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