Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jcy2004x
ShopXO
提交
aedfc3e5
ShopXO
项目概览
jcy2004x
/
ShopXO
与 Fork 源项目一致
Fork自
纵之格 / ShopXO
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
aedfc3e5
编写于
8月 25, 2019
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化支付宝授权逻辑
上级
fcae1203
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
73 addition
and
74 deletion
+73
-74
public/appmini/old/alipay/app.js
public/appmini/old/alipay/app.js
+73
-63
public/appmini/old/alipay/package-lock.json
public/appmini/old/alipay/package-lock.json
+0
-11
未找到文件。
public/appmini/old/alipay/app.js
浏览文件 @
aedfc3e5
...
...
@@ -195,7 +195,7 @@ App({
var
user
=
this
.
get_user_cache_info
();
if
(
user
==
false
)
{
// 唤醒用户授权
this
.
user_login
(
object
,
method
);
this
.
user_login
();
return
false
;
}
else
{
...
...
@@ -216,75 +216,85 @@ App({
/**
* 用户授权
* object 回调操作对象
* method 回调操作对象的函数
* auth_data 授权数据
*/
user_login
(
object
,
method
,
auth_data
)
{
var
$this
=
this
;
// 加载loding
my
.
showLoading
({
content
:
"
授权中...
"
});
// 请求授权接口
my
.
getAuthCode
({
scopes
:
"
auth_user
"
,
success
:
res
=>
{
if
(
res
.
authCode
)
{
my
.
request
({
url
:
$this
.
get_request_url
(
"
alipayuserauth
"
,
"
user
"
),
method
:
"
POST
"
,
data
:
{
authcode
:
res
.
authCode
},
dataType
:
"
json
"
,
headers
:
{
'
content-type
'
:
'
application/x-www-form-urlencoded
'
}
,
success
:
res
=>
{
my
.
hideLoading
();
if
(
res
.
data
.
code
==
0
)
{
my
.
setStorage
(
{
key
:
$this
.
data
.
cache_user_login_key
,
data
:
res
.
data
.
data
});
my
.
confirm
({
title
:
'
温馨提示
'
,
content
:
'
授权用户信息
'
,
confirmButtonText
:
'
确认
'
,
cancelButtonText
:
'
暂不
'
,
success
:
(
result
)
=>
{
if
(
result
.
confirm
)
{
my
.
navigateTo
({
url
:
"
/pages/login/login
"
});
}
}
});
}
else
{
user_login
()
{
var
openid
=
my
.
getStorageSync
({
key
:
this
.
data
.
cache_user_login_key
})
;
if
((
openid
.
data
||
null
)
==
null
)
{
var
$this
=
this
;
// 加载loding
my
.
showLoading
({
content
:
"
授权中...
"
});
// 请求授权接口
my
.
getAuthCode
(
{
scopes
:
"
auth_base
"
,
success
:
res
=>
{
if
(
res
.
authCode
)
{
my
.
request
({
url
:
$this
.
get_request_url
(
"
alipayuserauth
"
,
"
user
"
)
,
method
:
"
POST
"
,
data
:
{
authcode
:
res
.
authCode
},
dataType
:
"
json
"
,
headers
:
{
'
content-type
'
:
'
application/x-www-form-urlencoded
'
},
success
:
res
=>
{
my
.
hideLoading
();
if
(
res
.
data
.
code
==
0
)
{
my
.
setStorageSync
({
key
:
$this
.
data
.
cache_user_login_key
,
data
:
res
.
data
.
data
});
$this
.
login_to_auth
();
}
else
{
my
.
showToast
(
{
type
:
"
fail
"
,
content
:
res
.
data
.
msg
,
duration
:
3000
});
}
},
fail
:
()
=>
{
my
.
hideLoading
();
my
.
showToast
({
type
:
"
fail
"
,
content
:
res
.
data
.
msg
,
content
:
"
服务器请求出错
"
,
duration
:
3000
});
}
}
,
fail
:
()
=>
{
my
.
hideLoading
();
my
.
showToast
(
{
type
:
"
fail
"
,
content
:
"
服务器请求出错
"
,
duration
:
3000
});
}
}
);
}
},
fail
:
e
=>
{
my
.
hideLoading
();
my
.
showToast
({
type
:
"
fail
"
,
content
:
"
授权失败
"
,
duration
:
3000
});
}
},
fail
:
e
=>
{
my
.
hideLoading
();
my
.
showToast
({
type
:
"
fail
"
,
content
:
"
授权失败
"
,
duration
:
3000
});
}
});
});
}
else
{
this
.
login_to_auth
();
}
},
/**
* 跳转到登录页面授权
*/
login_to_auth
()
{
my
.
confirm
({
title
:
'
温馨提示
'
,
content
:
'
授权用户信息
'
,
confirmButtonText
:
'
确认
'
,
cancelButtonText
:
'
暂不
'
,
success
:
(
result
)
=>
{
if
(
result
.
confirm
)
{
my
.
navigateTo
({
url
:
"
/pages/login/login
"
});
}
}
});
},
/**
...
...
@@ -297,7 +307,7 @@ App({
var
openid
=
my
.
getStorageSync
({
key
:
this
.
data
.
cache_user_login_key
});
if
((
openid
.
data
||
null
)
==
null
)
{
this
.
user_login
(
object
,
method
,
auth_data
);
this
.
user_login
();
}
else
{
this
.
get_user_login_info
(
object
,
method
,
openid
.
data
,
auth_data
);
}
...
...
public/appmini/old/alipay/package-lock.json
已删除
100755 → 0
浏览文件 @
fcae1203
{
"requires"
:
true
,
"lockfileVersion"
:
1
,
"dependencies"
:
{
"mini-antui"
:
{
"version"
:
"0.4.4"
,
"resolved"
:
"https://registry.npmjs.org/mini-antui/-/mini-antui-0.4.4.tgz"
,
"integrity"
:
"sha512-mkrn5VF30ojspyVY70Otn91sp0YyJE4j0fvsqqzAaXqOv1fpHROTwLMcIwshi8XcMn9gAxXrdFujJQQo46uh+Q=="
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录