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
c59b521b
Commit
c59b521b
authored
Sep 24, 2020
by
韦凯德
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opt: c_client 模板优化
parent
98440a97
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 @
c59b521b
No preview for this file type
c_client/client/api.js
View file @
c59b521b
...
@@ -12,8 +12,9 @@ const request = tbccRequest({
...
@@ -12,8 +12,9 @@ const request = tbccRequest({
// api handle 列表
// api handle 列表
const
apiList
=
{
const
apiList
=
{
...
capi
,
...
capi
,
getIndex
:
{
getActivityBaseInfoById
:
{
handle
:
'index'
,
handle
:
'getActivityBaseInfoById'
,
method
:
'GET'
,
isShowLoading
:
true
isShowLoading
:
true
},
},
login
:
'login'
login
:
'login'
...
...
c_client/client/app.js
View file @
c59b521b
...
@@ -6,7 +6,7 @@ cloud.init({
...
@@ -6,7 +6,7 @@ cloud.init({
});
});
App
({
App
({
requestType
:
'
ams'
,
// ams:ams接口,cloud: 云函数
requestType
:
'
yapi'
,
// cloud: 云函数, yapi: yapi 接口, ams: ams接口,
cloudName
:
'CommonToC'
,
// 主云函数项目名
cloudName
:
'CommonToC'
,
// 主云函数项目名
cloud
,
cloud
,
tbcc
,
tbcc
,
...
...
c_client/client/pages/index/index.js
View file @
c59b521b
...
@@ -24,7 +24,7 @@ Page({
...
@@ -24,7 +24,7 @@ Page({
console
.
info
(
`Page onLoad with query:
${
JSON
.
stringify
(
query
)}
`
);
console
.
info
(
`Page onLoad with query:
${
JSON
.
stringify
(
query
)}
`
);
},
},
init
()
{
init
()
{
this
.
get
Index
();
this
.
get
ActivityBaseInfoById
();
},
},
onReady
()
{
onReady
()
{
// 页面加载完成
// 页面加载完成
...
@@ -65,8 +65,8 @@ Page({
...
@@ -65,8 +65,8 @@ Page({
/**
/**
* 获取主接口
* 获取主接口
*/
*/
async
get
Index
()
{
async
get
ActivityBaseInfoById
()
{
const
{
success
,
data
}
=
await
API
.
get
Index
().
catch
(
res
=>
{
const
{
success
,
data
}
=
await
API
.
get
ActivityBaseInfoById
().
catch
(
res
=>
{
commonToast
(
res
&&
res
.
message
);
commonToast
(
res
&&
res
.
message
);
})
||
{};
})
||
{};
...
@@ -80,7 +80,7 @@ Page({
...
@@ -80,7 +80,7 @@ Page({
*/
*/
async
login
()
{
async
login
()
{
const
{
nickName
,
avatar
}
=
app
;
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
);
commonToast
(
res
&&
res
.
message
);
})
||
{};
})
||
{};
...
...
c_client/client/pages/myprize/myprize.js
View file @
c59b521b
...
@@ -74,6 +74,7 @@ Page({
...
@@ -74,6 +74,7 @@ Page({
this
.
setData
({
this
.
setData
({
myPrizeList
:
data
.
list
myPrizeList
:
data
.
list
})
})
console
.
log
(
data
.
list
)
console
.
log
(
data
.
list
)
this
.
getEndTime
(
data
.
list
)
this
.
getEndTime
(
data
.
list
)
}
}
...
...
c_client/client/tbcc-sdk/lib/capi.js
View file @
c59b521b
const
capi
=
{
const
capi
=
{
getMyPrizeList
:
{
getMyPrizeList
:
{
method
:
'GET'
,
handle
:
'getMyPrizeList'
,
handle
:
'getMyPrizeList'
,
isShowLoading
:
true
isShowLoading
:
true
},
},
receiveObjectPrize
:
'receiveObjectPrize'
,
receiveObjectPrize
:
{
method
:
'GET'
,
handle
:
'receiveObjectPrize'
}
,
receiveEnamePrize
:
'receiveEnamePrize'
,
receiveEnamePrize
:
{
method
:
'GET'
,
handle
:
'receiveObjectPrize'
}
,
getItemListByItemIds
:
'getItemListByItemIds'
,
getItemListByItemIds
:
{
method
:
'GET'
,
handle
:
'getItemListByItemIds'
}
,
getCollectGoodsList
:
'getCollectGoodsList'
,
getCollectGoodsList
:
{
method
:
'GET'
,
handle
:
'getCollectGoodsList'
}
,
doCollectGoodsTask
:
'doCollectGoodsTask'
,
doCollectGoodsTask
:
{
method
:
'GET'
,
handle
:
'doCollectGoodsTask'
}
,
doBrowseGoodsTask
:
'doBrowseGoodsTask'
,
doBrowseGoodsTask
:
{
method
:
'GET'
,
handle
:
'doBrowseGoodsTask'
}
,
doJumpLinkTask
:
'doJumpLinkTask'
,
doJumpLinkTask
:
{
method
:
'GET'
,
handle
:
'doJumpLinkTask'
}
,
doExchangeCreditsTask
:
'doExchangeCreditsTask'
,
doExchangeCreditsTask
:
{
method
:
'GET'
,
handle
:
'doExchangeCreditsTask'
}
,
getVipInfo
:
'getVipInfo'
getVipInfo
:
{
method
:
'GET'
,
handle
:
'getVipInfo'
}
};
};
export
default
capi
;
export
default
capi
;
c_client/client/tbcc-sdk/lib/request.js
View file @
c59b521b
const
AMS_URL
=
'https://docs.dui88.com/mock/140/'
;
const
request
=
({
cloud
,
cloudName
,
requestType
=
'cloud'
,
mockUrl
})
=>
{
const
request
=
({
cloud
,
cloudName
,
requestType
=
'cloud'
})
=>
{
if
(
!
cloud
)
{
if
(
!
cloud
)
{
console
.
error
(
'请传入cloud'
);
console
.
error
(
'请传入cloud'
);
return
false
;
return
false
;
...
@@ -28,11 +26,16 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => {
...
@@ -28,11 +26,16 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => {
my
.
showLoading
();
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
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
my
.
request
({
my
.
request
({
url
:
AMS_URL
+
_cloudName
+
'.'
+
handle
,
url
:
requestPrefix
+
_cloudName
+
'.'
+
handle
,
method
:
"GET"
,
method
,
data
:
params
,
data
:
params
,
dataType
:
'json'
dataType
:
'json'
}).
then
(({
data
:
res
})
=>
{
}).
then
(({
data
:
res
})
=>
{
...
@@ -67,7 +70,7 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => {
...
@@ -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 @
c59b521b
...
@@ -336,6 +336,9 @@ export const getUserAddress = async (opts = {}) => {
...
@@ -336,6 +336,9 @@ export const getUserAddress = async (opts = {}) => {
reject
(
res
);
reject
(
res
);
}
}
);
);
},
fail
:
err
=>
{
reject
(
err
)
}
}
});
});
});
});
...
@@ -356,7 +359,7 @@ export const chooseImage = async (opts = {}) => {
...
@@ -356,7 +359,7 @@ export const chooseImage = async (opts = {}) => {
if
(
!
my
.
chooseImage
)
{
if
(
!
my
.
chooseImage
)
{
reject
({
reject
({
noSupport
:
true
,
noSupport
:
true
,
errorMessage
:
'当前版本不支持选择
收货地址
,请升级到最新版本'
errorMessage
:
'当前版本不支持选择
图片
,请升级到最新版本'
});
});
return
false
;
return
false
;
}
}
...
@@ -487,9 +490,8 @@ export const chattingSendCard = async (requestInfo) => {
...
@@ -487,9 +490,8 @@ export const chattingSendCard = async (requestInfo) => {
};
};
/**
/**
* 分享到群聊卡片
* 文本风险校验
* @param {*} cloud 小程序云
* @param {string} text 文本
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
*/
export
const
textRiskIdentification
=
async
(
text
)
=>
{
export
const
textRiskIdentification
=
async
(
text
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
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