diff --git a/manifest.json b/manifest.json index eed39fb..a86662d 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "appid" : "__UNI__7573222", "description" : "", "versionName" : "1.0.0", - "versionCode" : "100", + "versionCode" : 1, "transformPx" : false, "app-plus" : { /* 5+App特有相关 */ diff --git a/pages.json b/pages.json index 5a95018..2119879 100644 --- a/pages.json +++ b/pages.json @@ -2,20 +2,32 @@ "easycom": { "^u-(.*)": "@/uni_modules/uview-ui/components/u-$1/u-$1.vue" }, - "pages": [ - { + "pages": [{ "path": "pages/login/login", "style": { "navigationBarTitleText": "" } }, + { + "path": "pages/upgrade/index", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom", + "app-plus": { + "bounce": "none", + "animationType": "none", + "background": "transparent" + } + } + }, + { "path": "pages/xcrw/index", "style": { "navigationBarTitleText": "" } }, - { + { "path": "pages/xcrw/detail/index", "style": { "navigationBarTitleText": "" @@ -27,7 +39,7 @@ "navigationBarTitleText": "" } }, - { + { "path": "pages/spjk/index", "style": { "navigationBarTitleText": "" @@ -45,14 +57,6 @@ "navigationBarTitleText": "" } }, - - { - "path": "pages/rain/rain", - "style": { - "navigationBarTitleText": "", - "enablePullDownRefresh": false - } - }, { "path": "pages/homeIndex/index", "style": { @@ -67,102 +71,49 @@ } } }, - { - "path": "pages/xxsb/index", - "style": { - "navigationBarTitleText": "信息上报" - } - }, - { - "path": "pages/xxsb/from", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/xxsb/fromSeverity", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/xxsb/dsfrom", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/xxsb/map", - "style": { - "navigationBarTitleText": "地图示例" - } - }, - { - "path": "pages/gqzq/index", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/gqzq/gqxx", - "style": { - "navigationBarTitleText": "工情信息" - } - }, - { - "path": "pages/gqzq/zqxx", - "style": { - "navigationBarTitleText": "灾情信息" - } - }, - { - "path": "pages/gqzq/detail/index", - "style": { - "navigationBarTitleText": "查看" - } - }, + { "path": "pages/mypage/mypage", "style": { "navigationBarTitleText": "" } }, - { - "path": "pages/mypage/compents/wtcl/index", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/mypage/compents/wxyh/index", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/mypage/compents/wxyh/formZdy/index", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/mypage/compents/xcrw/index", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/mypage/compents/wtcl/detail/index", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/mypage/compents/xcrw/detail/index", - "style": { - "navigationBarTitleText": "" - } - }, + { + "path": "pages/mypage/compents/wtcl/index", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/mypage/compents/wxyh/index", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/mypage/compents/wxyh/formZdy/index", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/mypage/compents/xcrw/index", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/mypage/compents/wtcl/detail/index", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/mypage/compents/xcrw/detail/index", + "style": { + "navigationBarTitleText": "" + } + }, { "path": "pages/personInfo/personInfo", "style": { @@ -175,204 +126,80 @@ "navigationBarTitleText": "" } }, - { - "path": "pages/forewarning/forewarning", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/forewarning/sh", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/forewarning/shInformation/shInformation", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/addressBook/addressBook", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/water/water", - "style": { - "navigationBarTitleText": "", - "enablePullDownRefresh": false - }, - "onMessage": "handleMessage" - }, - { - "path": "pages/rainDetail/rainDetail", - "style": { - "navigationBarTitleText": "", - "enablePullDownRefresh": false - } - }, - { - "path": "pages/hdDetail/hdDetail", - "style": { - "navigationBarTitleText": "", - "enablePullDownRefresh": false - } - }, - { - "path": "pages/skDetail/skDetail", - "style": { - "navigationBarTitleText": "", - "enablePullDownRefresh": false - } - }, - { - "path": "pages/addressBook/follow", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/addressBook/myDept", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/orderFeedback/orderFeedback", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/orderFeedback/orderInformation", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/gqzq/gqxx/gqxx", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/gqzq/gqxx/qk", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/gqzq/gqxx/xq", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/gqzq/gqxx/qkForm", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/gqzq/gqxx/xqForm", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/gqzq/zqxx/zqxx", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/gqzq/zqxx/table", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/gqzq/zqxx/form", - "style": { - "navigationBarTitleText": "" - } - }, + { "path": "pages/wxyh/index", "style": { "navigationBarTitleText": "" } }, - { - "path": "pages/wtcl/index", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/wtcl/detail/index", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/yj/index", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/yj/detail/qxyj", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/yj/detail/wyyj", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/yj/detail/aiyj", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/messageList/index", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/messageList/detail/index", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/skInfo/detail/index", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/skInfo/waterDatail/index", - "style": { - "navigationBarTitleText": "" - } - }, - { - "path": "pages/ylzList/detail/index", - "style": { - "navigationBarTitleText": "" - } - } - + { + "path": "pages/wtcl/index", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/wtcl/detail/index", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/yj/index", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/yj/detail/qxyj", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/yj/detail/wyyj", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/yj/detail/aiyj", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/messageList/index", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/messageList/detail/index", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/skInfo/detail/index", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/skInfo/waterDatail/index", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/ylzList/detail/index", + "style": { + "navigationBarTitleText": "" + } + } + ], "usingComponents": { "map": "/uni_modules/@dcloudio/uni-map/components/uni-map/uni-map" @@ -381,8 +208,7 @@ "tabBar": { "color": "#333333", "selectedColor": "#59A7FF", - "list": [ - { + "list": [{ "pagePath": "pages/homeIndex/index", "iconPath": "/static/tabs/home.png", "selectedIconPath": "static/tabs/home2.png", @@ -407,16 +233,12 @@ "background": "#efeff4" } }, - "subPackages": [ - { - "root": "subpkg", - "pages": [ - { - "path": "rainDetail/rainDetail" - } - ] - } - ], + "subPackages": [{ + "root": "subpkg", + "pages": [{ + "path": "rainDetail/rainDetail" + }] + }], "globalStyle": { "navigationBarTextStyle": "black", "navigationBarTitleText": "uni-app", @@ -428,4 +250,4 @@ "background": "#efeff4" } } -} +} \ No newline at end of file diff --git a/pages/login/login.vue b/pages/login/login.vue index 944ade7..0f44295 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -46,6 +46,40 @@ } }, methods: { + // 更新版本 + init(){ + this.checkVersion(); + }, + // 检查版本更新情况 + async checkVersion(){ + try { + const {data} = await uni.$http.get("/gunshiApp/xyt/appVersionRecord/latest"); + if(data.code == 200){ + const selfVersionCode = uni.getSystemInfoSync().appWgtVersion//当前App版本号 + const newVersionCode = data.data.version; //线上最新版本号 + if (selfVersionCode != newVersionCode) { + let platform = uni.getSystemInfoSync().platform //手机平台 + //安卓手机弹窗升级 + if (platform === 'android') { + uni.navigateTo({ + url: `/pages/upgrade/index?info=${encodeURIComponent(JSON.stringify(data.data))}` + }) + } + //IOS无法在线升级提示到商店下载 + else { + uni.showModal({ + title: '发现新版本 ' +'V' + newVersionCode, + content: '请到App store进行升级', + showCancel: false + }) + } + } + } + } catch (error) { + uni.$showMsg() + } + }, + handleChange(formData) { formData.checked = !formData.checked }, @@ -136,6 +170,9 @@ } }, + }, + onLoad(){ + this.init(); } } diff --git a/pages/mypage/mypage.vue b/pages/mypage/mypage.vue index 7f81f92..5fd0de5 100644 --- a/pages/mypage/mypage.vue +++ b/pages/mypage/mypage.vue @@ -80,7 +80,7 @@ userList: uni.getStorageSync('value'), username: '', userresponse: '防汛办', - version: '011.14.23', + version: uni.getSystemInfoSync().appWgtVersion, func: func, xjxList:xjxList, default_src: uni.getStorageSync('avatar'), @@ -247,7 +247,7 @@ justify-content: center; flex-direction: column-reverse; width: 92%; - height: 6vh; + height: 8vh; font-size: 20px; color: white; background-color: #007afd; diff --git a/pages/upgrade/index.vue b/pages/upgrade/index.vue new file mode 100644 index 0000000..0b1d25a --- /dev/null +++ b/pages/upgrade/index.vue @@ -0,0 +1,276 @@ + + + + + + \ No newline at end of file diff --git a/pages/utils/tool.js b/pages/utils/tool.js index 766979a..732f13c 100644 --- a/pages/utils/tool.js +++ b/pages/utils/tool.js @@ -64,20 +64,9 @@ export const adnmZhen = adcd => { } export const fileChange = (file) => { - - let target= '' let blob = new Blob([file]); - console.log("blobblob",blob); - let url = window.URL.createObjectURL(blob); - // let reader = new FileReader(blob); - // console.log("reader",reader); - - // reader.readAsDataURL(url); - // reader.onload = function (e) { - // target=e.target.result - // } - console.log("target",url); + console.log("url",url); return url } diff --git a/pages/utils/upgrade.js b/pages/utils/upgrade.js new file mode 100644 index 0000000..a226c70 --- /dev/null +++ b/pages/utils/upgrade.js @@ -0,0 +1,90 @@ +/** + * @description H5+下载App + * @param downloadUrl:App下载链接 + * @param progressCallBack:下载进度回调 + */ +export const downloadApp = (downloadUrl, progressCallBack = () => { },) => { + return new Promise((resolve, reject) => { + //创建下载任务 + const downloadTask = plus.downloader.createDownload(downloadUrl, { + method: "GET" + }, (task, status) => { + if (status == 200) { //下载成功 + resolve(task.filename) + + } else { + reject('fail') + uni.showToast({ + title: '下载失败', + duration: 1500, + icon: "none" + }); + } + }) + //监听下载过程 + downloadTask.addEventListener("statechanged", (task, status) => { + switch (task.state) { + case 1: // 开始 + break; + case 2: //已连接到服务器 + break; + case 3: // 已接收到数据 + let hasProgress = task.totalSize && task.totalSize > 0 //是否能获取到App大小 + if (hasProgress) { + let current = parseInt(100 * task.downloadedSize / task.totalSize); //获取下载进度百分比 + progressCallBack(current) + } + break; + case 4: // 下载完成 + break; + } + }); + //开始执行下载 + downloadTask.start(); + }) + + +} +/** + * @description H5+安装APP + * @param fileName:app文件名 + * @param callBack:安装成功回调 + */ +export const installApp = (fileName, callBack = () => {}) => { + //注册广播监听app安装情况 + onInstallListening(callBack); + //开始安装 + plus.runtime.install(plus.io.convertLocalFileSystemURL(fileName), {}, () => { + //成功跳转到安装界面 + }, function(error) { + uni.showToast({ + title: '安装失败', + duration: 1500, + icon: "none" + }); + }) + +} +/** + * @description 注册广播监听APP是否安装成功 + * @param callBack:安装成功回调函数 + */ +const onInstallListening = (callBack = () => {}) => { + + let mainActivity = plus.android.runtimeMainActivity(); //获取activity + //生成广播接收器 + let receiver = plus.android.implements('io.dcloud.android.content.BroadcastReceiver', { + onReceive: (context, intent) => { //接收广播回调 + plus.android.importClass(intent); + mainActivity.unregisterReceiver(receiver); //取消监听 + callBack() + } + }); + let IntentFilter = plus.android.importClass('android.content.IntentFilter'); + let Intent = plus.android.importClass('android.content.Intent'); + let filter = new IntentFilter(); + filter.addAction(Intent.ACTION_PACKAGE_ADDED); //监听APP安装 + filter.addDataScheme("package"); + mainActivity.registerReceiver(receiver, filter); //注册广播 + +} \ No newline at end of file diff --git a/pages/wtcl/index.vue b/pages/wtcl/index.vue index c548eb5..b02e63e 100644 --- a/pages/wtcl/index.vue +++ b/pages/wtcl/index.vue @@ -113,9 +113,9 @@ "handleUserId": uni.getStorageSync('value').userId } console.log(params,'dsd'); - // uni.$http.post('/gunshiApp/xyt/inspect/detail/page', params).then(res => { - // this.list=res.data.data.records - // }) + uni.$http.post('/gunshiApp/xyt/inspect/detail/page', params).then(res => { + this.list=res.data.data.records + }) }, confirm(e) { console.log(e); diff --git a/static/images/upgrade.png b/static/images/upgrade.png new file mode 100644 index 0000000..243ea25 Binary files /dev/null and b/static/images/upgrade.png differ