Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taobao-mini-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
qinhaitao
taobao-mini-template
Commits
caaa2228
Commit
caaa2228
authored
Sep 24, 2020
by
韦凯德
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'c_client_opt' into 'c_client'
opt: c_client 模板优化 See merge request
!1
parents
98440a97
c59b521b
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
28 deletions
+36
-28
.DS_Store
.DS_Store
+0
-0
api.js
c_client/client/api.js
+3
-2
app.js
c_client/client/app.js
+1
-1
index.js
c_client/client/pages/index/index.js
+4
-4
myprize.js
c_client/client/pages/myprize/myprize.js
+1
-0
capi.js
c_client/client/tbcc-sdk/lib/capi.js
+10
-9
request.js
c_client/client/tbcc-sdk/lib/request.js
+11
-8
tb.js
c_client/client/tbcc-sdk/lib/tb.js
+6
-4
No files found.
.DS_Store
View file @
caaa2228
No preview for this file type
c_client/client/api.js
View file @
caaa2228
...
...
@@ -12,8 +12,9 @@ const request = tbccRequest({
// api handle 列表
const
apiList
=
{
...
capi
,
getIndex
:
{
handle
:
'index'
,
getActivityBaseInfoById
:
{
handle
:
'getActivityBaseInfoById'
,
method
:
'GET'
,
isShowLoading
:
true
},
login
:
'login'
...
...
c_client/client/app.js
View file @
caaa2228
...
...
@@ -6,7 +6,7 @@ cloud.init({
});
App
({
requestType
:
'
ams'
,
// ams:ams接口,cloud: 云函数
requestType
:
'
yapi'
,
// cloud: 云函数, yapi: yapi 接口, ams: ams接口,
cloudName
:
'CommonToC'
,
// 主云函数项目名
cloud
,
tbcc
,
...
...
c_client/client/pages/index/index.js
View file @
caaa2228
...
...
@@ -24,7 +24,7 @@ Page({
console
.
info
(
`Page onLoad with query:
${
JSON
.
stringify
(
query
)}
`
);
},
init
()
{
this
.
get
Index
();
this
.
get
ActivityBaseInfoById
();
},
onReady
()
{
// 页面加载完成
...
...
@@ -65,8 +65,8 @@ Page({
/**
* 获取主接口
*/
async
get
Index
()
{
const
{
success
,
data
}
=
await
API
.
get
Index
().
catch
(
res
=>
{
async
get
ActivityBaseInfoById
()
{
const
{
success
,
data
}
=
await
API
.
get
ActivityBaseInfoById
().
catch
(
res
=>
{
commonToast
(
res
&&
res
.
message
);
})
||
{};
...
...
@@ -80,7 +80,7 @@ Page({
*/
async
login
()
{
const
{
nickName
,
avatar
}
=
app
;
const
{
success
}
=
await
API
.
login
({
nickName
,
avatar
}).
catch
(
res
=>
{
const
{
success
}
=
await
API
.
login
({
userNick
:
nickName
,
avatar
}).
catch
(
res
=>
{
commonToast
(
res
&&
res
.
message
);
})
||
{};
...
...
c_client/client/pages/myprize/myprize.js
View file @
caaa2228
...
...
@@ -74,6 +74,7 @@ Page({
this
.
setData
({
myPrizeList
:
data
.
list
})
console
.
log
(
data
.
list
)
this
.
getEndTime
(
data
.
list
)
}
...
...
c_client/client/tbcc-sdk/lib/capi.js
View file @
caaa2228
const
capi
=
{
getMyPrizeList
:
{
method
:
'GET'
,
handle
:
'getMyPrizeList'
,
isShowLoading
:
true
},
receiveObjectPrize
:
'receiveObjectPrize'
,
receiveEnamePrize
:
'receiveEnamePrize'
,
getItemListByItemIds
:
'getItemListByItemIds'
,
getCollectGoodsList
:
'getCollectGoodsList'
,
doCollectGoodsTask
:
'doCollectGoodsTask'
,
doBrowseGoodsTask
:
'doBrowseGoodsTask'
,
doJumpLinkTask
:
'doJumpLinkTask'
,
doExchangeCreditsTask
:
'doExchangeCreditsTask'
,
getVipInfo
:
'getVipInfo'
receiveObjectPrize
:
{
method
:
'GET'
,
handle
:
'receiveObjectPrize'
}
,
receiveEnamePrize
:
{
method
:
'GET'
,
handle
:
'receiveObjectPrize'
}
,
getItemListByItemIds
:
{
method
:
'GET'
,
handle
:
'getItemListByItemIds'
}
,
getCollectGoodsList
:
{
method
:
'GET'
,
handle
:
'getCollectGoodsList'
}
,
doCollectGoodsTask
:
{
method
:
'GET'
,
handle
:
'doCollectGoodsTask'
}
,
doBrowseGoodsTask
:
{
method
:
'GET'
,
handle
:
'doBrowseGoodsTask'
}
,
doJumpLinkTask
:
{
method
:
'GET'
,
handle
:
'doJumpLinkTask'
}
,
doExchangeCreditsTask
:
{
method
:
'GET'
,
handle
:
'doExchangeCreditsTask'
}
,
getVipInfo
:
{
method
:
'GET'
,
handle
:
'getVipInfo'
}
};
export
default
capi
;
c_client/client/tbcc-sdk/lib/request.js
View file @
caaa2228
const
AMS_URL
=
'https://docs.dui88.com/mock/140/'
;
const
request
=
({
cloud
,
cloudName
,
requestType
=
'cloud'
})
=>
{
const
request
=
({
cloud
,
cloudName
,
requestType
=
'cloud'
,
mockUrl
})
=>
{
if
(
!
cloud
)
{
console
.
error
(
'请传入cloud'
);
return
false
;
...
...
@@ -28,11 +26,16 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => {
my
.
showLoading
();
}
const
requestAms
=
()
=>
{
const
requestMock
=
()
=>
{
const
mockUrlPrefix
=
{
ams
:
'https://ams.dui88.com/server/index.php?g=Web&c=Mock&o=simple&projectID=218&uri='
,
yapi
:
'https://docs.dui88.com/mock/140/'
};
const
requestPrefix
=
mockUrl
||
mockUrlPrefix
[
requestType
];
return
new
Promise
((
resolve
,
reject
)
=>
{
my
.
request
({
url
:
AMS_URL
+
_cloudName
+
'.'
+
handle
,
method
:
"GET"
,
url
:
requestPrefix
+
_cloudName
+
'.'
+
handle
,
method
,
data
:
params
,
dataType
:
'json'
}).
then
(({
data
:
res
})
=>
{
...
...
@@ -67,7 +70,7 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => {
});
};
return
requestType
===
'ams'
?
requestAms
()
:
requestCloud
();
return
[
'ams'
,
'yapi'
].
includes
(
requestType
)
?
requestMock
()
:
requestCloud
();
};
};
...
...
c_client/client/tbcc-sdk/lib/tb.js
View file @
caaa2228
...
...
@@ -336,6 +336,9 @@ export const getUserAddress = async (opts = {}) => {
reject
(
res
);
}
);
},
fail
:
err
=>
{
reject
(
err
)
}
});
});
...
...
@@ -356,7 +359,7 @@ export const chooseImage = async (opts = {}) => {
if
(
!
my
.
chooseImage
)
{
reject
({
noSupport
:
true
,
errorMessage
:
'当前版本不支持选择
收货地址
,请升级到最新版本'
errorMessage
:
'当前版本不支持选择
图片
,请升级到最新版本'
});
return
false
;
}
...
...
@@ -487,9 +490,8 @@ export const chattingSendCard = async (requestInfo) => {
};
/**
* 分享到群聊卡片
* @param {*} cloud 小程序云
* @param {object} requestInfo 分享到群聊卡片所需请求参数
* 文本风险校验
* @param {string} text 文本
*/
export
const
textRiskIdentification
=
async
(
text
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
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