| | |
| | | <script setup> |
| | | import { adminDetailApi,getRunStateApi,getTotalRevenueApi,getWaterConsumptionApi} from '../../api/index.js' |
| | | import { adminDetailApi,getRunStateApi,getTotalRevenueApi,getWaterConsumptionApi,changePasswordApi} from '../../api/index.js' |
| | | import { onMounted,ref } from 'vue' |
| | | import { onShow } from '@dcloudio/uni-app' |
| | | const echarts = require('../../static/echarts.min.js') |
| | |
| | | chart.setOption(flowOption) |
| | | }) |
| | | } |
| | | //修改密码 |
| | | const popup = ref() |
| | | const rules = ref({ |
| | | newPassword: { |
| | | rules:[{required: true, errorMessage:'请输入', trigger: "blur"}], |
| | | }, |
| | | oldPassword: { |
| | | rules:[{required: true, errorMessage:'请输入', trigger: "blur"}], |
| | | }, |
| | | }) |
| | | const pwdFormRef =ref() |
| | | const pwdForm = ref({ |
| | | oldPassword:'', |
| | | newPassword:'', |
| | | }) |
| | | function editPwd(){ |
| | | popup.value.open() |
| | | } |
| | | function concel(){ |
| | | pwdForm.value = {} |
| | | pwdFormRef.value.clearValidate() |
| | | popup.value.close() |
| | | } |
| | | async function confirmEdit(){ |
| | | pwdFormRef.value.validate().then(async(validate)=>{ |
| | | let res = await changePasswordApi(pwdForm.value) |
| | | if(res.code === 200){ |
| | | uni.showToast({ |
| | | title:'修改成功' |
| | | }) |
| | | concel() |
| | | }else{ |
| | | uni.showToast({ |
| | | title:'修改失败' |
| | | }) |
| | | concel() |
| | | } |
| | | }).catch((err)=>{}) |
| | | } |
| | | //退登 |
| | | function loginOut(){ |
| | | wx.showModal({ |
| | | title: '提示', |
| | |
| | | </view> |
| | | </view> |
| | | <view class="edit"> |
| | | <view class="edit-text1">修改密码</view> |
| | | <view class="edit-text1" @click="editPwd">修改密码</view> |
| | | <view class="edit-text2" @click="loginOut">退出登录</view> |
| | | </view> |
| | | </view> |
| | |
| | | <view class="charts3"> |
| | | <l-echart ref="flowEcharts"></l-echart> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <uni-popup ref="popup" :is-mask-click ='false' type="center" border-radius="20px"> |
| | | <view class="dialog-box"> |
| | | <view> |
| | | <uni-forms ref="pwdFormRef" :model="pwdForm" :rules="rules"> |
| | | <uni-forms-item label="旧密码:" name='oldPassword'> |
| | | <uni-easyinput class="input" v-model="pwdForm.oldPassword" placeholder="请输入旧密码">></uni-easyinput> |
| | | </uni-forms-item> |
| | | <uni-forms-item label="新密码:" name="newPassword"> |
| | | <uni-easyinput class="input" v-model="pwdForm.newPassword" placeholder="请输入新密码">></uni-easyinput> |
| | | </uni-forms-item> |
| | | </uni-forms> |
| | | </view> |
| | | <view class="button-box"> |
| | | <button class="btn1" @click="concel">取消</button> |
| | | <button class="btn2" @click="confirmEdit">确认</button> |
| | | </view> |
| | | </view> |
| | | </uni-popup> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | .dialog-box{ |
| | | width:600rpx; |
| | | height:500rpx; |
| | | background: #fafbfc; |
| | | padding:40rpx; |
| | | box-sizing: border-box; |
| | | display: flex; |
| | | justify-content:center; |
| | | flex-direction: column; |
| | | border-radius:20rpx; |
| | | .input{ |
| | | align-items: center; |
| | | } |
| | | .button-box{ |
| | | width:100%; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | .btn1{ |
| | | line-height:60rpx; |
| | | width:180rpx; |
| | | height:60rpx; |
| | | background: #fcfcfc; |
| | | color: #505354; |
| | | } |
| | | .btn2{ |
| | | line-height:60rpx; |
| | | width:180rpx; |
| | | height:60rpx; |
| | | background: #b7cafc; |
| | | color: #484b4c; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </style> |