Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 72064277
authored
Sep 02, 2024
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'SAAS+V4.44' into SAAS+V4.44.1
2 parents
961d5788
37ba75e4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
232 additions
and
264 deletions
assets/css/sprite.scss
components/HomeFrame/components/SettingBox.vue
components/Insurance/components/InsuranceTable.vue
uni_modules/uni-upgrade-center-app/utils/check-update-nvue.js
assets/css/sprite.scss
View file @
7206427
...
...
@@ -59,4 +59,4 @@
.icon-tool-finish
{
width
:
60rpx
;
height
:
60rpx
;
background-position
:
-526rpx
-964rpx
;}
.icon-tool-pay
{
width
:
60rpx
;
height
:
60rpx
;
background-position
:
-601rpx
-964rpx
;}
.icon-total
{
width
:
32rpx
;
height
:
32rpx
;
background-position
:
-664rpx
-853rpx
;}
.icon-visible
{
width
:
40rpx
;
height
:
40rpx
;
background-position
:
-1105rpx
-668rpx
;}
\ No newline at end of file
.icon-visible
{
width
:
40rpx
;
height
:
40rpx
;
background-position
:
-1105rpx
-668rpx
;}
components/HomeFrame/components/SettingBox.vue
View file @
7206427
...
...
@@ -30,100 +30,143 @@
<
script
type=
"text/ecmascript-6"
>
import
checkUpdate
from
"@/uni_modules/uni-upgrade-center-app/utils/check-update-nvue.js"
;
export
default
{
name
:
'SettingBox'
,
data
()
{
return
{
version
:
''
,
deviceId
:
''
}
},
mounted
()
{
this
.
version
=
plus
?.
runtime
?.
version
||
'1.0.0'
const
{
deviceId
}
=
uni
.
getDeviceInfo
()
this
.
deviceId
=
deviceId
},
methods
:
{
copyText
()
{
uni
.
setClipboardData
({
data
:
this
.
deviceId
,
success
:
function
()
{
uni
.
showToast
({
title
:
'复制成功'
,
icon
:
'success'
});
}
});
},
async
handleCheck
()
{
try
{
await
checkUpdate
()
this
.
close
()
}
catch
(
error
)
{
name
:
'SettingBox'
,
data
()
{
return
{
version
:
''
,
deviceId
:
''
}
},
mounted
()
{
this
.
version
=
plus
?.
runtime
?.
version
||
'1.0.0'
const
{
deviceId
}
=
uni
.
getDeviceInfo
()
this
.
deviceId
=
deviceId
},
methods
:
{
copyText
()
{
uni
.
setClipboardData
({
data
:
this
.
deviceId
,
success
:
function
()
{
uni
.
showToast
({
title
:
'复制成功'
,
icon
:
'success'
});
}
});
},
/** 比较版本号的大小
**/
compareVersions
(
version1
,
version2
)
{
const
v1
=
version1
.
split
(
'.'
).
map
(
v
=>
+
v
)
// 转化成数字数组
const
v2
=
version2
.
split
(
'.'
).
map
(
v
=>
+
v
)
const
b1
=
v1
.
every
(
v
=>
!
isNaN
(
v
))
// 判断数组的每一项是否是数字
const
b2
=
v2
.
every
(
v
=>
!
isNaN
(
v
))
// 如果不是则返回错误信息
if
(
!
b1
||
!
b2
)
return
'版本号错误,只能包含数字、.'
const
len
=
Math
.
max
(
v1
.
length
,
v2
.
length
)
for
(
let
i
=
0
;
i
<
len
;
i
++
)
{
const
num1
=
v1
[
i
]
||
0
const
num2
=
v2
[
i
]
||
0
if
(
num1
>
num2
)
return
1
// 如果版本号1大于版本号2,则输出1
if
(
num1
<
num2
)
return
-
1
// 反之则输出 -1
}
// 如果版本号1 等于版本号2,则输出0
return
0
},
async
handleCheck
()
{
const
{
textList
,
tempFileURL
,
version
}
=
uni
.
$storage
.
get
(
'mock_data'
)
const
res
=
this
.
compareVersions
(
this
.
version
,
version
)
if
(
res
>
-
1
)
{
uni
.
showToast
({
title
:
'目前已是最新版本'
,
duration
:
2000
,
icon
:
'none'
});
}
},
open
()
{
this
.
$refs
.
popup
.
open
(
"center"
);
},
close
()
{
this
.
$refs
.
popup
.
close
()
},
changeAccount
()
{
uni
.
reLaunch
({
url
:
'/pages/common/accountItems'
})
},
// 退出
logout
()
{
let
_this
=
this
uni
.
showModal
({
title
:
'温馨提示'
,
content
:
'是否退出当前账号?'
,
confirmColor
:
'#347BFF'
,
async
success
(
res
)
{
if
(
res
.
confirm
)
{
_this
.
$emit
(
'stopAudio'
)
try
{
uni
.
showLoading
({
mask
:
true
})
const
{
code
,
message
}
=
await
uni
.
$api
.
userApi
.
logout
(),
userInfo
=
uni
.
$storage
.
get
(
"userInfo"
)
console
.
log
(
code
)
if
(
code
==
0
)
{
uni
.
$storage
.
rm
(
"userInfo"
);
uni
.
$storage
.
rm
(
"sessionId"
);
uni
.
$storage
.
rm
(
"noSignInUuid"
);
setTimeout
(()
=>
{
uni
.
hideLoading
()
uni
.
reLaunch
({
url
:
`/pages/common/login?mobile=
${
userInfo
.
phone
}
`
,
});
},
500
)
}
else
throw
message
}
catch
(
error
)
{
console
.
log
(
error
)
uni
.
hideLoading
()
uni
.
showToast
({
title
:
error
,
icon
:
"none"
,
});
}
}
}
})
},
jump
(
type
)
{
let
url
=
type
==
'icp'
?
'https://beian.miit.gov.cn/'
:
'https://img01.glsx.com.cn/weapp/resource/saas/app/privacy.html'
uni
.
navigateTo
({
url
:
`/pages/common/webview?url=
${
url
}
`
})
}
}
return
}
this
.
close
()
const
e
=
{
result
:
{
"is_silently"
:
false
,
"is_mandatory"
:
true
,
"name"
:
""
,
"title"
:
""
,
"contents"
:
textList
.
join
(
'\n'
),
"version"
:
version
,
"url"
:
tempFileURL
,
"stable_publish"
:
true
,
},
}
checkUpdate
(
e
)
},
open
()
{
this
.
$refs
.
popup
.
open
(
"center"
);
},
close
()
{
this
.
$refs
.
popup
.
close
()
},
changeAccount
()
{
uni
.
reLaunch
({
url
:
'/pages/common/accountItems'
})
},
// 退出
logout
()
{
let
_this
=
this
uni
.
showModal
({
title
:
'温馨提示'
,
content
:
'是否退出当前账号?'
,
confirmColor
:
'#347BFF'
,
async
success
(
res
)
{
if
(
res
.
confirm
)
{
_this
.
$emit
(
'stopAudio'
)
try
{
uni
.
showLoading
({
mask
:
true
})
const
{
code
,
message
}
=
await
uni
.
$api
.
userApi
.
logout
(),
userInfo
=
uni
.
$storage
.
get
(
"userInfo"
)
console
.
log
(
code
)
if
(
code
==
0
)
{
uni
.
$storage
.
rm
(
"userInfo"
);
uni
.
$storage
.
rm
(
"sessionId"
);
uni
.
$storage
.
rm
(
"noSignInUuid"
);
setTimeout
(()
=>
{
uni
.
hideLoading
()
uni
.
reLaunch
({
url
:
`/pages/common/login?mobile=
${
userInfo
.
phone
}
`
,
});
},
500
)
}
else
throw
message
}
catch
(
error
)
{
console
.
log
(
error
)
uni
.
hideLoading
()
uni
.
showToast
({
title
:
error
,
icon
:
"none"
,
});
}
}
}
})
},
jump
(
type
)
{
let
url
=
type
==
'icp'
?
'https://beian.miit.gov.cn/'
:
'https://img01.glsx.com.cn/weapp/resource/saas/app/privacy.html'
uni
.
navigateTo
({
url
:
`/pages/common/webview?url=
${
url
}
`
})
}
}
}
</
script
>
...
...
@@ -139,6 +182,7 @@ export default {
align-items
:
center
;
justify-content
:
center
;
flex-direction
:
column
;
.close
{
position
:
absolute
;
width
:
120
rpx
;
...
...
@@ -147,20 +191,24 @@ export default {
right
:
0
;
justify-content
:
center
;
}
.app-info
{
flex-direction
:
column
;
font-size
:
32
rpx
;
color
:
#333333
;
.sprite-icon
{
margin-bottom
:
12
rpx
;
box-shadow
:
0
0
24
rpx
0
#3682ef33
;
border-radius
:
40
rpx
;
}
.version
{
margin-top
:
8
rpx
;
font-size
:
24
rpx
;
color
:
#999999
;
}
.check-box
{
width
:
120
rpx
;
padding
:
10
rpx
0
rpx
4
rpx
;
...
...
@@ -173,8 +221,10 @@ export default {
box-sizing
:
border-box
;
}
}
.btn-box
{
margin-top
:
120
rpx
;
.btn
{
width
:
384
rpx
;
height
:
64
rpx
;
...
...
@@ -186,25 +236,30 @@ export default {
color
:
#3b73ff
;
margin-bottom
:
16
rpx
;
}
.logout
{
background
:
#ffffff
;
color
:
#333333
;
border
:
2
rpx
solid
#e8e8e8
;
}
}
.a
{
font-size
:
24
rpx
;
color
:
#2c66f7
;
margin
:
48
rpx
0
16
rpx
;
}
.icp
{
font-size
:
24
rpx
;
color
:
#999999
;
}
.app-code
{
font-size
:
24
rpx
;
color
:
#999999
;
line-height
:
40
rpx
;
.icon-clone
{
width
:
24
rpx
;
height
:
24
rpx
;
...
...
components/Insurance/components/InsuranceTable.vue
View file @
7206427
...
...
@@ -130,10 +130,6 @@ export default {
setTimeout
(()
=>
{
this
.
scrollTop
=
0
},
100
);
}
},
show
(
n
)
{
if
(
n
)
{
const
{
storageKey
}
=
this
,
insuranceList
=
uni
.
getStorageSync
(
storageKey
)
if
(
insuranceList
)
{
...
...
@@ -141,6 +137,11 @@ export default {
this
.
insuranceList
=
JSON
.
parse
(
JSON
.
stringify
(
insuranceList
))
this
.
flag
=
true
}
}
},
show
(
n
)
{
if
(
n
)
{
this
.
getMerchantInsuranceList
()
}
},
...
...
@@ -258,8 +259,8 @@ export default {
return
processedString
},
choose
(
item
,
index
)
{
if
(
this
.
isPreview
)
return
choose
(
item
,
index
)
{
if
(
this
.
isPreview
)
return
this
.
insuranceList
[
index
].
checked
=
!
item
.
checked
},
}
...
...
uni_modules/uni-upgrade-center-app/utils/check-update-nvue.js
View file @
7206427
function
callCheckVersion
()
{
// #ifdef APP-PLUS
return
new
Promise
((
resolve
,
reject
)
=>
{
plus
.
runtime
.
getProperty
(
plus
.
runtime
.
appid
,
function
(
widgetInfo
)
{
let
data
=
{
action
:
'checkVersion'
,
appid
:
plus
.
runtime
.
appid
,
appVersion
:
plus
.
runtime
.
version
,
wgtVersion
:
widgetInfo
.
version
}
uniCloud
.
callFunction
({
name
:
'uni-upgrade-center'
,
data
,
success
:
(
e
)
=>
{
resolve
(
e
)
},
fail
:
(
error
)
=>
{
reject
(
error
)
}
})
})
})
// #endif
// #ifndef APP-PLUS
return
new
Promise
((
resolve
,
reject
)
=>
{})
// #endif
}
// 推荐再App.vue中使用
const
PACKAGE_INFO_KEY
=
'__package_info__'
export
default
function
()
{
// #ifdef APP-PLUS
return
new
Promise
((
resolve
,
reject
)
=>
{
callCheckVersion
().
then
(
async
(
e
)
=>
{
if
(
!
e
.
result
)
return
;
const
{
code
,
message
,
is_silently
,
// 是否静默更新
url
,
// 安装包下载地址
platform
,
// 安装包平台
type
// 安装包类型
}
=
e
.
result
;
// 此处逻辑仅为实例,可自行编写
if
(
code
>
0
)
{
// 腾讯云和阿里云下载链接不同,需要处理一下,阿里云会原样返回
const
{
fileList
}
=
await
uniCloud
.
getTempFileURL
({
fileList
:
[
url
]
});
if
(
fileList
[
0
].
tempFileURL
)
e
.
result
.
url
=
fileList
[
0
].
tempFileURL
;
resolve
(
e
)
// 静默更新,只有wgt有
if
(
is_silently
)
{
uni
.
downloadFile
({
url
:
e
.
result
.
url
,
success
:
res
=>
{
if
(
res
.
statusCode
==
200
)
{
// 下载好直接安装,下次启动生效
plus
.
runtime
.
install
(
res
.
tempFilePath
,
{
force
:
false
});
}
}
});
return
;
}
/**
* 提示升级一
* 使用 uni.showModal
*/
// return updateUseModal(e.result)
export
default
function
(
e
)
{
// #ifdef APP-PLUS
uni
.
setStorageSync
(
PACKAGE_INFO_KEY
,
e
.
result
)
uni
.
navigateTo
({
url
:
`/uni_modules/uni-upgrade-center-app/pages/upgrade-popup?local_storage_key=
${
PACKAGE_INFO_KEY
}
`
,
fail
:
err
=>
{
console
.
error
(
'更新弹框跳转失败'
,
err
)
uni
.
removeStorageSync
(
PACKAGE_INFO_KEY
)
}
})
/**
* 提示升级二
* 官方适配的升级弹窗,可自行替换资源适配UI风格
*/
uni
.
setStorageSync
(
PACKAGE_INFO_KEY
,
e
.
result
)
uni
.
navigateTo
({
url
:
`/uni_modules/uni-upgrade-center-app/pages/upgrade-popup?local_storage_key=
${
PACKAGE_INFO_KEY
}
`
,
fail
:
(
err
)
=>
{
console
.
error
(
'更新弹框跳转失败'
,
err
)
uni
.
removeStorageSync
(
PACKAGE_INFO_KEY
)
}
})
return
}
else
if
(
code
<
0
)
{
// TODO 云函数报错处理
console
.
error
(
message
)
return
reject
(
e
)
}
return
resolve
(
e
)
}).
catch
(
err
=>
{
// TODO 云函数报错处理
console
.
error
(
err
.
message
)
reject
(
err
)
})
});
// #endif
// #endif
}
/**
* 使用 uni.showModal 升级
*/
function
updateUseModal
(
packageInfo
)
{
const
{
title
,
// 标题
contents
,
// 升级内容
is_mandatory
,
// 是否强制更新
url
,
// 安装包下载地址
platform
,
// 安装包平台
type
// 安装包类型
}
=
packageInfo
;
const
{
title
,
// 标题
contents
,
// 升级内容
is_mandatory
,
// 是否强制更新
url
,
// 安装包下载地址
platform
,
// 安装包平台
type
// 安装包类型
}
=
packageInfo
let
isWGT
=
type
===
'wgt'
let
isiOS
=
!
isWGT
?
platform
.
includes
(
'iOS'
)
:
false
;
let
confirmText
=
isiOS
?
'立即跳转更新'
:
'立即下载更新'
let
isWGT
=
type
===
'wgt'
let
isiOS
=
!
isWGT
?
platform
.
includes
(
'iOS'
)
:
false
let
confirmText
=
isiOS
?
'立即跳转更新'
:
'立即下载更新'
return
uni
.
showModal
({
title
,
content
:
contents
,
showCancel
:
!
is_mandatory
,
confirmText
,
success
:
res
=>
{
if
(
res
.
cancel
)
return
;
return
uni
.
showModal
({
title
,
content
:
contents
,
showCancel
:
!
is_mandatory
,
confirmText
,
success
:
res
=>
{
if
(
res
.
cancel
)
return
// 安装包下载
if
(
isiOS
)
{
plus
.
runtime
.
openURL
(
url
);
return
;
}
// 安装包下载
if
(
isiOS
)
{
plus
.
runtime
.
openURL
(
url
)
return
}
uni
.
showToast
({
title
:
'后台下载中……'
,
duration
:
1000
});
uni
.
showToast
({
title
:
'后台下载中……'
,
duration
:
1000
})
// wgt 和 安卓下载更新
downloadTask
=
uni
.
downloadFile
({
url
,
success
:
res
=>
{
if
(
res
.
statusCode
!==
200
)
{
console
.
error
(
'下载安装包失败'
,
err
);
return
;
}
// 下载好直接安装,下次启动生效
plus
.
runtime
.
install
(
res
.
tempFilePath
,
{
force
:
false
},
()
=>
{
if
(
is_mandatory
)
{
//更新完重启app
plus
.
runtime
.
restart
();
return
;
}
uni
.
showModal
({
title
:
'安装成功是否重启?'
,
success
:
res
=>
{
if
(
res
.
confirm
)
{
//更新完重启app
plus
.
runtime
.
restart
();
}
}
});
},
err
=>
{
uni
.
showModal
({
title
:
'更新失败'
,
content
:
err
.
message
,
showCancel
:
false
});
});
}
});
}
});
// wgt 和 安卓下载更新
downloadTask
=
uni
.
downloadFile
({
url
,
success
:
res
=>
{
if
(
res
.
statusCode
!==
200
)
{
console
.
error
(
'下载安装包失败'
,
err
)
return
}
// 下载好直接安装,下次启动生效
plus
.
runtime
.
install
(
res
.
tempFilePath
,
{
force
:
false
},
()
=>
{
if
(
is_mandatory
)
{
//更新完重启app
plus
.
runtime
.
restart
()
return
}
uni
.
showModal
({
title
:
'安装成功是否重启?'
,
success
:
res
=>
{
if
(
res
.
confirm
)
{
//更新完重启app
plus
.
runtime
.
restart
()
}
}
})
},
err
=>
{
uni
.
showModal
({
title
:
'更新失败'
,
content
:
err
.
message
,
showCancel
:
false
})
}
)
}
})
}
})
}
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