Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
new_taobao
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
wildfirecode13
new_taobao
Commits
33a552c0
Commit
33a552c0
authored
Sep 30, 2020
by
wildfirecode13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
9d22853a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
45 deletions
+53
-45
index.axml
taobao_mini/client/pages/index/index.axml
+1
-2
index.js
taobao_mini/client/pages/index/index.js
+50
-41
request.js
taobao_mini/client/tbcc-sdk/lib/request.js
+2
-2
No files found.
taobao_mini/client/pages/index/index.axml
View file @
33a552c0
...
@@ -4,8 +4,7 @@
...
@@ -4,8 +4,7 @@
<view class="index-page__title">{{title}}</view>
<view class="index-page__title">{{title}}</view>
<view class="index-page__content">{{content}}</view>
<view class="index-page__content">{{content}}</view>
<view class="index-page__tips">AM接口只支持PC端预览,手机淘宝预览需要使用云函数模式</view>
<view class="index-page__tips">AM接口只支持PC端预览,手机淘宝预览需要使用云函数模式</view>
<view class="index-start-btn" onTap="doStart">开始</view>
<view class="index-start-btn" onTap="doShare">点击分享</view>
<view class="index-start-btn" onTap="doExchange">doExchange</view>
<navigator open-type="navigate" url="/pages/tbccDemo/tbccDemo" class="index-tbcc-btn">tbcc demo</navigator>
<navigator open-type="navigate" url="/pages/tbccDemo/tbccDemo" class="index-tbcc-btn">tbcc demo</navigator>
</view>
</view>
...
...
taobao_mini/client/pages/index/index.js
View file @
33a552c0
...
@@ -11,23 +11,46 @@ const SHARE_CONFIG = {
...
@@ -11,23 +11,46 @@ const SHARE_CONFIG = {
};
};
Page
({
Page
({
doShare
()
{},
data
:
{
data
:
{
title
:
''
,
content
:
''
,
rule
:
''
,
commonModalData
:
{
content
:
''
,
btnText
:
''
},
commonModalConfirm
:
null
,
commonModalVisible
:
false
,
ruleModalVisible
:
false
},
},
onLoad
(
query
)
{
onLoad
(
query
)
{
// 页面加载
// 页面加载
//
this.getAuth();
this
.
getAuth
();
console
.
info
(
`Page onLoad with query:
${
JSON
.
stringify
(
query
)}
`
);
console
.
info
(
`Page onLoad with query:
${
JSON
.
stringify
(
query
)}
`
);
},
},
/**
* 获取用户授权信息
*/
async
getAuth
()
{
const
userInfo
=
await
getAuthUserInfo
().
catch
(
err
=>
{
console
.
log
(
'未授权成功'
,
err
);
});
if
(
userInfo
)
{
console
.
log
(
'userInfo'
,
userInfo
);
const
{
nickName
,
avatar
}
=
userInfo
;
app
.
nickName
=
nickName
;
app
.
avatar
=
avatar
;
this
.
login
();
}
},
/**
* 登录接口
*/
async
login
()
{
const
{
nickName
,
avatar
,
isFollow
}
=
app
;
const
{
success
,
data
}
=
await
API
.
login
({
userNick
:
nickName
,
avatar
,
isFollow
:
true
}).
catch
(
res
=>
{
commonToast
(
res
&&
res
.
message
);
})
||
{};
if
(
success
)
{
const
{
openId
}
=
data
;
app
.
openId
=
openId
;
this
.
init
();
}
},
init
()
{
init
()
{
console
.
log
(
'do init'
)
console
.
log
(
'do init'
)
},
},
...
@@ -52,21 +75,7 @@ Page({
...
@@ -52,21 +75,7 @@ Page({
onReachBottom
()
{
onReachBottom
()
{
// 页面被拉到底部
// 页面被拉到底部
},
},
/**
* 获取用户授权信息
*/
async
getAuth
()
{
const
userInfo
=
await
getAuthUserInfo
().
catch
(
err
=>
{
console
.
log
(
'未授权成功'
,
err
);
});
if
(
userInfo
)
{
console
.
log
(
'userInfo'
,
userInfo
);
const
{
nickName
,
avatar
}
=
userInfo
;
app
.
nickName
=
nickName
;
app
.
avatar
=
avatar
;
this
.
login
();
}
},
/**
/**
* 获取主接口
* 获取主接口
*/
*/
...
@@ -80,19 +89,7 @@ Page({
...
@@ -80,19 +89,7 @@ Page({
this
.
setData
({
title
,
content
,
rule
});
this
.
setData
({
title
,
content
,
rule
});
}
}
},
},
/**
* 登录接口
*/
async
login
()
{
const
{
nickName
,
avatar
}
=
app
;
const
{
success
}
=
await
API
.
login
({
userNick
:
nickName
,
avatar
}).
catch
(
res
=>
{
commonToast
(
res
&&
res
.
message
);
})
||
{};
if
(
success
)
{
this
.
init
();
}
},
/**
/**
* 显示规则弹层
* 显示规则弹层
*/
*/
...
@@ -111,6 +108,18 @@ Page({
...
@@ -111,6 +108,18 @@ Page({
onShareAppMessage
()
{
onShareAppMessage
()
{
// 返回自定义分享信息
// 返回自定义分享信息
return
SHARE_CONFIG
;
let
{
},
path
,
...
rest
}
=
SHARE_CONFIG
;
if
(
app
.
openId
)
{
path
+=
'?inviteId='
+
app
.
openId
;
}
console
.
log
(
'path'
,
path
)
return
{
...
rest
,
path
}
}
});
});
taobao_mini/client/tbcc-sdk/lib/request.js
View file @
33a552c0
...
@@ -84,9 +84,9 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => {
...
@@ -84,9 +84,9 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => {
const
requestCloud
=
()
=>
{
const
requestCloud
=
()
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
//
console.log('requestCloud', handle, params);
console
.
log
(
'requestCloud'
,
handle
,
params
);
cloud
.
function
.
invoke
(
_cloudName
,
params
,
handle
).
then
(
res
=>
{
cloud
.
function
.
invoke
(
_cloudName
,
params
,
handle
).
then
(
res
=>
{
//
console.log('request Cloud callback=>', handle, res, JSON.stringify(res));
console
.
log
(
'request Cloud callback=>'
,
handle
,
res
,
JSON
.
stringify
(
res
));
hideMyLoading
();
hideMyLoading
();
if
(
res
&&
res
.
success
)
{
if
(
res
&&
res
.
success
)
{
resolve
(
res
);
resolve
(
res
);
...
...
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