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
5 years ago
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 {
},
mounted
()
{
this
.
cleanUrl
()
this
.
getAcessToken
();
//
this.getAcessToken();
this
.
createCode
();
},
methods
:
{
cleanUrl
()
{
// alert(`!-->cleanUrl: IN.`)
// alert(`!-->cleanUrl: url =${JSON.stringify(this.$route)}`)
// alert(`!-->cleanUrl: url =${JSON.stringify(this.$route.params)}`)
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
];
this
.
nowUrl
=
this
.
$route
.
query
.
Url
this
.
activeId
=
this
.
$route
.
query
.
activeId
this
.
voucherId
=
this
.
$route
.
query
.
voucherId
this
.
unionId
=
this
.
$route
.
query
.
unionId
},
getAcessToken
()
{
let
_this
=
this
;
...
...
@@ -46,28 +39,52 @@ export default {
_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
()
{
let
_this
=
this
;
let
pageUrl
=
`/wxx/cgi-bin/wxaapp/createwxaqrcode?access_token=
${
_this
.
accessToken
}
`
;
// alert(`!-->createCode: data: path: ${_this.nowUrl}&detailid=${_this.voucherId}&actionid=${_this.activeId}&unionid=${_this.unionId}`)
let
nowUrl
=
_this
.
nowUrl
?
_this
.
nowUrl
:
""
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
({
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"
},
data
:
{},
success
:
function
(
res
)
{
let
imgUrl
=
"data:image/png;base64,"
+
btoa
(
new
Uint8Array
(
res
).
reduce
(
(
data
,
byte
)
=>
data
+
String
.
fromCharCode
(
byte
),
""
)
);
$
(
"#image"
).
attr
(
"src"
,
imgUrl
);
console
.
log
(
res
)
$
(
'#image'
).
attr
(
'src'
,
res
.
data
)
},
error
:
function
(
data
)
{
alert
(
'error'
+
JSON
.
stringify
(
data
))
console
.
log
(
data
);
}
});
...
...
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