master
张林 2024-06-24 09:56:50 +08:00
parent 8aa407f7f2
commit ba009f0da3
5 changed files with 244 additions and 205 deletions

View File

@ -219,7 +219,11 @@
<div class="time">{{ imgHourstm[0] }} {{ imgHourstm[1] }}</div>
</div>
<div class="imgs" style="height: 100%; text-align: center">
<image :src="imgHoursList.url" mode="aspectFit"></image>
<image
v-if="imgHoursList"
:src="imgHoursList.url"
mode="aspectFit"
></image>
</div>
</view>
</view>
@ -229,7 +233,7 @@
<p class="title">
<span class="line"></span><span class="h4">雨情</span>
</p>
<div class="time" style="width:50%; color: #000" v-if="timeList">
<div class="time" style="width: 50%; color: #000" v-if="timeList">
<uni-data-select
v-model="value1"
:localdata="timeList"
@ -239,7 +243,11 @@
</uni-data-select>
</div>
</div>
<div class="info_icon" style="height: 260px; width: 100%" v-if="chartData.chartData">
<div
class="info_icon"
style="height: 260px; width: 100%"
v-if="chartData.chartData"
>
<qiun-data-charts
:chartData="chartData.chartData"
:echartsApp="true"
@ -252,7 +260,7 @@
<p class="title">
<span class="line"></span><span class="h4">水情</span>
</p>
<div class="time" style="width:50%; color: #000">
<div class="time" style="width: 50%; color: #000">
<u-subsection
:list="subList"
:current="current"
@ -312,7 +320,7 @@ const dataType = {
Tuesday: '星期二',
Wednesday: '星期三',
Thursday: '星期四',
Thursday: '星期五',
Friday: '星期五',
Saturday: '星期六',
Sunday: '星期天'
}
@ -507,16 +515,26 @@ export default {
let tms = null,
mm = null
let h1 = Number(h) - 1
if (h1 < 9) {
h1 = Number(h) - 3
}
if (h1 < 10) {
h1 = `0${h1}`
}
if (m > 30) {
tms = `${this.imgtm}${h1}30`
h1 = Number(h) - 1
tms = `${this.imgtm}${h}30`
mm = '30'
} else if (m < 10) {
tms = `${this.imgtm}${h1}00`
tms = `${this.imgtm}${h1}`
mm = '00'
} else {
tms = `${this.imgtm}${h1}30`
mm = '30'
}
console.log('ddddd', h, h1)
console.log('ddddd', tms)
uni.request({
url: 'https://shqxjs.cloudowr.cn/service/radar/rainimg',
data: {
@ -529,8 +547,8 @@ export default {
let m = moment().format('MM月DD日')
console.log('am222', this.imgHoursList)
this.imgHourstm = [`${m}${h1}${mm}`, `${m}${h1 + 2}${mm}`]
let m1 = Number(h1) + 2
this.imgHourstm = [`${m}${h1}${mm}`, `${m}${m1}${mm}`]
}
})
},
@ -787,15 +805,15 @@ export default {
this.getOverview()
this.getDataTime()
this.getResponseLevel()
this.getImgs()
this.getHoursImg()
this.getInterval()
},
onShow () {
this.getReadStatus()
if (this.limit == 1) {
this.getYjRead()
this.getInterval()
this.getImgs()
this.getHoursImg()
}
},
onUnload () {

View File

@ -1,178 +1,192 @@
<template>
<view class="container">
<div class="img">
<image style="width: 100%; height: 100%" src="../../static/images/u8.png" mode="scaleToFill"></image>
</div>
<uni-forms :modelValue="formData" class="form">
<uni-forms-item>
<uni-easyinput type="text" v-model="formData.username" placeholder="请输入用户名" />
</uni-forms-item>
<uni-forms-item>
<uni-easyinput type="password" v-model="formData.password" placeholder="请输入密码" />
</uni-forms-item>
<uni-forms-item>
<checkbox :checked="false" @click="handleChange(formData)" /><text>记住用户名和密码</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="login(formData)"></button>
</uni-forms>
</view>
<view class="container">
<div class="img">
<image
style="width: 100%; height: 100%"
src="../../static/images/u8.png"
mode="scaleToFill"
></image>
</div>
<uni-forms :modelValue="formData" class="form">
<uni-forms-item>
<uni-easyinput
type="text"
v-model="formData.username"
placeholder="请输入用户名"
/>
</uni-forms-item>
<uni-forms-item>
<uni-easyinput
type="password"
v-model="formData.password"
placeholder="请输入密码"
/>
</uni-forms-item>
<uni-forms-item>
<checkbox :checked="false" @click="handleChange(formData)" /><text
>记住用户名和密码</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="login(formData)">
登录
</button>
</uni-forms>
</view>
</template>
<script>
import CryptoJS from 'crypto-js'
let checked = false
export default {
data() {
return {
formData: {
username: '',
password: '',
checked: false,
},
import CryptoJS from 'crypto-js'
}
},
methods: {
handleChange(formData){
checked = !checked
formData.checked = !formData.checked
},
xian() {
this.formData = {
username: 'cwz',
password: '12345678a',
checked: false,
}
},
xiang() {
this.formData = {
username: 'mdx',
password: '1234567a',
checked: false,
}
},
login(formData){
//loading
// uni.showLoading({title:'...', mask:true});
//MD5
const encryptData = (data) => {
const encryptedData = CryptoJS.MD5(data).toString()
return encryptedData
}
//
let postForm = {
loginName: formData.username,
secretKey: encryptData(formData.password),
}
let checked = false
//
if (formData.checked === true){
uni.setStorageSync('loginName',postForm.loginName)
uni.setStorageSync('secretKey',postForm.secretKey)
} else {
// uni.removeStorageSync('loginName')
// uni.removeStorageSync('secretKey')
// this.formData.username = ''
// this.formData.password = ''
}
//
uni.$http.post('/gunshiApp/xfflood/doLogin',postForm).then(res=>{
uni.showLoading({title:'努力登录中...', mask:true});
if (res.data.code === 200) {
//localStoragetoken
if (res.data.data){
uni.setStorageSync('Gs-Token', res.data.data)
uni.$http.get('/gunshiApp/xfflood/getLoginInfo').then(res=>{
console.log("sss",res.data.data);
uni.setStorageSync('value', res.data.data)
console.log('-----value------',res.data.data);
})
//userId
uni.$http.get('/gunshiApp/xfflood/my/info/getByUserId').then(res=>{
console.log('-----avatar1------',res.data);
if (res.data.data) {
let url = '/gunshiApp/xfflood/bzProjectManipulationRecord/file/get/'
url = url + res.data.data.fileId
uni.$http.get(url).then(res=>{
uni.setStorageSync('avatar','http://223.75.53.141:9102/test.by-lyf.tmp'+res.data.data.filePath)
console.log('-----avatar------',uni.getStorageSync('avatar'));
})
} else {
uni.setStorageSync('avatar','../../static/tabs/touxiang.png')
}
})
}
//
setTimeout(
function(){
uni.hideLoading()
uni.reLaunch({
url: '/pages/homeIndex/index'
})
}
,1000)
clearTimeout()
} else if (res.data.code === 400) {
//
setTimeout(
function(){
uni.hideLoading()
uni.showToast({
title:res.data.description,
icon: 'none',
duration: 2000
})
}
,1000)
clearTimeout()
}
})
}
}
}
export default {
data () {
return {
formData: {
username: '',
password: '',
checked: false
}
}
},
methods: {
handleChange (formData) {
checked = !checked
formData.checked = !formData.checked
},
xian () {
this.formData = {
username: 'cwz',
password: '12345678a',
checked: false
}
},
xiang () {
this.formData = {
username: 'mdx',
password: '1234567a',
checked: false
}
},
login (formData) {
//loading
// uni.showLoading({title:'...', mask:true});
//MD5
const encryptData = data => {
const encryptedData = CryptoJS.MD5(data).toString()
return encryptedData
}
//
let postForm = {
loginName: formData.username,
secretKey: encryptData(formData.password)
}
//
if (formData.checked === true) {
uni.setStorageSync('loginName', postForm.loginName)
uni.setStorageSync('secretKey', postForm.secretKey)
} else {
// uni.removeStorageSync('loginName')
// uni.removeStorageSync('secretKey')
// this.formData.username = ''
// this.formData.password = ''
}
//
uni.$http.post('/gunshiApp/xfflood/doLogin', postForm).then(res => {
uni.showLoading({ title: '努力登录中...', mask: true })
if (res.data.code === 200) {
//localStoragetoken
if (res.data.data) {
uni.setStorageSync('Gs-Token', res.data.data)
uni.$http.get('/gunshiApp/xfflood/getLoginInfo').then(res => {
console.log('sss', res.data.data)
uni.setStorageSync('value', res.data.data)
console.log('-----value------', res.data.data)
})
//userId
uni.$http
.get('/gunshiApp/xfflood/my/info/getByUserId')
.then(res => {
console.log('-----avatar1------', res.data)
if (res.data.data) {
let url =
'/gunshiApp/xfflood/bzProjectManipulationRecord/file/get/'
url = url + res.data.data.fileId
uni.$http.get(url).then(res => {
uni.setStorageSync(
'avatar',
'http://223.75.53.141:9102/test.by-lyf.tmp' +
res.data.data.filePath
)
console.log(
'-----avatar------',
uni.getStorageSync('avatar')
)
})
} else {
uni.setStorageSync('avatar', '../../static/tabs/touxiang.png')
}
})
}
//
setTimeout(function () {
uni.hideLoading()
uni.reLaunch({
url: '/pages/homeIndex/index'
})
}, 1000)
clearTimeout()
} else if (res.data.code === 400) {
//
setTimeout(function () {
uni.hideLoading()
uni.showToast({
title: res.data.description,
icon: 'none',
duration: 2000
})
}, 1000)
clearTimeout()
}
})
}
}
}
</script>
<style>
.container{
display: flex;
flex: 1;
flex-direction: column;
width: 100vw;
height: 100vh;
align-items: center;
background-color: #f3f5f8;
}
.img{
width: 100vw;
height: 50vh;
margin-top: 5vh;
/* background-color: red; */
}
.form{
margin-top: 4vh;
width: 80%;
height: 8vh;
align-items: center;
justify-content: center;
}
.button{
}
.container {
display: flex;
flex: 1;
flex-direction: column;
width: 100vw;
height: 100vh;
align-items: center;
background-color: #f3f5f8;
}
.img {
width: 100vw;
height: 50vh;
margin-top: 5vh;
/* background-color: red; */
}
.form {
margin-top: 4vh;
width: 80%;
height: 8vh;
align-items: center;
justify-content: center;
}
.button {
}
</style>

View File

@ -15,8 +15,8 @@
<u--form
labelPosition="left"
:model="formList"
ref="form2"
labelWidth="150"
ref="form3"
labelWidth="100"
v-if="key == 3"
>
<u-form-item
@ -57,8 +57,11 @@
<u-form-item
label="灾害发生地点"
prop="address"
@click="toMap"
:borderBottom="false"
@click="
isMap = true
hideKeyboard()
"
ref="item1"
>
<u--input
@ -408,7 +411,7 @@ export default {
name: '否'
}
],
rules: {
rules2: {
otime: [
{
type: 'string',
@ -429,7 +432,7 @@ export default {
{
type: 'string',
required: true,
message: '请选择灾害发生点',
message: '请选择',
trigger: ['blur', 'change']
}
]
@ -447,7 +450,7 @@ export default {
onReady () {
console.log('搜索框22key', this.key)
// setRules
this.$refs.form2.setRules(this.rules)
this.$refs.form3.setRules(this.rules2)
},
methods: {
back (lnglat, address) {
@ -456,6 +459,7 @@ export default {
this.formList.lgtd = lnglat[0]
this.formList.lttd = lnglat[1]
this.formList.address = address
this.$refs.form3.validateField('address')
},
toMap () {
this.isMap = true
@ -577,25 +581,26 @@ export default {
open () {},
navigateBack () {
uni.navigateBack()
uni.reLaunch({
url: '/pages/xxsb/index'
})
},
severitySelect (e) {
console.log('severitySelect0', e)
this.formList.severity = e.name
this.$refs.form2.validateField('severity')
this.$refs.form3.validateField('severity')
},
controlledSelect (e) {
this.formList.isControlled = e.name
this.$refs.form2.validateField('isControlled')
this.$refs.form3.validateField('isControlled')
},
submit () {
this.$refs.form2
this.$refs.form3
.validate()
.then(res => {
uni.$u.toast('校验通过', res)
debugger
let params = Object.assign(this.formList)
// 1 2 3 4
if (this.formList.severity == '一般险情') {
@ -635,11 +640,11 @@ export default {
// catchthentrue
},
reset () {
const validateList = ['projectName', 'radiovalue1']
this.$refs.form1.resetFields()
this.$refs.form1.clearValidate()
const validateList = ['otime', 'severity', 'address']
this.$refs.form3.resetFields()
this.$refs.form3.clearValidate()
setTimeout(() => {
this.$refs.form1.clearValidate(validateList)
this.$refs.form3.clearValidate(validateList)
// 使 this.$refs.form1.clearValidate()
}, 10)
},

View File

@ -504,7 +504,9 @@ export default {
open () {},
navigateBack () {
uni.navigateBack()
uni.reLaunch({
url: '/pages/xxsb/index'
})
},
//
sexSelect (e) {
@ -539,14 +541,14 @@ export default {
params.isPowerGeneration = params.isPowerGeneration == '是' ? 1 : 0
params.isFloodRelease = params.isFloodRelease == '是' ? 1 : 0
console.log('参数', params)
if (this.fileList1.length > 0) {
params.fileId = this.fileList1.map(item => {
params.fileIds = this.fileList1.map(item => {
return JSON.parse(item.url).data.fileId
})
} else {
params.fileIds = []
}
console.log('参数', params)
uni.$http
.post('/gunshiApp/xfflood/xfProjectRun/insert', params)
.then(res => {
@ -559,10 +561,10 @@ export default {
}
})
.catch(e => {
this.model1.isPowerGeneration =
params.isPowerGeneration == 1 ? '是' : '否'
this.model1.isFloodRelease =
params.isPowerGeneration == 1 ? '是' : '否'
// this.model1.isPowerGeneration =
// params.isPowerGeneration == 1 ? '' : ''
// this.model1.isFloodRelease =
// params.isPowerGeneration == 1 ? '' : ''
})
})
.catch(errors => {

View File

@ -2,7 +2,7 @@
<view>
<view class="page-section page-section-gap">
<map
style="width: 100%; height: 450px"
style="width: 100%; height: 300px; flex: 1"
id="container"
:latitude="lnglat[1]"
:longitude="lnglat[0]"