Compare commits
1 Commits
gyq_openpl
...
gyq_openag
| Author | SHA1 | Date | |
|---|---|---|---|
| 786bceb7a4 |
12
index.html
12
index.html
@@ -1,16 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favico.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>vue admin</title>
|
||||
</head>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -2,7 +2,7 @@ import request from "@/utils/request.js";
|
||||
export function login(data) {
|
||||
return request({
|
||||
method: "POST",
|
||||
url: "/user/doLogin",
|
||||
url: "agent/login",
|
||||
data,
|
||||
});
|
||||
}
|
||||
@@ -26,3 +26,16 @@ export function getNotices(params) {
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
* @param {*} data
|
||||
* @returns
|
||||
*/
|
||||
export function register(data) {
|
||||
return request({
|
||||
method: 'post',
|
||||
url: '/agent/register',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ router.beforeEach(async (to, from, next) => {
|
||||
NProgress.start();
|
||||
const token = _hook.useLocalStorage.get("token");
|
||||
const storeUser = useUser();
|
||||
if (to.path === "/login" && !token) {
|
||||
if ((to.path === "/login" || to.path === "/register") && !token) {
|
||||
next();
|
||||
NProgress.done();
|
||||
} else {
|
||||
|
||||
@@ -59,6 +59,15 @@ export const fullScreenRouting = [
|
||||
isHide: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/register",
|
||||
name: "register",
|
||||
component: () => import("@/views/register/register.vue"),
|
||||
meta: {
|
||||
title: "注册",
|
||||
isHide: true,
|
||||
},
|
||||
}
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -280,7 +289,7 @@ export const asyncRoutes = [
|
||||
component: layout,
|
||||
meta: {
|
||||
title: '大机构管理',
|
||||
roles: ['MG'],
|
||||
// roles: ['MG'],
|
||||
isHide: true
|
||||
},
|
||||
redirect: '/organization/big_organization',
|
||||
@@ -310,7 +319,7 @@ export const asyncRoutes = [
|
||||
component: layout,
|
||||
meta: {
|
||||
title: '小机构管理',
|
||||
roles: ['FO'],
|
||||
// roles: ['FO'],
|
||||
isHide: true
|
||||
},
|
||||
redirect: '/mini_organization_manage/mini_organization',
|
||||
@@ -340,7 +349,7 @@ export const asyncRoutes = [
|
||||
component: layout,
|
||||
meta: {
|
||||
title: '大代理管理',
|
||||
roles: ['FO', 'SO'],
|
||||
// roles: ['FO', 'SO'],
|
||||
isHide: true
|
||||
},
|
||||
redirect: '/agent_manage/agent_list',
|
||||
@@ -370,7 +379,7 @@ export const asyncRoutes = [
|
||||
meta: {
|
||||
title: '一级代理',
|
||||
icon: 'User',
|
||||
roles: ['FO', 'SO', 'AG']
|
||||
// roles: ['FO', 'SO', 'AG']
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -379,7 +388,7 @@ export const asyncRoutes = [
|
||||
meta: {
|
||||
title: '二级代理',
|
||||
icon: 'User',
|
||||
roles: ['FO', 'SO', 'AG', 'FB']
|
||||
// roles: ['FO', 'SO', 'AG', 'FB']
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -389,7 +398,7 @@ export const asyncRoutes = [
|
||||
component: layout,
|
||||
meta: {
|
||||
title: '商家管理',
|
||||
roles: ['FO', 'SO', 'AG', 'FB', 'SB'],
|
||||
// roles: ['FO', 'SO', 'AG', 'FB', 'SB'],
|
||||
icon: 'Handbag'
|
||||
},
|
||||
redirect: '/shop_manage/shop_list',
|
||||
@@ -428,7 +437,7 @@ export const asyncRoutes = [
|
||||
component: layout,
|
||||
meta: {
|
||||
title: '提现管理',
|
||||
roles: ['FO', 'SO'],
|
||||
// roles: ['FO', 'SO'],
|
||||
isHide: true
|
||||
},
|
||||
redirect: '/withdraw_manage/withdraw_list',
|
||||
@@ -487,7 +496,7 @@ export const asyncRoutes = [
|
||||
meta: {
|
||||
title: '推广图片管理',
|
||||
isHide: true,
|
||||
roles: ['MG']
|
||||
// roles: ['MG']
|
||||
},
|
||||
redirect: '/promotion/promotion_list',
|
||||
children: [
|
||||
@@ -507,7 +516,7 @@ export const asyncRoutes = [
|
||||
meta: {
|
||||
title: 'APP管理',
|
||||
icon: 'Iphone',
|
||||
roles: ['MG']
|
||||
// roles: ['MG']
|
||||
},
|
||||
redirect: '/app_manage/menu_list',
|
||||
children: [
|
||||
@@ -527,7 +536,7 @@ export const asyncRoutes = [
|
||||
meta: {
|
||||
title: '系统设置',
|
||||
icon: 'Setting',
|
||||
roles: ['MG']
|
||||
// roles: ['MG']
|
||||
},
|
||||
redirect: '/setting/appid_manage',
|
||||
children: [
|
||||
@@ -547,7 +556,7 @@ export const asyncRoutes = [
|
||||
meta: {
|
||||
title: '消息管理',
|
||||
isHide: true,
|
||||
roles: ['MG']
|
||||
// roles: ['MG']
|
||||
},
|
||||
redirect: '/notice/index',
|
||||
children: [
|
||||
|
||||
@@ -30,9 +30,9 @@ export const useUser = defineStore("useUser", {
|
||||
userlogin(param) {
|
||||
return login(param).then((res) => {
|
||||
// console.log(res);
|
||||
this.userInfo = res;
|
||||
this.userInfo = res.userinfo;
|
||||
_hook.useLocalStorage.set("token", this.userInfo.token);
|
||||
_hook.useLocalStorage.set("userInfo", this.userInfo.user);
|
||||
_hook.useLocalStorage.set("userInfo", this.userInfo);
|
||||
return this.userInfo;
|
||||
});
|
||||
},
|
||||
|
||||
@@ -39,7 +39,7 @@ service.interceptors.response.use(
|
||||
NProgress.done();
|
||||
// 对响应数据做点什么
|
||||
if (+response.status === 200) {
|
||||
if (+response.data.code == '000000') {
|
||||
if (+response.data.code == 1) {
|
||||
return response.data.data;
|
||||
} else if (+response.data.code == '999999') {
|
||||
ElMessage.error('登录已过期,请重新登录')
|
||||
@@ -49,8 +49,8 @@ service.interceptors.response.use(
|
||||
return Promise.reject('登录已过期,请重新登录')
|
||||
} else {
|
||||
// 响应错误
|
||||
ElMessage.error(response.data.message)
|
||||
return Promise.reject(response.data.message)
|
||||
ElMessage.error(response.data.msg)
|
||||
return Promise.reject(response.data.msg)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2,23 +2,23 @@
|
||||
<div class="login-case">
|
||||
<div class="form-case">
|
||||
<span class="Hello">Hello !</span>
|
||||
<span class="title">欢迎来到银收客</span>
|
||||
<span class="title">欢迎登录银收客开放平台代理</span>
|
||||
<el-form ref="ruleFormRef" :rules="rules" :model="form">
|
||||
<el-form-item prop="loginName">
|
||||
<el-input class="inp" v-model="form.loginName" clearable autocomplete="new-password" size="large"
|
||||
:prefix-icon="User" placeholder="请输入账号" style="width: 100%;" />
|
||||
:prefix-icon="User" placeholder="请输入手机号" style="width: 100%;" />
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input class="inp" v-model="form.password" clearable autocomplete="new-password" size="large" type="password"
|
||||
:prefix-icon="Lock" placeholder="请输入密码" style="width: 100%;" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<!-- <el-form-item>
|
||||
<el-select v-model="form.userType" placeholder="请选择机构类型" size="large" style="width: 100%;">
|
||||
<el-option key="MG" label="平台" value="MG"></el-option>
|
||||
<el-option key="FO" label="大机构" value="FO"></el-option>
|
||||
<el-option key="SO" label="小机构" value="SO"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item prop="code">
|
||||
<div class="code-case">
|
||||
<el-input class="inp" v-model="form.code" clearable autocomplete="new-password" size="large"
|
||||
@@ -26,6 +26,11 @@
|
||||
<verificationCode @getCode="getCode" :key="verificationCodeKey"></verificationCode>
|
||||
</div>
|
||||
</el-form-item> -->
|
||||
<div class="to_register">
|
||||
<router-link :to="{ name: 'register' }">
|
||||
<el-text type="primary">注册代理商</el-text>
|
||||
</router-link>
|
||||
</div>
|
||||
<el-form-item>
|
||||
<el-button type="primary" size="large" :loading="loading" @click="login" style="width: 100%;">登录</el-button>
|
||||
</el-form-item>
|
||||
@@ -63,8 +68,8 @@ function getCode(code) {
|
||||
}
|
||||
|
||||
const form = reactive({
|
||||
loginName: "",
|
||||
password: "",
|
||||
loginName: "15619297569",
|
||||
password: "123456",
|
||||
userType: 'MG',
|
||||
code: "",
|
||||
});
|
||||
@@ -107,9 +112,9 @@ async function login() {
|
||||
if (valid) {
|
||||
loading.value = true
|
||||
const params = {
|
||||
loginName: form.loginName,
|
||||
password: form.password,
|
||||
userType: form.userType
|
||||
account: form.loginName,
|
||||
password: form.password
|
||||
// userType: form.userType
|
||||
};
|
||||
store.userlogin(params).then((res) => {
|
||||
router.replace("/home");
|
||||
@@ -166,4 +171,11 @@ _hook.useKeyStroke("Enter", login);
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.to_register {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
font-size: 14px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
187
src/views/register/register.vue
Normal file
187
src/views/register/register.vue
Normal file
@@ -0,0 +1,187 @@
|
||||
<template>
|
||||
<div class="login-case">
|
||||
<div class="form-case">
|
||||
<span class="Hello">Hello !</span>
|
||||
<span class="title">欢迎注册银收客开放平台代理</span>
|
||||
<el-form ref="ruleFormRef" :rules="rules" :model="form">
|
||||
<el-form-item prop="loginName">
|
||||
<el-input class="inp" v-model="form.loginName" clearable autocomplete="new-password" size="large"
|
||||
:prefix-icon="User" placeholder="请输入昵称" style="width: 100%;" />
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input class="inp" v-model="form.password" clearable autocomplete="new-password" size="large"
|
||||
type="password" :prefix-icon="Lock" placeholder="请输入手机号" style="width: 100%;" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item>
|
||||
<el-select v-model="form.userType" placeholder="请选择机构类型" size="large" style="width: 100%;">
|
||||
<el-option key="MG" label="平台" value="MG"></el-option>
|
||||
<el-option key="FO" label="大机构" value="FO"></el-option>
|
||||
<el-option key="SO" label="小机构" value="SO"></el-option>
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item prop="code">
|
||||
<div class="code-case">
|
||||
<el-input class="inp" v-model="form.code" clearable autocomplete="new-password" size="large"
|
||||
:prefix-icon="CircleCheck" width="100px" placeholder="验证码" />
|
||||
<verificationCode @getCode="getCode" :key="verificationCodeKey"></verificationCode>
|
||||
</div>
|
||||
</el-form-item> -->
|
||||
<div class="to_register">
|
||||
<router-link :to="{ name: 'login' }">
|
||||
<el-text type="primary">登录代理商</el-text>
|
||||
</router-link>
|
||||
</div>
|
||||
<el-form-item>
|
||||
<el-button type="primary" size="large" :loading="loading" @click="login"
|
||||
style="width: 100%;">注册</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import verificationCode from "@/components/verificationCode.vue"
|
||||
import { User, Lock, CircleCheck } from "@element-plus/icons-vue"
|
||||
import { useUser } from "@/store/user.js"
|
||||
import { register } from "@/api/user.js"
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
const ruleFormRef = ref("");
|
||||
const store = useUser();
|
||||
const router = useRouter();
|
||||
const loading = ref(false)
|
||||
|
||||
onMounted(() => {
|
||||
// ElMessage({
|
||||
// message: "请使用用户名为 admin、yonghu1、yonghu2 进行登录测试,来获取不同的权限",
|
||||
// type: "success",
|
||||
// duration: 5000,
|
||||
// });
|
||||
});
|
||||
|
||||
let verificationCodeKey = ref(0);
|
||||
let trueCode = ref("");
|
||||
|
||||
/**
|
||||
* @description: 获取正确的验证码值
|
||||
* @param {*} code: 正确的验证码
|
||||
*/
|
||||
function getCode(code) {
|
||||
trueCode.value = code;
|
||||
}
|
||||
|
||||
const form = reactive({
|
||||
loginName: "",
|
||||
password: "",
|
||||
userType: 'MG',
|
||||
code: "",
|
||||
});
|
||||
/**
|
||||
* @description: 自定义验证 - 验证账号
|
||||
*/
|
||||
function checkName(rule, value, callback) {
|
||||
if (value === "") {
|
||||
callback(new Error("账号不可为空"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 自定义验证 - 验证验证码
|
||||
*/
|
||||
function checkCode(rule, value, callback) {
|
||||
if (value === "") {
|
||||
callback(new Error("验证码不可为空"));
|
||||
} else if (value !== trueCode.value) {
|
||||
verificationCodeKey.value++;
|
||||
callback(new Error("验证码不正确"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
// form 验证
|
||||
const rules = reactive({
|
||||
loginName: [{ validator: checkName, required: true, trigger: "blur" }],
|
||||
password: [{ required: true, message: "密码不可为空", trigger: "blur" }],
|
||||
code: [{ validator: checkCode, required: true, trigger: "blur" }],
|
||||
});
|
||||
|
||||
// 登录
|
||||
async function login() {
|
||||
//通过 ref 的值触发验证
|
||||
await ruleFormRef.value.validate((valid) => {
|
||||
if (valid) {
|
||||
loading.value = true
|
||||
const params = {
|
||||
nickname: form.loginName,
|
||||
mobile: form.password
|
||||
};
|
||||
register(params).then((res) => {
|
||||
ElMessage.success('注册成功,请等待审核!')
|
||||
loading.value = false
|
||||
// router.replace("/home");
|
||||
}).catch(err => {
|
||||
loading.value = false
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// 回车键触发登录操作
|
||||
_hook.useKeyStroke("Enter", login);
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.login-case {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: url('../../assets/logo_bg.png') no-repeat right bottom / contain;
|
||||
}
|
||||
|
||||
.form-case {
|
||||
position: absolute;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
// height: 450px;
|
||||
left: 20%;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.Hello {
|
||||
font-weight: bold;
|
||||
font-size: 30px;
|
||||
color: #000;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-weight: 600;
|
||||
font-size: 40px;
|
||||
color: #000;
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
.code-case {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.inp {
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.to_register {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
font-size: 14px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -12,8 +12,9 @@ export default defineConfig({
|
||||
// target: 'http://192.168.2.161:18071/admin/',
|
||||
// target: 'http://newadminapi.sxczgkj.cn/admin/',
|
||||
// target: 'http://admintestapi.sxczgkj.cn/admin/',
|
||||
target: 'http://gw.sxczgkj.cn/admin/', // 测试
|
||||
// target: 'http://gw.sxczgkj.cn/admin/', // 测试
|
||||
// target: 'http://192.168.2.128:18071/admin/',
|
||||
target: 'http://192.168.2.23:7777/proxy/',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user