Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
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
60e16ded
Commit
60e16ded
authored
5 years ago
by
xulili
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
二维码
parent
6bee6688
master
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
8 deletions
+69
-8
package.json
ybf_wx/package.json
+1
-0
index.js
ybf_wx/src/router/index.js
+5
-0
index.vue
ybf_wx/src/views/qrCode/index.vue
+49
-0
index.vue
ybf_wx/src/views/voucherInfo/index.vue
+14
-8
No files found.
ybf_wx/package.json
View file @
60e16ded
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
"core-js"
:
"^3.4.4"
,
"core-js"
:
"^3.4.4"
,
"js-md5"
:
"^0.7.3"
,
"js-md5"
:
"^0.7.3"
,
"jssdk"
:
"^0.0.1"
,
"jssdk"
:
"^0.0.1"
,
"qrcode"
:
"^1.4.4"
,
"vant"
:
"^2.3.3"
,
"vant"
:
"^2.3.3"
,
"vue"
:
"^2.6.10"
,
"vue"
:
"^2.6.10"
,
"vue-router"
:
"^3.1.3"
,
"vue-router"
:
"^3.1.3"
,
...
...
This diff is collapsed.
Click to expand it.
ybf_wx/src/router/index.js
View file @
60e16ded
...
@@ -122,6 +122,11 @@ const routes = [
...
@@ -122,6 +122,11 @@ const routes = [
name
:
'VoucherInfo'
,
name
:
'VoucherInfo'
,
component
:
()
=>
import
(
'@/views/voucherInfo/index'
)
component
:
()
=>
import
(
'@/views/voucherInfo/index'
)
},
},
{
path
:
'/qrCode'
,
name
:
'qrCode'
,
component
:
()
=>
import
(
'@/views/qrCode/index'
)
},
// {
// {
// path: '/about',
// path: '/about',
// name: 'about',
// name: 'about',
...
...
This diff is collapsed.
Click to expand it.
ybf_wx/src/views/qrCode/index.vue
0 → 100644
View file @
60e16ded
<
template
>
<div
class=
"qr-code"
>
<canvas
id=
"QRCode_header"
></canvas>
</div>
</
template
>
<
script
>
import
QRCode
from
'qrcode'
export
default
{
name
:
'index'
,
data
(){
return
{
QRCodeMsg
:
''
}
},
mounted
(){
this
.
creatQrCode
()
},
methods
:{
creatQrCode
(){
let
opts
=
{
errorCorrectionLevel
:
"H"
,
//容错级别
type
:
"image/png"
,
//生成的二维码类型
quality
:
0.3
,
//二维码质量
margin
:
12
,
//二维码留白边距
width
:
200
,
//宽
height
:
180
,
//高
color
:
{
dark
:
"#333333"
,
//前景色
light
:
"#fff"
//背景色
}
};
// 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"
>
</
style
>
This diff is collapsed.
Click to expand it.
ybf_wx/src/views/voucherInfo/index.vue
View file @
60e16ded
<
template
>
<
template
>
<div
class=
"main"
>
<div>
<div>
Hola World.
</div>
<span>
正在跳转中...
</span>
<img
src=
"../../assets/qrcode.jpeg"
alt=
"Please Scan QRCode."
/>
<button
@
click=
"redirect"
>
redirect
</button>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
const
zlog
=
console
.
log
.
bind
(
console
);
const
zlog
=
console
.
log
.
bind
(
console
);
export
default
{
export
default
{
name
:
"voucherInfo"
,
name
:
"voucherInfo"
,
data
()
{
data
()
{
return
{};
return
{
QRCodeMsg
:
''
};
},
},
created
()
{
created
()
{
alert
(
"--->voucherInfo: Created."
);
//
alert("--->voucherInfo: Created.");
// wx.miniProgram.navigateTo({url: '/path/to/page'})
// wx.miniProgram.navigateTo({url: '/path/to/page'})
// wx.miniProgram.navigateTo({url: '/pages/coupon/detail/detailid=100000338&actionid=97'})
// wx.miniProgram.navigateTo({url: '/pages/coupon/detail/detailid=100000338&actionid=97'})
},
},
mounted
()
{},
mounted
()
{
wx
.
miniProgram
.
navigateTo
({
url
:
'/pages/coupon/detail/detailid=100000338&actionid=97'
})
},
methods
:
{
methods
:
{
redirect
()
{
redirect
()
{
// wx.miniProgram.navigateTo({url: '/pages/coupon/detail/detailid=100000338&actionid=97'})
// wx.miniProgram.navigateTo({url: '/pages/coupon/detail/detailid=100000338&actionid=97'})
...
@@ -50,6 +52,10 @@ export default {
...
@@ -50,6 +52,10 @@ export default {
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
#qrcode
{
width
:
100px
;
height
:
100px
;
}
.main
{
.main
{
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
...
...
This diff is collapsed.
Click to expand it.
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