Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mes-pad
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ximai
mes-pad
Commits
521092d1
Commit
521092d1
authored
Jun 25, 2024
by
沈翠玲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app自动更新
parent
84d0139c
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
142 additions
and
22 deletions
+142
-22
App.vue
App.vue
+15
-2
checkappupdate.js
common/checkappupdate.js
+104
-0
config.js
common/config.js
+2
-2
http.api.js
common/http.api.js
+5
-2
manifest.json
manifest.json
+14
-14
index.vue
pages/mes/prodReport/index.vue
+1
-1
vue.config.js
vue.config.js
+1
-1
No files found.
App.vue
View file @
521092d1
<
script
>
import
checkappupdate
from
'common/checkappupdate.js'
export
default
{
onLaunch
:
function
()
{
// #ifdef APP-PLUS
plus
.
navigator
.
setFullscreen
(
true
);
plus
.
screen
.
lockOrientation
(
'landscape-primary'
);
const
fn
=
()
=>
{
checkappupdate
.
check
({
title
:
'检测到有新版本!'
,
content
:
'请升级app到最新版本!'
,
canceltext
:
'暂不升级'
,
oktext
:
'立即升级'
,
func
:
this
.
$u
.
api
.
getCurrentsys
})
return
fn
// 函数中返回自身
}
setInterval
(
fn
(),
3600
*
1000
)
// #endif
},
//把想要全局的数据放在globalData对象里,globalData是uniapp的不可以自定义命名。
...
...
common/checkappupdate.js
0 → 100644
View file @
521092d1
import
config
from
'./config.js'
function
check
(
param
=
{})
{
// 合并默认参数
param
=
Object
.
assign
({
title
:
"检测到有新版本!"
,
content
:
"请升级app到最新版本!"
,
canceltext
:
"暂不升级"
,
oktext
:
"立即升级"
},
param
)
plus
.
runtime
.
getProperty
(
plus
.
runtime
.
appid
,
(
widgetInfo
)
=>
{
let
platform
=
plus
.
os
.
name
.
toLocaleLowerCase
()
try
{
param
.
func
().
then
(
result
=>
{
let
data
=
result
.
data
?
result
.
data
[
0
]
:
null
;
if
(
widgetInfo
.
version
===
data
.
version
)
{
return
;
}
if
(
result
.
code
==
200
)
{
// android进行如下操作
uni
.
showModal
({
title
:
param
.
title
,
content
:
data
.
updateDesc
?
data
.
updateDesc
+
''
:
param
.
content
,
showCancel
:
false
,
confirmText
:
param
.
oktext
,
cancelText
:
param
.
canceltext
,
success
:
res
=>
{
if
(
!
res
.
confirm
)
{
console
.
log
(
'取消了升级'
);
plus
.
runtime
.
quit
();
}
// 清除缓存
// request.clearLogin();
// 开始下载
// 创建下载任务
var
dtask
=
plus
.
downloader
.
createDownload
(
data
.
url
,
{
filename
:
"_downloads/"
},
function
(
d
,
status
)
{
// 下载完成
if
(
status
==
200
)
{
plus
.
runtime
.
install
(
d
.
filename
,
{
force
:
true
},
function
()
{
//进行重新启动;
plus
.
runtime
.
restart
();
},
(
e
)
=>
{
uni
.
showToast
({
title
:
'安装升级包失败:'
+
JSON
.
stringify
(
e
),
icon
:
'none'
})
});
}
else
{
this
.
tui
.
toast
(
"下载升级包失败,请手动去站点下载安装,错误码: "
+
status
);
}
});
let
view
=
new
plus
.
nativeObj
.
View
(
"maskView"
,
{
backgroundColor
:
"rgba(0,0,0,.6)"
,
left
:
'0px'
,
bottom
:
"0px"
,
width
:
plus
.
screen
.
resolutionWidth
,
height
:
plus
.
screen
.
resolutionHeight
})
view
.
drawText
(
'开始下载'
,
{},
{
size
:
'12px'
,
color
:
'#FFFFFF'
});
view
.
show
()
dtask
.
addEventListener
(
"statechanged"
,
(
e
)
=>
{
if
(
e
&&
e
.
downloadedSize
>
0
)
{
let
jindu
=
((
e
.
downloadedSize
/
e
.
totalSize
)
*
100
).
toFixed
(
2
)
view
.
reset
();
view
.
drawText
(
'进度:'
+
jindu
+
'%'
,
{},
{
size
:
'12px'
,
color
:
'#FFFFFF'
});
}
},
false
);
dtask
.
start
();
}
})
}
})
}
catch
(
e
)
{
console
.
log
(
'eee'
,
e
)
}
});
}
export
default
{
check
}
common/config.js
View file @
521092d1
...
...
@@ -22,8 +22,8 @@ const config = {
// 设置后台接口服务的基础地址
// config.baseUrl = 'http://192.168.3.91:8080';
//
config.baseUrl = 'http://192.168.3.91:8100';
config
.
baseUrl
=
'/api'
;
config
.
baseUrl
=
'http://192.168.3.91:8100'
;
//
config.baseUrl = '/api';
//测试环境
// config.baseUrl = 'http://192.168.3.91:8080';
...
...
common/http.api.js
View file @
521092d1
...
...
@@ -29,7 +29,10 @@ const install = (Vue, vm) => {
vm
.
$u
.
post
(
config
.
adminPath
+
'/mobile/login/sendCode'
,
params
),
registerUser
:
(
params
=
{})
=>
vm
.
$u
.
post
(
config
.
adminPath
+
'/mobile/user/registerUser'
,
params
),
getCurrentsys
:
(
params
=
{})
=>
vm
.
$u
.
get
(
config
.
adminPath
+
'/md/appconfig/getVersion'
),
/**
* 系统设置API
*/
...
...
manifest.json
View file @
521092d1
{
"name"
:
"mes-pad"
,
"appid"
:
"__UNI__E
A378AB
"
,
"appid"
:
"__UNI__E
FAA56F
"
,
"description"
:
"MES-PAD"
,
"versionName"
:
"1.0.0"
,
"versionCode"
:
"100"
,
...
...
@@ -61,13 +61,13 @@
},
"icons"
:
{
"android"
:
{
"hdpi"
:
"
unpackage/res/icons/72x72
.png"
,
"xhdpi"
:
"
unpackage/res/icons/96x96
.png"
,
"xxhdpi"
:
"
unpackage/res/icons/144x144
.png"
,
"xxxhdpi"
:
"
unpackage/res/icons/192x192
.png"
"hdpi"
:
"
static/logo
.png"
,
"xhdpi"
:
"
static/logo
.png"
,
"xxhdpi"
:
"
static/logo
.png"
,
"xxxhdpi"
:
"
static/logo
.png"
},
"ios"
:
{
"appstore"
:
"
unpackage/res/icons/1024x1024
.png"
,
"appstore"
:
"
static/logo
.png"
,
"ipad"
:
{
"app"
:
"unpackage/res/icons/76x76.png"
,
"app@2x"
:
"unpackage/res/icons/152x152.png"
,
...
...
@@ -80,14 +80,14 @@
"spotlight@2x"
:
"unpackage/res/icons/80x80.png"
},
"iphone"
:
{
"app@2x"
:
"
unpackage/res/icons/120x120
.png"
,
"app@3x"
:
"
unpackage/res/icons/180x180
.png"
,
"notification@2x"
:
"
unpackage/res/icons/40x40
.png"
,
"notification@3x"
:
"
unpackage/res/icons/60x60
.png"
,
"settings@2x"
:
"
unpackage/res/icons/58x58
.png"
,
"settings@3x"
:
"
unpackage/res/icons/87x87
.png"
,
"spotlight@2x"
:
"
unpackage/res/icons/80x80
.png"
,
"spotlight@3x"
:
"
unpackage/res/icons/120x120
.png"
"app@2x"
:
"
static/logo
.png"
,
"app@3x"
:
"
static/logo
.png"
,
"notification@2x"
:
"
static/logo
.png"
,
"notification@3x"
:
"
static/logo
.png"
,
"settings@2x"
:
"
static/logo
.png"
,
"settings@3x"
:
"
static/logo
.png"
,
"spotlight@2x"
:
"
static/logo
.png"
,
"spotlight@3x"
:
"
static/logo
.png"
}
}
}
...
...
pages/mes/prodReport/index.vue
View file @
521092d1
...
...
@@ -291,7 +291,7 @@
</view>
<view
v-else
>
<u-form
label-width=
"
8
0px"
:model=
"feedback"
:rules=
"rules"
labelAlign=
"right"
>
<u-form
label-width=
"
10
0px"
:model=
"feedback"
:rules=
"rules"
labelAlign=
"right"
>
<u-row>
<u-col
span=
"6"
>
<u-form-item
label=
"任务单号:"
prop=
"quantity"
>
...
...
vue.config.js
View file @
521092d1
...
...
@@ -17,7 +17,7 @@ module.exports = {
devServer
:
{
proxy
:
{
'/api'
:
{
target
:
'http://
localhost:8080/
'
,
target
:
'http://
192.168.3.91:8100
'
,
changeOrigin
:
true
,
pathRewrite
:
{
'^/api'
:
''
...
...
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