|
@@ -44,6 +44,19 @@
|
|
|
登录
|
|
登录
|
|
|
</el-button>
|
|
</el-button>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <div
|
|
|
|
|
+ style="
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ text-decoration: underline;
|
|
|
|
|
+ color: #999;
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ "
|
|
|
|
|
+ @click="router.push('/forgetPassword')"
|
|
|
|
|
+ >
|
|
|
|
|
+ 忘记密码
|
|
|
|
|
+ </div>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="df aic jcc" style="margin-top: 55px">
|
|
<div class="df aic jcc" style="margin-top: 55px">
|
|
@@ -72,7 +85,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
-<script>
|
|
|
|
|
|
|
+<script setup>
|
|
|
import { ref, reactive, toRefs, computed } from "vue";
|
|
import { ref, reactive, toRefs, computed } from "vue";
|
|
|
import { ElNotification } from "element-plus";
|
|
import { ElNotification } from "element-plus";
|
|
|
import store from "../../store";
|
|
import store from "../../store";
|
|
@@ -81,112 +94,95 @@ import router from "../../router";
|
|
|
import md5 from "md5";
|
|
import md5 from "md5";
|
|
|
import api from "../../apis/fetch";
|
|
import api from "../../apis/fetch";
|
|
|
|
|
|
|
|
-export default {
|
|
|
|
|
- setup() {
|
|
|
|
|
- const form = ref(null);
|
|
|
|
|
- const ruleForm = reactive({
|
|
|
|
|
- ruleForm: {
|
|
|
|
|
- phone: "",
|
|
|
|
|
- password: "",
|
|
|
|
|
- },
|
|
|
|
|
- });
|
|
|
|
|
|
|
+const form = ref(null);
|
|
|
|
|
+const ruleForm = ref({
|
|
|
|
|
+ phone: "",
|
|
|
|
|
+ password: "",
|
|
|
|
|
+});
|
|
|
|
|
|
|
|
- const rules = reactive({
|
|
|
|
|
- rules: {
|
|
|
|
|
- phone: [
|
|
|
|
|
- { required: true, message: "请输入手机号", trigger: "blur" },
|
|
|
|
|
- { min: 11, max: 11, message: "请正确输入手机号", trigger: "blur" },
|
|
|
|
|
- ],
|
|
|
|
|
- password: [
|
|
|
|
|
- { required: true, message: "请输入密码", trigger: "blur" },
|
|
|
|
|
- { min: 6, max: 20, message: "请正确输入手机号", trigger: "blur" },
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- });
|
|
|
|
|
- function check() {
|
|
|
|
|
- // form.value.validate((valid) => {});
|
|
|
|
|
- }
|
|
|
|
|
- function login() {
|
|
|
|
|
- form.value.validate(async (valid) => {
|
|
|
|
|
- if (valid) {
|
|
|
|
|
- let { phone, password } = ruleForm.ruleForm;
|
|
|
|
|
- let res = await api.staffLogin({
|
|
|
|
|
- phone,
|
|
|
|
|
- // password: md5(password).toUpperCase(),
|
|
|
|
|
- password,
|
|
|
|
|
- // proxyId: 31,
|
|
|
|
|
|
|
+const rules = ref({
|
|
|
|
|
+ phone: [
|
|
|
|
|
+ { required: true, message: "请输入手机号", trigger: "blur" },
|
|
|
|
|
+ { min: 11, max: 11, message: "请正确输入手机号", trigger: "blur" },
|
|
|
|
|
+ ],
|
|
|
|
|
+ password: [
|
|
|
|
|
+ { required: true, message: "请输入密码", trigger: "blur" },
|
|
|
|
|
+ { min: 6, max: 20, message: "请正确输入手机号", trigger: "blur" },
|
|
|
|
|
+ ],
|
|
|
|
|
+});
|
|
|
|
|
+function check() {
|
|
|
|
|
+ // form.value.validate((valid) => {});
|
|
|
|
|
+}
|
|
|
|
|
+function login() {
|
|
|
|
|
+ form.value.validate(async (valid) => {
|
|
|
|
|
+ if (valid) {
|
|
|
|
|
+ let { phone, password } = ruleForm.value;
|
|
|
|
|
+ let res = await api.staffLogin({
|
|
|
|
|
+ phone,
|
|
|
|
|
+ // password: md5(password).toUpperCase(),
|
|
|
|
|
+ password: md5(md5(password)),
|
|
|
|
|
+ // proxyId: 31,
|
|
|
|
|
+ });
|
|
|
|
|
+ if (res.data.status == 0) {
|
|
|
|
|
+ let {
|
|
|
|
|
+ userId,
|
|
|
|
|
+ userName,
|
|
|
|
|
+ phone,
|
|
|
|
|
+ contactName,
|
|
|
|
|
+ loginAccountId,
|
|
|
|
|
+ rolePermission,
|
|
|
|
|
+ email,
|
|
|
|
|
+ } = res.data.result;
|
|
|
|
|
+ if (!rolePermission.length) {
|
|
|
|
|
+ ElNotification.error({
|
|
|
|
|
+ title: "失败",
|
|
|
|
|
+ duration: 2000,
|
|
|
|
|
+ message: "暂无权限,请联系管理员",
|
|
|
|
|
+ type: "error",
|
|
|
});
|
|
});
|
|
|
- if (res.data.status == 0) {
|
|
|
|
|
- let {
|
|
|
|
|
- userId,
|
|
|
|
|
- userName,
|
|
|
|
|
- phone,
|
|
|
|
|
- contactName,
|
|
|
|
|
- loginAccountId,
|
|
|
|
|
- rolePermission,
|
|
|
|
|
- } = res.data.result;
|
|
|
|
|
- if (!rolePermission.length) {
|
|
|
|
|
- ElNotification.error({
|
|
|
|
|
- title: "失败",
|
|
|
|
|
- duration: 2000,
|
|
|
|
|
- message: "暂无权限,请联系管理员",
|
|
|
|
|
- type: "error",
|
|
|
|
|
- });
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- ElNotification.success({
|
|
|
|
|
- title: "成功",
|
|
|
|
|
- duration: 2000,
|
|
|
|
|
- message: res.data.msg,
|
|
|
|
|
- type: "success",
|
|
|
|
|
- });
|
|
|
|
|
- localStorage.setItem("userId", userId);
|
|
|
|
|
- localStorage.setItem("userName", userName);
|
|
|
|
|
- localStorage.setItem("phone", phone);
|
|
|
|
|
- localStorage.setItem("contactName", contactName);
|
|
|
|
|
- localStorage.setItem("userType", 1);
|
|
|
|
|
- localStorage.setItem("loginAccountId", loginAccountId);
|
|
|
|
|
- rolePermission = rolePermission || [];
|
|
|
|
|
- let arr = [...new Set([...rolePermission])];
|
|
|
|
|
- localStorage.setItem("rolePermission", arr);
|
|
|
|
|
- store.dispatch(
|
|
|
|
|
- "GetBasePermissionData",
|
|
|
|
|
- localStorage.loginAccountId
|
|
|
|
|
- );
|
|
|
|
|
- let res1 = await store.dispatch(
|
|
|
|
|
- "GetUserPermission",
|
|
|
|
|
- localStorage.loginAccountId
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- router.replace("/index");
|
|
|
|
|
- store.commit("changeLogin", true);
|
|
|
|
|
- } else {
|
|
|
|
|
- ElNotification.error({
|
|
|
|
|
- title: "错误",
|
|
|
|
|
- duration: 3000,
|
|
|
|
|
- message: res.data.msg,
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- console.log("error submit!!");
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ElNotification.success({
|
|
|
|
|
+ title: "成功",
|
|
|
|
|
+ duration: 2000,
|
|
|
|
|
+ message: res.data.msg,
|
|
|
|
|
+ type: "success",
|
|
|
|
|
+ });
|
|
|
|
|
+ localStorage.setItem("userId", userId);
|
|
|
|
|
+ localStorage.setItem("userName", userName);
|
|
|
|
|
+ localStorage.setItem("phone", phone);
|
|
|
|
|
+ localStorage.setItem("contactName", contactName);
|
|
|
|
|
+ localStorage.setItem("userType", 1);
|
|
|
|
|
+ localStorage.setItem("email", email);
|
|
|
|
|
+ localStorage.setItem("loginAccountId", loginAccountId);
|
|
|
|
|
+ rolePermission = rolePermission || [];
|
|
|
|
|
+ let arr = [...new Set([...rolePermission])];
|
|
|
|
|
+ localStorage.setItem("rolePermission", arr);
|
|
|
|
|
+ store.dispatch("GetBasePermissionData", localStorage.loginAccountId);
|
|
|
|
|
+ let res1 = await store.dispatch(
|
|
|
|
|
+ "GetUserPermission",
|
|
|
|
|
+ localStorage.loginAccountId
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
- function goBeian() {
|
|
|
|
|
- window.open("https://beian.miit.gov.cn/");
|
|
|
|
|
|
|
+ router.replace("/index");
|
|
|
|
|
+ store.commit("changeLogin", true);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElNotification.error({
|
|
|
|
|
+ title: "错误",
|
|
|
|
|
+ duration: 3000,
|
|
|
|
|
+ message: res.data.msg,
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.log("error submit!!");
|
|
|
|
|
+ return false;
|
|
|
}
|
|
}
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
- return {
|
|
|
|
|
- form,
|
|
|
|
|
- ...toRefs(ruleForm),
|
|
|
|
|
- ...toRefs(rules),
|
|
|
|
|
- login,
|
|
|
|
|
- goBeian,
|
|
|
|
|
- };
|
|
|
|
|
- },
|
|
|
|
|
-};
|
|
|
|
|
|
|
+function goBeian() {
|
|
|
|
|
+ window.open("https://beian.miit.gov.cn/");
|
|
|
|
|
+}
|
|
|
</script>
|
|
</script>
|
|
|
<style scoped>
|
|
<style scoped>
|
|
|
.container {
|
|
.container {
|