Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
梁建民
/
wmsApp
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
2dcb7512
authored
Dec 18, 2023
by
LJM
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
更新逻辑优化
parent
40911097
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
164 additions
and
35 deletions
App.vue
assets/css/mine/login.scss
manifest.json
pages/mine/login.vue
pages/stocktake/operate.vue
util/api.js
App.vue
View file @
2dcb7512
...
...
@@ -5,14 +5,11 @@
console
.
log
(
'App Launch'
);
},
onShow
:
function
()
{
console
.
log
(
'App Show'
);
let
wms_version
=
uni
.
getStorageSync
(
'wms_version'
)
||
''
;
//获取系统版本
console
.
log
(
'App Show 首页初始化...'
);
var
wms_version
=
uni
.
getStorageSync
(
'wms_version'
)
||
''
;
this
.
request
(
API
.
getLatestAppInfo
,
'POST'
,
{},
false
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
wms_version
==
''
)
{
uni
.
setStorageSync
(
'wms_version'
,
res
.
data
.
latest_app_info
.
wms_version
);
}
else
{
if
(
wms_version
)
{
//判断是否跟线上版本一样
if
(
wms_version
!=
res
.
data
.
latest_app_info
.
wms_version
)
{
uni
.
showModal
({
...
...
@@ -22,12 +19,9 @@
cancelText
:
'取消更新'
,
success
:
data
=>
{
if
(
data
.
confirm
)
{
uni
.
setStorageSync
(
'wms_version'
,
res
.
data
.
latest_app_info
.
wms_version
);
this
.
downloadApk
(
res
.
data
.
latest_app_info
.
download_url
);
this
.
downloadApk
(
res
.
data
.
latest_app_info
.
download_url
);
//开始下载apk文件
console
.
log
(
'用户点击确定'
);
}
else
if
(
data
.
cancel
)
{
console
.
log
(
'用户点击取消'
);
}
}
else
if
(
data
.
cancel
)
{}
}
});
}
...
...
@@ -47,9 +41,11 @@
});
let
dtask
=
plus
.
downloader
.
createDownload
(
url
,
{},
(
d
,
status
)
=>
{
if
(
status
==
200
)
{
this
.
local_version
=
this
.
online_version
;
//更新最新版本号
uni
.
setStorageSync
(
'wms_version'
,
this
.
online_version
);
//更新本地存储最新版本号
uni
.
hideLoading
();
//下载成功后调用安装方法
this
.
installApk
(
d
.
filename
);
uni
.
hideLoading
();
}
else
{
uni
.
showToast
({
title
:
'下载失败'
,
...
...
@@ -65,13 +61,9 @@
plus
.
runtime
.
install
(
filePath
,
{},
()
=>
{
console
.
log
(
'
安装
成功'
);
console
.
log
(
'
更新
成功'
);
},
e
=>
{
uni
.
showToast
({
title
:
'安装失败'
,
icon
:
'error'
});
console
.
log
(
'安装失败:'
+
JSON
.
stringify
(
e
));
}
);
...
...
assets/css/mine/login.scss
View file @
2dcb7512
...
...
@@ -53,6 +53,35 @@
color
:
#ffffff
;
margin-top
:
33rpx
;
}
.check-update
{
position
:
relative
;
margin-top
:
33rpx
;
width
:
495rpx
;
font-size
:
22rpx
;
.tip
{
color
:
#1969f9
;
}
.version
{
color
:
#919399
;
font-size
:
20rpx
;
margin-left
:
6rpx
;
}
.online_version
{
position
:
relative
;
&
.curr
{
&
:
:
after
{
position
:
absolute
;
top
:
-14rpx
;
right
:
-8rpx
;
width
:
10rpx
;
height
:
10rpx
;
border-radius
:
50%
;
background-color
:
#f00
;
content
:
''
;
}
}
}
}
.copyright
{
margin-top
:
34rpx
;
font-size
:
15rpx
;
...
...
manifest.json
View file @
2dcb7512
{
"name"
:
"wms"
,
"appid"
:
"__UNI__655E80D"
,
"description"
:
""
,
"versionName"
:
"
1.0
.1"
,
"versionCode"
:
"100"
,
"description"
:
"
供应链仓储App
"
,
"versionName"
:
"
2.2
.1"
,
"versionCode"
:
100000000
,
"transformPx"
:
false
,
/*
5
+App特有相关
*/
"app-plus"
:
{
...
...
pages/mine/login.vue
View file @
2dcb7512
...
...
@@ -20,6 +20,16 @@
<input
class=
"uni-input"
password
placeholder=
"请输入账号密码"
placeholder-style=
"color:#919399"
v-model=
"passwd"
@
input=
"onKeyInput"
/>
</view>
<button
class=
"btn row rowCenter verCenter"
@
click=
"submit()"
:disabled=
"disabled"
>
登录
</button>
<view
class=
"check-update row verCenter bothSide"
@
click=
"checkUpdate(1)"
>
<view
class=
"local_version row verCenter"
>
<text
class=
"tip"
>
本地版本
</text>
<text
class=
"version"
>
{{
local_version
||
'0.0.0'
}}
</text>
</view>
<view
class=
"online_version row verCenter"
:class=
"
{curr:active}">
<text
class=
"tip"
>
最新版本
</text>
<text
class=
"version"
>
{{
online_version
}}
</text>
</view>
</view>
<text
class=
"copyright"
>
© 深圳市猎芯科技有限公司
</text>
</view>
</
template
>
...
...
@@ -35,7 +45,11 @@
array
:
[
'深圳市猎芯科技有限公司'
,
'深贸电子有限公司'
,
'深圳华云数智工业科技有限公司'
],
name
:
''
,
passwd
:
''
,
disabled
:
false
disabled
:
false
,
isFirst
:
true
,
online_version
:
''
,
//线上后台版本
local_version
:
uni
.
getStorageSync
(
'wms_version'
),
//本地存储的版本
active
:
false
//是否更新
};
},
onLoad
()
{
...
...
@@ -48,6 +62,8 @@
const
name
=
uni
.
getStorageSync
(
'name'
)
||
''
;
const
passwd
=
uni
.
getStorageSync
(
'passwd'
)
||
''
;
this
.
checkUpdate
();
if
(
name
&&
passwd
)
{
this
.
name
=
name
;
this
.
passwd
=
passwd
;
...
...
@@ -66,6 +82,97 @@
this
.
disabled
=
false
;
},
/**
* 检查app是否需要更新
*/
checkUpdate
(
type
)
{
this
.
request
(
API
.
getLatestAppInfo
,
'POST'
,
{},
true
).
then
(
res
=>
{
this
.
online_version
=
res
.
data
.
latest_app_info
.
wms_version
||
'0.0.0'
;
//赋值线上版本
if
(
res
.
code
===
0
)
{
//判断进来第一次
if
(
this
.
isFirst
&&
!
this
.
local_version
)
{
this
.
local_version
=
res
.
data
.
latest_app_info
.
wms_version
;
//更新本地版本号
uni
.
setStorageSync
(
'wms_version'
,
res
.
data
.
latest_app_info
.
wms_version
);
//第一次存取本地版本号
//本地版本和线上版本不一样,就提示小红点
if
(
this
.
local_version
!=
this
.
online_version
)
{
this
.
active
=
true
;
//样式标记
this
.
isFirst
=
false
;
return
false
;
}
}
else
{
if
(
this
.
local_version
!=
this
.
online_version
)
{
this
.
active
=
true
;
//样式标记
}
}
//只有点击才会触发
if
(
type
)
{
//判断本地版本和线上版本是否一致
if
(
this
.
local_version
!=
this
.
online_version
)
{
//用户更新提示确认
uni
.
showModal
({
title
:
'更新提示'
,
content
:
res
.
data
.
latest_app_info
.
remark
,
confirmText
:
'确定更新'
,
cancelText
:
'取消更新'
,
success
:
data
=>
{
if
(
data
.
confirm
)
{
this
.
downloadApk
(
res
.
data
.
latest_app_info
.
download_url
);
//开始下载apk文件
console
.
log
(
'用户点击确定'
);
}
else
if
(
data
.
cancel
)
{
console
.
log
(
'用户点击取消'
);
}
}
});
}
else
{
uni
.
showToast
({
title
:
'已是最新版本'
,
icon
:
'success'
});
}
}
}
});
},
//下载apk文件
downloadApk
(
url
)
{
uni
.
showLoading
({
title
:
'下载安装文件'
,
mask
:
true
});
let
dtask
=
plus
.
downloader
.
createDownload
(
url
,
{},
(
d
,
status
)
=>
{
if
(
status
==
200
)
{
this
.
local_version
=
this
.
online_version
;
//更新最新版本号
uni
.
setStorageSync
(
'wms_version'
,
this
.
online_version
);
//更新本地存储最新版本号
uni
.
hideLoading
();
//下载成功后调用安装方法
this
.
installApk
(
d
.
filename
);
}
else
{
uni
.
showToast
({
title
:
'下载失败'
,
icon
:
'error'
});
console
.
log
(
'下载失败'
);
}
});
dtask
.
start
();
},
//安装apk文件
installApk
(
filePath
)
{
plus
.
runtime
.
install
(
filePath
,
{},
()
=>
{
console
.
log
(
'更新成功'
);
},
e
=>
{
uni
.
showToast
({
title
:
'安装失败'
,
icon
:
'error'
});
console
.
log
(
'安装失败:'
+
JSON
.
stringify
(
e
));
}
);
},
/**
* 组织切换
*/
changeOrgId
()
{
...
...
@@ -78,7 +185,7 @@
});
setTimeout
(()
=>
{
uni
.
redirectTo
({
url
:
'/pages/index/index'
url
:
'/pages/index/index
?fromLogin=true
'
});
},
2000
);
}
else
{
...
...
pages/stocktake/operate.vue
View file @
2dcb7512
...
...
@@ -635,15 +635,16 @@
});
setTimeout
(()
=>
{
this
.
resetChange
();
this
.
getData
();
this
.
closeDrawer
();
//清空入库批次号,货品名称,旧标签
this
.
input_stock_in_batch_sn
=
false
;
this
.
searchParams
.
stock_in_batch_sn
=
''
;
this
.
searchParams
.
goods_name
=
''
;
this
.
getData
();
//入库批次号重新获取焦点
this
.
is_focus
=
false
;
setTimeout
(()
=>
{
//清空入库批次号,货品名称,旧标签
this
.
searchParams
.
stock_in_batch_sn
=
''
;
this
.
searchParams
.
goods_name
=
''
;
this
.
is_focus
=
true
;
//再次获取焦点
},
500
);
},
2000
);
...
...
util/api.js
View file @
2dcb7512
const
API_BASE_USER
=
'http://user.liexindev.net'
;
//用户系统
const
API_BASE_PUR
=
'http://pur.liexindev.net'
;
//采购系统
const
API_BASE
=
'http://wms.liexindev.net'
;
//WMS系统
const
API_BASE_OSS
=
'http://image.liexindev.net'
;
//oss系统
//
const API_BASE_USER = 'http://user.liexindev.net'; //用户系统
//
const API_BASE_PUR = 'http://pur.liexindev.net'; //采购系统
//
const API_BASE = 'http://wms.liexindev.net'; //WMS系统
//
const API_BASE_OSS = 'http://image.liexindev.net'; //oss系统
//
const API_BASE_USER = 'https://user.ichunt.net'; //用户系统
//
const API_BASE_PUR = 'https://purchase.ichunt.net'; //采购系统
//
const API_BASE = 'https://wms.ichunt.net'; //WMS系统
//
const API_BASE_OSS = 'https://image.ichunt.net'; //oss系统
const
API_BASE_USER
=
'https://user.ichunt.net'
;
//用户系统
const
API_BASE_PUR
=
'https://purchase.ichunt.net'
;
//采购系统
const
API_BASE
=
'https://wms.ichunt.net'
;
//WMS系统
const
API_BASE_OSS
=
'https://image.ichunt.net'
;
//oss系统
const
API
=
{
...
...
@@ -302,7 +302,7 @@ const API = {
/**
* 获取最新版本信息
* */
getLatestAppInfo
:
API_BASE
+
'/
api
/app/getLatestAppInfo'
,
getLatestAppInfo
:
API_BASE
+
'/
open
/app/getLatestAppInfo'
,
/**
* H5盘点任务列表
* */
...
...
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