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
2a0a5690
Commit
2a0a5690
authored
Feb 08, 2022
by
柳士祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文章优化,细节优化,二级页面携带分销关系优化
parent
1612b8bf
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
379 additions
and
34 deletions
+379
-34
src/App.vue
+13
-0
src/api/shop.js
+7
-0
src/app.json
+2
-1
src/main.js
+3
-0
src/pages/pages_subpack/article/index.vue
+177
-30
src/pages/pages_subpack/article/main.json
+1
-1
src/pages/tabBar1/index.vue
+140
-0
src/utils/themeModule.js
+0
-0
src/utils/tool.js
+34
-0
static/vant/tabs/index.wxs
+2
-2
No files found.
src/App.vue
View file @
2a0a5690
...
@@ -48,6 +48,9 @@ export default {
...
@@ -48,6 +48,9 @@ export default {
// 页面配置信息
// 页面配置信息
this
.
getThemePage
(
extConfig
);
this
.
getThemePage
(
extConfig
);
// 商城配置
this
.
shopConfiguration
()
setTimeout
(()
=>
{
setTimeout
(()
=>
{
let
mpApp
=
getApp
();
let
mpApp
=
getApp
();
...
@@ -225,6 +228,16 @@ export default {
...
@@ -225,6 +228,16 @@ export default {
}
}
});
});
},
},
//商城配置
shopConfiguration
(){
shop
.
get_shop_configuration
().
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
let
mpApp
=
getApp
();
mpApp
.
shop_configuration
=
res
.
data
.
data
console
.
log
(
mpApp
.
shop_configuration
,
'mpApp.shop_configuration'
);
}
})
},
async
getThemePage
({
mixid
,
shopid
})
{
async
getThemePage
({
mixid
,
shopid
})
{
await
shop
await
shop
.
themePagesInfo
({
.
themePagesInfo
({
...
...
src/api/shop.js
View file @
2a0a5690
...
@@ -37,5 +37,12 @@ export default {
...
@@ -37,5 +37,12 @@ export default {
return
requestPOST
(
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/user/draw_membership_card?cardId=
${
params
}
`
`
${
process
.
env
.
OLSHOP_URL
}
/user/draw_membership_card?cardId=
${
params
}
`
);
);
},
//获取shop配置
get_shop_configuration
(){
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/shop/get_shop_configuration`
);
}
}
};
};
src/app.json
View file @
2a0a5690
...
@@ -14,7 +14,8 @@
...
@@ -14,7 +14,8 @@
"pages/tabBar4/main"
,
"pages/tabBar4/main"
,
"pages/changeAdr/main"
,
"pages/changeAdr/main"
,
"pages/downFile/main"
,
"pages/downFile/main"
,
"pages/wxArticle/main"
"pages/wxArticle/main"
,
"pages/pages_subpack/article/main"
],
],
"usingComponents"
:
{},
"usingComponents"
:
{},
"window"
:
{
"window"
:
{
...
...
src/main.js
View file @
2a0a5690
...
@@ -11,6 +11,8 @@ import cartApi from './api/cart'
...
@@ -11,6 +11,8 @@ import cartApi from './api/cart'
import
classificationApi
from
"./api/classification"
;
import
classificationApi
from
"./api/classification"
;
import
spokesmanApi
from
'./api/spokesman'
import
spokesmanApi
from
'./api/spokesman'
import
{
DFSImg
,
concatUrl
}
from
"@/utils/index"
;
import
{
DFSImg
,
concatUrl
}
from
"@/utils/index"
;
//一些js工具类
import
tool
from
"@/utils/tool"
;
var
log
=
require
(
'./utils/log'
)
var
log
=
require
(
'./utils/log'
)
import
fenxiaoModel
from
"@/utils/fenxiaoModel"
;
import
fenxiaoModel
from
"@/utils/fenxiaoModel"
;
import
{
import
{
...
@@ -135,6 +137,7 @@ mpApp.getThemePage = getThemePage
...
@@ -135,6 +137,7 @@ mpApp.getThemePage = getThemePage
mpApp
.
themeColor
=
{}
mpApp
.
themeColor
=
{}
mpApp
.
log
=
log
mpApp
.
log
=
log
mpApp
.
tool
=
tool
function
getThemePage
({
mixid
,
shopid
})
{
function
getThemePage
({
mixid
,
shopid
})
{
shop
shop
...
...
src/pages/pages_subpack/article/index.vue
View file @
2a0a5690
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
<div
class=
"title_user"
>
{{
article
.
author
}}
</div>
<div
class=
"title_user"
>
{{
article
.
author
}}
</div>
<div
class=
"title_time"
>
{{
article
.
createDatetime
}}
</div>
<div
class=
"title_time"
>
{{
article
.
createDatetime
}}
</div>
</div>
</div>
<!--
<wxParse
:content=
"article.content"
v-if=
"!article.msg"
/>
-->
<div
v-html=
"article.content"
v-if=
"!article.msg"
></div>
<div
v-html=
"article.content"
v-if=
"!article.msg"
></div>
<!--
<rich-text
:datas=
"datas"
v-if=
"!article.msg"
></rich-text>
-->
<!--
<rich-text
:datas=
"datas"
v-if=
"!article.msg"
></rich-text>
-->
<div
class=
"title"
style=
"min-height: 50vh;color: #999;align-items: center;display: flex;justify-content: center;"
v-else
>
{{
article
.
msg
}}
</div>
<div
class=
"title"
style=
"min-height: 50vh;color: #999;align-items: center;display: flex;justify-content: center;"
v-else
>
{{
article
.
msg
}}
</div>
...
@@ -52,7 +53,9 @@
...
@@ -52,7 +53,9 @@
<
script
>
<
script
>
import
article
from
'@/api/article'
import
article
from
'@/api/article'
import
shadeGuide
from
"./shadeGuide.vue"
;
import
shadeGuide
from
"./shadeGuide.vue"
;
import
richText
from
"../../../components/basicTool/rich-text/index.vue"
;
import
{
throttle
,
concatUrl
}
from
"../../../utils/index.js"
// import wxParse from 'mpvue-wxparse'
const
app
=
getApp
();
const
app
=
getApp
();
const
{
log
}
=
app
;
const
{
log
}
=
app
;
export
default
{
export
default
{
...
@@ -71,59 +74,197 @@ export default {
...
@@ -71,59 +74,197 @@ export default {
pageNum
:
0
,
pageNum
:
0
,
pageSize
:
20
,
pageSize
:
20
,
},
},
datas
:
{
componentData
:
{}
}
}
}
},
},
components
:
{
components
:
{
"shade-guide"
:
shadeGuide
,
"shade-guide"
:
shadeGuide
"rich-text"
:
richText
},
},
created
()
{
created
()
{
},
},
onReady
()
{
onReady
()
{
},
},
onLoad
(
option
)
{
onLoad
(
option
s
)
{
wx
.
showShareMenu
({
wx
.
showShareMenu
({
withShareTicket
:
true
,
withShareTicket
:
true
,
menus
:
[
'shareAppMessage'
,
'shareTimeline'
]
menus
:
[
'shareAppMessage'
,
'shareTimeline'
]
})
})
this
.
articleId
=
option
.
article_id
if
(
options
.
queryStr
)
{
wx
.
showModal
({
title
:
""
,
content
:
options
.
queryStr
,
showCancel
:
true
,
cancelText
:
'取消'
,
cancelColor
:
'#000000'
,
confirmText
:
'确定'
,
confirmColor
:
'#3CC51F'
,
success
:
(
result
)
=>
{
if
(
result
.
confirm
)
{
}
},
fail
:
()
=>
{
},
complete
:
()
=>
{
}
});
}
else
if
(
options
.
article_id
)
{
this
.
articleId
=
options
.
article_id
this
.
query
[
'articleId'
]
=
this
.
articleId
this
.
query
[
'articleId'
]
=
this
.
articleId
this
.
init
()
this
.
init
()
}
//进页面存储需要绑定的信息
if
(
options
.
userId
||
options
.
spokesmanRelId
)
{
wx
.
setStorage
({
key
:
"becomeInfo"
,
data
:
JSON
.
stringify
(
options
)
});
}
if
(
wx
.
getStorageSync
(
"sessionid"
))
{
//获取分销信息
this
.
getSpokesmanInit
(
wx
.
getStorageSync
(
"becomeInfo"
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
"becomeInfo"
))
:
''
)
}
},
},
onShareAppMessage
()
{
// onShareAppMessage() {
// return {
// title: '',
// path: `/pages/pages_subpack/article/main?article_id=${this.articleId}`
// }
// },
async
onShareAppMessage
(
res
)
{
console
.
log
(
'wxshare'
);
let
newHref
=
`/pages/pages_subpack/article/main?article_id=
${
this
.
articleId
}
`
;
let
title
=
app
.
globalData
.
shopInfo
.
shopName
;
let
hasInvitationStatus
=
0
;
if
(
wx
.
getStorageSync
(
"sessionid"
))
{
await
app
.
fenxiaoModel
.
getSpokesmanidByShare
().
then
(
data
=>
{
hasInvitationStatus
=
data
.
hasInvitationStatus
;
})
await
app
.
fenxiaoModel
.
getSpokesmanInfo
().
then
(
data
=>
{
let
newData
=
{}
if
(
data
!=
null
)
{
if
(
hasInvitationStatus
==
1
)
{
newData
=
{
spokesmanGroupId
:
data
.
groupId
,
spokesmanShopId
:
data
.
shopId
,
spokesmanRelId
:
data
.
id
,
userId
:
data
.
userId
}
}
else
{
newData
=
{
userId
:
data
.
userId
}
}
}
newHref
=
concatUrl
(
newHref
,
newData
)
})
}
console
.
log
(
newHref
,
title
,
'share'
);
return
{
return
{
title
:
''
,
title
:
title
,
// 默认是小程序的名称
path
:
`/pages/article/main?article_id=
${
this
.
articleId
}
`
path
:
newHref
,
// 默认是当前页面
imageUrl
:
''
,
success
:
function
(
res
)
{
// 转发成功之后的回调
if
(
res
.
errMsg
==
"shareAppMessage:ok"
)
{
log
.
info
(
res
,
"分享成功"
);
}
},
fail
:
function
()
{
// 转发失败之后的回调
if
(
res
.
errMsg
==
"shareAppMessage:fail cancel"
)
{
// 用户取消转发
log
.
info
(
res
,
"分享失败"
);
}
else
if
(
res
.
errMsg
==
"shareAppMessage:fail"
)
{
// 转发失败,其中 detail message 为详细失败信息
}
},
complete
:
function
()
{
// 转发结束之后的回调(转发成不成功都会执行)
}
}
};
},
},
onShareTimeline
()
{
//用户点击右上角分享朋友圈
onShareTimeline
:
function
()
{
return
{
return
{
title
:
''
,
title
:
''
,
query
:
{
query
:
`article_id=
${
this
.
article_id
}
`
,
article_id
:
this
.
articleId
imageUrl
:
''
},
imageUrl
:
''
,
createDatetime
:
''
}
}
},
},
// async onShareTimeline() {
// console.log('Timeline');
// // let newHref = `/pages/pages_subpack/article/main?article_id=${this.articleId}`;
// let newHref = ''
// let title = app.globalData.shopInfo.shopName;
// let hasInvitationStatus = 0;
// if (wx.getStorageSync("sessionid")) {
// await app.fenxiaoModel.getSpokesmanidByShare().then(data => {
// hasInvitationStatus = data.hasInvitationStatus;
// })
// await app.fenxiaoModel.getSpokesmanInfo().then(data => {
// let newData = {}
// if (data != null) {
// if (hasInvitationStatus == 1) {
// newData = {
// spokesmanGroupId: data.groupId,
// spokesmanShopId: data.shopId,
// spokesmanRelId: data.id,
// userId: data.userId
// }
// } else {
// newData = {
// userId: data.userId
// }
// }
// }
// newHref = concatUrl(newHref, newData)
// })
// }
// console.log(newHref, title, 'TimelineShare');
// // let queryStr = `articleId_${this.articleId}/spokesmanGroupId_${obj.spokesmanGroupId}/spokesmanShopId_${obj.spokesmanShopId}/spokesmanRelId_${obj.spokesmanRelId}/userId_${obj.userId}`
// return {
// title: title,
// query: 'a=1111',
// imageUrl: '',
// createDatetime: ''
// }
// },
methods
:
{
methods
:
{
getSpokesmanInit
(
extConfig
)
{
//绑定上下级关系
app
.
fenxiaoModel
.
becomeRelation
(
extConfig
).
then
(
res
=>
{
if
(
res
)
{
wx
.
removeStorage
({
key
:
"becomeInfo"
});
}
})
},
//富文本解析和替换
formatRichText
(
html
)
{
formatRichText
(
html
)
{
console
.
log
(
html
,
'html'
);
let
newContent
=
html
.
replace
(
/<img
[^
>
]
*>/gi
,
function
(
match
,
capture
)
{
let
newContent
=
html
.
replace
(
/<img
[^
>
]
*>/gi
,
function
(
match
,
capture
)
{
if
(
match
.
startsWith
(
'<img style="object-fit: contain;'
))
{
console
.
log
(
match
,
'match'
);
match
=
match
.
replace
(
/height:
(
.*
?)
;/g
,
'height: 76px !important;'
)
console
.
log
(
match
,
'match'
);
}
else
{
match
=
match
.
replace
(
/style="
[^
"
]
+"/gi
,
''
).
replace
(
/style='
[^
'
]
+'/gi
,
''
);
match
=
match
.
replace
(
/style="
[^
"
]
+"/gi
,
''
).
replace
(
/style='
[^
'
]
+'/gi
,
''
);
match
=
match
.
replace
(
/width="
[^
"
]
+"/gi
,
''
).
replace
(
/width='
[^
'
]
+'/gi
,
''
);
match
=
match
.
replace
(
/width="
[^
"
]
+"/gi
,
''
).
replace
(
/width='
[^
'
]
+'/gi
,
''
);
match
=
match
.
replace
(
/height="
[^
"
]
+"/gi
,
''
).
replace
(
/height='
[^
'
]
+'/gi
,
''
);
match
=
match
.
replace
(
/height="
[^
"
]
+"/gi
,
''
).
replace
(
/height='
[^
'
]
+'/gi
,
''
);
}
return
match
;
return
match
;
});
});
console
.
log
(
'newContent'
,
newContent
);
newContent
=
newContent
.
replace
(
/style="
[^
"
]
+"/gi
,
function
(
match
,
capture
)
{
newContent
=
newContent
.
replace
(
/style="
[^
"
]
+"/gi
,
function
(
match
,
capture
)
{
match
=
match
.
replace
(
/width:
[^
;
]
+;/gi
,
'max-width:100%;'
).
replace
(
/width:
[^
;
]
+;/gi
,
'max-width:100%;'
);
match
=
match
.
replace
(
/width:
[^
;
]
+;/gi
,
'max-width:100%;'
).
replace
(
/width:
[^
;
]
+;/gi
,
'max-width:100%;'
);
return
match
;
return
match
;
});
});
newContent
=
newContent
.
replace
(
/<br
[^
>
]
*
\/
>/gi
,
''
);
newContent
=
newContent
.
replace
(
/<br
[^
>
]
*
\/
>/gi
,
''
);
newContent
=
newContent
.
replace
(
/\<img/gi
,
'<img style="max-width:100%;height:auto;display:block;margin:10px 0;"'
);
newContent
=
newContent
.
replace
(
/\<img/gi
,
'<img style="max-width:100%;height:auto;display:block;margin:10px 0;"'
);
return
newContent
return
newContent
},
},
init
()
{
init
()
{
...
@@ -131,22 +272,22 @@ export default {
...
@@ -131,22 +272,22 @@ export default {
article
.
getArticleInfo
(
this
.
articleId
).
then
(
res
=>
{
article
.
getArticleInfo
(
this
.
articleId
).
then
(
res
=>
{
if
(
res
.
data
.
data
)
{
if
(
res
.
data
.
data
)
{
let
article
=
res
.
data
.
data
let
article
=
res
.
data
.
data
let
content
=
res
.
data
.
data
.
content
.
replace
(
"<body>"
,
""
).
replace
(
"</body>"
,
""
)
let
content
=
res
.
data
.
data
.
content
.
replace
(
'<body>'
,
'<div style="overflow-x: hidden;width:100%">'
).
replace
(
"</body>"
,
"</div>"
)
let
createDatetime
=
article
.
createDatetime
!=
''
?
article
.
createDatetime
.
slice
(
0
,
-
9
)
:
''
article
.
content
=
this
.
formatRichText
(
content
)
article
.
content
=
this
.
formatRichText
(
content
)
this
.
datas
.
componentData
[
'padding'
]
=
0
article
.
createDatetime
=
createDatetime
this
.
datas
.
componentData
[
'richText'
]
=
content
this
.
datas
.
componentData
[
'backgroundColor'
]
=
'#fff'
this
.
article
=
article
this
.
article
=
article
// this.createDatetime = article.createDatetime != '' ? article.createDatetime.slice(0,-3):''
// this.createDatetime = article.createDatetime != '' ? article.createDatetime.slice(0,-3):''
// log.info(this.createDatetime,'article.createDatetime');
// log.info(this.createDatetime,'article.createDatetime');
if
(
article
.
fabulousFlag
==
'true'
)
{
if
(
article
.
fabulousFlag
==
'true'
)
{
this
.
isThumbsUp
=
true
;
this
.
isThumbsUp
=
true
;
}
}
if
(
article
.
title
&&
article
.
title
.
length
)
{
// 不设置title
wx
.
setNavigationBarTitle
({
// if (article.title && article.title.length) {
title
:
article
.
title
// wx.setNavigationBarTitle({
})
// title: article.title
}
// })
// }
}
}
});
});
...
@@ -267,6 +408,10 @@ export default {
...
@@ -267,6 +408,10 @@ export default {
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
//
@import
url("~mpvue-wxparse/src/wxParse.css")
;
.imgbox
.img
{
height
:
96px
!important
;
}
.article_container
{
.article_container
{
position
:
relative
;
position
:
relative
;
}
}
...
@@ -276,6 +421,7 @@ export default {
...
@@ -276,6 +421,7 @@ export default {
padding
:
0
10px
;
padding
:
0
10px
;
padding-bottom
:
100px
;
padding-bottom
:
100px
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
overflow-x
:
hidden
;
}
}
.title
{
.title
{
...
@@ -284,13 +430,14 @@ export default {
...
@@ -284,13 +430,14 @@ export default {
width
:
100%
;
width
:
100%
;
padding
:
12px
0
;
padding
:
12px
0
;
text-align
:
left
;
text-align
:
left
;
font-weight
:
700
;
}
}
.title_info
{
.title_info
{
display
:
flex
;
display
:
flex
;
justify-content
:
center
;
justify-content
:
flex-start
;
//
padding
:
0
12px
;
//
padding
:
0
12px
;
font-size
:
13px
;
font-size
:
13px
;
margin-bottom
:
12
px
;
margin-bottom
:
24
px
;
}
}
.title_user
{
.title_user
{
width
:
100%
;
width
:
100%
;
...
@@ -299,7 +446,7 @@ export default {
...
@@ -299,7 +446,7 @@ export default {
.title_time
{
.title_time
{
width
:
100%
;
width
:
100%
;
//
padding-right
:
13px
;
//
padding-right
:
13px
;
text-align
:
righ
t
;
text-align
:
lef
t
;
color
:
#999
;
color
:
#999
;
}
}
...
...
src/pages/pages_subpack/article/main.json
View file @
2a0a5690
{
{
"backgroundTextStyle"
:
"light"
,
"backgroundTextStyle"
:
"light"
,
"navigationBarBackgroundColor"
:
"#fff"
,
"navigationBarBackgroundColor"
:
"#fff"
,
"navigationBarTitleText"
:
"
文章详情
"
,
"navigationBarTitleText"
:
""
,
"navigationBarTextStyle"
:
"black"
,
"navigationBarTextStyle"
:
"black"
,
"usingComponents"
:
{
"usingComponents"
:
{
...
...
src/pages/tabBar1/index.vue
View file @
2a0a5690
...
@@ -4,9 +4,149 @@
...
@@ -4,9 +4,149 @@
<
script
>
<
script
>
import
tabbarPage
from
"../../components/tabbarPage.vue"
;
import
tabbarPage
from
"../../components/tabbarPage.vue"
;
import
{
concatUrl
}
from
"../../utils/index.js"
const
app
=
getApp
();
const
{
log
}
=
app
;
export
default
{
export
default
{
components
:
{
components
:
{
tabbarPage
,
tabbarPage
,
},
},
data
()
{
return
{
pageInfo
:
{},
pageData
:
{},
}
},
onLoad
(
options
)
{
wx
.
showShareMenu
({
withShareTicket
:
true
,
menus
:
[
'shareAppMessage'
,
'shareTimeline'
]
})
wx
.
showModal
({
title
:
''
,
content
:
JSON
.
stringify
(
options
),
showCancel
:
true
,
cancelText
:
'取消'
,
cancelColor
:
'#000000'
,
confirmText
:
'确定'
,
confirmColor
:
'#3CC51F'
,
success
:
(
result
)
=>
{
if
(
result
.
confirm
){
}
},
fail
:
()
=>
{},
complete
:
()
=>
{}
});
console
.
log
(
this
.
mpApp
.
globalData
.
pageList
,
'llll'
);
this
.
init
()
if
(
options
.
userId
||
options
.
spokesmanRelId
)
{
wx
.
setStorage
({
key
:
"becomeInfo"
,
data
:
JSON
.
stringify
(
options
)
});
}
if
(
wx
.
getStorageSync
(
"sessionid"
))
{
//获取个人名片入口
app
.
fenxiaoModel
.
getHomePageQuickAccess
().
then
(
res
=>
{
that
.
showMyCard
=
res
;
})
//获取分销信息
this
.
getSpokesmanInit
(
wx
.
getStorageSync
(
"becomeInfo"
)
?
JSON
.
parse
(
wx
.
getStorageSync
(
"becomeInfo"
))
:
''
)
}
},
async
onShareAppMessage
(
res
)
{
log
.
info
(
res
)
let
newHref
=
'/pages/tabBar1/main'
;
let
title
=
app
.
globalData
.
shopInfo
.
shopName
;
let
hasInvitationStatus
=
0
;
if
(
wx
.
getStorageSync
(
"sessionid"
))
{
await
app
.
fenxiaoModel
.
getSpokesmanidByShare
().
then
(
data
=>
{
hasInvitationStatus
=
data
.
hasInvitationStatus
;
})
await
app
.
fenxiaoModel
.
getSpokesmanInfo
().
then
(
data
=>
{
let
newData
=
{}
if
(
data
!=
null
)
{
if
(
hasInvitationStatus
==
1
)
{
newData
=
{
spokesmanGroupId
:
data
.
groupId
,
spokesmanShopId
:
data
.
shopId
,
spokesmanRelId
:
data
.
id
,
userId
:
data
.
userId
}
}
else
{
newData
=
{
userId
:
data
.
userId
}
}
}
newHref
=
concatUrl
(
newHref
,
newData
)
})
}
let
imageUrl
=
''
;
//多主题自定义分享标题和图片
if
(
this
.
pageInfo
.
pageSettingData
&&
JSON
.
parse
(
this
.
pageInfo
.
pageSettingData
).
shareTitle
)
{
title
=
JSON
.
parse
(
this
.
pageInfo
.
pageSettingData
).
shareTitle
}
if
(
this
.
pageInfo
.
pageSettingData
&&
JSON
.
parse
(
this
.
pageInfo
.
pageSettingData
).
shareImg
)
{
imageUrl
=
JSON
.
parse
(
this
.
pageInfo
.
pageSettingData
).
shareImg
}
log
.
info
(
newHref
,
3333555666
,
title
,
res
)
return
{
title
:
title
,
// 默认是小程序的名称
path
:
newHref
,
// 默认是当前页面
imageUrl
:
imageUrl
,
success
:
function
(
res
)
{
// 转发成功之后的回调
if
(
res
.
errMsg
==
"shareAppMessage:ok"
)
{
log
.
info
(
res
,
"分享成功"
);
}
},
fail
:
function
()
{
// 转发失败之后的回调
if
(
res
.
errMsg
==
"shareAppMessage:fail cancel"
)
{
// 用户取消转发
log
.
info
(
res
,
"分享失败"
);
}
else
if
(
res
.
errMsg
==
"shareAppMessage:fail"
)
{
// 转发失败,其中 detail message 为详细失败信息
}
},
complete
:
function
()
{
// 转发结束之后的回调(转发成不成功都会执行)
}
};
},
onShareTimeline
(
res
)
{
log
.
info
(
res
,
'-----onShareTimeline'
)
},
methods
:
{
init
()
{
this
.
setVisible
(
this
.
mpApp
.
globalData
.
pageList
,
(
res
)
=>
{
this
.
pageInfo
=
res
;
this
.
pageData
=
JSON
.
parse
(
this
.
pageInfo
.
pageData
);
});
},
async
setVisible
(
pageList
,
cb
)
{
// 首页显示条件
let
pageInfo
=
pageList
.
filter
((
item
)
=>
item
.
pageCode
==
1
)[
0
];
cb
(
pageInfo
)
},
getSpokesmanInit
(
extConfig
)
{
//绑定上下级关系
app
.
fenxiaoModel
.
becomeRelation
(
extConfig
).
then
(
res
=>
{
if
(
res
)
{
wx
.
removeStorage
({
key
:
"becomeInfo"
});
}
})
},
}
};
};
</
script
>
</
script
>
src/utils/themeModule.js
View file @
2a0a5690
This diff is collapsed.
Click to expand it.
src/utils/tool.js
0 → 100644
View file @
2a0a5690
/*函数节流*/
function
throttle
(
fn
,
interval
)
{
var
enterTime
=
0
;
//触发的时间
var
gapTime
=
interval
||
300
;
//间隔时间,如果interval不传,则默认300ms
return
function
()
{
var
context
=
this
;
var
backTime
=
new
Date
();
//第一次函数return即触发的时间
if
(
backTime
-
enterTime
>
gapTime
)
{
fn
.
call
(
context
,
arguments
);
enterTime
=
backTime
;
//赋值给第一次触发的时间,这样就保存了第二次触发的时间
}
};
}
/*函数防抖*/
function
debounce
(
fn
,
interval
)
{
console
.
log
(
'防抖抖~~~'
);
var
timer
;
var
gapTime
=
interval
||
1000
;
//间隔时间,如果interval不传,则默认1000ms
return
function
()
{
clearTimeout
(
timer
);
var
context
=
this
;
var
args
=
arguments
;
//保存此处的arguments,因为setTimeout是全局的,arguments不是防抖函数需要的。
timer
=
setTimeout
(
function
()
{
fn
.
call
(
context
,
args
);
},
gapTime
);
};
}
export
default
{
throttle
,
debounce
};
\ No newline at end of file
static/vant/tabs/index.wxs
View file @
2a0a5690
...
@@ -59,9 +59,9 @@ function trackStyle(data) {
...
@@ -59,9 +59,9 @@ function trackStyle(data) {
function lineStyle(data) {
function lineStyle(data) {
return style({
return style({
width: utils.addUnit(data.lineWidth -
16
),
width: utils.addUnit(data.lineWidth -
32
),
transform: 'translateX(' + (data.lineOffsetLeft +16) + 'px)',
transform: 'translateX(' + (data.lineOffsetLeft +16) + 'px)',
'-webkit-transform': 'translateX(' + (data.lineOffsetLeft +
8
) + 'px)',
'-webkit-transform': 'translateX(' + (data.lineOffsetLeft +
16
) + 'px)',
'background-color': data.color,
'background-color': data.color,
height: data.lineHeight !== -1 ? utils.addUnit(data.lineHeight) : null,
height: data.lineHeight !== -1 ? utils.addUnit(data.lineHeight) : null,
'border-radius':
'border-radius':
...
...
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