| | |
| | | <view class="LoginBg"></view> |
| | | <view class=""> </view> |
| | | </view> |
| | | |
| | | <el-form :hide-required-asterisk="true" ref="formLogin1" label-position="top" :rules="rules1" |
| | | :model="loginData"> |
| | | <el-form-item label="登录账号" prop="loginID"> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import CryptoJS from 'crypto-js'; |
| | | import { |
| | | encryptAES,decryptAES |
| | | } from '@/utils/Crypto.js' |
| | | import { |
| | | nextTick |
| | | } from "vue"; |
| | |
| | | required: true, |
| | | message: '请输入登录账号', |
| | | trigger: 'blur' |
| | | }], |
| | | }, |
| | | |
| | | ], |
| | | pass: [{ |
| | | required: true, |
| | | message: '请输入密码', |
| | |
| | | // 登录用户账号 |
| | | loginData: { |
| | | // 账号 |
| | | loginID: 'bbb', |
| | | pass: 'acy2jnwt/loR44ytIPPZBg==' |
| | | loginID: '', |
| | | pass: '' |
| | | }, |
| | | // 书籍数据 |
| | | listData: [{ |
| | | name: '历代医家传记库', |
| | | name: '中医人物数据库', |
| | | id: 1, |
| | | }, { |
| | | name: '世医医家库', |
| | | name: '世医医家数据库', |
| | | id: 2, |
| | | }, { |
| | | name: '医学学术流派', |
| | | name: '中医学术流派', |
| | | id: 3, |
| | | }, { |
| | | name: '中国地域医谱', |
| | | name: '中医地域医谱', |
| | | id: 4, |
| | | }, { |
| | | name: '中国医事制度', |
| | | name: '中医医事制度', |
| | | id: 5, |
| | | }, |
| | | |
| | |
| | | }, |
| | | // 用户登录 |
| | | async Login(formName) { |
| | | // let Obj = { |
| | | // username: this.loginData.loginID, |
| | | // password: this.loginData.pass, |
| | | // } |
| | | // AES 加密 |
| | | console.log(this.loginData.pass); |
| | | const encrypted = CryptoJS.AES.encrypt(this.loginData.pass, 'secret passphrase'); |
| | | console.log(decryptAES(this.loginData.pass),'this.loginData.pass'); |
| | | let Obj = { |
| | | username: this.loginData.loginID, |
| | | // encryptAES(this.loginData.pass) | this.loginData.pass |
| | | password: encryptAES(this.loginData.pass), |
| | | } |
| | | console.log(Obj, 'Obj'); |
| | | |
| | | // 将加密结果转换为 Base64 |
| | | const base64Result = encrypted.toString(CryptoJS.enc.Base64); |
| | | |
| | | // 输出加密后并转换为 Base64 的结果 |
| | | console.log('Encrypted and Base64 encoded password:', base64Result); |
| | | let res = await getLogin(Obj) |
| | | console.log(res, 'sfdsf'); |
| | | if (res.success) { |
| | |
| | | await getUserInfo().then(res => { |
| | | console.log(res, 'rrrrrrrrrrsd'); |
| | | }) |
| | | // 将账号存入到vuex中 |
| | | this.$store.dispatch('setUserName',res.object.username) |
| | | |
| | | uni.redirectTo({ |
| | | url: '/pages/index/index' |
| | | }) |