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
6bee6688
Commit
6bee6688
authored
Mar 16, 2020
by
Z
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Z: Dot: Next: Create QRCode in views/voucherInfo/index.vue
parent
51a2c9eb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
329 additions
and
117 deletions
+329
-117
package.json
ybf_wx/package.json
+1
-0
test-city.png
ybf_wx/public/mainSale/test-city.png
+0
-0
ea.js
ybf_wx/src/api/sidebar/ea.js
+1
-1
qrcode.jpeg
ybf_wx/src/assets/qrcode.jpeg
+0
-0
index.js
ybf_wx/src/router/index.js
+35
-13
aCommon.js
ybf_wx/src/utils/aCommon.js
+146
-91
home.vue
ybf_wx/src/views/home.vue
+3
-0
index.vue
ybf_wx/src/views/sideNav/discount/index.vue
+79
-12
test-city.png
ybf_wx/src/views/sideNav/discount/test-city.png
+0
-0
index.vue
ybf_wx/src/views/voucherInfo/index.vue
+59
-0
qrcode.jpeg
ybf_wx/src/views/voucherInfo/qrcode.jpeg
+0
-0
yarn.lock
ybf_wx/yarn.lock
+5
-0
No files found.
ybf_wx/package.json
View file @
6bee6688
...
...
@@ -14,6 +14,7 @@
"axios"
:
"^0.19.1"
,
"core-js"
:
"^3.4.4"
,
"js-md5"
:
"^0.7.3"
,
"jssdk"
:
"^0.0.1"
,
"vant"
:
"^2.3.3"
,
"vue"
:
"^2.6.10"
,
"vue-router"
:
"^3.1.3"
,
...
...
ybf_wx/public/mainSale/test-city.png
View replaced file @
51a2c9eb
View file @
6bee6688
This diff is collapsed.
Click to expand it.
ybf_wx/src/api/sidebar/ea.js
View file @
6bee6688
...
...
@@ -5,7 +5,7 @@ export function getVoucherList(inData) {
let
postData
=
{
args
:
inData
}
alert
(
`--->PostToEA: ea.js: postData =
${
JSON
.
stringify
(
postData
)}
`
)
//
alert(`--->PostToEA: ea.js: postData =${JSON.stringify(postData)}`)
return
request
({
url
:
''
,
method
:
'post'
,
...
...
ybf_wx/src/assets/qrcode.jpeg
0 → 100644
View file @
6bee6688
30.3 KB
ybf_wx/src/router/index.js
View file @
6bee6688
...
...
@@ -117,6 +117,11 @@ const routes = [
name
:
'newInfo'
,
component
:
()
=>
import
(
'@/views/message/newInfo'
)
},
{
path
:
'/voucherInfo'
,
name
:
'VoucherInfo'
,
component
:
()
=>
import
(
'@/views/voucherInfo/index'
)
},
// {
// path: '/about',
// name: 'about',
...
...
@@ -133,19 +138,36 @@ const router = new VueRouter({
routes
})
// const whiteList = ['/discount']
// router.beforeEach((to, from ,next) => {
// if (whiteList.indexOf(to.path) !== -1) {
// next()
// } else {
// if(sessionStorage.getItem('unionid')) {
// next()
// } else {
// getUnionId(to)
// // next()
// }
// }
// })
// const whiteList = ['/', '/home','/home/']
const
whiteList
=
[
'/discount'
,
'discount'
]
// const whiteList = ['/discount', 'discount', '/voucherInfo', 'voucherInfo']
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
// alert(`--->route: beforeEach: to =${JSON.stringify(to)}. from =${from}. next =${JSON.stringify(next)}`)
if
(
whiteList
.
indexOf
(
to
.
path
)
!=
-
1
)
{
// alert(`--->route: beforeEach: If: UnIn whiteList.`)
if
(
sessionStorage
.
getItem
(
'zConfigWx'
)
===
'Pass'
){
next
()
}
else
{
configWx
(
to
)
}
}
else
{
// alert(`--->route: beforeEach: If: In whiteList.`)
next
()
}
// if (whiteList.indexOf(to.path) !== -1) {
// next()
// } else {
// if(sessionStorage.getItem('unionid')) {
// next()
// } else {
// getUnionId(to)
// // next()
// }
// }
})
// async function getUnionId (to) {
// await getXToken()
...
...
ybf_wx/src/utils/aCommon.js
View file @
6bee6688
This diff is collapsed.
Click to expand it.
ybf_wx/src/views/home.vue
View file @
6bee6688
...
...
@@ -92,6 +92,7 @@ export default {
// this.zTestGetNowUrlInfo();
},
created
()
{
// alert(`--->home: created.`)
this
.
zReadyUserId
()
// this.zReadyUserId();
// this.zTestGetNowUrlInfo();
...
...
@@ -103,6 +104,7 @@ export default {
"color: orange;"
,
this
.
$route
.
query
.
code
);
if
(
this
.
$route
.
query
.
code
===
undefined
)
{
this
.
zTestPreAuthCode
();
}
else
{
...
...
@@ -126,6 +128,7 @@ export default {
// 测试-获取预授权码
// redirectUrI: encodeURIComponent(location.href.split('#')[0]),
zTestPreAuthCode
()
{
// alert(`--->home: zTestPreAuthCode: IN.`)
const
basicInfo
=
{
head
:
"https://open.weixin.qq.com/connect/oauth2/authorize?"
,
appId
:
"wwd1cdbca7b8b2b6c4"
,
...
...
ybf_wx/src/views/sideNav/discount/index.vue
View file @
6bee6688
...
...
@@ -28,7 +28,7 @@
<div
v-if=
"zlist.voucherUrl !== ''"
class=
"voucherUrl"
>
<div
@
click=
"zpick"
>
小程序Url:
{{
zlist
.
voucherUrl
}}
</div>
</div>
</div>
-->
</div>
-->
</div>
<div
...
...
@@ -61,8 +61,15 @@
<div
class=
"zListActive"
>
<div
class=
"lists"
>
<div
v-if=
"zlist.voucherUrl !== ''"
class=
"voucherUrl"
>
<div
@
click=
"zpick"
>
小程序Url:
</div>
<div
@
click=
"zpick"
>
{{
zlist
.
voucherUrl
}}
</div>
<div
@
click=
"zpick"
>
小程序Url:
{{
String
(
zlist
.
voucherUrl
).
slice
(
-
2
)
}}
</div>
<div
v-if=
"String(zlist.voucherUrl).slice(-2) === '97'"
@
click=
"zpick('text', String(zlist.voucherUrl))"
>
{{
zlist
.
voucherUrl
}}
</div>
<div
v-if=
"String(zlist.voucherUrl).slice(-2) !== '97'"
@
click=
"zpick('h5', String(zlist.voucherUrl))"
>
{{
zlist
.
voucherUrl
}}
</div>
</div>
</div>
</div>
...
...
@@ -126,11 +133,13 @@ export default {
},
created
()
{
zlog
(
"%c--->Created."
,
"color: orange"
);
// alert(`--->discount: IN.`);
// configWx()
this
.
zcache
.
userId
=
this
.
$route
.
params
.
userId
;
// zlog('%c--->userId =', this.zcache.userId)
this
.
zReadyGetUserFromId
();
// this.zReadySetVoucherList();
this
.
getAgentAuth
();
},
mounted
()
{
// zlog("%c--->Mounted.", "color: orange");
...
...
@@ -218,26 +227,84 @@ export default {
zVoucherPick
(
inActiveId
,
inVoucherId
)
{
this
.
zVoucherUrlDel
();
const
postData
=
{
appCode
:
"0697"
,
action_id
:
Number
(
inActiveId
),
coupon_id
:
Number
(
inVoucherId
)
};
zlog
(
"%c--->VoucherWxUrl: PD ="
,
"background: red;"
,
postData
);
getVoucherWxUrl
(
postData
).
then
(
res
=>
{
zlog
(
"%c--->VoucherWxUrl: RD ="
,
"background: green;"
,
res
);
this
.
zVoucherUrlSet
(
res
.
result
.
link
);
});
},
zpick
()
{
zlog
(
"%c--->Click: Url ="
,
"background: orange;"
,
String
(
this
.
zlist
.
voucherUrl
)
);
window
.
wx
.
miniProgram
.
navigateTo
({
url
:
this
.
zlist
.
voucherUrl
});
zpick
(
inMsgType
,
inUrl
)
{
alert
(
`--->discount.vue: zpick: IN.`
);
switch
(
inMsgType
)
{
case
"text"
:
wx
.
invoke
(
"sendChatMessage"
,
{
msgtype
:
"text"
,
//消息类型,必填
text
:
{
content
:
inUrl
}
},
function
(
res
)
{
if
(
res
.
err_msg
==
"sendChatMessage:ok"
)
{
alert
(
"--->discount.vue: zpick: text 分享成功!"
);
}
else
if
(
res
.
err_msg
!=
"sendChatMessage:ok"
)
{
alert
(
`--->discount.vue: zpick: text 分享失败: res =
${
res
.
err_msg
}
`
);
}
}
);
break
;
case
"h5"
:
wx
.
invoke
(
"sendChatMessage"
,
{
msgtype
:
"text"
,
//消息类型,必填
news
:
{
link
:
"http://qywx2.100smartdata.com/voucherInfo"
,
//H5消息页面url 必填
title
:
"Z: h5消息标题"
,
//H5消息标题
desc
:
inUrl
,
//H5消息摘要
// imgUrl: "http://qywx2.100smartdata.com/hi.jpg" //H5消息封面图片URL
imgUrl
:
inUrl
//H5消息封面图片URL
}
},
function
(
res
)
{
if
(
res
.
err_msg
==
"sendChatMessage:ok"
)
{
alert
(
"--->discount.vue: zpick: h5 分享成功!"
);
}
else
if
(
res
.
err_msg
!=
"sendChatMessage:ok"
)
{
alert
(
`--->discount.vue: zpick: h5 分享失败: res =
${
res
}
`
);
alert
(
`--->discount.vue: zpick: h5 分享失败: res =
${
res
.
err_msg
}
`
);
}
}
);
break
;
default
:
break
;
}
// zlog(
// "%c--->Click: Url =",
// "background: orange;",
// String(this.zlist.voucherUrl)
// );
// window.wx.miniProgram.navigateTo({
// url: this.zlist.voucherUrl
// });
},
zVoucherSet
(
inArray
)
{
this
.
zlist
.
voucher
=
inArray
;
...
...
ybf_wx/src/views/sideNav/discount/test-city.png
0 → 100644
View file @
6bee6688
730 KB
ybf_wx/src/views/voucherInfo/index.vue
0 → 100644
View file @
6bee6688
<
template
>
<div
class=
"main"
>
<div>
Hola World.
</div>
<img
src=
"../../assets/qrcode.jpeg"
alt=
"Please Scan QRCode."
/>
<button
@
click=
"redirect"
>
redirect
</button>
</div>
</
template
>
<
script
>
const
zlog
=
console
.
log
.
bind
(
console
);
export
default
{
name
:
"voucherInfo"
,
data
()
{
return
{};
},
created
()
{
alert
(
"--->voucherInfo: Created."
);
// wx.miniProgram.navigateTo({url: '/path/to/page'})
// wx.miniProgram.navigateTo({url: '/pages/coupon/detail/detailid=100000338&actionid=97'})
},
mounted
()
{},
methods
:
{
redirect
()
{
// wx.miniProgram.navigateTo({url: '/pages/coupon/detail/detailid=100000338&actionid=97'})
alert
(
'--->voucherInfo: redirect: IN.'
)
window
.
location
.
href
=
'https://mp.weixin.qq.com/a/~PLEzZIqxoasdl5QDu_HZEw~~'
;
// wx.navigateToMiniProgram({
// appId: "1000004",
// path: "page/index/index?id=123",
// extraData: {
// foo: "bar"
// },
// success(res) {
// alert(`--->voucherInfo: navigateToMiniProgram: res.`)
// alert(`--->voucherInfo: navigateToMiniProgram: res =${JSON.stringify(res)}`)
// // 打开成功
// },
// fail(err) {
// alert(`--->voucherInfo: navigateToMiniProgram: err.`)
// alert(`--->voucherInfo: navigateToMiniProgram: err =${JSON.stringify(err)}`)
// // 打开成功
// }
// });
}
}
};
</
script
>
<
style
scoped
>
.main
{
display
:
flex
;
flex-direction
:
column
;
justify-content
:
flex-start
;
align-items
:
center
;
}
</
style
>
ybf_wx/src/views/voucherInfo/qrcode.jpeg
0 → 100644
View file @
6bee6688
30.3 KB
ybf_wx/yarn.lock
View file @
6bee6688
...
...
@@ -4789,6 +4789,11 @@ jsprim@^1.2.2:
json-schema "0.2.3"
verror "1.10.0"
jssdk@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/jssdk/-/jssdk-0.0.1.tgz#923d8163c63e223f8d60f1305014201964e1aaf0"
integrity sha1-kj2BY8Y+Ij+NYPEwUBQgGWThqvA=
killable@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/killable/-/killable-1.0.1.tgz#4c8ce441187a061c7474fb87ca08e2a638194892"
...
...
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