Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
U
uni-pdtravel
Project
Project
Details
Activity
Releases
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
panyongping
uni-pdtravel
Commits
265edc7b
Commit
265edc7b
authored
Aug 18, 2021
by
潘永坪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支付宝小程序开发
parent
2766f0ba
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
55 additions
and
33 deletions
+55
-33
App.vue
App.vue
+3
-2
request.js
common/request.js
+1
-1
combiChoose.vue
pages/combination/combiChoose/combiChoose.vue
+0
-3
distributionCombiChoose.vue
...ation/distributionCombiChoose/distributionCombiChoose.vue
+0
-2
index.vue
pages/index/index.vue
+7
-5
login.vue
pages/login/login.vue
+36
-4
electronicTicket.vue
pages/my/order/electronicTicket/electronicTicket.vue
+0
-2
ourPayment.vue
pages/ourPayment/ourPayment.vue
+3
-12
projectIntruduce
projectIntruduce
+5
-2
No files found.
App.vue
View file @
265edc7b
...
@@ -7,8 +7,9 @@
...
@@ -7,8 +7,9 @@
export
default
{
export
default
{
onLaunch
:
function
(
options
)
{
//初始化完成时触发(全局只触发一次
onLaunch
:
function
(
options
)
{
//初始化完成时触发(全局只触发一次
let
path
=
options
.
path
let
path
=
options
.
path
let
openid
=
uni
.
getStorageSync
(
"openid"
)
uni
.
setStorageSync
(
"enterUrl"
,
path
)
if
(
!
openid
&&
path
.
indexOf
(
"pages/ourPayment/ourPayment"
)
==-
1
){
//扫码支付页面不需要在此登录
let
token
=
uni
.
getStorageSync
(
"token"
)
if
(
!
token
&&
path
.
indexOf
(
"pages/ourPayment/ourPayment"
)
==-
1
){
//扫码支付页面不需要在此登录
setTimeout
(()
=>
{
//解决关联普通二维码扫码首次进入时一直显示登录中
setTimeout
(()
=>
{
//解决关联普通二维码扫码首次进入时一直显示登录中
uni
.
navigateTo
({
uni
.
navigateTo
({
url
:
"/pages/login/login"
url
:
"/pages/login/login"
...
...
common/request.js
View file @
265edc7b
...
@@ -10,7 +10,7 @@ const request = (url = '', data = {}, type = 'POST') => {
...
@@ -10,7 +10,7 @@ const request = (url = '', data = {}, type = 'POST') => {
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
request
({
uni
.
request
({
method
:
type
,
method
:
type
,
url
:
baseUrl
+
url
+
'?token='
+
uni
.
getStorageSync
(
"
openid
"
),
url
:
baseUrl
+
url
+
'?token='
+
uni
.
getStorageSync
(
"
token
"
),
data
:
data
,
data
:
data
,
dataType
:
'json'
,
dataType
:
'json'
,
}).
then
((
response
)
=>
{
}).
then
((
response
)
=>
{
...
...
pages/combination/combiChoose/combiChoose.vue
View file @
265edc7b
<
template
>
<
template
>
<view>
<view>
<!--#ifdef MP-WEIXIN -->
<web-view
:src=
"outUrl"
></web-view>
<web-view
:src=
"outUrl"
></web-view>
<!--#endif-->
</view>
</view>
</
template
>
</
template
>
...
...
pages/combination/distributionCombiChoose/distributionCombiChoose.vue
View file @
265edc7b
<
template
>
<
template
>
<view>
<view>
<!--#ifdef MP-WEIXIN -->
<web-view
:src=
"outUrl"
></web-view>
<web-view
:src=
"outUrl"
></web-view>
<!--#endif-->
</view>
</view>
</
template
>
</
template
>
...
...
pages/index/index.vue
View file @
265edc7b
<
template
>
<
template
>
<view
>
<view
>
<!--#ifdef MP-ALIPAY -->
<!--
<view
class=
"top"
>
<!--
<view
class=
"top"
>
<view
class=
"top-search"
>
<view
class=
"top-search"
>
</view>
</view>
...
@@ -66,8 +66,7 @@
...
@@ -66,8 +66,7 @@
</view>
</view>
</view>
-->
</view>
-->
<!--#endif-->
<!--
<text
@
click=
"getUserInfo()"
>
授权获取头像昵称
</text>
-->
<!--
<button
@
click=
"getUserInfo()"
>
授权获取头像昵称
</button>
-->
<view
class=
"bottom"
>
<view
class=
"bottom"
>
<web-view
:src=
"outUrl"
></web-view>
<web-view
:src=
"outUrl"
></web-view>
</view>
</view>
...
@@ -81,9 +80,12 @@
...
@@ -81,9 +80,12 @@
outUrl
:
""
,
//跳出地址
outUrl
:
""
,
//跳出地址
}
}
},
},
onLoad
()
{
onLoad
(){
let
pdOpenid
=
uni
.
getStorageSync
(
"openid"
)
//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let
pdOpenid
=
uni
.
getStorageSync
(
"openid"
)
//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
this
.
outUrl
=
"https://wx.pangdly.com/#/home?pdOpenid="
+
pdOpenid
let
pdToken
=
uni
.
getStorageSync
(
"token"
)
let
pdCreateUserId
=
uni
.
getStorageSync
(
"createUserId"
)
let
pdUserId
=
uni
.
getStorageSync
(
"userId"
)
this
.
outUrl
=
"https://wx.pangdly.com/#/home?pdOpenid="
+
pdOpenid
+
"&pdToken="
+
pdToken
+
"&pdCreateUserId="
+
pdCreateUserId
+
"&pdUserId="
+
pdUserId
},
},
methods
:
{
methods
:
{
getUserInfo
()
{
// 获取用户信息
getUserInfo
()
{
// 获取用户信息
...
...
pages/login/login.vue
View file @
265edc7b
...
@@ -37,18 +37,50 @@
...
@@ -37,18 +37,50 @@
if
(
res
.
code
==
'00'
){
if
(
res
.
code
==
'00'
){
let
openid
=
res
.
data
.
openid
let
openid
=
res
.
data
.
openid
uni
.
setStorageSync
(
'openid'
,
openid
)
uni
.
setStorageSync
(
'openid'
,
openid
)
uni
.
navigateBack
({
let
userId
=
res
.
data
.
userId
||
""
delta
:
1
let
datas
=
{
openid
,
source
,
userId
}
_this
.
$request
(
"wechatUser/login/findWxUserAndLogin"
,
datas
).
then
((
res
)
=>
{
//通过openid获取token
if
(
res
.
code
==
"00"
){
let
token
=
res
.
data
.
token
||
""
uni
.
setStorageSync
(
'token'
,
token
)
let
createUserId
=
res
.
data
.
personId
||
""
uni
.
setStorageSync
(
'createUserId'
,
createUserId
)
let
userId
=
res
.
data
.
userId
||
""
uni
.
setStorageSync
(
'userId'
,
userId
)
let
enterUrl
=
uni
.
getStorageSync
(
"enterUrl"
)
if
(
token
){
uni
.
redirectTo
({
url
:
"/"
+
enterUrl
})
})
// uni.navigateBack({
// delta:1
// })
}
}
else
{
}
else
{
uni
.
removeStorageSync
(
'openid'
)
uni
.
showToast
({
uni
.
showToast
({
title
:
res
.
message
,
title
:
res
.
message
,
icon
:
"none"
icon
:
"none"
})
})
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
uni
.
removeStorageSync
(
'openid'
)
uni
.
showToast
({
title
:
"登录失败"
,
icon
:
"none"
})
})
}
else
{
// uni.removeStorageSync('openid')
uni
.
showToast
({
title
:
res
.
message
,
icon
:
"none"
})
}
}).
catch
((
err
)
=>
{
// uni.removeStorageSync('openid')
uni
.
showToast
({
title
:
"登录失败"
,
icon
:
"none"
})
})
})
}
}
}
}
...
...
pages/my/order/electronicTicket/electronicTicket.vue
View file @
265edc7b
<
template
>
<
template
>
<view>
<view>
<!--#ifdef MP-WEIXIN -->
<web-view
:src=
"outUrl"
></web-view>
<web-view
:src=
"outUrl"
></web-view>
<!--#endif-->
</view>
</view>
</
template
>
</
template
>
...
...
pages/ourPayment/ourPayment.vue
View file @
265edc7b
...
@@ -180,9 +180,7 @@
...
@@ -180,9 +180,7 @@
}
else
{
//小商家没有merchantId
}
else
{
//小商家没有merchantId
this
.
initTwo
()
this
.
initTwo
()
}
}
//#ifdef MP-WEIXIN
this
.
initCoupon
()
this
.
initCoupon
()
//#endif
}
else
{
}
else
{
this
.
login
()
this
.
login
()
}
}
...
@@ -217,10 +215,7 @@
...
@@ -217,10 +215,7 @@
}
else
{
//小商家没有merchantId
}
else
{
//小商家没有merchantId
_this
.
initTwo
()
_this
.
initTwo
()
}
}
//#ifdef MP-WEIXIN
_this
.
initCoupon
()
_this
.
initCoupon
()
//#endif
}
else
{
}
else
{
uni
.
removeStorageSync
(
'openid'
)
uni
.
removeStorageSync
(
'openid'
)
}
}
...
@@ -244,9 +239,7 @@
...
@@ -244,9 +239,7 @@
},
200
)
},
200
)
clearTimeout
(
this
.
flag
)
clearTimeout
(
this
.
flag
)
this
.
flag
=
setTimeout
(()
=>
{
this
.
flag
=
setTimeout
(()
=>
{
//#ifdef MP-WEIXIN
this
.
initCoupon
()
this
.
initCoupon
()
//#endif
},
1500
)
},
1500
)
},
},
clickEnter
(){
//---------------------------------------------------------------------退格
clickEnter
(){
//---------------------------------------------------------------------退格
...
@@ -257,9 +250,7 @@
...
@@ -257,9 +250,7 @@
},
200
)
},
200
)
clearTimeout
(
this
.
flag
)
clearTimeout
(
this
.
flag
)
this
.
flag
=
setTimeout
(()
=>
{
this
.
flag
=
setTimeout
(()
=>
{
//#ifdef MP-WEIXIN
this
.
initCoupon
()
this
.
initCoupon
()
//#endif
},
1500
)
},
1500
)
},
},
couponChoose
(
data
)
{
//---------------------------------------------------------------子组件券选择之后触发的事件
couponChoose
(
data
)
{
//---------------------------------------------------------------子组件券选择之后触发的事件
...
@@ -441,9 +432,9 @@
...
@@ -441,9 +432,9 @@
provider
:
'alipay'
,
// 服务提供商 支付宝支付: alipay 微信支付: wxpay
provider
:
'alipay'
,
// 服务提供商 支付宝支付: alipay 微信支付: wxpay
orderInfo
:
this
.
orderInfo
,
// 支付宝订单号
orderInfo
:
this
.
orderInfo
,
// 支付宝订单号
success
:
function
(
res
)
{
success
:
function
(
res
)
{
//
uni.redirectTo({
uni
.
redirectTo
({
// url:"../paySuccess/paySuccess"
url
:
"../paySuccess/paySuccess?orderId="
+
_this
.
orderId
//
})
})
},
},
fail
:
function
(
err
)
{
fail
:
function
(
err
)
{
uni
.
showToast
({
uni
.
showToast
({
...
...
projectIntruduce
View file @
265edc7b
项目介绍文件
项目介绍文件
一、本地存储数据
一、本地存储数据
1.uni.getStorageSync("openid")
1.uni.getStorageSync("openid") //openid
2.uni.getStorageSync("alipayQrCode")
2.uni.getStorageSync("token") //token
3.uni.getStorageSync("createUserId") //当前用户的id
4.uni.getStorageSync("userId") //平台id
5.uni.getStorageSync("alipayQrCode") //支付宝参数码
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