Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
24134a16
Commit
24134a16
authored
Mar 21, 2020
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
d11341ad
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
39 deletions
+44
-39
src/api/live.js
+5
-0
src/components/livedModel/livedGoodsDia.vue
+6
-0
src/components/livedModel/livedIsEnded.vue
+6
-0
src/components/livedModel/notStarted.vue
+1
-1
src/pages/lived/index.vue
+1
-15
src/pages/testCanvasPoster/index.vue
+25
-23
No files found.
src/api/live.js
View file @
24134a16
...
...
@@ -49,4 +49,8 @@ export default {
getLiveStatisticsById
(
options
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/liveBroadcastInfo/getLiveStatisticsById`
,
options
);
},
// 商品点击埋点记录
addLiveUserGoodsByUser
(
options
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/liveBroadcastInfo/addLiveUserGoodsByUser`
,
options
);
},
};
\ No newline at end of file
src/components/livedModel/livedGoodsDia.vue
View file @
24134a16
...
...
@@ -179,6 +179,12 @@ export default {
},
// 到商品详情
toGoodsInfo
(
val
)
{
// 点击商品埋点
let
info
=
{
liveBroadcastId
:
Number
(
this
.
liveId
),
liveBroadcastGoodsId
:
Number
(
val
.
productId
),
}
live
.
addLiveUserGoodsByUser
(
info
).
then
(
res
=>
{});
let
query
=
{
fromLived
:
1
,
liveId
:
this
.
liveId
...
...
src/components/livedModel/livedIsEnded.vue
View file @
24134a16
...
...
@@ -97,6 +97,12 @@ export default {
methods
:
{
// 到商品详情
toGoodsInfo
(
val
)
{
// 点击商品埋点
let
info
=
{
liveBroadcastId
:
Number
(
this
.
liveId
),
liveBroadcastGoodsId
:
Number
(
val
.
productId
),
}
live
.
addLiveUserGoodsByUser
(
info
).
then
(
res
=>
{});
let
query
=
{
fromLived
:
1
,
liveId
:
this
.
liveId
...
...
src/components/livedModel/notStarted.vue
View file @
24134a16
...
...
@@ -45,7 +45,7 @@ export default {
const
tmplIds
=
[];
for
(
var
key
in
subscribeMessageObj
)
{
// 改成开播key
if
(
key
==
"
gift_be_expir
e"
)
{
if
(
key
==
"
start_liv
e"
)
{
tmplIds
.
push
(
subscribeMessageObj
[
key
]);
}
}
...
...
src/pages/lived/index.vue
View file @
24134a16
...
...
@@ -253,21 +253,7 @@ export default {
// 查询分销员信息
_this
.
getSpokesman
();
},
fail
(
res
)
{
console
.
log
(
"未登录------150"
);
// 跳转登录页
let
backUrl
=
"/lived/main"
;
let
query
=
{
liveId
:
_this
.
liveId
,
fromType
:
"mini"
};
let
url
=
`/pages/login/main?back=
${
backUrl
}
¶ms=
${
JSON
.
stringify
(
query
)}
`
;
wx
.
navigateTo
({
url
:
url
});
}
fail
(
res
)
{}
});
},
getMsgConfig
()
{
...
...
src/pages/testCanvasPoster/index.vue
View file @
24134a16
<
template
>
<div
class=
"test"
>
测试
<!--index.wxml-->
<view
class=
"posterWrap"
>
<canvas
canvas-id=
"posterCanvas"
class=
"myCanvas"
></canvas>
...
...
@@ -25,32 +24,40 @@ export default {
name
:
""
,
data
()
{
return
{
InfoSync
:
{}
InfoSync
:
{},
// 海报中信息
info
:
{
coverUrl
:
""
,
livedStatus
:
1
,
//直播状态 0未开播 1一开播
livedTime
:
"3月21日 20:20"
,
nickName
:
""
,
avatarUrl
:
""
}
};
},
components
:
{},
computed
:
{},
onLoad
()
{
wx
.
getUserInfo
({
//获取微信用户信息
success
:
function
(
res
)
{
console
.
log
(
res
,
"----------------108"
);
}
});
this
.
initPoster
(
this
.
info
);
},
created
()
{},
mounted
()
{},
methods
:
{
initPoster
(
info
)
{
const
InfoSync
=
wx
.
getSystemInfoSync
();
this
.
InfoSync
=
InfoSync
;
let
bili
=
InfoSync
.
windowWidth
/
375
*
1
;
const
ctx
=
wx
.
createCanvasContext
(
"posterCanvas"
);
this
.
saveThe
(
"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1575527967726&di=172dcdd5a6f6b3a92a17d670793a6a50&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201303%2F10%2F20130310192450_S8HG8.thumb.700_0.jpeg"
,
path
=>
{
ctx
.
drawImage
(
path
,
0
,
0
,
310
*
bili
,
435
*
bili
);
//ctx.drawImage(图片路径,距离画布左边,距离画布右边,图片宽,图片高)
ctx
.
save
();
// 保存当前绘画
ctx
.
setTextAlign
(
"center"
);
// 文字居中 ctx.fillText(显示文字,距离画布左边/基准点/文字以这个点居中或左对齐,距离画布顶部)
ctx
.
setFillStyle
(
"#111"
);
// 文字颜色:fff
ctx
.
setFontSize
(
16
);
// 文字字号
ctx
.
fillText
(
"刘亦菲"
,
155
*
bili
,
164
*
bili
);
//名字 ctx.fillText(显示文字,距离画布左边/基准点/文字以这个点居中或左对齐,距离画布顶部)
ctx
.
setFontSize
(
21
);
// 文字字号
ctx
.
fillText
(
"位置差一点出阴影重叠加粗"
,
155
*
bili
,
222.5
*
bili
);
ctx
.
setFillStyle
(
"#895908"
);
// 文字颜色:895908
ctx
.
setTextAlign
(
"center"
);
// 文字居中
ctx
.
fillText
(
"位置差一点出阴影重叠加粗"
,
155
*
bili
,
221.5
*
bili
);
ctx
.
fillText
(
"位置差一点出阴影重叠加粗"
,
155
*
bili
,
221.5
*
bili
);
ctx
.
fillText
(
info
.
livedTime
,
155
*
bili
,
164
*
bili
);
//名字 ctx.fillText(显示文字,距离画布左边/基准点/文字以这个点居中或左对齐,距离画布顶部
ctx
.
setFontSize
(
14
);
// 文字字号
ctx
.
setTextAlign
(
"left"
);
// 文字居中
...
...
@@ -77,13 +84,13 @@ export default {
ctx
.
fill
();
//二维码
this
.
saveThe
(
"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1575528227860&di=f644289e83c18cf73d44e76dec4c1246&imgtype=0&src=http%3A%2F%2Fn.sinaimg.cn%2Fsinacn%2Fw640h395%2F20180109%2F0ae9-fyqnici9075376.jp
g"
,
"http://test-bucket-ant.oss-cn-shanghai.aliyuncs.com/product/png/08af1c1f-b7a8-4bac-b85d-36e3cfc5cd05.pn
g"
,
path
=>
{
ctx
.
drawImage
(
path
,
30.5
*
bili
,
320
*
bili
,
93
*
bili
,
93
*
bili
);
ctx
.
save
();
//头像
this
.
saveThe
(
"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1575528093128&di=a92d8586763a982f233df10d358b8136&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201602%2F16%2F20160216165321_eTASf.jpe
g"
,
"http://test-bucket-ant.oss-cn-shanghai.aliyuncs.com/product/png/08af1c1f-b7a8-4bac-b85d-36e3cfc5cd05.pn
g"
,
path
=>
{
ctx
.
clip
();
ctx
.
drawImage
(
...
...
@@ -100,12 +107,7 @@ export default {
);
}
);
}
);
},
created
()
{},
mounted
()
{},
methods
:
{
// 小程序需要将图片下载下来,然后才能绘制到画布上
saveThe
(
url
,
callback
)
{
wx
.
getImageInfo
({
...
...
@@ -246,7 +248,7 @@ export default {
<
style
scoped
>
.posterWrap
{
min-height
:
100%
;
min-height
:
calc
(
100vh
-
40px
)
;
padding-top
:
40px
;
background-color
:
#f1f1f1
;
}
...
...
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