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
c6b56e48
Commit
c6b56e48
authored
Mar 11, 2021
by
程默
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
09b7fa38
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
75 additions
and
162 deletions
+75
-162
custom-tab-bar/index.js
+0
-60
custom-tab-bar/index.wxml
+1
-1
custom-tab-bar/index.wxss
+0
-5
ext.json
+3
-2
src/App.vue
+3
-3
src/pages/home/index.vue
+5
-8
src/pages/tabBar1/index.vue
+6
-6
src/pages/tabBar2/index.vue
+2
-2
src/pages/tabBar3/index.vue
+7
-12
src/pages/tabBar4/index.vue
+7
-12
src/utils/mayi.js
+41
-51
No files found.
custom-tab-bar/index.js
View file @
c6b56e48
const
app
=
getApp
();
const
app
=
getApp
();
console
.
log
(
app
,
"apppppppppp"
);
Component
({
Component
({
pageLifetimes
:
{
show
()
{
console
.
log
(
"哈哈哈哈"
);
if
(
typeof
this
.
getTabBar
===
"function"
&&
this
.
getTabBar
())
{
this
.
getTabBar
().
setData
({
selected
:
1
});
}
}
},
data
:
{
data
:
{
selected
:
0
,
selected
:
0
,
color
:
"#7A7E83"
,
color
:
"#7A7E83"
,
...
@@ -84,21 +72,9 @@ Component({
...
@@ -84,21 +72,9 @@ Component({
});
});
};
};
}
}
console
.
log
(
this
.
data
.
themeColor
,
"themeColor"
);
if
(
typeof
this
.
getTabBar
===
"function"
&&
this
.
getTabBar
())
{
this
.
getTabBar
().
setData
({
selected
:
1
});
}
this
.
setData
({
this
.
setData
({
mmm
:
Math
.
ceil
(
app
.
globalData
.
footerVal
.
componentData
.
list
.
length
/
2
-
1
)
mmm
:
Math
.
ceil
(
app
.
globalData
.
footerVal
.
componentData
.
list
.
length
/
2
-
1
)
});
});
console
.
log
(
Math
.
ceil
(
app
.
globalData
.
footerVal
.
componentData
.
list
.
length
/
2
-
1
),
this
.
data
.
selected
);
console
.
log
(
this
.
data
.
mmm
,
"ready"
);
},
},
attached
()
{
attached
()
{
let
that
=
this
;
let
that
=
this
;
...
@@ -108,24 +84,13 @@ Component({
...
@@ -108,24 +84,13 @@ Component({
that
.
data
.
selected
&&
that
.
data
.
selected
&&
app
.
globalData
.
footerVal
.
componentData
[
"styleSelectionNum"
]
==
1
;
app
.
globalData
.
footerVal
.
componentData
[
"styleSelectionNum"
]
==
1
;
console
.
log
(
733333
,
mm
);
that
.
setData
({
that
.
setData
({
componentData
:
app
.
globalData
.
footerVal
.
componentData
,
componentData
:
app
.
globalData
.
footerVal
.
componentData
,
list
:
app
.
globalData
.
footerVal
.
componentData
.
list
,
list
:
app
.
globalData
.
footerVal
.
componentData
.
list
,
mm
:
mm
mm
:
mm
});
});
console
.
log
(
"777777"
,
Math
.
ceil
(
this
.
data
.
list
.
length
/
2
-
1
),
this
.
data
.
selected
,
this
.
data
.
componentData
[
"styleSelectionNum"
]
);
}
else
{
}
else
{
console
.
log
(
73333381
);
app
.
footerCallBack
=
function
(
params
)
{
app
.
footerCallBack
=
function
(
params
)
{
console
.
log
(
"back"
);
console
.
log
(
params
,
app
.
globalData
.
footerVal
.
componentData
)
params
.
componentData
.
selectIconColor
=
app
.
globalData
.
footerVal
.
componentData
.
selectIconBackground
==
1
?
'val(--main-color)'
:
params
.
componentData
.
selectIconColor
params
.
componentData
.
selectIconColor
=
app
.
globalData
.
footerVal
.
componentData
.
selectIconBackground
==
1
?
'val(--main-color)'
:
params
.
componentData
.
selectIconColor
that
.
setData
({
that
.
setData
({
componentData
:
params
.
componentData
,
componentData
:
params
.
componentData
,
...
@@ -137,20 +102,8 @@ Component({
...
@@ -137,20 +102,8 @@ Component({
Math
.
ceil
(
params
.
componentData
.
list
.
length
/
2
-
1
)
==
Math
.
ceil
(
params
.
componentData
.
list
.
length
/
2
-
1
)
==
that
.
data
.
selected
&&
that
.
data
.
selected
&&
params
.
componentData
[
"styleSelectionNum"
]
==
1
;
params
.
componentData
[
"styleSelectionNum"
]
==
1
;
console
.
log
(
"87777777"
,
mm
);
console
.
log
(
that
.
data
.
componentData
,
'componentData'
)
};
};
}
}
// ----------webview 变化
console
.
log
(
"启动1111"
,
this
.
getTabBar
());
app
.
webviewCallBack
=
function
(
state
,
params
)
{
console
.
log
(
"webview变化"
,
state
,
params
);
};
//
this
.
setData
({
this
.
setData
({
mm
:
mm
:
Math
.
ceil
(
this
.
data
.
list
.
length
/
2
-
1
)
==
this
.
data
.
selected
&&
Math
.
ceil
(
this
.
data
.
list
.
length
/
2
-
1
)
==
this
.
data
.
selected
&&
...
@@ -158,21 +111,11 @@ Component({
...
@@ -158,21 +111,11 @@ Component({
});
});
},
},
methods
:
{
methods
:
{
init
()
{},
switchTab
(
e
)
{
switchTab
(
e
)
{
const
{
index
}
=
e
.
currentTarget
.
dataset
;
const
{
index
}
=
e
.
currentTarget
.
dataset
;
console
.
log
(
"755555555"
,
this
.
data
.
list
[
index
].
link
);
app
.
$themeToLink
(
this
.
data
.
list
[
index
][
"link"
],
1
);
app
.
$themeToLink
(
this
.
data
.
list
[
index
][
"link"
],
1
);
// this.toPage(this.data.list[index].link,index)
// this.setData({
// selected: index
// })
},
},
toPage
(
data
,
index
)
{
toPage
(
data
,
index
)
{
console
.
log
(
"index98"
,
index
,
this
);
// index=index==0?index+1:index
// 跳转
// 跳转
if
(
data
.
link
==
"/"
)
{
if
(
data
.
link
==
"/"
)
{
wx
.
switchTab
({
wx
.
switchTab
({
...
@@ -182,9 +125,6 @@ Component({
...
@@ -182,9 +125,6 @@ Component({
wx
.
switchTab
({
wx
.
switchTab
({
url
:
`/pages/tabBar
${
index
}
/main`
url
:
`/pages/tabBar
${
index
}
/main`
});
});
// ?from=tabbar&backpath=${
// data.link
// }
}
}
}
}
}
}
...
...
custom-tab-bar/index.wxml
View file @
c6b56e48
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<!-- {{index}}{{selected}}--{{Math.ceil(5/2-1)}}--{{mm}} -->
<!-- {{index}}{{selected}}--{{Math.ceil(5/2-1)}}--{{mm}} -->
<!-- &&componentData['styleSelectionNum']==1 -->
<!-- &&componentData['styleSelectionNum']==1 -->
<!-- 图标 -->
<!-- 图标 -->
<view
class="item" class="
{{index == selected ? 'current' : ''}}">
<view
class="item
{{index == selected ? 'current' : ''}}">
<view>
<view>
<view wx:if="{{item.iconType==0||!item.iconType}}">
<view wx:if="{{item.iconType==0||!item.iconType}}">
<view class="antt {{item.icon}}" style="font-size:{{componentData.defaultIcon==1 ? '36rpx' : (componentData.defaultIconSize*2 + 'rpx')}};color:{{index==selected?componentData.selectIconColor:componentData.defaultIconColor}}"></view>
<view class="antt {{item.icon}}" style="font-size:{{componentData.defaultIcon==1 ? '36rpx' : (componentData.defaultIconSize*2 + 'rpx')}};color:{{index==selected?componentData.selectIconColor:componentData.defaultIconColor}}"></view>
...
...
custom-tab-bar/index.wxss
View file @
c6b56e48
...
@@ -1198,12 +1198,7 @@
...
@@ -1198,12 +1198,7 @@
}
}
.tab-bar-item .item{
.tab-bar-item .item{
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
position: relative;
position: relative;
height: 100%;
}
}
.isItem {
.isItem {
...
...
ext.json
View file @
c6b56e48
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
"extEnable"
:
true
,
"extEnable"
:
true
,
"extAppid"
:
"wxae95a07ffdf11548"
,
"extAppid"
:
"wxae95a07ffdf11548"
,
"ext"
:{
"ext"
:{
"mixid"
:
"
antgood
"
,
"mixid"
:
"
xyyx
"
,
"shopid"
:
67
"shopid"
:
133
}
}
}
}
\ No newline at end of file
src/App.vue
View file @
c6b56e48
...
@@ -11,9 +11,9 @@ export default {
...
@@ -11,9 +11,9 @@ export default {
process
.
env
.
NODE_ENV
==
"production"
||
process
.
env
.
NODE_ENV
==
"production"
||
JSON
.
stringify
(
extConfig
)
==
"{}"
JSON
.
stringify
(
extConfig
)
==
"{}"
)
{
)
{
extConfig
=
{
mixid
:
"antgood"
,
shopid
:
67
};
//
extConfig = { mixid: "antgood", shopid: 67 };
//
extConfig = { "mixid":"xyyx",
extConfig
=
{
"mixid"
:
"xyyx"
,
//
"shopid":133 };
"shopid"
:
133
};
}
}
console
.
log
(
"1444444444"
,
extConfig
);
console
.
log
(
"1444444444"
,
extConfig
);
this
.
$store
.
commit
(
"setExtConfig"
,
extConfig
.
mixid
);
this
.
$store
.
commit
(
"setExtConfig"
,
extConfig
.
mixid
);
...
...
src/pages/home/index.vue
View file @
c6b56e48
...
@@ -241,7 +241,7 @@ export default {
...
@@ -241,7 +241,7 @@ export default {
methods
:
{
methods
:
{
init
(
pageList
)
{
init
(
pageList
)
{
this
.
getCartNum
()
setTabBarActive
.
bind
(
this
)(
checkTabbarPage
(
'/'
));
setTabBarActive
.
bind
(
this
)(
checkTabbarPage
(
'/'
));
this
.
pageInfo
=
pageList
.
filter
((
item
)
=>
item
.
pageCode
==
1
)[
0
];
this
.
pageInfo
=
pageList
.
filter
((
item
)
=>
item
.
pageCode
==
1
)[
0
];
...
@@ -256,12 +256,6 @@ export default {
...
@@ -256,12 +256,6 @@ export default {
},
},
scrolls
(
el
){
scrolls
(
el
){
// this.setFooterShow(el);
// this.setFooterShow(el);
// if(this.$mp.page && this.$mp.page.selectComponent(".goodsListItem")){
// this.$mp.page.selectComponent(".goodsListItem").getScroll(el);
// }
// if(this.$mp.page && this.$mp.page.selectComponent(".merchants-list")){
// this.$mp.page.selectComponent(".merchants-list").getScroll(el);
// }
if
(
this
.
pageData
)
{
if
(
this
.
pageData
)
{
for
(
let
i
=
0
;
i
<
this
.
pageData
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
pageData
.
length
;
i
++
)
{
const
element
=
this
.
pageData
[
i
]
const
element
=
this
.
pageData
[
i
]
...
@@ -285,6 +279,7 @@ export default {
...
@@ -285,6 +279,7 @@ export default {
},
},
setFooterShow
(
el
){
setFooterShow
(
el
){
// return
let
afterScrollTop
=
el
.
scrollTop
;
let
afterScrollTop
=
el
.
scrollTop
;
let
delta
=
afterScrollTop
-
this
.
beforeScrollTop
;
let
delta
=
afterScrollTop
-
this
.
beforeScrollTop
;
let
{
showFlag
}
=
this
.
$mp
.
page
.
getTabBar
().
data
;
let
{
showFlag
}
=
this
.
$mp
.
page
.
getTabBar
().
data
;
...
@@ -298,7 +293,9 @@ export default {
...
@@ -298,7 +293,9 @@ export default {
this
.
beforeScrollTop
=
afterScrollTop
;
this
.
beforeScrollTop
=
afterScrollTop
;
return
;
return
;
}
}
this
.
$mp
.
page
.
getTabBar
().
setData
({
'showFlag'
:
delta
>
0
?
'down'
:
'up'
})
this
.
$mp
.
page
.
getTabBar
().
animation
({
'showFlag'
:
delta
>
0
?
'down'
:
'up'
})
console
.
log
(
showFlag
,
'set296'
)
// this.$mp.page.getTabBar().setData({'showFlag':delta>0?'down':'up'})
},
},
scrolltolower
(){
scrolltolower
(){
console
.
log
(
"scrolltolower"
)
console
.
log
(
"scrolltolower"
)
...
...
src/pages/tabBar1/index.vue
View file @
c6b56e48
...
@@ -7,13 +7,13 @@
...
@@ -7,13 +7,13 @@
<div
style=
"width:100%;height:90vh;display:flex;justify-content: center;align-items: center;"
>
<div
style=
"width:100%;height:90vh;display:flex;justify-content: center;align-items: center;"
>
<van-loading
size=
"40px"
type=
"spinner"
></van-loading>
<van-loading
size=
"40px"
type=
"spinner"
></van-loading>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
import
{
getUrlofLink
,
getUrlofLink
,
getUrlofQuery
,
setTabBarActive
,
setTabBarActive
,
checkTabbarPage
,
checkTabbarPage
,
}
from
"../../utils/mayi.js"
;
}
from
"../../utils/mayi.js"
;
...
@@ -22,14 +22,14 @@ export default {
...
@@ -22,14 +22,14 @@ export default {
return
{
return
{
link
:
process
.
env
.
BASE_URL
,
link
:
process
.
env
.
BASE_URL
,
page
:
"/"
,
page
:
"/"
,
params
:
"?mixid="
+
this
.
$store
.
state
.
mixid
,
params
:
"?mixid="
+
this
.
$store
.
state
.
mixid
,
index
:
1
,
index
:
1
,
ss
:
""
,
ss
:
""
,
};
};
},
},
computed
:
{
computed
:
{
pageUrl
()
{
pageUrl
()
{
return
this
.
link
+
this
.
page
+
this
.
params
+
`&native_test=1&tabbar=1
&location_obj=
${
wx
.
getStorageSync
(
"location"
)}
`
+
this
.
ss
;
return
this
.
link
+
this
.
page
+
this
.
params
+
`&native_test=1&tabbar=2
&location_obj=
${
wx
.
getStorageSync
(
"location"
)}
`
+
this
.
ss
;
},
},
},
},
onLoad
(
options
)
{
onLoad
(
options
)
{
...
@@ -38,11 +38,12 @@ export default {
...
@@ -38,11 +38,12 @@ export default {
// tabbar 跳转
// tabbar 跳转
let
homeIndex
=
checkTabbarPage
(
"/"
);
let
homeIndex
=
checkTabbarPage
(
"/"
);
homeIndex
!=
0
&&
homeIndex
==
this
.
index
&&
(
this
.
index
=
0
);
homeIndex
!=
0
&&
homeIndex
==
this
.
index
&&
(
this
.
index
=
0
);
if
(
this
.
mpApp
.
globalData
.
footerVal
.
componentData
.
list
[
this
.
index
].
link
)
{
if
(
this
.
mpApp
.
globalData
.
footerVal
.
componentData
.
list
[
this
.
index
].
link
)
{
this
.
page
=
getUrlofLink
(
this
.
page
=
getUrlofLink
(
this
.
mpApp
.
globalData
.
footerVal
.
componentData
.
list
[
this
.
index
].
link
this
.
mpApp
.
globalData
.
footerVal
.
componentData
.
list
[
this
.
index
].
link
);
);
this
.
params
+=
'&'
+
getUrlofQuery
(
this
.
mpApp
.
globalData
.
footerVal
.
componentData
.
list
[
this
.
index
].
link
)
this
.
mpApp
.
globalData
.
tabBarPageLink
=
""
;
this
.
mpApp
.
globalData
.
tabBarPageLink
=
""
;
}
}
},
},
...
@@ -51,14 +52,13 @@ export default {
...
@@ -51,14 +52,13 @@ export default {
if
(
!
this
.
ss
&&
ss
)
{
if
(
!
this
.
ss
&&
ss
)
{
this
.
ss
=
`&sessionid=
${
ss
}
`
;
this
.
ss
=
`&sessionid=
${
ss
}
`
;
}
else
if
(
!
ss
){
}
else
if
(
!
ss
){
//
!this.params.includes('logOut=true') && (this.params+="&logOut=true")
//
this.params+="&logOut=true"
}
else
{
}
else
{
this
.
params
+=
`×tamp=
${
new
Date
().
getTime
()}
`
this
.
params
+=
`×tamp=
${
new
Date
().
getTime
()}
`
}
}
setTabBarActive
.
bind
(
this
)(
this
.
index
);
setTabBarActive
.
bind
(
this
)(
this
.
index
);
console
.
log
(
'----'
,
this
.
pageUrl
)
},
},
methods
:
{
methods
:
{
handleError
(
data
)
{
handleError
(
data
)
{
...
...
src/pages/tabBar2/index.vue
View file @
c6b56e48
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
<
script
>
<
script
>
import
{
import
{
getUrlofLink
,
getUrlofLink
,
getUrlofQuery
,
setTabBarActive
,
setTabBarActive
,
checkTabbarPage
,
checkTabbarPage
,
}
from
"../../utils/mayi.js"
;
}
from
"../../utils/mayi.js"
;
...
@@ -42,6 +43,7 @@ export default {
...
@@ -42,6 +43,7 @@ export default {
this
.
page
=
getUrlofLink
(
this
.
page
=
getUrlofLink
(
this
.
mpApp
.
globalData
.
footerVal
.
componentData
.
list
[
this
.
index
].
link
this
.
mpApp
.
globalData
.
footerVal
.
componentData
.
list
[
this
.
index
].
link
);
);
this
.
params
+=
'&'
+
getUrlofQuery
(
this
.
mpApp
.
globalData
.
footerVal
.
componentData
.
list
[
this
.
index
].
link
)
this
.
mpApp
.
globalData
.
tabBarPageLink
=
""
;
this
.
mpApp
.
globalData
.
tabBarPageLink
=
""
;
}
}
},
},
...
@@ -56,8 +58,6 @@ export default {
...
@@ -56,8 +58,6 @@ export default {
}
}
setTabBarActive
.
bind
(
this
)(
this
.
index
);
setTabBarActive
.
bind
(
this
)(
this
.
index
);
console
.
log
(
'----'
,
this
.
pageUrl
)
},
},
methods
:
{
methods
:
{
handleError
(
data
)
{
handleError
(
data
)
{
...
...
src/pages/tabBar3/index.vue
View file @
c6b56e48
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
<
script
>
<
script
>
import
{
import
{
getUrlofLink
,
getUrlofLink
,
getUrlofQuery
,
setTabBarActive
,
setTabBarActive
,
checkTabbarPage
,
checkTabbarPage
,
}
from
"../../utils/mayi.js"
;
}
from
"../../utils/mayi.js"
;
...
@@ -21,14 +22,14 @@ export default {
...
@@ -21,14 +22,14 @@ export default {
return
{
return
{
link
:
process
.
env
.
BASE_URL
,
link
:
process
.
env
.
BASE_URL
,
page
:
"/"
,
page
:
"/"
,
params
:
"?mixid="
+
this
.
$store
.
state
.
mixid
,
params
:
"?mixid="
+
this
.
$store
.
state
.
mixid
,
index
:
3
,
index
:
3
,
ss
:
""
,
ss
:
""
,
};
};
},
},
computed
:
{
computed
:
{
pageUrl
()
{
pageUrl
()
{
return
this
.
link
+
this
.
page
+
this
.
params
+
`&native_test=1&tabbar=3
&location_obj=
${
wx
.
getStorageSync
(
"location"
)}
`
+
this
.
ss
;
return
this
.
link
+
this
.
page
+
this
.
params
+
`&native_test=1&tabbar=2
&location_obj=
${
wx
.
getStorageSync
(
"location"
)}
`
+
this
.
ss
;
},
},
},
},
onLoad
(
options
)
{
onLoad
(
options
)
{
...
@@ -39,15 +40,10 @@ export default {
...
@@ -39,15 +40,10 @@ export default {
let
homeIndex
=
checkTabbarPage
(
"/"
);
let
homeIndex
=
checkTabbarPage
(
"/"
);
homeIndex
!=
0
&&
homeIndex
==
this
.
index
&&
(
this
.
index
=
0
);
homeIndex
!=
0
&&
homeIndex
==
this
.
index
&&
(
this
.
index
=
0
);
if
(
this
.
mpApp
.
globalData
.
footerVal
.
componentData
.
list
[
this
.
index
].
link
)
{
if
(
this
.
mpApp
.
globalData
.
footerVal
.
componentData
.
list
[
this
.
index
].
link
)
{
let
p
=
getUrlofLink
(
this
.
mpApp
.
globalData
.
footerVal
.
componentData
.
list
[
this
.
index
].
link
);
this
.
page
=
getUrlofLink
(
let
pl
=
p
.
split
(
'?'
)
this
.
mpApp
.
globalData
.
footerVal
.
componentData
.
list
[
this
.
index
].
link
if
(
pl
[
1
])
{
);
this
.
page
=
pl
[
0
]
this
.
params
+=
'&'
+
getUrlofQuery
(
this
.
mpApp
.
globalData
.
footerVal
.
componentData
.
list
[
this
.
index
].
link
)
this
.
params
+=
'&'
+
pl
[
1
]
}
else
{
this
.
page
=
p
}
this
.
mpApp
.
globalData
.
tabBarPageLink
=
""
;
this
.
mpApp
.
globalData
.
tabBarPageLink
=
""
;
}
}
},
},
...
@@ -62,7 +58,6 @@ export default {
...
@@ -62,7 +58,6 @@ export default {
}
}
setTabBarActive
.
bind
(
this
)(
this
.
index
);
setTabBarActive
.
bind
(
this
)(
this
.
index
);
console
.
log
(
'----'
,
this
.
pageUrl
)
},
},
methods
:
{
methods
:
{
...
...
src/pages/tabBar4/index.vue
View file @
c6b56e48
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
<
script
>
<
script
>
import
{
import
{
getUrlofLink
,
getUrlofLink
,
getUrlofQuery
,
setTabBarActive
,
setTabBarActive
,
checkTabbarPage
,
checkTabbarPage
,
}
from
"../../utils/mayi.js"
;
}
from
"../../utils/mayi.js"
;
...
@@ -21,14 +22,14 @@ export default {
...
@@ -21,14 +22,14 @@ export default {
return
{
return
{
link
:
process
.
env
.
BASE_URL
,
link
:
process
.
env
.
BASE_URL
,
page
:
"/"
,
page
:
"/"
,
params
:
"?mixid="
+
this
.
$store
.
state
.
mixid
,
params
:
"?mixid="
+
this
.
$store
.
state
.
mixid
,
index
:
4
,
index
:
4
,
ss
:
""
,
ss
:
""
,
};
};
},
},
computed
:
{
computed
:
{
pageUrl
()
{
pageUrl
()
{
return
this
.
link
+
this
.
page
+
this
.
params
+
`&native_test=1&tabbar=4
&location_obj=
${
wx
.
getStorageSync
(
"location"
)}
`
+
this
.
ss
;
return
this
.
link
+
this
.
page
+
this
.
params
+
`&native_test=1&tabbar=2
&location_obj=
${
wx
.
getStorageSync
(
"location"
)}
`
+
this
.
ss
;
},
},
},
},
onLoad
(
options
)
{
onLoad
(
options
)
{
...
@@ -39,15 +40,10 @@ export default {
...
@@ -39,15 +40,10 @@ export default {
let
homeIndex
=
checkTabbarPage
(
"/"
);
let
homeIndex
=
checkTabbarPage
(
"/"
);
homeIndex
!=
0
&&
homeIndex
==
this
.
index
&&
(
this
.
index
=
0
);
homeIndex
!=
0
&&
homeIndex
==
this
.
index
&&
(
this
.
index
=
0
);
if
(
this
.
mpApp
.
globalData
.
footerVal
.
componentData
.
list
[
this
.
index
].
link
)
{
if
(
this
.
mpApp
.
globalData
.
footerVal
.
componentData
.
list
[
this
.
index
].
link
)
{
let
p
=
getUrlofLink
(
this
.
mpApp
.
globalData
.
footerVal
.
componentData
.
list
[
this
.
index
].
link
);
this
.
page
=
getUrlofLink
(
let
pl
=
p
.
split
(
'?'
)
this
.
mpApp
.
globalData
.
footerVal
.
componentData
.
list
[
this
.
index
].
link
if
(
pl
[
1
])
{
);
this
.
page
=
pl
[
0
]
this
.
params
+=
'&'
+
getUrlofQuery
(
this
.
mpApp
.
globalData
.
footerVal
.
componentData
.
list
[
this
.
index
].
link
)
this
.
params
+=
'&'
+
pl
[
1
]
}
else
{
this
.
page
=
p
}
this
.
mpApp
.
globalData
.
tabBarPageLink
=
""
;
this
.
mpApp
.
globalData
.
tabBarPageLink
=
""
;
}
}
},
},
...
@@ -62,7 +58,6 @@ export default {
...
@@ -62,7 +58,6 @@ export default {
}
}
setTabBarActive
.
bind
(
this
)(
this
.
index
);
setTabBarActive
.
bind
(
this
)(
this
.
index
);
console
.
log
(
'----'
,
this
.
pageUrl
)
},
},
methods
:
{
methods
:
{
...
...
src/utils/mayi.js
View file @
c6b56e48
import
cart
from
"@/api/cart"
import
cart
from
"@/api/cart"
import
classificationApi
from
"@/api/classification"
;
import
classificationApi
from
"@/api/classification"
;
// 登录白名单 name
// 登录白名单 name
export
const
noLoginList
=
[
"index"
,
"media-video"
,
"goods-goodsInfo"
,
"goods-commodityMenu"
,
"goodsSearch-goodsSearch"
,
"chooseStores"
,
"activty-receivingGift"
,
"activty"
,
"login-register"
,
"login-phoneLogin"
,
"login-authInformation"
,
"login-forgetPassWord"
,
"login-accountLogin"
,
"login-wxRegister"
,
"pay-payList"
,
"comment-evaluateList"
,
"goods-commonProblemList"
,
"article-articlePage"
,
"article-articleList"
,
"goods-posters"
,
"liveBroadcast"
,
"liveBroadcast-list"
,
"personalCenter-coupon-getCoupon"
,
"buyerShow-showDetail"
,
"goods-addGoodsList"
,
"personalCenter-CDkey-exchange"
,
"giftCards-linkReceive"
,
"giftCoupon-preview"
,
"smartForm"
,
"shopCart-shareShopCart"
,
"groupBuying-beInvite"
,
"brandTopics"
,
'personalCenter-spokesmanCenter'
,
'personalCenter-spokesmanCenter-mine-spokesmanHomePage'
,
'liveBroadcast-lived'
,
'personalCenter-spokesmanCenter-mine-getBusinessCard'
,
'changeAdr'
];
export
const
noLoginList
=
[
"index"
,
"media-video"
,
"goods-goodsInfo"
,
"goods-commodityMenu"
,
"goodsSearch-goodsSearch"
,
"chooseStores"
,
"activty-receivingGift"
,
"activty"
,
"login-register"
,
"login-phoneLogin"
,
"login-authInformation"
,
"login-forgetPassWord"
,
"login-accountLogin"
,
"login-wxRegister"
,
"pay-payList"
,
"comment-evaluateList"
,
"goods-commonProblemList"
,
"article-articlePage"
,
"article-articleList"
,
"goods-posters"
,
"liveBroadcast"
,
"liveBroadcast-list"
,
"personalCenter-coupon-getCoupon"
,
"buyerShow-showDetail"
,
"goods-addGoodsList"
,
"personalCenter-CDkey-exchange"
,
"giftCards-linkReceive"
,
"giftCoupon-preview"
,
"smartForm"
,
"shopCart-shareShopCart"
,
"groupBuying-beInvite"
,
"brandTopics"
,
'personalCenter-spokesmanCenter'
,
'personalCenter-spokesmanCenter-mine-spokesmanHomePage'
,
'liveBroadcast-lived'
,
'personalCenter-spokesmanCenter-mine-getBusinessCard'
,
'changeAdr'
];
// path
// path
export
const
noLoginListPath
=
noLoginList
.
map
(
item
=>
{
export
const
noLoginListPath
=
noLoginList
.
map
(
item
=>
{
item
=
item
.
replace
(
/-/g
,
'/'
)
item
=
item
.
replace
(
/-/g
,
'/'
)
item
=
'/'
+
item
item
=
'/'
+
item
item
==
"/index"
&&
(
item
=
"/"
)
item
==
"/index"
&&
(
item
=
"/"
)
return
item
return
item
})
})
// 主题色
// 主题色
export
let
themeColor
=
{
export
let
themeColor
=
{
"--main-color"
:
"#ffffff"
,
"--main-color"
:
"#ffffff"
,
"--minor-color"
:
"#ffffff"
"--minor-color"
:
"#ffffff"
}
}
// 获取link 中页面地址(link兼容 有object或者string)
// 获取link 中页面地址(link兼容 有object或者string)
export
function
getUrlofLink
(
data
)
{
export
function
getUrlofLink
(
data
)
{
return
data
.
link
.
split
(
'?'
)[
0
]
return
data
.
link
.
split
(
'?'
)[
0
]
...
@@ -25,36 +22,31 @@ export function getUrlofLink(data) {
...
@@ -25,36 +22,31 @@ export function getUrlofLink(data) {
export
function
getUrlofQuery
(
data
)
{
export
function
getUrlofQuery
(
data
)
{
return
data
.
link
.
split
(
'?'
)[
1
]
||
''
return
data
.
link
.
split
(
'?'
)[
1
]
||
''
}
}
// 全局跳转 data:link数据 option:是否为底部栏触发
// 全局跳转 data:link数据 option:是否为底部栏触发
export
function
$themeToLink
(
data
,
option
)
{
export
function
$themeToLink
(
data
,
option
)
{
let
app
=
getApp
();
let
app
=
getApp
();
let
type
=
data
.
type
;
let
type
=
data
.
type
;
console
.
log
(
'299999'
,
data
,
noLoginListPath
)
//
点击底部栏--
//
登录拦截和底部导航栏拦截(非功能项)
if
(
type
!=
2
)
{
if
(
type
!=
2
)
{
// 登录拦截
// 登录拦截
let
parseLink
=
getUrlofLink
(
data
);
let
parseLink
=
getUrlofLink
(
data
);
let
aa
=
noLoginListPath
.
includes
(
parseLink
)
||
parseLink
.
substr
(
0
,
7
)
==
"/goods/"
let
aa
=
noLoginListPath
.
includes
(
parseLink
)
||
parseLink
.
substr
(
0
,
7
)
==
"/goods/"
||
parseLink
.
includes
(
'/brandTopics'
);
console
.
log
(
parseLink
,
aa
,
'parseLinkparseLinkparseLink'
,
parseLink
,
noLoginListPath
)
console
.
log
(
noLoginListPath
.
includes
(
parseLink
),
'3535'
)
if
(
!
aa
&&
!
wx
.
getStorageSync
(
"sessionid"
))
{
if
(
!
aa
&&
!
wx
.
getStorageSync
(
"sessionid"
))
{
let
url
=
`/pages/login/main?back=
${
parseLink
}
`
;
let
url
=
`/pages/login/main?back=
${
parseLink
}
`
;
wx
.
navigateTo
({
url
});
wx
.
navigateTo
({
url
});
return
return
}
}
//判断是否市跳转到tabbar页面 替换首页位置
//判断是否市跳转到tabbar页面 替换首页位置
let
isTabbarIndex
=
checkTabbarPage
(
parseLink
);
let
isTabbarIndex
=
checkTabbarPage
(
parseLink
);
console
.
log
(
'44'
,
isTabbarIndex
)
if
(
isTabbarIndex
>=
0
)
{
if
(
isTabbarIndex
>=
0
)
{
isTabbarIndex
=
isTabbarIndex
==
0
?
checkTabbarPage
(
'/'
)
:
isTabbarIndex
isTabbarIndex
=
isTabbarIndex
==
0
?
checkTabbarPage
(
'/'
)
:
isTabbarIndex
wx
.
switchTab
({
wx
.
switchTab
({
url
:
parseLink
==
'/'
?
'/pages/home/main'
:
`/pages/tabBar
${
isTabbarIndex
}
/main`
,
url
:
parseLink
==
'/'
?
'/pages/home/main'
:
`/pages/tabBar
${
isTabbarIndex
}
/main`
,
})
})
return
return
}
}
// console.log(option, data,'---',parseLink == '/' ? '/pages/home/main' : `/pages/tabBar${isTabbarIndex}/main`)
// return
}
}
...
@@ -113,33 +105,32 @@ export function $themeToLink(data, option) {
...
@@ -113,33 +105,32 @@ export function $themeToLink(data, option) {
}
}
}
}
export
function
$themeAddToCard
(
item
,
callback
)
{
export
function
$themeAddToCard
(
item
,
callback
)
{
let
app
=
getApp
();
let
errorMsg
=
""
;
let
errorMsg
=
""
;
if
(
item
.
productNature
==
5
)
{
if
(
item
.
productNature
==
5
)
{
errorMsg
=
"电子卡券不可加入购物车"
;
errorMsg
=
"电子卡券不可加入购物车"
;
}
}
if
(
item
.
productNature
==
3
)
{
if
(
item
.
productNature
==
3
)
{
errorMsg
=
"会员卡不可加入购物车"
;
errorMsg
=
"会员卡不可加入购物车"
;
}
}
if
(
item
.
productNature
==
2
)
{
if
(
item
.
productNature
==
2
)
{
errorMsg
=
"虚拟商品不可加入购物车"
;
errorMsg
=
"虚拟商品不可加入购物车"
;
}
}
if
(
errorMsg
)
{
if
(
errorMsg
)
{
wx
.
showToast
({
wx
.
showToast
({
title
:
errorMsg
,
title
:
errorMsg
,
icon
:
'none'
,
icon
:
'none'
,
});
});
}
}
cart
cart
.
addCart
([
.
addCart
([
{
productGoodsId
:
item
.
minProductGoodsId
,
qty
:
item
.
saleQty
}
{
productGoodsId
:
item
.
minProductGoodsId
,
qty
:
item
.
saleQty
}
])
])
.
then
(
res
=>
{
.
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
wx
.
showToast
({
title
:
"加入购物车成功"
,
icon
:
"none"
});
wx
.
showToast
({
title
:
"加入购物车成功"
,
icon
:
"none"
});
}
}
callback
();
callback
();
});
});
}
}
function
toPage
(
backPath
,
backParams
=
""
)
{
function
toPage
(
backPath
,
backParams
=
""
)
{
...
@@ -148,21 +139,20 @@ function toPage(backPath, backParams = "") {
...
@@ -148,21 +139,20 @@ function toPage(backPath, backParams = "") {
});
});
}
}
// check 链接是否为底部导航栏页面 返回索引
// check 链接是否为底部导航栏页面 返回索引
export
function
checkTabbarPage
(
link
)
{
export
function
checkTabbarPage
(
link
)
{
let
app
=
getApp
()
let
app
=
getApp
()
if
(
!
app
.
globalData
.
footerVal
)
return
-
1
if
(
!
app
.
globalData
.
footerVal
)
return
-
1
let
footerVal
=
app
.
globalData
.
footerVal
.
componentData
.
list
;
let
footerVal
=
app
.
globalData
.
footerVal
.
componentData
.
list
;
let
isFooter
=
footerVal
.
findIndex
(
item
=>
{
let
isFooter
=
footerVal
.
findIndex
(
item
=>
{
return
item
.
link
.
link
==
link
return
getUrlofLink
(
item
.
link
)
==
link
.
split
(
'?'
)[
0
]
})
})
return
isFooter
return
isFooter
}
}
// 当前底部栏选中项
// 当前底部栏选中项
export
function
setTabBarActive
(
data
)
{
export
function
setTabBarActive
(
data
)
{
console
.
log
(
this
,
'this'
,
data
)
console
.
log
(
data
,
'sssssssssss'
,
this
.
$mp
.
page
.
getTabBar
(),
data
)
if
(
data
<
0
||
!
this
.
$mp
.
page
)
return
if
(
data
<
0
||
!
this
.
$mp
.
page
)
return
if
(
typeof
this
.
$mp
.
page
.
getTabBar
===
'function'
&&
if
(
typeof
this
.
$mp
.
page
.
getTabBar
===
'function'
&&
this
.
$mp
.
page
.
getTabBar
())
{
this
.
$mp
.
page
.
getTabBar
())
{
...
@@ -176,7 +166,7 @@ export function setTabBarActive(data) {
...
@@ -176,7 +166,7 @@ export function setTabBarActive(data) {
// 遍历所有组件有显示条件的id 是否包含地区导航组件
// 遍历所有组件有显示条件的id 是否包含地区导航组件
export
function
checkShowConditionIds
(
list
)
{
export
function
checkShowConditionIds
(
list
)
{
let
allCondition
=
[];
let
allCondition
=
[];
let
isAreaNavigation
=
false
;
let
isAreaNavigation
=
false
;
list
.
forEach
(
element
=>
{
list
.
forEach
(
element
=>
{
pollCondition
(
element
)
pollCondition
(
element
)
});
});
...
@@ -202,26 +192,25 @@ export function checkShowConditionIds(list) {
...
@@ -202,26 +192,25 @@ export function checkShowConditionIds(list) {
}
}
// 有地区导航组件
// 有地区导航组件
if
(
object
.
componentCode
==
'area-navigation'
)
{
if
(
object
.
componentCode
==
'area-navigation'
)
{
isAreaNavigation
=
true
isAreaNavigation
=
true
}
}
}
}
}
}
return
{
return
{
allCondition
:[...
new
Set
(
allCondition
)],
allCondition
:
[...
new
Set
(
allCondition
)],
isAreaNavigation
isAreaNavigation
}
}
}
}
export
function
$themeArticleLike
(
item
,
callback
){
export
function
$themeArticleLike
(
item
,
callback
)
{
let
query
=
{
articleId
:
item
.
id
};
let
query
=
{
articleId
:
item
.
id
};
classificationApi
.
addLike
(
query
).
then
(
res
=>
{
classificationApi
.
addLike
(
query
).
then
(
res
=>
{
if
(
res
.
data
.
code
==
"200"
)
{
if
(
res
.
data
.
code
==
"200"
)
{
if
(
res
.
data
.
data
==
'true'
)
{
if
(
res
.
data
.
data
==
'true'
)
{
callback
(
"true"
);
callback
(
"true"
);
}
else
{
callback
(
"false"
);
}
}
else
{
}
else
{
callback
(
"false"
);
}
}
}
else
{
});
Toast
(
res
.
data
.
msg
);
}
});
}
}
\ No newline at end of file
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