master
parent
128cfe4b90
commit
3bf4926b5d
121
main.js
121
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
|
||||
|
|
@ -125,7 +125,7 @@
|
|||
<span class="line"></span><span class="h4">24小时天气预报</span>
|
||||
</p>
|
||||
<div>
|
||||
<span class="time">{{ imgData[0] }}至{{ imgData[1] }}</span>
|
||||
<!-- <span class="time">{{ imgData[0] }}至{{ imgData[1] }}</span> -->
|
||||
<!-- <image
|
||||
style="width: 16px; height: 16px; vertical-align: middle"
|
||||
src="../../static/tabs/panelTitle.png"
|
||||
|
|
@ -219,9 +219,9 @@
|
|||
<p class="title">
|
||||
<span class="line"></span><span class="h4">短时天气预报</span>
|
||||
</p>
|
||||
<div class="time" v-if="imgHourstm.length > 0">
|
||||
<!-- <div class="time" v-if="imgHourstm.length > 0">
|
||||
{{ imgHourstm[0] }}至{{ imgHourstm[1] }}
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="imgs" style="height: 100%; text-align: center">
|
||||
<image
|
||||
|
|
@ -325,6 +325,10 @@
|
|||
|
||||
</view>
|
||||
</view>
|
||||
<view class="info_24" :style="{display:'flex',justifyContent:'center',alignItems:'center',padding:'5px 0',margin:'0'}">
|
||||
<image :style="{width:'20px',height:'20px',marginRight:'10px'}" src="../../static/logoc.png"></image>
|
||||
<div>技术支持: 湖北鲧石物联科技有限公司</div>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -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 () {
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@
|
|||
>记住用户名和密码</text
|
||||
>
|
||||
</uni-forms-item>
|
||||
<button type="primary" class="button" @click="xian">县</button>
|
||||
<button type="primary" class="button" @click="xiang">乡</button>
|
||||
<!-- <button type="primary" class="button" @click="xian">县</button> -->
|
||||
<!-- <button type="primary" class="button" @click="xiang">乡</button> -->
|
||||
<button type="primary" class="button" @click="login(formData)">
|
||||
登录
|
||||
</button>
|
||||
|
|
@ -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()
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 453 KiB |
Loading…
Reference in New Issue