Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
uni-app-ddh-shop
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhanhai
uni-app-ddh-shop
Commits
4c031cd0
Commit
4c031cd0
authored
Nov 09, 2024
by
caimeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新弹框有bug;已修复
parent
3a74269c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
330 additions
and
317 deletions
+330
-317
App.vue
App.vue
+2
-4
upgradePopup.vue
components/showModal/upgradePopup.vue
+311
-300
index.less
pages/index/index.less
+2
-2
index.vue
pages/index/index.vue
+11
-8
index.vue
pages/starPage/index.vue
+4
-3
No files found.
App.vue
View file @
4c031cd0
...
@@ -44,15 +44,13 @@ export default {
...
@@ -44,15 +44,13 @@ export default {
// 存储所有请求的头部信息
// 存储所有请求的头部信息
uni
.
setStorage
({
key
:
'm-header-version'
,
data
:
versionNumber
});
uni
.
setStorage
({
key
:
'm-header-version'
,
data
:
versionNumber
});
})
})
/*** tabbar*/
switchShowTabbar
()
},
},
async
onShow
()
{
async
onShow
()
{
await
ininIndex
()
await
ininIndex
()
await
initSettings
()
await
initSettings
()
await
initApp
()
await
initApp
()
switchShowTabbar
()
},
},
/** 切换到后台 */
/** 切换到后台 */
onHide
()
{
onHide
()
{
...
...
components/showModal/upgradePopup.vue
View file @
4c031cd0
<
template
>
<
template
>
<view>
<view>
<!-- 遮罩滚动锁定组件 -->
<!-- 遮罩滚动锁定组件 -->
<page-meta
:page-style=
"'overflow:'
+(popupShow?'hidden':
'visible')"
></page-meta>
<page-meta
:page-style=
"'overflow:'
+ (popupShow ? 'hidden' :
'visible')"
></page-meta>
<uni-popup
ref=
"upgradePopup"
background-color=
"#fff"
class=
"upgradePopup"
@
change=
"upgradePopupChange"
<uni-popup
ref=
"upgradePopup"
background-color=
"#fff"
class=
"upgradePopup"
@
change=
"upgradePopupChange"
:mask-click=
"false"
>
:mask-click=
"false"
>
<view
class=
"rocket-content"
>
<view
class=
"rocket-content"
>
...
@@ -21,13 +21,15 @@
...
@@ -21,13 +21,15 @@
<view
class=
"update-content"
>
<view
class=
"update-content"
>
<text
space=
"nbsp"
>
{{
appUpgeadeObj
.
updateContent
}}
</text>
<text
space=
"nbsp"
>
{{
appUpgeadeObj
.
updateContent
}}
</text>
</view>
</view>
<view
v-if=
"updateButtonBoolean"
class=
"update-button"
>
<view
v-if=
"updateButtonBoolean"
class=
"update-button"
>
<button
class=
"not-updated-button"
:disabled=
"noUpdatedDisabled"
<button
class=
"not-updated-button"
:disabled=
"noUpdatedDisabled"
v-show=
"appUpgeadeObj.forceUpdate == false"
type=
"warn"
@
tap
.
stop=
"noUpdate"
>
暂不更新
</button>
v-show=
"appUpgeadeObj.forceUpdate == false"
type=
"warn"
@
tap
.
stop=
"noUpdate"
>
暂不更新
</button>
<button
v-show=
'appUpgeadeObj.type == "ANDROID"'
class=
"updated-button"
type=
"warn"
@
tap
.
stop=
"upgradeNowAndroid"
>
立即升级
</button>
<button
v-show=
'appUpgeadeObj.type == "ANDROID"'
class=
"updated-button"
type=
"warn"
<button
v-show=
'appUpgeadeObj.type == "IOS" '
class=
"updated-button"
type=
"warn"
@
tap
.
stop=
"upgradeNow"
>
立即升级
</button>
@
tap
.
stop=
"upgradeNowAndroid"
>
立即升级
</button>
<button
v-show=
'appUpgeadeObj.type == "IOS"'
class=
"updated-button"
type=
"warn"
@
tap
.
stop=
"upgradeNow"
>
立即升级
</button>
</view>
</view>
<!-- v-if="progressBolean" -->
<!-- v-if="progressBolean" -->
<!--
{{
progressBolean
}}
-->
<!--
{{
progressBolean
}}
-->
...
@@ -40,7 +42,7 @@
...
@@ -40,7 +42,7 @@
</
template
>
</
template
>
<
script
>
<
script
>
export
default
{
export
default
{
props
:
{
props
:
{
appUpgeadeObj
:
{
appUpgeadeObj
:
{
type
:
Object
,
type
:
Object
,
...
@@ -63,7 +65,7 @@
...
@@ -63,7 +65,7 @@
},
},
progressBolean
:
false
,
// 进度条的显示和隐藏
progressBolean
:
false
,
// 进度条的显示和隐藏
noUpdatedDisabled
:
false
,
noUpdatedDisabled
:
false
,
isWGT
:
false
,
// 是否wgt资源包
isWGT
:
false
,
// 是否wgt资源包
};
};
},
},
...
@@ -94,8 +96,11 @@
...
@@ -94,8 +96,11 @@
},
},
// 暂不更新按钮事件
// 暂不更新按钮事件
noUpdate
()
{
noUpdate
()
{
this
.
popupShow
=
false
uni
.
showTabBar
()
uni
.
showTabBar
()
setTimeout
(()
=>
{
this
.
$emit
(
'pause'
)
this
.
$emit
(
'pause'
)
},
10
)
},
},
// 立即升级事件
// 立即升级事件
upgradeNow
()
{
upgradeNow
()
{
...
@@ -104,26 +109,26 @@
...
@@ -104,26 +109,26 @@
let
platform
=
uni
.
getSystemInfoSync
().
platform
let
platform
=
uni
.
getSystemInfoSync
().
platform
const
wgtType
=
that
.
containsWGTExtension
(
that
.
appUpgeadeObj
.
downloadUrl
)
const
wgtType
=
that
.
containsWGTExtension
(
that
.
appUpgeadeObj
.
downloadUrl
)
that
.
isWGT
=
wgtType
that
.
isWGT
=
wgtType
const
index
=
that
.
appUpgeadeObj
.
downloadUrl
.
indexOf
(
'apps.apple.com'
)
const
index
=
that
.
appUpgeadeObj
.
downloadUrl
.
indexOf
(
'apps.apple.com'
)
console
.
log
(
that
.
isWGT
,
'that.isWGT3333'
)
console
.
log
(
that
.
isWGT
,
'that.isWGT3333'
)
if
(
that
.
isWGT
==
true
){
if
(
that
.
isWGT
==
true
)
{
that
.
updateWgt
(
that
.
appUpgeadeObj
.
downloadUrl
,
that
.
appUpgeadeObj
.
downloadUrl
.
versionName
)
that
.
updateWgt
(
that
.
appUpgeadeObj
.
downloadUrl
,
that
.
appUpgeadeObj
.
downloadUrl
.
versionName
)
}
else
{
}
else
{
if
(
platform
==
'ios'
&&
index
!==
-
1
)
return
plus
.
runtime
.
openURL
(
that
.
appUpgeadeObj
.
downloadUrl
);
if
(
platform
==
'ios'
&&
index
!==
-
1
)
return
plus
.
runtime
.
openURL
(
that
.
appUpgeadeObj
.
downloadUrl
);
}
}
},
},
upgradeNowAndroid
(){
upgradeNowAndroid
()
{
let
that
=
this
let
that
=
this
that
.
noUpdatedDisabled
=
true
that
.
noUpdatedDisabled
=
true
let
platform
=
uni
.
getSystemInfoSync
().
platform
let
platform
=
uni
.
getSystemInfoSync
().
platform
const
index
=
that
.
containsApkExtension
(
that
.
appUpgeadeObj
.
downloadUrl
)
const
index
=
that
.
containsApkExtension
(
that
.
appUpgeadeObj
.
downloadUrl
)
const
wgtType
=
that
.
containsWGTExtension
(
that
.
appUpgeadeObj
.
downloadUrl
)
const
wgtType
=
that
.
containsWGTExtension
(
that
.
appUpgeadeObj
.
downloadUrl
)
console
.
log
(
wgtType
,
'that.isWGT'
)
console
.
log
(
wgtType
,
'that.isWGT'
)
that
.
isWGT
=
wgtType
that
.
isWGT
=
wgtType
if
(
index
==
true
){
if
(
index
==
true
)
{
plus
.
runtime
.
getProperty
(
plus
.
runtime
.
appid
,
(
wgtinfo
)
=>
{
plus
.
runtime
.
getProperty
(
plus
.
runtime
.
appid
,
(
wgtinfo
)
=>
{
var
downloadTask
=
uni
.
downloadFile
({
var
downloadTask
=
uni
.
downloadFile
({
url
:
that
.
appUpgeadeObj
.
downloadUrl
,
url
:
that
.
appUpgeadeObj
.
downloadUrl
,
...
@@ -133,11 +138,11 @@
...
@@ -133,11 +138,11 @@
.
tempFilePath
,
{
.
tempFilePath
,
{
force
:
false
force
:
false
},
},
function
()
{
function
()
{
plus
.
cache
.
clear
();
plus
.
cache
.
clear
();
plus
.
runtime
.
restart
();
plus
.
runtime
.
restart
();
},
},
function
(
err
)
{
function
(
err
)
{
console
.
log
(
'err--------安装升级包失败'
,
err
)
console
.
log
(
'err--------安装升级包失败'
,
err
)
uni
.
showToast
({
uni
.
showToast
({
title
:
'安装升级包失败'
,
title
:
'安装升级包失败'
,
...
@@ -151,8 +156,8 @@
...
@@ -151,8 +156,8 @@
this
.
progressData
.
percent
=
res
.
progress
this
.
progressData
.
percent
=
res
.
progress
});
});
})
})
}
else
{
}
else
{
console
.
log
(
333
,
'indexw'
)
console
.
log
(
333
,
'indexw'
)
//跳转到应用商店
//跳转到应用商店
let
appurl
=
"market://details?id=io.dcloud.ddh"
let
appurl
=
"market://details?id=io.dcloud.ddh"
plus
.
runtime
.
openURL
(
appurl
)
plus
.
runtime
.
openURL
(
appurl
)
...
@@ -162,37 +167,37 @@
...
@@ -162,37 +167,37 @@
},
},
//wgt更新
//wgt更新
updateWgt
(
downloadUrl
,
newVersion
)
{
updateWgt
(
downloadUrl
,
newVersion
)
{
uni
.
showModal
({
uni
.
showModal
({
title
:
'已发现新版本'
,
title
:
'已发现新版本'
,
content
:
'确认更新?'
,
content
:
'确认更新?'
,
showCancel
:
false
,
showCancel
:
false
,
success
:
function
(
res
)
{
success
:
function
(
res
)
{
uni
.
setStorageSync
(
'checkVersions'
,
newVersion
)
uni
.
setStorageSync
(
'checkVersions'
,
newVersion
)
if
(
res
.
confirm
)
{
if
(
res
.
confirm
)
{
uni
.
downloadFile
({
uni
.
downloadFile
({
url
:
downloadUrl
,
url
:
downloadUrl
,
success
:
(
downloadResult
)
=>
{
success
:
(
downloadResult
)
=>
{
plus
.
runtime
.
install
(
downloadResult
.
tempFilePath
,{
force
:
true
},
function
(){
plus
.
runtime
.
install
(
downloadResult
.
tempFilePath
,
{
force
:
true
},
function
()
{
//应用热重启,重新启动进入首页
//应用热重启,重新启动进入首页
plus
.
runtime
.
restart
();
plus
.
runtime
.
restart
();
uni
.
showModal
({
uni
.
showModal
({
title
:
'安装成功!'
,
title
:
'安装成功!'
,
content
:
'已重新进入应用'
,
content
:
'已重新进入应用'
,
showCancel
:
false
,
showCancel
:
false
,
success
:
function
(
res
)
{
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
if
(
res
.
confirm
)
{
console
.
log
(
'用户点击确定'
);
console
.
log
(
'用户点击确定'
);
}
else
if
(
res
.
cancel
)
{
}
else
if
(
res
.
cancel
)
{
console
.
log
(
'用户点击确定'
);
console
.
log
(
'用户点击确定'
);
}
}
}
}
})
})
},
},
function
(
e
)
{
function
(
e
)
{
console
.
log
(
e
,
'安装失败'
)
console
.
log
(
e
,
'安装失败'
)
uni
.
showModal
({
uni
.
showModal
({
title
:
'安装失败'
,
title
:
'安装失败'
,
icon
:
'none'
icon
:
'none'
...
@@ -206,7 +211,7 @@
...
@@ -206,7 +211,7 @@
})
})
}
}
})
})
}
else
if
(
res
.
cancel
)
{
}
else
if
(
res
.
cancel
)
{
uni
.
showToast
({
uni
.
showToast
({
title
:
'已取消'
,
title
:
'已取消'
,
icon
:
'none'
icon
:
'none'
...
@@ -222,11 +227,11 @@
...
@@ -222,11 +227,11 @@
return
/
\.
wgt$/i
.
test
(
url
);
return
/
\.
wgt$/i
.
test
(
url
);
}
}
}
}
};
};
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
.upgradePopup
{
.upgradePopup
{
z-index
:
999
;
z-index
:
999
;
/
deep
/
.uni-popup__wrapper
{
/
deep
/
.uni-popup__wrapper
{
...
@@ -254,23 +259,27 @@
...
@@ -254,23 +259,27 @@
left
:
225rpx
;
left
:
225rpx
;
}
}
}
}
.content-v-des
{
.content-v-des
{
position
:
absolute
;
position
:
absolute
;
left
:
40rpx
;
left
:
40rpx
;
top
:
30rpx
;
top
:
30rpx
;
z-index
:
3
;
z-index
:
3
;
.content-v
{
.content-v
{
font-size
:
75rpx
;
font-size
:
75rpx
;
color
:
#FFFFFF
;
color
:
#FFFFFF
;
}
}
.content-text
{
.content-text
{
padding-top
:
20rpx
;
padding-top
:
20rpx
;
font-family
:
PingFangSC
,
PingFang
SC
;
font-family
:
PingFangSC
,
PingFang
SC
;
font-size
:
42rpx
;
font-size
:
42rpx
;
color
:
#333333
;
color
:
#333333
;
}
}
.title
{
.title
{
margin-top
:
20rpx
;
margin-top
:
20rpx
;
display
:
flex
;
display
:
flex
;
font-family
:
PingFangSC
,
PingFang
SC
;
font-family
:
PingFangSC
,
PingFang
SC
;
font-weight
:
400
;
font-weight
:
400
;
...
@@ -279,13 +288,15 @@
...
@@ -279,13 +288,15 @@
line-height
:
28px
;
line-height
:
28px
;
text-align
:
left
;
text-align
:
left
;
font-style
:
normal
;
font-style
:
normal
;
.info_desc_scroll
{
.info_desc_scroll
{
width
:
450rpx
;
width
:
450rpx
;
height
:
200rpx
;
height
:
200rpx
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
line-height
:
1
.3
;
line-height
:
1
.3
;
.scroll-text
{
padding-bottom
:
6rpx
;
.scroll-text
{
padding-bottom
:
6rpx
;
}
}
}
}
}
}
...
@@ -354,5 +365,5 @@
...
@@ -354,5 +365,5 @@
}
}
}
}
}
}
}
}
</
style
>
</
style
>
\ No newline at end of file
pages/index/index.less
View file @
4c031cd0
...
@@ -236,8 +236,8 @@
...
@@ -236,8 +236,8 @@
}
}
}
}
.box-at-home{
.box-at-home{
// height: 1200rpx;
background:#F7FAFF ;
background:#F7FAFF ;
.main-box{
.main-box{
display:flex;
display:flex;
flex-wrap: wrap;
flex-wrap: wrap;
...
...
pages/index/index.vue
View file @
4c031cd0
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
<view
class=
'i-header'
v-show=
'isFixed != true'
>
<view
class=
'i-header'
v-show=
'isFixed != true'
>
<text>
多典花
</text>
<text>
多典花
</text>
</view>
</view>
<view
v-if=
'index !== null'
class=
'i-boxs'
>
<view
v-if=
'index !== null'
class=
'i-boxs'
>
<!-- Banner 位 -->
<!-- Banner 位 -->
<view
class=
'i-banner'
>
<view
class=
'i-banner'
>
...
@@ -76,10 +77,10 @@
...
@@ -76,10 +77,10 @@
</view>
</view>
</view>
</view>
</scroll-view>
</scroll-view>
</view>
</view>
</view>
</view>
<!-- 更新 -->
<!-- 更新 -->
<upgrade-Popup
:app-upgeade-obj=
"appUpgeadeObj"
v-if=
"appUpgeadeObj.downloadUrl"
<upgrade-Popup
:app-upgeade-obj=
"appUpgeadeObj"
v-if=
"appUpgeadeObj.downloadUrl"
...
@@ -88,8 +89,7 @@
...
@@ -88,8 +89,7 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
isLogin
,
ininIndex
}
from
'@/utils/index'
import
{
isLogin
,
switchShowTabbar
,
ininIndex
}
from
'@/utils/index'
const
cacheIndexData
=
uni
.
getStorageSync
(
'dataIndex'
)
?
JSON
.
parse
(
uni
.
getStorageSync
(
'dataIndex'
))
:
null
;
const
cacheIndexData
=
uni
.
getStorageSync
(
'dataIndex'
)
?
JSON
.
parse
(
uni
.
getStorageSync
(
'dataIndex'
))
:
null
;
export
default
{
export
default
{
...
@@ -134,16 +134,19 @@ export default {
...
@@ -134,16 +134,19 @@ export default {
},
},
async
onLoad
()
{
async
onLoad
()
{
this
.
isFirstShow
=
uni
.
getStorageSync
(
'isFirstShow'
)
this
.
isFirstShow
=
uni
.
getStorageSync
(
'isFirstShow'
)
await
this
.
getAppVersion
()
},
},
async
onShow
()
{
async
onShow
()
{
// 初始化首页数据
ininIndex
()
ininIndex
()
// 显示隐藏tabBar
// 显示隐藏tabBar
// switchShowTabbar()
switchShowTabbar
()
// initSettings()
// 首页流量埋点
// 首页流量埋点
this
.
buryingPoint
(
'app:index_page_view'
)
this
.
buryingPoint
(
'app:index_page_view'
)
await
this
.
initAjax
();
await
this
.
initAjax
();
// await this.getAppVersion()
},
},
methods
:
{
methods
:
{
...
...
pages/starPage/index.vue
View file @
4c031cd0
...
@@ -9,9 +9,7 @@ import { ininIndex, initSettings, initApp } from '@/utils/index'
...
@@ -9,9 +9,7 @@ import { ininIndex, initSettings, initApp } from '@/utils/index'
export
default
{
export
default
{
async
onLoad
()
{
async
onLoad
()
{
await
ininIndex
()
await
initSettings
()
await
initApp
()
// 有网络了再弹窗
// 有网络了再弹窗
uni
.
getNetworkType
({
uni
.
getNetworkType
({
...
@@ -33,6 +31,9 @@ export default {
...
@@ -33,6 +31,9 @@ export default {
})
})
await
ininIndex
()
await
initSettings
()
await
initApp
()
},
},
methods
:
{
methods
:
{
init
()
{
init
()
{
...
...
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