niexiting
9 months ago
116 changed files with 651 additions and 214 deletions
@ -0,0 +1,7 @@ |
|||||
|
# 设置基础镜像 |
||||
|
FROM nginx:WIN-1.25.3 |
||||
|
|
||||
|
WORKDIR /opt/sfms3.0-uniapp |
||||
|
COPY nginx.conf /usr/local/nginx/conf/nginx.conf |
||||
|
# 将dist/build/h5/文件中的内容复制到 /opt/sfms3.0-uniapp 这个目录下面 |
||||
|
COPY dist/build/h5/ /opt/sfms3.0-uniapp |
@ -0,0 +1,53 @@ |
|||||
|
user root; |
||||
|
worker_processes 2; |
||||
|
|
||||
|
events { |
||||
|
worker_connections 1024; |
||||
|
} |
||||
|
|
||||
|
http { |
||||
|
include mime.types; |
||||
|
charset utf-8,gbk; |
||||
|
default_type application/octet-stream; |
||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' |
||||
|
'$status $body_bytes_sent "$http_referer" ' |
||||
|
'"$http_user_agent" "$http_x_forwarded_for" "$request_time $upstream_response_time"'; |
||||
|
|
||||
|
proxy_cache_path /opt/nginx_cache/ levels=1:2 keys_zone=my_zone:10m inactive=300s max_size=5g; |
||||
|
access_log logs/access.log main; |
||||
|
sendfile on; |
||||
|
#tcp_nopush on; |
||||
|
keepalive_timeout 600s; |
||||
|
client_max_body_size 200m; |
||||
|
gzip on; |
||||
|
gzip_min_length 10k; |
||||
|
gzip_comp_level 9; |
||||
|
gzip_buffers 4 16k; |
||||
|
gzip_types text/plain application/javascript text/css application/xml text/javascript image/jpeg image/gif image/png; |
||||
|
gzip_vary on; |
||||
|
gzip_disable "MSIE [1-6]\."; |
||||
|
upstream sfms3.0 { |
||||
|
server localhost:25110 weight=10 max_fails=3 fail_timeout=10s; |
||||
|
} |
||||
|
server { |
||||
|
listen 25102; |
||||
|
server_name_in_redirect off; |
||||
|
server_name dev.ccwin-in.com; |
||||
|
location /api/ { |
||||
|
proxy_pass http://sfms3.0/; |
||||
|
proxy_next_upstream http_500 http_502 http_503 http_504 error timeout invalid_header; |
||||
|
proxy_set_header X-Forwared-For $proxy_add_x_forwarded_for; |
||||
|
proxy_set_header Host $http_host; |
||||
|
proxy_set_header X-Real-IP $remote_addr; |
||||
|
proxy_set_header X-Forwarded-For $http_x_forwarded_for; |
||||
|
} |
||||
|
location / { |
||||
|
proxy_cache my_zone; |
||||
|
proxy_cache_valid 200 304 12h; |
||||
|
proxy_cache_key $host$uri$is_args$args; |
||||
|
try_files $uri $uri/ /index.html; |
||||
|
root /opt/sfms3.0-uniapp; |
||||
|
index index.html index.htm; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,116 @@ |
|||||
|
import { |
||||
|
appCheckUpdate |
||||
|
} from '../api/request2.js'; |
||||
|
export function appUpdate() { |
||||
|
let curversion = 0; |
||||
|
plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) { |
||||
|
const data = { |
||||
|
action: 'checkVersion', |
||||
|
appid: plus.runtime.appid, |
||||
|
appVersion: plus.runtime.version, |
||||
|
wgtVersion: widgetInfo.version, |
||||
|
versionCode: widgetInfo.versionCode |
||||
|
} |
||||
|
curversion=data.versionCode |
||||
|
appCheckUpdate().then(res => { |
||||
|
console.log("当前版本提示",curversion) |
||||
|
if (res.data) { |
||||
|
if (res.data.versionCode > Number(curversion)) { |
||||
|
var downUrl = res.data.downUrl; |
||||
|
var content = res.data.content; |
||||
|
var version =res.data.version |
||||
|
console.log("新版本提示") |
||||
|
uni.showModal({ |
||||
|
title: "发现新版本:("+version+")", |
||||
|
content: content, |
||||
|
confirmText: "更新", |
||||
|
cancelText: "取消", |
||||
|
success: (res) => { |
||||
|
if (res.confirm) { |
||||
|
confirm(downUrl); |
||||
|
console.log('comfirm') //点击确定之后执行的代码
|
||||
|
} else { |
||||
|
console.log('cancel') //点击取消之后执行的代码
|
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
uni.showToast({ |
||||
|
title:"当前是最新版本" |
||||
|
}) |
||||
|
console.log("没有新版本") |
||||
|
} |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
console.log("版本错误", error) |
||||
|
}) |
||||
|
|
||||
|
}) |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
export function confirm(downUrl) { |
||||
|
var downloadApkUrl = downUrl |
||||
|
var dtask = plus.downloader.createDownload(downloadApkUrl, {}, |
||||
|
function(d, status) { |
||||
|
|
||||
|
// 下载完成
|
||||
|
if (status == 200) { |
||||
|
|
||||
|
plus.runtime.install(plus.io.convertLocalFileSystemURL( |
||||
|
d.filename), {}, {}, function(error) { |
||||
|
uni.showToast({ |
||||
|
title: '安装失败', |
||||
|
duration: 1500 |
||||
|
}); |
||||
|
}) |
||||
|
} else { |
||||
|
uni.showToast({ |
||||
|
title: '更新失败', |
||||
|
duration: 1500 |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
try { |
||||
|
dtask.start(); // 开启下载的任务
|
||||
|
var prg = 0; |
||||
|
var showLoading = plus.nativeUI.showWaiting( |
||||
|
"正在下载"); //创建一个showWaiting对象
|
||||
|
dtask.addEventListener('statechanged', function( |
||||
|
task, |
||||
|
status |
||||
|
) { |
||||
|
// 给下载任务设置一个监听 并根据状态 做操作
|
||||
|
switch (task.state) { |
||||
|
case 1: |
||||
|
showLoading.setTitle("正在下载"); |
||||
|
break; |
||||
|
case 2: |
||||
|
showLoading.setTitle("已连接到服务器"); |
||||
|
break; |
||||
|
case 3: |
||||
|
prg = parseInt( |
||||
|
(parseFloat(task.downloadedSize) / |
||||
|
parseFloat(task.totalSize)) * |
||||
|
100 |
||||
|
); |
||||
|
showLoading.setTitle(" 正在下载" + prg + "% "); |
||||
|
break; |
||||
|
case 4: |
||||
|
plus.nativeUI.closeWaiting(); |
||||
|
//下载完成
|
||||
|
break; |
||||
|
} |
||||
|
}); |
||||
|
} catch (err) { |
||||
|
plus.nativeUI.closeWaiting(); |
||||
|
uni.showToast({ |
||||
|
title: '更新失败-03', |
||||
|
mask: false, |
||||
|
duration: 1500 |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue