![]()
@@ -95,9 +95,8 @@ import Cookies from "js-cookie";
import CDialog from "@c/CDialog";
import debounce from "lodash/debounce";
import { messages } from "@/i18n";
-import { getUUID } from "@/utils";
+import { getUUID, encryptedData } from "@/utils";
import { Loading } from "element-ui"; // 引入Loading服务
-import JSEncrypt from "jsencrypt"; //引入加密
let loading; // 加载动画
export default {
@@ -176,35 +175,16 @@ export default {
// 表单提交
dataFormSubmitHandle() {
this.$refs["dataForm"].validate((valid, messageObj) => {
+ console.log(valid, messageObj);
if (!valid) {
app.util.validateRule(messageObj);
+ return;
}
this.startLoading();
- // const url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/epmetuser/customerstaff/customerlist'
const url = "/epmetuser/customerstaff/customerlist";
const params = {
- phone: this.dataForm.phone,
+ phone: encryptedData(this.pubKey, this.dataForm.phone),
};
- // this.$http
- // .post(url, params).then(({ data })=> {
- // console.log('res--comll', data)
- // if (data.data.length === 0) {
- // //没有客户,提示无法登录
- // this.$message.error('账号不存在')
- // this.endLoading()
- // } else if (data.data.length === 1) {
- // this.selectCustomer(data.data[0])
- // } else {
- // this.endLoading()
- // this.diaVisible = true
- // this.$nextTick(() => {
- // this.tableData = data.data
- // })
- // }
- // }).catch((err) => {
- // this.endLoading()
- // this.$message.error(err)
- // })
window.app.ajax.post(
url,
params,
@@ -262,7 +242,8 @@ export default {
this.dataForm.customerId = row.customerId;
let param = {};
Object.assign(param, this.dataForm);
- param.password = this.encryptedData(this.pubKey, this.dataForm.password);
+ param.phone = encryptedData(this.pubKey, this.dataForm.phone);
+ param.password = encryptedData(this.pubKey, this.dataForm.password);
this.$http
.post(url, param)
.then(({ data: res }) => {
@@ -301,15 +282,6 @@ export default {
loading.close();
}
},
- // 加密
- encryptedData(key, data) {
- // 新建JSEncrypt对象
- let encryptor = new JSEncrypt();
- // 设置公钥
- encryptor.setPublicKey(key);
- // 加密数据
- return encryptor.encrypt(data);
- },
},
};