Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
business-assistant
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a8434f56
authored
Nov 30, 2022
by
luyt
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:调整标题
1 parent
660fe85c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
17 deletions
pages/viewProd/index.js
pages/viewProd/index.json
pages/viewProdBanner/index.js
pages/viewVideo/index.js
utils/util.js
pages/viewProd/index.js
View file @
a8434f5
...
...
@@ -66,9 +66,11 @@ Page({
let
item
=
senceData
[
actNum
]?.
productList
[
activeNavIdx
]
console
.
log
(
'title'
,
item
.
productName
)
setTimeout
(()
=>
{
wx
.
setNavigationBarTitle
({
title
:
item
.
productName
,
});
// wx.setNavigationBarTitle({
// title: " "+item.productName,
// });
utils
.
setNavigationBarTitle
(
item
.
productName
)
},
100
)
this
.
shareQuery
=
`sceneCode=
${
senceItem
?.
sceneCode
}
&
productCode
=
$
{
item
?.
productCode
}
&
isShare
=
$
{
true
}
&
productDesc
=
$
{
item
?.
productName
}
&
category
=
$
{
item
?.
category
}
&
actNum
=
$
{
actNum
}
&
activeNavIdx
=
$
{
activeNavIdx
}
&
phone
=
$
{
phone
}
`
...
...
@@ -106,9 +108,11 @@ Page({
let item = senceData[actNum]?.productList[activeNavIdx]
console.log('title2',item.productName)
setTimeout(() => {
wx.setNavigationBarTitle({
title: item.productName,
});
// wx.setNavigationBarTitle({
// title: " "+item.productName,
// });
utils.setNavigationBarTitle(item.productName)
},100)
...
...
pages/viewProd/index.json
View file @
a8434f5
...
...
@@ -4,6 +4,5 @@
"apply-button"
:
"../viewVideo/components/apply-button/index"
,
"van-tab"
:
"@vant/weapp/tab/index"
,
"van-tabs"
:
"@vant/weapp/tabs/index"
}
}
\ No newline at end of file
pages/viewProdBanner/index.js
View file @
a8434f5
...
...
@@ -62,9 +62,10 @@ Page({
let
item
=
senceData
[
actNum
]?.
productList
[
activeNavIdx
]
console
.
log
(
'title'
,
item
.
productName
)
setTimeout
(()
=>
{
wx
.
setNavigationBarTitle
({
title
:
item
.
productName
,
});
// wx.setNavigationBarTitle({
// title: item.productName,
// });
utils
.
setNavigationBarTitle
(
item
.
productName
)
},
100
)
this
.
shareQuery
=
`sceneCode=
${
senceItem
?.
sceneCode
}
&
productCode
=
$
{
item
?.
productCode
}
&
isShare
=
$
{
true
}
&
productDesc
=
$
{
item
?.
productName
}
&
category
=
$
{
item
?.
category
}
&
actNum
=
$
{
actNum
}
&
activeNavIdx
=
$
{
activeNavIdx
}
&
phone
=
$
{
phone
}
`
...
...
@@ -102,9 +103,10 @@ Page({
let item = senceData[actNum]?.productList[activeNavIdx]
console.log('title2',item.productName)
setTimeout(() => {
wx.setNavigationBarTitle({
title: item.productName,
});
// wx.setNavigationBarTitle({
// title: item.productName,
// });
utils.setNavigationBarTitle(item.productName)
},100)
...
...
pages/viewVideo/index.js
View file @
a8434f5
...
...
@@ -93,9 +93,10 @@ Page({
setpagesTitle(){
//设置标题
let {videoitem} = this.data
wx.setNavigationBarTitle({
title: videoitem.name,
});
// wx.setNavigationBarTitle({
// title: videoitem.name,
// });
utils.setNavigationBarTitle(videoitem.name)
},
// 视频下载
downVideo() {
...
...
utils/util.js
View file @
a8434f5
...
...
@@ -160,6 +160,7 @@ const getCurrentPageUrl = () =>{
return
url
}
// 克隆
const
deepClone
=
(
target
)
=>
{
const
map
=
new
WeakMap
()
...
...
@@ -223,6 +224,39 @@ const deepClone = (target) => {
return
clone
(
target
)
}
//设置标题
const
setNavigationBarTitle
=
(
title
)
=>
{
wx
.
getSystemInfo
({
success
:
(
res
)
=>
{
// console.log('++++++++++++++', res);
// console.log('title length',title.length)
let
width
=
res
.
safeArea
.
width
/
res
.
fontSizeSetting
;
// console.log('width: ', width);
let
space
=
''
;
// for (let i = 0; i <= width+4; i++) {
// space = space + ' ';
// }
width
=
width
-
(
title
.
length
)
/
2
for
(
let
i
=
0
;
i
<
width
;
i
++
)
{
space
=
space
+
' '
;
}
if
(
res
.
system
.
includes
(
'iOS'
)
===
false
)
{
wx
.
setNavigationBarTitle
({
title
:
space
+
title
});
}
else
{
wx
.
setNavigationBarTitle
({
title
:
title
});
}
}
});
}
const
Util
=
{
getImgVersion
,
onReachBottom
,
...
...
@@ -232,6 +266,7 @@ const Util = {
isEmptyObj
,
parseString
,
getCurrentPageUrl
,
deepClone
deepClone
,
setNavigationBarTitle
};
export
default
Util
;
Write
Preview
Markdown
is supported
Attach a file
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 post a comment