diff --git a/main.js b/main.js index 6b03a64..c5102fd 100644 --- a/main.js +++ b/main.js @@ -1,53 +1,68 @@ -// #ifndef VUE3 -import Vue from 'vue' -import uView from '@/uni_modules/uview-ui' -Vue.use(uView) -import App from './App' -import { $http } from '@escook/request-miniprogram' - -Vue.config.productionTip = false -uni.$http = $http -// $http.baseUrl = 'http://local.gunshiiot.com:18083' -$http.baseUrl = 'http://36.139.207.50:18083' -// 请求拦截器 -$http.beforeRequest = function (options) { - uni.showLoading({ - title: '数据加载中' - }) - - if (options.url.indexOf('/doLogin') == -1) { - options.header = { - 'gs-token': uni.getStorageSync('Gs-Token') - } - } -} -// 响应拦截器 -$http.afterRequest = function (options) { - uni.hideLoading() -} -uni.$showMsg = function (title = '数据请求失败了', duration = 1500) { - return uni.showToast({ - title, - duration, - icon: 'none' - }) -} -Vue.config.productionTip = false -App.mpType = 'app' - -const app = new Vue({ - ...App -}) -app.$mount() -// #endif - -// #ifdef VUE3 -import { createSSRApp } from 'vue' -import App from './App.vue' -export function createApp () { - const app = createSSRApp(App) - return { - app - } -} -// #endif +// #ifndef VUE3 +import Vue from 'vue' +import uView from '@/uni_modules/uview-ui' +Vue.use(uView) +import App from './App' +import { + $http +} from '@escook/request-miniprogram' + +Vue.config.productionTip = false +uni.$http = $http +// $http.baseUrl = 'http://local.gunshiiot.com:18083' +$http.baseUrl = 'http://36.139.207.50:18083' +// 请求拦截器 +$http.beforeRequest = function(options) { + // uni.showLoading({ + // title: '数据加载中' + // }) + // if ( + // options.url.indexOf('/gunshiApp/xfflood/doLogin') == -1 + // && options.url.indexOf('/gunshiApp/xfflood/getLoginInfo') == -1 + // && options.url.indexOf('/gunshiApp/xfflood/my/info/getByUserId') == -1 + // && options.url.indexOf('/gunshiApp/xfflood/bzProjectManipulationRecord/file/get/') == -1 + // ) { + // // uni.showLoading({ + // // title: '数据加载中' + // // }) + // } + + + if (options.url.indexOf('/doLogin') == -1) { + options.header = { + 'gs-token': uni.getStorageSync('Gs-Token') + } + } +} +// 响应拦截器 +$http.afterRequest = function(options) { + // uni.hideLoading() +} +uni.$showMsg = function(title = '数据请求失败了', duration = 1500) { + return uni.showToast({ + title, + duration, + icon: 'none' + }) +} +Vue.config.productionTip = false +App.mpType = 'app' + +const app = new Vue({ + ...App +}) +app.$mount() +// #endif + +// #ifdef VUE3 +import { + createSSRApp +} from 'vue' +import App from './App.vue' +export function createApp() { + const app = createSSRApp(App) + return { + app + } +} +// #endif \ No newline at end of file diff --git a/pages/homeIndex/index.vue b/pages/homeIndex/index.vue index 57edcf2..0276ac0 100644 --- a/pages/homeIndex/index.vue +++ b/pages/homeIndex/index.vue @@ -125,7 +125,7 @@ 24小时天气预报

- {{ imgData[0] }}至{{ imgData[1] }} +
+ + +
技术支持: 湖北鲧石物联科技有限公司
+
@@ -403,15 +407,23 @@ export default { numPic: 0, allStatus: false } - }, - onPullDownRefresh() { - this.getSwiperList() - this.getOverview() - this.getDataTime() - this.getResponseLevel() - setTimeout(function () { - uni.stopPullDownRefresh(); - }, 1000); + }, + onPullDownRefresh() { + this.getSwiperList() + this.getOverview() + this.getDataTime() + this.getResponseLevel() + this.getDispatchStatus() + this.getReadStatus() + if (this.limit == 1) { + this.getYjRead() + // this.getInterval() + this.getImgs() + this.getHoursImg() + } + setTimeout(function () { + uni.stopPullDownRefresh(); + }, 1000); }, computed: { getNavList () { @@ -522,25 +534,33 @@ export default { async getImgs () { let h = moment().format('HH') let m = moment().format('mm') - await uni.request({ - url: 'http://223.75.53.124:8005/grb/rainimglist', - data: { - tm: `${this.imgtm}08` - }, - success: res => { - console.log(res.data.data) - this.imgList = res.data.data - - // let inx = restm(h) - - // this.imgHours = res.data.data.imgHours[inx] - - let tm = moment().add(1, 'days').format('MM月DD日') - let tm2 = moment().format('MM月DD日') - this.imgData = [`${tm2}08时`, `${tm}08时`] - // this.imgHourstm = [`${tm2}${h + 1}时`, `${tm2}${h + 2}时`] - } - }) + uni.request({ + url: 'http://223.75.53.124:8005/grb/latest', + success: res => { + const myTm = res.data.data.tm + if(myTm){ + uni.request({ + url: 'http://223.75.53.124:8005/grb/rainimglist', + data: { + tm: moment(myTm).format('YYYYMMDDHH') + }, + success: res => { + console.log(res.data.data) + this.imgList = res.data.data + + // let inx = restm(h) + + // this.imgHours = res.data.data.imgHours[inx] + + let tm = moment().add(1, 'days').format('MM月DD日') + let tm2 = moment().format('MM月DD日') + this.imgData = [`${tm2}08时`, `${tm}08时`] + // this.imgHourstm = [`${tm2}${h + 1}时`, `${tm2}${h + 2}时`] + } + }) + } + } + }) }, getTmData () { let hn = this.numPic > 0 ? this.numPic : 1 @@ -602,31 +622,34 @@ export default { console.log('小时', h1) console.log('需要参数', tms) - uni.request({ - url: 'https://shqxjs.cloudowr.cn/service/radar/rainimg', - data: { - tm: tms - }, - success: res => { - console.log('pic---', tms, res.data.data) - this.imgHoursList = res.data.data.img - let m = moment().format('MM月DD日') - - console.log('am222', this.imgHoursList) - let m1 = Number(h1) + 2 - this.imgHourstm = [`${m}${h1}时${mm}分`, `${m}${m1}时${mm}分`] - - if (res.data.data.img == null) { - this.numPic++ - setTimeout(() => { - this.getHoursImg() - }, 10 * 1000) - } else { - this.numPic = 0 - return - } - } - }) + + uni.request({ + url: 'http://223.75.53.124:8005/radar/latest', + success: res => { + let tm = moment(res.data.data.tm); + let subfix = '?rainFile=' + res.data.data.rainFile; + let url = `http://shqxjs.cloudowr.cn/yj_folder/rain/radar/${tm.format('YYYYMM')}/${tm.format('DD')}/${tm.format('YYYYMMDDHHmm')}+00.02.jpg${subfix}`; + console.log(222222222227,url) + + console.log('pic---', tms, res.data.data) + this.imgHoursList = {'url':url} + let m = moment().format('MM月DD日') + + console.log('am222', this.imgHoursList) + let m1 = Number(h1) + 2 + this.imgHourstm = [`${m}${h1}时${mm}分`, `${m}${m1}时${mm}分`] + + if (url == null) { + this.numPic++ + setTimeout(() => { + this.getHoursImg() + }, 10 * 1000) + } else { + this.numPic = 0 + return + } + } + }) }, // async getInterval () { diff --git a/pages/login/login.vue b/pages/login/login.vue index f07d095..957e0bd 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -27,8 +27,8 @@ >记住用户名和密码 - - + + @@ -83,7 +83,7 @@ export default { }, login (formData) { //loading - // uni.showLoading({title:'努力登录中...', mask:true}); + uni.showLoading({title:'努力登录中...', mask:true}); //MD5加密 const encryptData = data => { @@ -115,7 +115,7 @@ export default { //提交表单 uni.$http.post('/gunshiApp/xfflood/doLogin', postForm).then(res => { - // uni.showLoading({ title: '努力登录中...', mask: true }) + uni.showLoading({ title: '努力登录中...', mask: true }) if (res.data.code === 200) { //localStorage保存token @@ -153,7 +153,7 @@ export default { - uni.showLoading({title:'努力登录中...', mask:true}); + // uni.showLoading({title:'努力登录中...', mask:true}); //登录成功后跳转界 setTimeout(function () { uni.hideLoading() diff --git a/static/logoc.png b/static/logoc.png new file mode 100644 index 0000000..05d2b77 Binary files /dev/null and b/static/logoc.png differ