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
89fa64fb
Commit
89fa64fb
authored
Mar 17, 2020
by
xulili
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
推送
parent
6aed2285
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
25 deletions
+42
-25
index.vue
ybf_wx/src/views/qrCode/index.vue
+42
-25
No files found.
ybf_wx/src/views/qrCode/index.vue
View file @
89fa64fb
...
@@ -19,22 +19,15 @@ export default {
...
@@ -19,22 +19,15 @@ export default {
},
},
mounted
()
{
mounted
()
{
this
.
cleanUrl
()
this
.
cleanUrl
()
this
.
getAcessToken
();
//
this.getAcessToken();
this
.
createCode
();
this
.
createCode
();
},
},
methods
:
{
methods
:
{
cleanUrl
()
{
cleanUrl
()
{
// alert(`!-->cleanUrl: IN.`)
this
.
nowUrl
=
this
.
$route
.
query
.
Url
// alert(`!-->cleanUrl: url =${JSON.stringify(this.$route)}`)
this
.
activeId
=
this
.
$route
.
query
.
activeId
// alert(`!-->cleanUrl: url =${JSON.stringify(this.$route.params)}`)
this
.
voucherId
=
this
.
$route
.
query
.
voucherId
this
.
unionId
=
this
.
$route
.
query
.
unionId
const
url
=
this
.
$route
;
this
.
nowUrl
=
url
.
split
(
"&"
)[
0
].
slice
(
41
);
this
.
activeId
=
url
.
split
(
"&"
)[
1
].
split
(
"="
)[
1
];
this
.
voucherId
=
url
.
split
(
"&"
)[
2
].
split
(
"="
)[
1
];
this
.
unionId
=
url
.
split
(
"&"
)[
3
].
split
(
"="
)[
1
];
},
},
getAcessToken
()
{
getAcessToken
()
{
let
_this
=
this
;
let
_this
=
this
;
...
@@ -46,28 +39,52 @@ export default {
...
@@ -46,28 +39,52 @@ export default {
_this
.
createCode
();
_this
.
createCode
();
});
});
},
},
// createCode() {
// let _this = this;
// let pageUrl = `/wxx/cgi-bin/wxaapp/createwxaqrcode?access_token=${_this.accessToken}`;
// $.ajax({
// type: "POST",
// url: pageUrl,
// data: JSON.stringify({ path: "pages/signIn/signIn" }),
// // data: JSON.stringify({ path: `${_this.nowUrl}&detailid=${_this.voucherId}&actionid=${_this.activeId}&unionid=${_this.unionId}` }),
// xhrFields: { responseType: "arraybuffer" },
// success: function(res) {
// alert('success' + JSON.stringify(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) {
// alert('error' + JSON.stringify(data))
// console.log(data);
// }
// });
// },
createCode
()
{
createCode
()
{
let
_this
=
this
;
let
_this
=
this
;
let
pageUrl
=
`/wxx/cgi-bin/wxaapp/createwxaqrcode?access_token=
${
_this
.
accessToken
}
`
;
let
nowUrl
=
_this
.
nowUrl
?
_this
.
nowUrl
:
""
// alert(`!-->createCode: data: path: ${_this.nowUrl}&detailid=${_this.voucherId}&actionid=${_this.activeId}&unionid=${_this.unionId}`)
let
voucherId
=
_this
.
voucherId
?
_this
.
voucherId
:
""
let
activeId
=
_this
.
activeId
?
_this
.
activeId
:
""
let
unionId
=
_this
.
unionId
?
_this
.
unionId
:
""
let
pageUri
=
`
${
nowUrl
}
&detailid=
${
voucherId
}
&actionid=
${
activeId
}
&unionid=
${
unionId
}
`
;
let
pageUrl
=
`http://139.155.48.151:8085/workWx/auth/oauth2/wxMiniQrCode?pageUri=
${
pageUri
}
`
;
$
.
ajax
({
$
.
ajax
({
type
:
"POST"
,
type
:
"POST"
,
url
:
pageUrl
,
url
:
pageUrl
,
// data: JSON.stringify({ path: "pages/signIn/signIn" }),
// data: JSON.stringify({ path: "pages/signIn/signIn" }),
data
:
JSON
.
stringify
({
path
:
`
${
_this
.
nowUrl
}
&detailid=
${
_this
.
voucherId
}
&actionid=
${
_this
.
activeId
}
&unionid=
${
_this
.
unionId
}
`
}),
data
:
{},
xhrFields
:
{
responseType
:
"arraybuffer"
},
success
:
function
(
res
)
{
success
:
function
(
res
)
{
let
imgUrl
=
console
.
log
(
res
)
"data:image/png;base64,"
+
$
(
'#image'
).
attr
(
'src'
,
res
.
data
)
btoa
(
new
Uint8Array
(
res
).
reduce
(
(
data
,
byte
)
=>
data
+
String
.
fromCharCode
(
byte
),
""
)
);
$
(
"#image"
).
attr
(
"src"
,
imgUrl
);
},
},
error
:
function
(
data
)
{
error
:
function
(
data
)
{
alert
(
'error'
+
JSON
.
stringify
(
data
))
console
.
log
(
data
);
console
.
log
(
data
);
}
}
});
});
...
...
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