| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <template>
- <!-- <page-meta :root-font-size="getRootFontSize(1)"></page-meta> -->
- <view id="wrap">
- <view class="changeFont">
- <view class="changeFont_left"><text style="color: #ff0000; ">*</text>原密码:</view>
- <uni-easyinput v-model="oldpass" placeholder="原密码" type="password"/>
- </view>
- <view class="changeFont">
- <view class="changeFont_left"><text style="color: #ff0000; ">*</text>新密码:</view>
- <uni-easyinput v-model="newpass" placeholder="新密码(8-20位必须包含字母大小写和数字)" type="password"/>
- </view>
- <view class="changeFont">
- <view class="changeFont_left"><text style="color: #ff0000; ">*</text>确认密码:</view>
- <uni-easyinput v-model="confirmpass" placeholder="确认密码(8-20位必须包含字母大小写和数字)" type="password"/>
- </view>
- <view class="btnClass">
- <wButton class="wbutton" text="保存" :rotate="isRotate" @click="saveFont"></wButton>
- </view>
- </view>
- </template>
- <script>
- import wButton from '@/components/watch-login/watch-button.vue' //button
- import { encrypt, decrypt } from "@/utils/jsencrypt";
- import md5 from '@/static/js/md5/md5.js'
- export default {
- data() {
- return {
- selectValue: 1,
- isAllow:"",
- isRotate: false, //是否加载旋转
- range: [{
- value: 1,
- text: "小"
- },
- {
- value: 1.2,
- text: "中"
- },
- {
- value: 1.4,
- text: "大"
- },
- ],
- oldpass:'',
- newpass:'',
- confirmpass:''
- };
- },
- components: {
- wButton,
- },
- onLoad() {
- this.selectValue = uni.getStorageSync('fontSizeValue')
- },
- methods: {
- change(e) {
- console.log("e:", e);
- },
- getAllowDept(){
- const params = {}
- this.$http.get('Index/GetUserDept', params).then(res=>{
- if(res.message == '需要选择科室'){
- this.isAllow = "1"
- }else{
- this.isAllow = "0"
- }
- uni.setStorageSync('isAllow', this.isAllow)
- uni.switchTab({
- url: '/pages/myTask/myTask'
- });
- })
- },
- saveFont() {
- const reg = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,20}$/;
- if(!this.oldpass){
- this.$mHelper.toast("原密码不能为空");
- return
- }
- if(!this.newpass){
- this.$mHelper.toast("新密码不能为空");
- return
- }
- if(this.newpass == this.oldpass){
- this.$mHelper.toast("新密码不能和原密码相同!");
- return
- }
- if(!this.confirmpass){
- this.$mHelper.toast("确认密码不能为空");
- return
- }
- if(this.confirmpass != this.newpass){
- this.$mHelper.toast("两次密码不一致,请重新输入");
- return
- }
- if(!reg.test(this.newpass) || !reg.test(this.confirmpass)){
- this.$mHelper.toast("密码不符合规范,请重新输入密码");
- return
- }
- const params={
- oldpwd: md5.hex_md5(this.oldpass),
- pwd: md5.hex_md5(this.confirmpass),
- // username: uni.getStorageSync("userName"),
- usercode: uni.getStorageSync("userCode"),
- }
- this.$http.get("UserAccount/ResetPwd", params).then((response) => {
- if (response.state == "success") {
- this.$mHelper.toast("恭喜你,重置密码成功!");
- this.getAllowDept()
- }else{
- this.$mHelper.toast(response.message);
- }
- })
- },
- }
- }
- </script>
- <style scoped>
- #wrap {
- background: #fff;
- padding: 15px;
- }
- .btnClass {
- margin-top: 30px;
- }
- .fontContent {
- margin-top: 30px;
- }
- .changeFont_left {
- width: 25%;
- }
- .changeFont {
- margin-top: 30px;
- display: flex;
- background: #fff;
- line-height: 36px;
- }
- </style>
|