Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
singleStore
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Max
singleStore
Commits
0bace7fd
Commit
0bace7fd
authored
Aug 05, 2021
by
June
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:首页,详情页,分类,登录,店铺详情添加分享;fixed:商品详情页顶部滚动渐变优化
parent
996d6872
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
198 additions
and
119 deletions
+198
-119
App.vue
App.vue
+8
-2
components/c-nav_bar/index.vue
components/c-nav_bar/index.vue
+11
-1
mixins/setting_share.js
mixins/setting_share.js
+33
-0
pages.json
pages.json
+80
-65
pages/category/index.vue
pages/category/index.vue
+3
-7
pages/goods/detail.vue
pages/goods/detail.vue
+28
-17
pages/home/index.vue
pages/home/index.vue
+5
-10
pages/login/index.vue
pages/login/index.vue
+3
-7
subPages/storeInfo/index.vue
subPages/storeInfo/index.vue
+3
-10
testA/pageA/index.vue
testA/pageA/index.vue
+9
-0
utils/common.js
utils/common.js
+15
-0
No files found.
App.vue
View file @
0bace7fd
...
...
@@ -12,7 +12,6 @@ export default {
const
token
=
this
.
$getStorage
(
'
token
'
)
this
.
$store
.
state
.
user
.
token
=
token
this
.
getStoreInfo
()
// 这个接口一定要先获取,因为如果店铺过期
// wx.login
login_wx
()
...
...
@@ -29,7 +28,14 @@ export default {
})
},
onShow
()
{
globalData
:
{
backHome
:
false
// 根据分享进入场景,自定义返回是否是返回首页
},
onShow
(
ops
)
{
if
([
1007
,
1008
,
1154
,
1155
].
includes
(
ops
.
scene
))
{
this
.
globalData
.
backHome
=
true
}
if
(
!
this
.
$store
.
state
.
systemInfo
.
menuCalcInfo
)
{
this
.
setMobileData
()
}
...
...
components/c-nav_bar/index.vue
View file @
0bace7fd
...
...
@@ -14,6 +14,7 @@
<
script
>
import
{
mapState
}
from
'
vuex
'
const
app
=
getApp
()
export
default
{
props
:
{
color
:
{
...
...
@@ -54,8 +55,17 @@ export default {
},
methods
:
{
handleBack
()
{
uni
.
navigateBack
()
const
{
backHome
}
=
app
.
globalData
if
(
backHome
)
{
uni
.
switchTab
({
url
:
'
/pages/home/index
'
})
}
else
{
uni
.
navigateBack
()
}
}
}
}
...
...
mixins/setting_share.js
0 → 100644
View file @
0bace7fd
import
{
getURLwithArgs
}
from
'
@/utils/common.js
'
import
{
mapState
}
from
'
vuex
'
import
{
baseUrl
}
from
'
@/config/index.js
'
const
common_share
=
{
computed
:
{
...
mapState
({
storeInfo
:
state
=>
state
.
user
.
storeInfo
}),
judgePages
()
{
const
path
=
getURLwithArgs
()
let
imageUrl
=
''
let
title
=
this
.
storeInfo
.
shop_name
if
(
path
&&
path
.
startsWith
(
'
pages/goods/detail
'
))
{
imageUrl
=
(
this
.
detail
&&
this
.
detail
.
goods_thumb
)
?
`
${
baseUrl
}
/
${
this
.
detail
.
goods_thumb
}
`
:
''
title
=
this
.
detail
?
this
.
detail
.
goods_name
:
''
}
return
{
path
,
imageUrl
,
title
}
}
},
onShareAppMessage
()
{
return
this
.
judgePages
},
onShareTimeline
()
{
return
this
.
judgePages
}
}
export
default
common_share
\ No newline at end of file
pages.json
View file @
0bace7fd
...
...
@@ -74,73 +74,88 @@
}
}
],
"subPackages"
:
[{
"root"
:
"subPages"
,
"pages"
:
[
{
"path"
:
"resetPwd/index"
,
"style"
:
{
"navigationBarTitleText"
:
"重置密码"
}
},
{
"path"
:
"userManage/index"
,
"style"
:
{
"navigationBarTitleText"
:
"账号管理"
}
},
{
"path"
:
"collection/index"
,
"style"
:
{
"navigationBarTitleText"
:
"收藏历史"
}
},
{
"path"
:
"address/index"
,
"style"
:
{
"navigationBarTitleText"
:
"地址列表"
,
"enablePullDownRefresh"
:
true
,
"onReachBottomDistance"
:
50
}
},
{
"path"
:
"address/edit"
,
"style"
:
{
"navigationBarTitleText"
:
"添加地址"
}
},
{
"path"
:
"web-view/index"
,
"style"
:
{
"navigationBarTitleText"
:
" "
}
},
{
"path"
:
"storeInfo/index"
,
"style"
:
{
"navigationBarTitleText"
:
"店铺详情"
}
},
{
"path"
:
"afterSales/apply"
,
"style"
:
{
"navigationBarTitleText"
:
"申请售后"
}
},
{
"path"
:
"afterSales/detail"
,
"style"
:
{
"navigationBarTitleText"
:
"申请退款/退货"
"subPackages"
:
[
{
"root"
:
"subPages"
,
"pages"
:
[
{
"path"
:
"resetPwd/index"
,
"style"
:
{
"navigationBarTitleText"
:
"重置密码"
}
},
{
"path"
:
"userManage/index"
,
"style"
:
{
"navigationBarTitleText"
:
"账号管理"
}
},
{
"path"
:
"collection/index"
,
"style"
:
{
"navigationBarTitleText"
:
"收藏历史"
}
},
{
"path"
:
"address/index"
,
"style"
:
{
"navigationBarTitleText"
:
"地址列表"
,
"enablePullDownRefresh"
:
true
,
"onReachBottomDistance"
:
50
}
},
{
"path"
:
"address/edit"
,
"style"
:
{
"navigationBarTitleText"
:
"添加地址"
}
},
{
"path"
:
"web-view/index"
,
"style"
:
{
"navigationBarTitleText"
:
" "
}
},
{
"path"
:
"storeInfo/index"
,
"style"
:
{
"navigationBarTitleText"
:
"店铺详情"
}
},
{
"path"
:
"afterSales/apply"
,
"style"
:
{
"navigationBarTitleText"
:
"申请售后"
}
},
{
"path"
:
"afterSales/detail"
,
"style"
:
{
"navigationBarTitleText"
:
"申请退款/退货"
}
},
{
"path"
:
"pay_status/index"
,
"style"
:
{
"navigationBarTitleText"
:
"支付结果"
}
}
},
{
"path"
:
"pay_status/index"
,
"style"
:
{
"navigationBarTitleText"
:
"支付结果"
]
},
{
"root"
:
"testA"
,
"pages"
:[
{
"path"
:
"pageA/index"
,
"style"
:
{
"navigationBarTitleText"
:
"收藏历史"
,
"navigationStyle"
:
"custom"
},
"independent"
:
true
}
}
]
}
],
]
}
],
"preloadRule"
:
{
"pages/home/index"
:
{
"network"
:
"all"
,
...
...
pages/category/index.vue
View file @
0bace7fd
...
...
@@ -136,6 +136,7 @@ import price from '@/components/price/index.vue'
import
{
getCatetories
,
cateGoodsList
}
from
'
@/apis/category.js
'
import
{
searchGoods
,
goodsSku
}
from
'
@/apis/goods.js
'
import
{
baseUrl
}
from
'
@/config/index.js
'
import
common_share
from
'
@/mixins/setting_share.js
'
import
{
mapState
,
mapActions
}
from
'
vuex
'
let
cat_id
=
0
...
...
@@ -161,8 +162,7 @@ export default {
computed
:
{
...
mapState
({
token
:
state
=>
state
.
user
.
token
,
isOverdue
:
state
=>
state
.
user
.
isOverdue
,
storeInfo
:
state
=>
state
.
user
.
storeInfo
isOverdue
:
state
=>
state
.
user
.
isOverdue
})
},
// async created() {
...
...
@@ -177,11 +177,7 @@ export default {
}
uni
.
hideLoading
()
},
onShareAppMessage
()
{
return
{
title
:
this
.
storeInfo
.
shop_name
||
''
}
},
mixins
:
[
common_share
],
methods
:
{
...
mapActions
(
'
cart
'
,
[
'
setCount
'
]),
async
getCate
()
{
...
...
pages/goods/detail.vue
View file @
0bace7fd
...
...
@@ -2,13 +2,13 @@
<view
class=
"wrapper w-100"
>
<c-nav
_bar
showBack
title=
"商品详情"
:bg=
"navBg"
/>
<!--
<left-menu-button
/>
-->
<!--
<left-menu-button
/>
-->
<view
class=
"swiper-wrap"
>
<swiper
...
...
@@ -153,7 +153,7 @@
</template>
<
script
>
//
import leftMenuButton from './components/left-menuButton.vue'
import
leftMenuButton
from
'
./components/left-menuButton.vue
'
import
uParse
from
'
@/components/parse/parse.vue
'
import
price
from
'
@/components/price/index.vue
'
...
...
@@ -162,6 +162,8 @@ import { goodDetail, goodsSku, collectGoods } from '@/apis/goods.js'
import
{
baseUrl
}
from
'
@/config/index.js
'
import
{
makePhoneCall
,
throttle
}
from
'
@/utils/common.js
'
import
{
mapState
}
from
'
vuex
'
import
common_share
from
'
@/mixins/setting_share.js
'
let
goods_id
=
null
export
default
{
data
()
{
...
...
@@ -170,6 +172,7 @@ export default {
mode
:
'
widthFix
'
,
lazyLoad
:
true
},
showHome
:
false
,
baseUrl
,
detail
:
null
,
swiperCurrent
:
0
,
...
...
@@ -181,8 +184,9 @@ export default {
navBg
:
"
rgba(255, 255, 255, 0)
"
}
},
mixins
:
[
common_share
],
components
:
{
//
leftMenuButton,
leftMenuButton
,
uParse
,
price
,
goodsPopup
...
...
@@ -195,8 +199,7 @@ export default {
computed
:
{
...
mapState
({
cart_count
:
state
=>
state
.
cart
.
cart_count
,
storeInfo
:
state
=>
state
.
user
.
storeInfo
cart_count
:
state
=>
state
.
cart
.
cart_count
}),
logisticsTab
()
{
...
...
@@ -221,20 +224,28 @@ export default {
},
},
onShareAppMessage
()
{
const
goods_thumb
=
this
.
detail
.
goods_thumb
const
goods_name
=
this
.
detail
.
goods_name
return
{
title
:
goods_name
||
''
,
image
:
goods_thumb
?
`
${
this
.
baseUrl
}
/
${
goods_thumb
}
`
:
''
}
},
onPageScroll
:
throttle
(
function
(
e
)
{
// onShareAppMessage() {
// const goods_thumb = this.detail.goods_thumb
// const goods_name = this.detail.goods_name
// return {
// title: goods_name || '',
// image: goods_thumb ? `${this.baseUrl}/${goods_thumb}` : ''
// }
// },
// onPageScroll: throttle(function(e) {
// const scrollTop = e.scrollTop
// if(scrollTop > 500) return
// const opacity = (scrollTop / 375).toFixed(1)
// this.navBg = `rgba(255, 255, 255, ${opacity})`
// }, 250),
onPageScroll
(
e
)
{
const
scrollTop
=
e
.
scrollTop
if
(
scrollTop
>
500
)
return
const
opacity
=
(
scrollTop
/
375
).
toFixed
(
1
)
if
(
opacity
>
1.2
)
return
this
.
navBg
=
`rgba(255, 255, 255,
${
opacity
}
)`
},
250
),
},
methods
:
{
// 富文本预览事件
preview
(
src
,
e
)
{
...
...
pages/home/index.vue
View file @
0bace7fd
...
...
@@ -192,7 +192,7 @@ import { baseUrl } from '@/config/index.js'
import
{
makePhoneCall
,
throttle
}
from
'
@/utils/common.js
'
import
{
goodsSku
}
from
'
@/apis/goods.js
'
import
{
mapState
,
mapActions
}
from
'
vuex
'
import
common_share
from
'
@/mixins/setting_share.js
'
export
default
{
data
()
{
return
{
...
...
@@ -217,10 +217,11 @@ export default {
...
mapState
([
'
systemInfo
'
]),
...
mapState
({
isOverdue
:
state
=>
state
.
user
.
isOverdue
,
token
:
state
=>
state
.
user
.
token
,
storeInfo
:
state
=>
state
.
user
.
storeInfo
token
:
state
=>
state
.
user
.
token
})
},
mixins
:
[
common_share
],
created
()
{
// 实例化分页方法
...
...
@@ -281,13 +282,7 @@ export default {
this
.
navColor
=
'
#fff
'
this
.
navBg
=
'
rgba(255, 255, 255, 0)
'
}
},
300
),
onShareAppMessage
()
{
return
{
title
:
this
.
storeInfo
.
shop_name
||
''
}
},
},
300
),
onReachBottom
()
{
console
.
log
(
'
触底
'
)
...
...
pages/login/index.vue
View file @
0bace7fd
...
...
@@ -90,6 +90,7 @@ import { timerFn } from '@/utils/common.js'
import
{
loginSms
}
from
'
@/apis/user.js
'
import
{
mapState
,
mapActions
}
from
'
vuex
'
import
md5
from
'
md5
'
import
common_share
from
'
@/mixins/setting_share.js
'
const
userPlachelderStr
=
{
1
:
''
,
2
:
'
请输入手机号码
'
,
...
...
@@ -112,18 +113,13 @@ export default {
computed
:
{
...
mapState
({
session_key
:
state
=>
state
.
user
.
session_key
,
openid
:
state
=>
state
.
user
.
openid
,
storeInfo
:
state
=>
state
.
user
.
storeInfo
openid
:
state
=>
state
.
user
.
openid
}),
userPlachelder
()
{
return
userPlachelderStr
[
this
.
form
.
lgtype
]
}
},
onShareAppMessage
()
{
return
{
title
:
this
.
storeInfo
.
shop_name
||
''
}
},
mixins
:
[
common_share
],
methods
:
{
...
common
,
...
mapActions
(
'
user
'
,
[
'
login
'
]),
...
...
subPages/storeInfo/index.vue
View file @
0bace7fd
...
...
@@ -50,10 +50,11 @@
</
template
>
<
script
>
import
{
mapState
}
from
'
vuex
'
import
{
baseUrl
}
from
'
@/config/index.js
'
import
dayjs
from
'
dayjs
'
import
{
weeks
}
from
'
@/config/global.js
'
// 引用了common_share 就不需要再在页面上引用vuex的storeInfo
import
common_share
from
'
@/mixins/setting_share.js
'
export
default
{
data
()
{
return
{
...
...
@@ -61,9 +62,6 @@ export default {
}
},
computed
:
{
...
mapState
({
storeInfo
:
state
=>
state
.
user
.
storeInfo
}),
startT
()
{
return
weeks
[
this
.
storeInfo
.
business_week_start
]
||
''
},
...
...
@@ -74,12 +72,7 @@ export default {
return
dayjs
(
this
.
storeInfo
.
add_time
*
1000
).
format
(
'
YYYY-MM-DD
'
)
||
''
}
},
onShareAppMessage
()
{
const
storeInfo
=
this
.
storeInfo
return
{
title
:
storeInfo
.
shop_name
||
''
}
},
mixins
:
[
common_share
]
}
</
script
>
...
...
testA/pageA/index.vue
0 → 100644
View file @
0bace7fd
<
template
>
<view>
测试
</view>
</
template
>
<
script
>
</
script
>
<
style
>
</
style
>
utils/common.js
View file @
0bace7fd
...
...
@@ -89,3 +89,18 @@ export function makePhoneCall() {
})
}
}
export
function
getURLwithArgs
(){
const
pages
=
getCurrentPages
()
const
currentPage
=
pages
[
pages
.
length
-
1
]
const
url
=
currentPage
.
route
const
options
=
currentPage
.
options
//拼接url的参数
let
urlWithArgs
=
`
${
url
}
?`
for
(
let
key
in
options
){
const
value
=
options
[
key
]
urlWithArgs
+=
`
${
key
}
=
${
value
}
&`
}
urlWithArgs
=
urlWithArgs
.
substring
(
0
,
urlWithArgs
.
length
-
1
)
return
urlWithArgs
}
\ 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