master
秦子超 2024-07-04 13:15:43 +08:00
parent 128cfe4b90
commit 3bf4926b5d
4 changed files with 152 additions and 114 deletions

121
main.js
View File

@ -1,53 +1,68 @@
// #ifndef VUE3 // #ifndef VUE3
import Vue from 'vue' import Vue from 'vue'
import uView from '@/uni_modules/uview-ui' import uView from '@/uni_modules/uview-ui'
Vue.use(uView) Vue.use(uView)
import App from './App' import App from './App'
import { $http } from '@escook/request-miniprogram' import {
$http
Vue.config.productionTip = false } from '@escook/request-miniprogram'
uni.$http = $http
// $http.baseUrl = 'http://local.gunshiiot.com:18083' Vue.config.productionTip = false
$http.baseUrl = 'http://36.139.207.50:18083' uni.$http = $http
// 请求拦截器 // $http.baseUrl = 'http://local.gunshiiot.com:18083'
$http.beforeRequest = function (options) { $http.baseUrl = 'http://36.139.207.50:18083'
uni.showLoading({ // 请求拦截器
title: '数据加载中' $http.beforeRequest = function(options) {
}) // uni.showLoading({
// title: '数据加载中'
if (options.url.indexOf('/doLogin') == -1) { // })
options.header = { // if (
'gs-token': uni.getStorageSync('Gs-Token') // 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
// 响应拦截器 // ) {
$http.afterRequest = function (options) { // // uni.showLoading({
uni.hideLoading() // // title: '数据加载中'
} // // })
uni.$showMsg = function (title = '数据请求失败了', duration = 1500) { // }
return uni.showToast({
title,
duration, if (options.url.indexOf('/doLogin') == -1) {
icon: 'none' options.header = {
}) 'gs-token': uni.getStorageSync('Gs-Token')
} }
Vue.config.productionTip = false }
App.mpType = 'app' }
// 响应拦截器
const app = new Vue({ $http.afterRequest = function(options) {
...App // uni.hideLoading()
}) }
app.$mount() uni.$showMsg = function(title = '数据请求失败了', duration = 1500) {
// #endif return uni.showToast({
title,
// #ifdef VUE3 duration,
import { createSSRApp } from 'vue' icon: 'none'
import App from './App.vue' })
export function createApp () { }
const app = createSSRApp(App) Vue.config.productionTip = false
return { App.mpType = 'app'
app
} const app = new Vue({
} ...App
// #endif })
app.$mount()
// #endif
// #ifdef VUE3
import {
createSSRApp
} from 'vue'
import App from './App.vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
// #endif

View File

@ -125,7 +125,7 @@
<span class="line"></span><span class="h4">24小时天气预报</span> <span class="line"></span><span class="h4">24小时天气预报</span>
</p> </p>
<div> <div>
<span class="time">{{ imgData[0] }}{{ imgData[1] }}</span> <!-- <span class="time">{{ imgData[0] }}{{ imgData[1] }}</span> -->
<!-- <image <!-- <image
style="width: 16px; height: 16px; vertical-align: middle" style="width: 16px; height: 16px; vertical-align: middle"
src="../../static/tabs/panelTitle.png" src="../../static/tabs/panelTitle.png"
@ -219,9 +219,9 @@
<p class="title"> <p class="title">
<span class="line"></span><span class="h4">短时天气预报</span> <span class="line"></span><span class="h4">短时天气预报</span>
</p> </p>
<div class="time" v-if="imgHourstm.length > 0"> <!-- <div class="time" v-if="imgHourstm.length > 0">
{{ imgHourstm[0] }}{{ imgHourstm[1] }} {{ imgHourstm[0] }}{{ imgHourstm[1] }}
</div> </div> -->
</div> </div>
<div class="imgs" style="height: 100%; text-align: center"> <div class="imgs" style="height: 100%; text-align: center">
<image <image
@ -325,6 +325,10 @@
</view> </view>
</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> </view>
</template> </template>
@ -403,15 +407,23 @@ export default {
numPic: 0, numPic: 0,
allStatus: false allStatus: false
} }
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.getSwiperList() this.getSwiperList()
this.getOverview() this.getOverview()
this.getDataTime() this.getDataTime()
this.getResponseLevel() this.getResponseLevel()
setTimeout(function () { this.getDispatchStatus()
uni.stopPullDownRefresh(); this.getReadStatus()
}, 1000); if (this.limit == 1) {
this.getYjRead()
// this.getInterval()
this.getImgs()
this.getHoursImg()
}
setTimeout(function () {
uni.stopPullDownRefresh();
}, 1000);
}, },
computed: { computed: {
getNavList () { getNavList () {
@ -522,25 +534,33 @@ export default {
async getImgs () { async getImgs () {
let h = moment().format('HH') let h = moment().format('HH')
let m = moment().format('mm') let m = moment().format('mm')
await uni.request({ uni.request({
url: 'http://223.75.53.124:8005/grb/rainimglist', url: 'http://223.75.53.124:8005/grb/latest',
data: { success: res => {
tm: `${this.imgtm}08` const myTm = res.data.data.tm
}, if(myTm){
success: res => { uni.request({
console.log(res.data.data) url: 'http://223.75.53.124:8005/grb/rainimglist',
this.imgList = res.data.data data: {
tm: moment(myTm).format('YYYYMMDDHH')
// let inx = restm(h) },
success: res => {
// this.imgHours = res.data.data.imgHours[inx] console.log(res.data.data)
this.imgList = res.data.data
let tm = moment().add(1, 'days').format('MM月DD日')
let tm2 = moment().format('MM月DD日') // let inx = restm(h)
this.imgData = [`${tm2}08时`, `${tm}08时`]
// this.imgHourstm = [`${tm2}${h + 1}`, `${tm2}${h + 2}`] // 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 () { getTmData () {
let hn = this.numPic > 0 ? this.numPic : 1 let hn = this.numPic > 0 ? this.numPic : 1
@ -602,31 +622,34 @@ export default {
console.log('小时', h1) console.log('小时', h1)
console.log('需要参数', tms) console.log('需要参数', tms)
uni.request({
url: 'https://shqxjs.cloudowr.cn/service/radar/rainimg', uni.request({
data: { url: 'http://223.75.53.124:8005/radar/latest',
tm: tms success: res => {
}, let tm = moment(res.data.data.tm);
success: res => { let subfix = '?rainFile=' + res.data.data.rainFile;
console.log('pic---', tms, res.data.data) let url = `http://shqxjs.cloudowr.cn/yj_folder/rain/radar/${tm.format('YYYYMM')}/${tm.format('DD')}/${tm.format('YYYYMMDDHHmm')}+00.02.jpg${subfix}`;
this.imgHoursList = res.data.data.img console.log(222222222227,url)
let m = moment().format('MM月DD日')
console.log('pic---', tms, res.data.data)
console.log('am222', this.imgHoursList) this.imgHoursList = {'url':url}
let m1 = Number(h1) + 2 let m = moment().format('MM月DD日')
this.imgHourstm = [`${m}${h1}${mm}`, `${m}${m1}${mm}`]
console.log('am222', this.imgHoursList)
if (res.data.data.img == null) { let m1 = Number(h1) + 2
this.numPic++ this.imgHourstm = [`${m}${h1}${mm}`, `${m}${m1}${mm}`]
setTimeout(() => {
this.getHoursImg() if (url == null) {
}, 10 * 1000) this.numPic++
} else { setTimeout(() => {
this.numPic = 0 this.getHoursImg()
return }, 10 * 1000)
} } else {
} this.numPic = 0
}) return
}
}
})
}, },
// async getInterval () { // async getInterval () {

View File

@ -27,8 +27,8 @@
>记住用户名和密码</text >记住用户名和密码</text
> >
</uni-forms-item> </uni-forms-item>
<button type="primary" class="button" @click="xian"></button> <!-- <button type="primary" class="button" @click="xian"></button> -->
<button type="primary" class="button" @click="xiang"></button> <!-- <button type="primary" class="button" @click="xiang"></button> -->
<button type="primary" class="button" @click="login(formData)"> <button type="primary" class="button" @click="login(formData)">
登录 登录
</button> </button>
@ -83,7 +83,7 @@ export default {
}, },
login (formData) { login (formData) {
//loading //loading
// uni.showLoading({title:'...', mask:true}); uni.showLoading({title:'努力登录中...', mask:true});
//MD5 //MD5
const encryptData = data => { const encryptData = data => {
@ -115,7 +115,7 @@ export default {
// //
uni.$http.post('/gunshiApp/xfflood/doLogin', postForm).then(res => { uni.$http.post('/gunshiApp/xfflood/doLogin', postForm).then(res => {
// uni.showLoading({ title: '...', mask: true }) uni.showLoading({ title: '努力登录中...', mask: true })
if (res.data.code === 200) { if (res.data.code === 200) {
//localStoragetoken //localStoragetoken
@ -153,7 +153,7 @@ export default {
uni.showLoading({title:'努力登录中...', mask:true}); // uni.showLoading({title:'...', mask:true});
// //
setTimeout(function () { setTimeout(function () {
uni.hideLoading() uni.hideLoading()

BIN
static/logoc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 KiB