Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
Y
ybf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xulili
ybf
Commits
ee7458d0
Commit
ee7458d0
authored
Mar 16, 2020
by
xulili
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
二维码生成
parent
60e16ded
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
32 deletions
+55
-32
index.html
ybf_wx/public/index.html
+1
-0
jquery-3.4.1.min.js
ybf_wx/public/js/jquery-3.4.1.min.js
+2
-0
home.vue
ybf_wx/src/views/home.vue
+3
-3
index.vue
ybf_wx/src/views/qrCode/index.vue
+41
-29
vue.config.js
ybf_wx/vue.config.js
+8
-0
No files found.
ybf_wx/public/index.html
View file @
ee7458d0
...
...
@@ -7,6 +7,7 @@
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1.0"
>
<link
rel=
"icon"
href=
"<%= BASE_URL %>favicon.ico"
>
<title>
亿百分
</title>
<script
type=
"text/javascript"
src=
"js/jquery-3.4.1.min.js"
></script>
<script
src=
"http://res.wx.qq.com/open/js/jweixin-1.6.0.js"
></script>
</head>
<body>
...
...
ybf_wx/public/js/jquery-3.4.1.min.js
0 → 100644
View file @
ee7458d0
This diff is collapsed.
Click to expand it.
ybf_wx/src/views/home.vue
View file @
ee7458d0
...
...
@@ -20,7 +20,7 @@
<!--
<button
class=
"testButton"
@
click=
"zTestPreAuthCode"
>
preAuthCodeUrl
</button>
<div
class=
"fkwindow"
>
{{
zcache
.
preAuthCodeUrl
}}
</div>
-->
<!--
<!--
<button
class=
"testButton"
@
click=
"zTestGetNowUrlInfo"
>
nowUrlInfo
</button>
<div
class=
"fkwindow"
>
{{
zcache
.
nowUrl
}}
</div>
-->
...
...
@@ -106,7 +106,7 @@ export default {
);
if
(
this
.
$route
.
query
.
code
===
undefined
)
{
this
.
zTestPreAuthCode
();
//
this.zTestPreAuthCode();
}
else
{
this
.
zTestGetNowUrlInfo
()
this
.
zTestGetUserInfoByOldToken
()
...
...
@@ -365,4 +365,4 @@ export default {
font-size
:
14px
;
word-wrap
:
break-word
;
}
</
style
>
\ No newline at end of file
</
style
>
ybf_wx/src/views/qrCode/index.vue
View file @
ee7458d0
<
template
>
<div
class=
"qr-code"
>
<
canvas
id=
"QRCode_header"
></canvas
>
<
img
id=
"image"
src=
""
alt=
""
>
</div>
</
template
>
<
script
>
import
QRCode
from
'qrcode
'
import
axios
from
'axios
'
export
default
{
name
:
'index'
,
data
(){
return
{
QRCodeMsg
:
''
data
()
{
return
{
accessToken
:
""
}
},
mounted
(){
this
.
creatQrCode
()
mounted
()
{
this
.
getAcessToken
()
this
.
createCode
()
},
methods
:{
creatQrCode
(){
let
opts
=
{
errorCorrectionLevel
:
"H"
,
//容错级别
type
:
"image/png"
,
//生成的二维码类型
quality
:
0.3
,
//二维码质量
margin
:
12
,
//二维码留白边距
width
:
200
,
//宽
height
:
180
,
//高
color
:
{
dark
:
"#333333"
,
//前景色
light
:
"#fff"
//背景色
methods
:
{
getAcessToken
(){
let
_this
=
this
axios
({
url
:
"http://139.155.48.151:8085/workWx/auth/oauth2/getAccessToken"
,
method
:
"get"
,
}).
then
(
res
=>
{
_this
.
accessToken
=
res
.
data
.
data
_this
.
createCode
()
})
},
createCode
()
{
let
pageUrl
=
`/wxx/cgi-bin/wxaapp/createwxaqrcode?access_token=
${
this
.
accessToken
}
`
$
.
ajax
({
type
:
"POST"
,
url
:
pageUrl
,
data
:
JSON
.
stringify
({
"path"
:
"pages/signIn/signIn"
}),
xhrFields
:
{
responseType
:
"arraybuffer"
},
success
:
function
(
res
)
{
let
imgUrl
=
'data:image/png;base64,'
+
btoa
(
new
Uint8Array
(
res
).
reduce
((
data
,
byte
)
=>
data
+
String
.
fromCharCode
(
byte
),
''
))
$
(
'#image'
).
attr
(
'src'
,
imgUrl
)
},
error
:
function
(
data
)
{
console
.
log
(
data
)
}
};
// this.QRCodeMsg = window.location.href; //生成的二维码为URL地址js
// this.QRCodeMsg = window.location.href; //生成的二维码为URL地址js
alert
(
`
${
window
.
location
.
origin
}
/voucherInfo`
)
this
.
QRCodeMsg
=
`
${
window
.
location
.
origin
}
/voucherInfo`
;
//生成的二维码为URL地址js
let
msg
=
document
.
getElementById
(
"QRCode_header"
);
// 将获取到的数据(val)画到msg(canvas)上
QRCode
.
toCanvas
(
msg
,
this
.
QRCodeMsg
,
opts
,
function
(
error
)
{
console
.
log
(
error
)
});
}
,
}
}
}
</
script
>
<
style
scoped
lang=
"scss"
>
.qr-code
{
text-align
:
center
;
padding-top
:
50px
;
#image
{
display
:
inline-block
;
width
:
60%
;
}
}
</
style
>
ybf_wx/vue.config.js
View file @
ee7458d0
...
...
@@ -22,6 +22,14 @@ module.exports = {
'^/api'
:
''
}
},
'/wxx'
:
{
ws
:
false
,
target
:
'https://api.weixin.qq.com'
,
changeOrigin
:
true
,
pathRewrite
:
{
'^/wxx'
:
''
}
},
}
},
css
:
{
...
...
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