Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gl_help
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Max
gl_help
Commits
6da768ba
Commit
6da768ba
authored
Aug 11, 2023
by
何毅恒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
c
parent
a371c696
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
40 deletions
+68
-40
src/App.vue
src/App.vue
+20
-20
src/pages/index.vue
src/pages/index.vue
+19
-19
src/pages/mobile/articleDetails/index.vue
src/pages/mobile/articleDetails/index.vue
+8
-0
src/pages/mobile/index.vue
src/pages/mobile/index.vue
+20
-0
src/utils/wxJssdk.ts
src/utils/wxJssdk.ts
+1
-1
No files found.
src/App.vue
View file @
6da768ba
<
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
>
...
...
src/pages/index.vue
View file @
6da768ba
...
...
@@ -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
>
src/pages/mobile/articleDetails/index.vue
View file @
6da768ba
...
...
@@ -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
=
()
=>
{
...
...
src/pages/mobile/index.vue
View file @
6da768ba
...
...
@@ -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
"
,
},
});
}
};
...
...
src/utils/wxJssdk.ts
View file @
6da768ba
...
...
@@ -12,7 +12,7 @@ class wxJssdk{
let
res
:
any
=
await
post
(
'
Information/getTicket
'
,{
url
})
if
(
res
.
code
==
0
)
{
wx
.
config
({
debug
:
tru
e
,
// 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
debug
:
fals
e
,
// 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId
:
res
.
data
.
appid
,
// 必填,公众号的唯一标识
timestamp
:
res
.
data
.
timestamp
,
// 必填,生成签名的时间戳
nonceStr
:
res
.
data
.
noncestr
,
// 必填,生成签名的随机串
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment