Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
严立
/
mini-shimao
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
41e77e14
authored
Sep 24, 2020
by
wjw
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' of
http://120.77.182.185/yanl/mini-shimao.git
into master
parents
89084e91
2d31b335
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
208 additions
and
61 deletions
app.js
pages/commodity/menu-food/menu-food.js
pages/commodity/menu-food/menu-food.wxml
pages/mine/home/home.js
pages/mine/home/home.wxml
pages/mine/home/home.wxss
pages/play/activity-detail/activity-detail.wxml
pages/play/service-detail/service-detail.js
project.config.json
app.js
View file @
41e77e14
...
...
@@ -33,10 +33,16 @@ App({
onLaunch
:
function
()
{
this
.
setUnitProportion
()
this
.
login
()
},
onShow
:
function
()
{
console
.
log
(
'onShow'
)
if
(
this
.
globalData
.
token
===
''
)
return
this
.
queryUserStatus
()
},
setUnitProportion
:
function
()
{
let
funcProportion
=
wx
.
getSystemInfoSync
().
windowWidth
/
750
wx
.
setStorageSync
(
'unitProportion'
,
funcProportion
)
...
...
@@ -160,7 +166,7 @@ App({
// 防止无限刷新 token 的紧急修复手段
if
(
obj
&&
obj
.
error
)
{
wx
.
switchTab
({
url
:
'/pages/home/home'
url
:
'/pages/home/home
/home
'
})
}
},
...
...
@@ -208,7 +214,8 @@ App({
let
funcResponse
=
response
.
data
let
funcUserInfo
=
wx
.
getStorageSync
(
'userInfo'
)
let
funcStatus
=
Number
(
funcResponse
.
state
)
let
funcStatus
=
Number
(
funcResponse
.
state
)
// 最新的用户身份
let
funcStatusRaw
=
funcUserInfo
.
status
// 当前的用户身份,用于对比用户身份是否更新
let
funcStatusText
=
'去认证'
switch
(
funcStatus
)
{
...
...
@@ -235,6 +242,12 @@ App({
}
wx
.
setStorageSync
(
'userInfo'
,
funcUserInfo
)
// 如果用户身份有更新,则自动跳转到首页
if
(
funcStatus
!==
funcStatusRaw
)
{
console
.
log
(
'status change'
)
wx
.
switchTab
({
url
:
'/pages/home/home/home'
})
}
}
})
},
...
...
pages/commodity/menu-food/menu-food.js
View file @
41e77e14
...
...
@@ -3,6 +3,7 @@ let App = getApp()
Page
({
scrollLock
:
false
,
scrollTimer
:
0
,
sideBarIsSelection
:
false
,
data
:
{
imageBase
:
App
.
globalData
.
appImageBase
,
...
...
@@ -23,18 +24,12 @@ Page({
sideBarTopPadding
:
0
,
sideBarIndex
:
0
,
menuTitle
:
''
,
// 商品列表标题
commoditScroll
:
0
,
commodityList
:
[],
// 商品列表
commodityDetail
:
{},
// 商品详情
shoppingCart
:
[],
// 购物车列表
shoppingCartTotal
:
0
,
// 购物车总数
scrollTop
:
0
,
winToast
:
false
,
winLoading
:
false
,
winCommodityDetail
:
false
,
...
...
@@ -193,7 +188,6 @@ Page({
this
.
setData
({
sideBar
:
funcSideBar
,
menuTitle
:
funcSideBar
[
0
].
tab
})
this
.
queryCommodity
()
...
...
@@ -308,6 +302,7 @@ Page({
let
funcSideBarId
=
this
.
data
.
sideBar
let
funcList
=
[]
// 添加商品到对应分类
for
(
let
i
=
0
,
l
=
funcSideBarId
.
length
;
i
<
l
;
i
++
)
{
funcList
.
push
({
'id'
:
funcSideBarId
[
i
].
id
,
...
...
@@ -323,8 +318,18 @@ Page({
}
}
// 删除没有商品的分类
for
(
let
i
=
0
;
i
<
funcList
.
length
;
i
++
)
{
if
(
funcList
[
i
].
commodity
.
length
===
0
)
{
funcList
.
splice
(
i
,
1
)
funcSideBarId
.
splice
(
i
,
1
)
i
=
i
-
1
}
}
this
.
setData
({
winLoading
:
false
,
sideBar
:
funcSideBarId
,
commodityList
:
funcList
,
})
...
...
@@ -335,14 +340,13 @@ Page({
let
funcElement
=
response
[
0
]
let
funcSideBarHeight
=
[]
for
(
let
i
=
0
,
l
=
funcElement
.
length
;
i
<
l
;
i
++
)
{
funcSideBarHeight
.
push
(
funcElement
[
i
].
top
)
// 120 是分类标题元素 rpx 高度
funcSideBarHeight
.
push
(
funcElement
[
i
].
top
-
120
*
wx
.
getStorageSync
(
'unitProportion'
))
}
this
.
setData
({
sideBarHeight
:
funcSideBarHeight
})
console
.
log
(
this
.
data
.
sideBarHeight
)
})
},
...
...
@@ -354,14 +358,45 @@ Page({
*/
onSelectionSideBar
:
function
(
event
)
{
let
funcIndex
=
event
.
currentTarget
.
dataset
.
index
let
funcMenuTitle
=
this
.
data
.
sideBar
[
funcIndex
].
tab
this
.
setData
({
sideBarIndex
:
funcIndex
,
menuTitle
:
funcMenuTitle
,
scrollTop
:
0
commoditScroll
:
this
.
data
.
sideBarHeight
[
funcIndex
]
})
},
/**
* 商品列表滚动事件
* @function
* @param
* @returns
*/
onCommoditScroll
:
function
(
event
)
{
// 当滚动幅度较大时,认定为是分类点击跳转,屏蔽此事件的滚动
if
(
250
*
wx
.
getStorageSync
(
'unitProportion'
)
<
Math
.
abs
(
event
.
detail
.
deltaY
))
return
// 优化滚动事件触发频率
if
(
this
.
scrollLock
)
return
this
.
scrollLock
=
true
let
funcIndex
=
0
let
funcScrollHeight
=
event
.
detail
.
scrollTop
let
funcSideBarHeight
=
this
.
data
.
sideBarHeight
for
(
let
i
=
0
,
l
=
funcSideBarHeight
.
length
;
i
<
l
;
i
++
)
{
if
(
funcScrollHeight
>
funcSideBarHeight
[
i
])
{
funcIndex
=
i
}
}
this
.
setData
({
sideBarIndex
:
funcIndex
})
this
.
queryCommodity
()
// 恢复滚动事件
this
.
scrollTimer
=
setTimeout
(()
=>
{
this
.
scrollLock
=
false
clearTimeout
(
this
.
scrollTimer
)
},
10
)
},
/**
...
...
@@ -494,36 +529,4 @@ Page({
url
:
'/pages/commodity/shopping-cart/shopping-cart'
,
})
},
/**
* 页面滚动事件
* @function
* @param
* @returns
*/
onPageScroll
:
function
(
event
)
{
// 优化滚动事件触发频率
if
(
this
.
scrollLock
)
return
this
.
scrollLock
=
true
console
.
log
(
event
.
detail
.
scrollTop
)
let
funcIndex
=
0
let
funcScrollHeight
=
event
.
detail
.
scrollTop
let
funcSideBarHeight
=
this
.
data
.
sideBarHeight
for
(
let
i
=
0
,
l
=
funcSideBarHeight
.
length
;
i
<
l
;
i
++
)
{
if
(
funcScrollHeight
>
funcSideBarHeight
[
i
])
{
funcIndex
=
i
}
}
this
.
setData
({
sideBarIndex
:
funcIndex
})
// 恢复滚动事件
this
.
scrollTimer
=
setTimeout
(()
=>
{
this
.
scrollLock
=
false
clearTimeout
(
this
.
scrollTimer
)
},
10
)
},
})
\ No newline at end of file
pages/commodity/menu-food/menu-food.wxml
View file @
41e77e14
...
...
@@ -30,7 +30,7 @@
</scroll-view>
<!-- 商品列表 -->
<scroll-view class="menu-list" scroll-y
bindscroll="onPage
Scroll">
<scroll-view class="menu-list" scroll-y
scroll-top="{{commoditScroll}}" bindscroll="onCommodit
Scroll">
<block wx:for="{{commodityList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="right-content-title">{{item.tab}}</view>
...
...
pages/mine/home/home.js
View file @
41e77e14
const
App
=
getApp
()
Page
({
scrollLock
:
false
,
scrollTimer
:
0
,
/**
* 页面的初始数据
*/
data
:
{
// 导航栏相关属性
navigationStyle
:
{
normal
:
{
backIcon
:
''
,
color
:
'#FFFFFF'
,
background
:
'rgba(255, 255, 255, 0)'
},
change
:
{
backIcon
:
''
,
color
:
'#000000'
,
background
:
'rgba(255, 255, 255, 1)'
},
scroll
:
'400rpx'
,
},
navigationScroll
:
0
,
isCheckPermission
:
false
,
imageBase
:
App
.
globalData
.
appImageBase
,
imageResourcesBase
:
App
.
globalData
.
appResourcesBase
,
...
...
@@ -550,5 +565,25 @@ Page({
})
}
},
onPageScroll
:
function
(
event
)
{
console
.
log
(
this
.
scrollLock
)
// 优化滚动事件触发频率
if
(
this
.
scrollLock
)
return
this
.
scrollLock
=
true
this
.
setData
({
navigationScroll
:
event
.
scrollTop
})
console
.
log
(
this
.
data
.
navigationScroll
)
// 恢复滚动事件
this
.
scrollTimer
=
setTimeout
(()
=>
{
this
.
scrollLock
=
false
clearTimeout
(
this
.
scrollTimer
)
},
10
)
},
})
\ No newline at end of file
pages/mine/home/home.wxml
View file @
41e77e14
<navigation class="navigation" titleText="我的"
color="{{type == 1? '#FFFFFF' :''
}}"></navigation>
<navigation class="navigation" titleText="我的"
scrollStyle="{{navigationStyle}}" scrollHeight="{{navigationScroll
}}"></navigation>
<view class="container">
<view class="mine" wx:if="{{type !== 1}}">
...
...
pages/mine/home/home.wxss
View file @
41e77e14
...
...
@@ -5,7 +5,7 @@
}
.navigation {
z-index:
2
;
z-index:
1900
;
}
.background-image {
...
...
pages/play/activity-detail/activity-detail.wxml
View file @
41e77e14
<!-- 畅玩 - 活动详情 -->
<navigation class="navigation" titleText="主题活动" color="#ffffff" scrollStyle="{{navigationStyle}}" scrollHeight="{{navigationScroll}}"></navigation>
<navigation class="navigation" titleText="主题活动" scrollStyle="{{navigationStyle}}" scrollHeight="{{navigationScroll}}"></navigation>
<view class="container">
<view id="banner" class="banner">
...
...
pages/play/service-detail/service-detail.js
View file @
41e77e14
...
...
@@ -572,7 +572,7 @@ Page({
'scoreService'
:
funcResponse
.
list
[
i
].
environmentalEvaluation
,
// 服务评价
'scoreCommodity'
:
funcResponse
.
list
[
i
].
productEvaluation
,
// 商品评价
'scoreEnvironmental'
:
funcResponse
.
list
[
i
].
environmentalEvaluation
,
// 环境评价
'userName'
:
funcResponse
.
list
[
i
].
name
,
'userName'
:
funcResponse
.
list
[
i
].
n
ickn
ame
,
'userAvatar'
:
funcResponse
.
list
[
i
].
headImg
,
'userType'
:
funcResponse
.
list
[
i
].
userType
,
'userAlbum'
:
funcResponse
.
list
[
i
].
imgUrls
,
// 评论图册
...
...
project.config.json
0 → 100644
View file @
41e77e14
{
"description"
:
"项目配置文件"
,
"packOptions"
:
{
"ignore"
:
[]
},
"setting"
:
{
"urlCheck"
:
true
,
"es6"
:
true
,
"enhance"
:
true
,
"postcss"
:
true
,
"minified"
:
true
,
"newFeature"
:
true
,
"coverView"
:
true
,
"nodeModules"
:
true
,
"autoAudits"
:
false
,
"showShadowRootInWxmlPanel"
:
true
,
"scopeDataCheck"
:
false
,
"uglifyFileName"
:
false
,
"checkInvalidKey"
:
true
,
"checkSiteMap"
:
false
,
"uploadWithSourceMap"
:
true
,
"babelSetting"
:
{
"ignore"
:
[],
"disablePlugins"
:
[],
"outputPath"
:
""
}
},
"compileType"
:
"miniprogram"
,
"libVersion"
:
"2.10.0"
,
"appid"
:
"wx37a9b7a3d92029f2"
,
"projectname"
:
"%E4%B8%96%E8%8C%82%E5%B0%8F%E7%A8%8B%E5%BA%8F%E4%BA%8C%E6%9C%9F"
,
"cloudfunctionTemplateRoot"
:
""
,
"watchOptions"
:
{
"ignore"
:
[]
},
"debugOptions"
:
{
"hidedInDevtools"
:
[]
},
"scripts"
:
{},
"simulatorType"
:
"wechat"
,
"simulatorPluginLibVersion"
:
{},
"condition"
:
{
"search"
:
{
"current"
:
-1
,
"list"
:
[]
},
"conversation"
:
{
"current"
:
-1
,
"list"
:
[]
},
"plugin"
:
{
"current"
:
-1
,
"list"
:
[]
},
"game"
:
{
"list"
:
[]
},
"gamePlugin"
:
{
"current"
:
-1
,
"list"
:
[]
},
"miniprogram"
:
{
"current"
:
-1
,
"list"
:
[
{
"id"
:
-1
,
"name"
:
"pages/commodity/menu-food/menu-food"
,
"pathName"
:
"pages/commodity/menu-food/menu-food"
,
"query"
:
""
,
"scene"
:
null
},
{
"id"
:
-1
,
"name"
:
"pages/play/home/home"
,
"pathName"
:
"pages/play/home/home"
,
"query"
:
""
,
"scene"
:
null
},
{
"id"
:
-1
,
"name"
:
"pages/play/service-detail/service-detail"
,
"pathName"
:
"pages/play/service-detail/service-detail"
,
"query"
:
"id=1&type=4"
,
"scene"
:
null
},
{
"id"
:
-1
,
"name"
:
"pages/mine/home/home"
,
"pathName"
:
"pages/mine/home/home"
,
"query"
:
""
,
"scene"
:
null
}
]
}
}
}
\ 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