Merge branch 'ws-dev' into master1

master
wang@DESKTOP-VRHIPTL 2024-06-05 17:50:20 +08:00
commit 0e10dec871
14 changed files with 707 additions and 24 deletions

17
App.vue
View File

@ -1,7 +1,22 @@
<script>
export default {
onLaunch: function() {
console.log('App Launch')
const token = {
loginName: uni.getStorageSync('loginName'),
secretKey: uni.getStorageSync('secretKey'),
}
if (token.secretKey){
uni.reLaunch({
url: '/pages/homeIndex/index'
})
console.log(token.secretKey,'App Launch')
} else {
uni.reLaunch({
url: '/pages/login/login'
})
console.log(token.secretKey,'App Launch2')
}
},
onShow: function() {
console.log('App Show')

View File

@ -21,7 +21,7 @@ $http.beforeRequest = function (options) {
}
if (options.url.indexOf('/getLoginInfo') !== -1) {
options.header = {
'Gs-Token': '827C4B2AA67D4724B2677B0A708D5033'
'gs-token': uni.getStorageSync('Gs-Token')
}
}
}

11
package-lock.json generated
View File

@ -10,6 +10,7 @@
"echarts": "^4.9.0",
"es6-promise": "^4.2.8",
"flv.js": "^1.6.2",
"crypto-js": "^4.2.0",
"moment": "^2.30.1"
}
},
@ -40,6 +41,11 @@
"webworkify-webpack": "^2.1.5"
}
},
"node_modules/crypto-js": {
"version": "4.2.0",
"resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.2.0.tgz",
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="
},
"node_modules/moment": {
"version": "2.30.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
@ -87,6 +93,11 @@
"webworkify-webpack": "^2.1.5"
}
},
"crypto-js": {
"version": "4.2.0",
"resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.2.0.tgz",
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="
},
"moment": {
"version": "2.30.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",

View File

@ -1,6 +1,7 @@
{
"dependencies": {
"@escook/request-miniprogram": "^0.2.1",
"crypto-js": "^4.2.0",
"echarts": "^4.9.0",
"es6-promise": "^4.2.8",
"flv.js": "^1.6.2",

View File

@ -6,23 +6,51 @@
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": ""
// "navigationStyle": "custom"
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
},
{
"path": "pages/rain/rain",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
// {
// "path": "pages/rain/rain",
// "style": {
// "navigationBarTitleText": "",
// "enablePullDownRefresh": false
// }
// },
{
"path": "pages/homeIndex/index",
"style": {
"navigationBarTitleText": ""
}
},
{
"path" : "pages/mypage/mypage",
"style" :
{
"navigationBarTitleText" : ""
}
},
{
"path" : "pages/personInfo/personInfo",
"style":
{
"navigationBarTitleText" : ""
}
},
{
"path" : "pages/modifyPassword/modifyPassword",
"style" :
{
"navigationBarTitleText" : ""
}
},
{
"path" : "pages/login/login",
"style" :
{
"navigationBarTitleText" : ""
}
},
{
"path" : "pages/forewarning/forewarning",
"style" :
@ -101,10 +129,10 @@
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": ""
// "navigationStyle": "custom"
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
}
}
],
"tabBar": {
@ -116,18 +144,18 @@
"iconPath": "/static/tabs/my2_icon@2x.png",
"selectedIconPath": "static/tabs/my2_icon@2x.png",
"text": "pages"
},
{
"pagePath": "pages/homeIndex/index",
"iconPath": "/static/tabs/首页@2x.png",
"selectedIconPath": "static/tabs/首页2@2x.png",
"text": "首页"
},
{
"pagePath": "pages/addressBook/addressBook",
"iconPath": "/static/tabs/首页@2x.png",
"selectedIconPath": "static/tabs/首页2@2x.png",
"text": "通讯录"
"pagePath": "pages/homeIndex/index",
"iconPath": "/static/tabs/首页@2x.png",
"selectedIconPath": "static/tabs/首页2@2x.png",
"text": "首页"
},
{
"pagePath": "pages/mypage/mypage",
"iconPath": "/static/images/my1.png",
"selectedIconPath": "static/images/my.png",
"text": "我的"
}
]
},

145
pages/login/login.vue Normal file
View File

@ -0,0 +1,145 @@
<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="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,
},
}
},
methods: {
handleChange(formData){
checked = !checked
formData.checked = !formData.checked
},
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=>{
uni.setStorageSync('value', res.data.data)
})
}
//
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{
}
</style>

View File

@ -0,0 +1,139 @@
<template>
<view class="container">
<div class="userinfo">
<div class="icon" @click="goBack">
<uni-icons type="back" size="25" color="white"></uni-icons>
</div>
<div class="Header">
<span>修改密码</span>
</div>
</div>
<div class="info">
<uni-forms :modelValue="formData" >
<uni-forms-item label="原密码" :required="true" class="form">
<uni-easyinput type="password" v-model="formData.oldSecretKey" placeholder="请输入原密码" class="password"/>
</uni-forms-item>
<uni-forms-item label="新密码" :required="true" class="form">
<uni-easyinput type="password" v-model="formData.newSecretKey" placeholder="请输入新密码" class="password"/>
</uni-forms-item>
<uni-forms-item label="再次输入新密码" label-width="120px" :required="true" class="form">
<uni-easyinput type="password" v-model="formData.secondSecretKey" placeholder="请再次输入新密码" class="password"/>
</uni-forms-item>
<button type="primary" class="button" @click="save(formData)"></button>
</uni-forms>
</div>
</view>
</template>
<script>
import CryptoJS from 'crypto-js'
export default {
data() {
return {
formData: {
oldSecretKey: '',
newSecretKey: '',
secondSecretKey: '',
},
}
},
methods: {
goBack(){
uni.navigateBack()
},
save(formData){
let new_params = {
userId: '' ,
oldSecretKey: '',
newSecretKey: '',
secondSecretKey: '',
}
new_params.oldSecretKey = CryptoJS.MD5(formData.oldSecretKey).toString()
new_params.newSecretKey = CryptoJS.MD5(formData.newSecretKey).toString()
new_params.secondSecretKey = CryptoJS.MD5(formData.secondSecretKey).toString()
new_params.userId = uni.getStorageSync('value').userId
// console.log(formData)
uni.$http.post('/gunshiApp/xfflood/user/updateSecretKey',new_params).then(res=>{
console.log(res);
if (res.data.code === 200) {
uni.showToast({
title: res.data.description,
icon:'none',
duration: 2000
})
setTimeout(uni.navigateBack(),2500)
} else {
uni.showToast({
title: res.data.description,
icon:'none',
duration: 2000
})
}
})
// uni.navigateBack()
},
}
}
</script>
<style>
.userinfo{
border-radius: 5px;
display: flex;
flex-direction: row;
margin-top: 5vh;
margin-left: 2vw;
margin-bottom: 2vh;
align-items: center;
width: 95%;
height: 6vh;
background-color: #007afd;
}
.icon{
width: 6vw;
height: 6vh;
align-items: center;
line-height: 6vh;
}
.Header{
display: flex;
flex-direction: row;
flex: 0.95;
justify-content: center;
color: white;
font-size: 20px;
}
.form{
height: 50px;
width: 95%;
/* background-color: red; */
margin-left: 1vw;
align-items: center;
}
.password{
font-size: 20px;
border: none;
}
.button{
border-radius: 10px;
display: flex;
flex-direction: column-reverse;
margin-top: 50vh;
width: 92%;
height: 6vh;
font-size: 20px;
color: white;
background-color: #007afd;
}
</style>

203
pages/mypage/mypage.vue Normal file
View File

@ -0,0 +1,203 @@
<template>
<view class="container">
<view class="userInfo">
<div class="icon">
<image
style="width: 100%; height: 100%"
src="../../static/tabs/头像_icon@2x.png"
mode="aspectFit"
></image>
</div>
<div class="user">
<div class="username">{{userList.userName}}</div>
<div class="userresponse">{{userList.orgList[0].orgName}}</div>
</div>
</view>
<view class="funcBar">
<div class="funcList" v-for="(item, index) in func" :key="index" >
<div @click="navigateToSubPage(index)">
<div class="funcIcon">
<image
class="icon-left"
style="width: 100%; height: 100%"
:src="item.img"
mode="aspectFit"
></image>
</div>
<div class="funcTxt">{{ item.name }}</div>
</div>
</div>
</view>
<view class="version">
<div class="content">
<div class="left">
<uni-icons type="info" size="25" class="icon-left"></uni-icons>
版本号
</div>
<div class="mid"></div>
<div class="right">{{version}}</div>
</div>
</view>
<view class="null"></view>
<button type="primary" class="button" @click="logout">退</button>
</view>
</template>
<script>
const func = [
{img: '../../static/images/info.png', name: '个人信息', url:'/pages/personInfo/personInfo'},
{img: '../../static/images/password.png', name: '修改密码', url:'/pages/modifyPassword/modifyPassword'},
]
const userList = uni.getStorageSync('value')
console.log(userList);
export default {
data() {
return {
userList: userList,
username:'',
userresponse:'防汛办',
version:'011.14.23',
func: func,
}
},
methods: {
navigateToSubPage(index){
uni.navigateTo({
url: func[index].url,
animationType:'pop-in',
})
// console.log('click',index,func[index].url)
},
logout(){
uni.removeStorageSync('loginName')
uni.removeStorageSync('secretKey')
uni.removeStorageSync('Gs-Token')
uni.removeStorageSync('value')
uni.redirectTo({
url: '/pages/login/login'
})
}
}
}
</script>
<style>
.container{
display: flex;
flex-direction: column;
height: 100vh;
width: 100vw;
background-color: #f3f5f8;
}
.userInfo{
border-radius: 5px;
display: flex;
flex-direction: row;
align-items: center;
margin-top: 5vh;
margin-left: 2vw;
margin-bottom: 2vh;
width: 95%;
height: 15vh;
background-color: #fff;
}
.icon{
width: 50px;
height: 50px;
border-radius: 50%;
margin-left: 2vw;
background-color: #fff;
text-align: center;
color: #007afd;
line-height: 50px;
}
.user{
display: flex;
flex-direction: column;
margin-left: 6vw;
}
.username{
font-size: 20px;
font-weight: bold;
margin-bottom: 1vh;
}
.funcIcon{
width: 50px;
height: 50px;
margin-left: 4px;
margin-bottom: 1vh;
display: flex;
justify-content: center;
align-items: center;
}
.funcBar {
border-radius: 5px;
margin-bottom: 2vh;
margin-left: 2vw;
display: flex;
justify-content: row;
align-items: center;
width: 95%;
height: 15vh;
background-color: #fff;
}
.funcList {
text-align: center;
font-size: 14px;
margin: 2vw;
}
.version{
margin-left: 2vw;
border-radius: 5px;
display: flex;
flex-direction: column;
width: 95%;
height: 8vh;
background-color: #fff;
}
.content{
display: flex;
flex-direction: row;
}
.left{
width:100px;
text-align: start;
margin-left: 1vw;
line-height: 8vh;
}
.icon-left{
align-items: center;
width: 30px;
/* background-color: red; */
}
.mid{
flex: 1;
line-height: 8vh;
}
.right{
width:100px;
text-align: end;
line-height: 8vh;
margin-right: 10px;
}
.null{
height: 45vh;
}
.button{
border-radius: 10px;
display: flex;
flex-direction: column-reverse;
width: 92%;
height: 6vh;
font-size: 20px;
color: white;
background-color: #007afd;
}
</style>

View File

@ -0,0 +1,141 @@
<template>
<view class="container">
<div class="userinfo">
<div class="icon" @click="goBack">
<uni-icons type="back" size="25" color="white"></uni-icons>
</div>
<div class="Header">
<span>个人信息</span>
</div>
</div>
<uni-list class="info">
<uni-list-item
title="头像"
show-arrow="true"
clickable
class="listContainer"
@click="showActionSheet()"
>
<template v-slot:footer >
<image class="slot-image" src='../../static/tabs/头像_icon@2x.png' mode="aspectFit"></image>
</template>
</uni-list-item>
<uni-list-item
v-for="(item, index) in userListShow"
:key="index"
clickable
:title="item.name"
class="listContainer"
>
<template v-slot:footer >
<div @click="modifyValue(item)" @click.stop="over(item)">
<text >{{item.info}}</text>
</div>
</template>
</uni-list-item>
</uni-list>
<button type="primary" class="button">保存</button>
</view>
</template>
<script>
let modify = false
//访
const userList = uni.getStorageSync('value')
const userListShow = [
{name: '手机号码', info: userList.phone},
]
const default_src = '../../static/tabs/头像_icon@2x.png'
export default {
data() {
return {
userList: userList,
userListShow:userListShow,
modify: modify
}
},
methods: {
goBack(){
uni.navigateBack()
},
showActionSheet(){
uni.showActionSheet({
itemList: ['拍照/上传照片', '恢复默认头像'],
success: (res) => {
console.log('选择了第' + (res.tapIndex + 1) + '个选项');
if (res.tapIndex === 0) { //
} else if(res.tapIndex === 1) { //
}
},
fail: (err) => {
console.log('弹窗取消');
}
});
},
modifyValue(item){
console.log(item);
}
}
}
</script>
<style>
.userinfo{
border-radius: 5px;
display: flex;
flex-direction: row;
margin-top: 5vh;
margin-left: 2vw;
margin-bottom: 2vh;
align-items: center;
width: 95%;
height: 6vh;
background-color: #007afd;
}
.icon{
width: 6vw;
height: 6vh;
align-items: center;
line-height: 6vh;
}
.Header{
display: flex;
flex-direction: row;
flex: 0.95;
justify-content: center;
color: white;
font-size: 20px;
}
.info{
margin: 1vh;
}
.listContainer{
height: 6vh;
line-height: 8vh;
}
.button{
margin-top: 60vh;
border-radius: 10px;
display: flex;
flex-direction: column-reverse;
width: 92%;
height: 6vh;
font-size: 20px;
color: white;
background-color: #007afd;
}
.slot-image{
width: 8vw;
height: 8vh;
}
</style>

BIN
static/images/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 723 B

BIN
static/images/my.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 897 B

BIN
static/images/my1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 904 B

BIN
static/images/password.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 826 B

BIN
static/images/u8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 KiB