Commit bc3e5144 by liudx

联调用户管理

parent a72e36fc
......@@ -169,7 +169,7 @@ export default {
border: 2px solid #4079ff;
border-radius: 8px;
.type {
width: 90px;
width: 160px;
height: 40px;
// margin-top: 10px;
// line-height: 50px;
......
import { createRouter, createWebHistory } from 'vue-router'
import { createRouter, createWebHistory ,createWebHashHistory } from 'vue-router'
import { message } from "ant-design-vue";
// import HomeView from '../views/HomeView.vue'
import login from "../views/login/index.vue"
......@@ -25,7 +25,7 @@ import securitySetting from "../views/userset/securitySetting.vue"
//管理员设置
import adminset from "../views/adminset/index.vue"
import userInfo from "../views/adminset/userInfo.vue"
import notFound from "../views/404.vue"
const routes = [
......@@ -35,6 +35,11 @@ const routes = [
// component: AdminLogin,
},
{
path: '/404',
name: 'notFound',
component: notFound,
},
{
path: '/login',
name: 'login',
component: login,
......@@ -153,9 +158,10 @@ const routes = [
]
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
// mode:'hash',
routes
history: createWebHashHistory(process.env.BASE_URL),
mode:'hash',
routes,
})
router.beforeEach((to,from,next)=>{
if (to.path === '/login' || to.path === '/adminLogin' ||to.path === '/forget') {
......@@ -175,4 +181,5 @@ router.beforeEach((to,from,next)=>{
export default router
import { get, post,put } from './request'
/**
* 示例
get请求
export const changePassword = p => get('/api/home/changePassword',{});
oost请求
export const login = p => post('/api/common/login', p);
import { get, post, put, Delete } from './request'
/**
* 示例
get请求
export const changePassword = p => get('/api/home/changePassword',{});
oost请求
export const login = p => post('/api/common/login', p);
*/
export const login = p => post('/api/common/login', p);
export const changePassword = p => post('/api/common/changePassword',p);
export const sendSms = p => post('/api/common/sendSms',p);
export const users = p => get('/api/backup/users?page='+p.page+'&size='+p.size);
export const changeStatus = p => put('/api/backup/users/'+p.id,{status:p.status});
export const addusers = p => post('/api/backup/users',p);
export const login = p => post('/api/common/login', p);
export const changePassword = p => post('/api/common/changePassword', p);
export const sendSms = p => post('/api/common/sendSms', p);
export const users = p => get('/api/backup/users?page=' + p.page + '&size=' + p.size);
export const changeStatus = p => put('/api/backup/users/' + p.id, { status: p.status });
export const addusers = p => post('/api/backup/users', p);
export const deleusers = p => Delete('/api/backup/users', p);
......
......@@ -2,11 +2,16 @@ import axios from 'axios';
import store from '../store/index'
// 环境的切换
axios.defaults.baseURL = '/api';
axios.defaults.baseURL = '';
// 请求超时时间
axios.defaults.timeout = 50000;
// post请求头
axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8';
// axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8';
// // post请求头
// axios.defaults.headers.delete['Content-Type'] = 'application/json;charset=UTF-8';
axios.defaults.headers = {
'Content-Type': 'application/json;charset=UTF-8'
}
// 请求拦截器
axios.interceptors.request.use(
config => {
......@@ -133,3 +138,21 @@ axios.interceptors.response.use(
})
});
}
/**
* delete方法,对应delete请求
* @param {String} url [请求的url地址]
* @param {Object} params [请求时携带的参数]
*/export function Delete(url, params) {
return new Promise((resolve, reject) => {
axios.delete(url, { data: JSON.stringify(params), headers: { 'Content-Type': 'application/json' } })
.then(res => {
resolve(res.data);
// 处理响应
})
.catch(err => {
// 处理错误
reject(err.data)
});
});
}
\ No newline at end of file
import { get, post, put, Delete } from './request'
export const uploadFile = p => post('/api/common/uploadFile', p);
export const userInfo = p => get('/api/users/userInfo', {});
export const bduserInfo = p => post('/api/users/userInfo', p);
export const updateuserInfo = p => put('/api/users/userInfo', p);
<template>
<div class="notFind">
<svg
width="380px"
height="500px"
viewBox="0 0 837 1045"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"
>
<g
id="Page-1"
stroke="none"
stroke-width="1"
fill="none"
fill-rule="evenodd"
sketch:type="MSPage"
>
<path
d="M353,9 L626.664028,170 L626.664028,487 L353,642 L79.3359724,487 L79.3359724,170 L353,9 Z"
id="Polygon-1"
stroke="#007FB2"
stroke-width="6"
sketch:type="MSShapeGroup"
></path>
<path
d="M78.5,529 L147,569.186414 L147,648.311216 L78.5,687 L10,648.311216 L10,569.186414 L78.5,529 Z"
id="Polygon-2"
stroke="#EF4A5B"
stroke-width="6"
sketch:type="MSShapeGroup"
></path>
<path
d="M773,186 L827,217.538705 L827,279.636651 L773,310 L719,279.636651 L719,217.538705 L773,186 Z"
id="Polygon-3"
stroke="#795D9C"
stroke-width="6"
sketch:type="MSShapeGroup"
></path>
<path
d="M639,529 L773,607.846761 L773,763.091627 L639,839 L505,763.091627 L505,607.846761 L639,529 Z"
id="Polygon-4"
stroke="#F2773F"
stroke-width="6"
sketch:type="MSShapeGroup"
></path>
<path
d="M281,801 L383,861.025276 L383,979.21169 L281,1037 L179,979.21169 L179,861.025276 L281,801 Z"
id="Polygon-5"
stroke="#5a5c6c"
stroke-width="6"
sketch:type="MSShapeGroup"
></path>
</g>
</svg>
<div class="message-box">
<h1>404</h1>
<p>页面找不到啦 !</p>
<div class="buttons-con">
<div class="action-link-wrap">
<a @click="$router.go(-1)" class="link-button link-back-button"
>返回上一页</a
>
<a @click="$router.replace({ name: 'cockpit' })" class="link-button"
>前往首页</a
>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name:'notFound'
};
</script>
<style lang="less" scoped>
.notFind {
width: 100%;
height: 100%;
background-color: #2f3242;
}
svg {
position: absolute;
top: 50%;
left: 50%;
margin-top: -250px;
margin-left: -400px;
}
.message-box {
height: 200px;
width: 380px;
position: absolute;
top: 50%;
left: 50%;
margin-top: -100px;
margin-left: 50px;
color: #fff;
font-family: Roboto;
font-weight: 300;
}
.message-box h1 {
font-size: 60px;
line-height: 46px;
margin-bottom: 40px;
}
.buttons-con .action-link-wrap {
margin-top: 40px;
}
.buttons-con .action-link-wrap a {
background: #68c950;
padding: 8px 25px;
border-radius: 4px;
color: #fff;
font-weight: bold;
font-size: 14px;
transition: all 0.3s linear;
cursor: pointer;
text-decoration: none;
margin-right: 10px;
}
.buttons-con .action-link-wrap a:hover {
background: #5a5c6c;
color: #fff;
}
#Polygon-1,
#Polygon-2,
#Polygon-3,
#Polygon-4,
#Polygon-4,
#Polygon-5 {
animation: float 1s infinite ease-in-out alternate;
}
#Polygon-2 {
animation-delay: 0.2s;
}
#Polygon-3 {
animation-delay: 0.4s;
}
#Polygon-4 {
animation-delay: 0.6s;
}
#Polygon-5 {
animation-delay: 0.8s;
}
@keyframes float {
100% {
transform: translateY(20px);
}
}
@media (max-width: 750px) {
svg {
position: absolute;
top: 50%;
left: 50%;
margin-top: -250px;
margin-left: -190px;
}
.message-box {
top: 50%;
left: 50%;
margin-top: -100px;
margin-left: -190px;
text-align: center;
}
}
</style>
......@@ -39,9 +39,10 @@
<template v-if="column.dataIndex === 'action'">
<!-- <a @click="change(record)" danger v-if="text">禁用</a>
<a v-else>使用</a> -->
<a-switch @click="change(record)" v-model:checked="status"
></a-switch
>
<a-switch
@click="change(record)"
v-model:checked="record.status"
></a-switch>
</template>
</template>
</a-table>
......@@ -74,13 +75,13 @@
<script>
// import { AES_Encrypt, AES_Decrypt } from "@/utils/aes_util.js";
import { message } from "ant-design-vue";
import { users, changeStatus,addusers } from "@/utils/loginAPI";
import { users, changeStatus, addusers, deleusers } from "@/utils/loginAPI";
export default {
name: "userInfo",
data() {
return {
visible: false,
username:'',
username: "",
visibleDelete: false,
columns: [
{
......@@ -162,23 +163,24 @@ export default {
this.visibleDelete = false;
},
add() {
addusers({account_number:this.username}).then(res=>{
addusers({ account_number: this.username }).then((res) => {
if (res.code == 0) {
this.getList()
this.getList();
this.visible = false;
message.success(res.msg);
}else{
} else {
message.error(res.msg);
}
})
});
},
//用户列表初始化
init() {
this.getList();
},
//获取用户列表
getList(page) {
users({
page: page||1,
page: page || 1,
size: 10,
}).then((res) => {
if (res.code == 0) {
......@@ -192,15 +194,37 @@ export default {
selectedTableRows(selectedRowKeys, selectedRows) {
// 批量选中的key
this.selectedRowKeys = selectedRowKeys;
console.log(selectedRowKeys);
},
//删除用户
deleteUser() {
let parma = {
user_ids: [...this.selectedRowKeys],
};
console.log(parma);
deleusers(parma).then((res) => {
// console.log(res)
if (res.code == 0) {
message.success(res.msg);
this.visibleDelete = false;
this.getList();
} else {
message.error(res.msg);
this.visibleDelete = false;
}
});
},
//修改用户状态
change(record) {
changeStatus({ id: record.id, status: !record.status }).then((res) => {
let status = record.status;
changeStatus({ id: record.id, status: status }).then((res) => {
// console.log(res);
if (res.code == 0) {
this.getList()
message.success(res.msg);
this.getList();
} else {
message.error(res.msg);
}
});
},
......
......@@ -101,7 +101,7 @@
</a-form-item>
</a-form>
</a-modal>
<div style="width: 70%">
<div style="width: 70%;display: none;">
<EchartsCon
:id="'applyTrend1'"
:option="option1"
......
......@@ -133,7 +133,7 @@
</div>
</div>
<div class="company_con_anchor">
<a-anchor>
<a-anchor @click="handleAnchorClick">
<a-anchor-link
style="font-size: 20px; color: #1c1c28; font-weight: bold"
title="企业概况"
......@@ -410,6 +410,15 @@ export default {
},
};
},
methods: {
handleAnchorClick(e, link) {
// 阻止点击的默认事件修改路由
e.preventDefault();
// console.log(link)
// var srcolls = document.getElementById(link.href);
// srcolls.scrollIntoView({ block: "start", behavior: "smooth" });
},
},
};
</script>
......
......@@ -12,7 +12,9 @@
>次产学研合作。其中,与<span class="color">{{
joint.max_name_apply
}}</span
>最为密切,合作次数为<span class="color">{{ joint.max_value_apply }}</span
>最为密切,合作次数为<span class="color">{{
joint.max_value_apply
}}</span
>次,与该企业合作次数最多的申请人如下图所示。
</p>
<EchartsCon :option="option1" :id="'echarts1'"></EchartsCon>
......@@ -33,7 +35,7 @@
</div>
</div>
<div class="company_con_anchor">
<a-anchor>
<a-anchor @click="handleAnchorClick">
<a-anchor-link
style="font-size: 20px; color: #1c1c28; font-weight: bold"
title="技术合作"
......@@ -84,6 +86,9 @@ export default {
this.init();
},
methods: {
handleAnchorClick(e, link) {
e.preventDefault();
},
init() {
this.getOptions1();
this.getOptions2();
......@@ -95,17 +100,27 @@ export default {
symbolSize: 40,
category: 0,
value: 0,
x: 550,
y: 250,
// fixed: true,
},
];
let links = [];
//添加数据
if (this.joint.joint_application.length != 0) {
this.joint.joint_application.forEach((item) => {
this.joint.joint_application.forEach((item, index) => {
points.push({
name: item.name,
symbolSize: 40,
category: 1,
value: item.value,
// x:
// index % 2 == 1
// ? 550 + (index % 2) * (600)
// : 550 - (index % 2) * 600,
// y: 750,
// x:550+
});
links.push({
source: this.company_name,
......@@ -113,6 +128,7 @@ export default {
value: item.value,
});
});
console.log(points);
}
this.option1 = {
legend: {
......@@ -122,11 +138,12 @@ export default {
series: [
{
type: "graph",
layout: "force",
layout: "none",
force: {
repulsion: 1500,
repulsion: 100,
edgeLength: 30,
},
bottom: 0,
roam: false,
label: {
show: true,
......@@ -139,6 +156,48 @@ export default {
},
},
data: points,
// data: [
// {
// name: "1",
// symbolSize: 40,
// category: 1,
// value: "3",
// // x: 80,
// // y: 80,
// x: 550 + Math.cos(((Math.PI * 1) / 10) * 10) * 200,
// y: 550 + Math.sin(((Math.PI * 1) / 10) * 10) * 200,
// },
// {
// name: "2",
// symbolSize: 40,
// category: 1,
// value: "3",
// // x: 80,
// // y: 80,
// x: 550 + Math.cos(((Math.PI * 2) / 10) * 10) * 200,
// y: 550 + Math.sin(((Math.PI * 2) / 10) * 10) * 200,
// },
// {
// name: "3",
// symbolSize: 40,
// category: 1,
// value: "3",
// // x: 80,
// // y: 80,
// x: 550 + Math.cos(((Math.PI * 3) / 10) * 10) * 200,
// y: 550 + Math.sin(((Math.PI * 3) / 10) * 10) * 200,
// },
// {
// name: "4",
// symbolSize: 40,
// category: 1,
// value: "3",
// // x: 80,
// // y: 80,
// x: 550 + Math.cos(((Math.PI * 4) / 10) * 10) * 200,
// y: 550 + Math.sin(((Math.PI * 4) / 10) * 10) * 200,
// },
// ],
links: links,
lineStyle: {
normal: {
......@@ -172,8 +231,7 @@ export default {
},
splitLine: {
show: true,
lineStyle: {
},
lineStyle: {},
},
},
yAxis: {
......
......@@ -60,15 +60,15 @@
/>
</a-config-provider>
</a-form-item>
<a-row><label for="">注册资本</label></a-row>
<a-row><label for="">注册资本(人民币)</label></a-row>
<a-row>
<a-col :span="11">
<a-form-item name="capital_nums_min">
<a-input
v-model="formState.capital_nums_min"
style="width: 95%"
style="width: 80%"
placeholder="请输入数值"
></a-input>
></a-input>&nbsp;
</a-form-item>
</a-col>
<a-col :span="1">-</a-col>
......@@ -76,9 +76,9 @@
<a-form-item name="capital_nums_max">
<a-input
v-model="formState.capital_nums_max"
style="width: 95%"
style="width: 80%"
placeholder="请输入数值"
></a-input>
></a-input>&nbsp;
</a-form-item>
</a-col>
</a-row>
......@@ -88,6 +88,7 @@
v-model:value="valueInnovation"
placeholder="请选择"
:options="optionsInnovation"
allowClear
></a-select>
</a-form-item>
</a-form>
......@@ -215,7 +216,6 @@ export default {
optionsArea: [],
valueInnovation: "",
optionsInnovation: [
{ label: "请选择", value: "" },
{ label: "企业科创能力", value: "企业科创能力" },
{ label: "企业技术合作", value: "企业技术合作" },
],
......@@ -378,7 +378,7 @@ export default {
: null,
capital_nums_min: Number(this.formState.capital_nums_min),
capital_nums_max: Number(this.formState.capital_nums_max),
innovate: this.valueInnovation,
innovate: this.valueInnovation?this.valueInnovation:null,
};
//将筛选条件渲染到页面上//搜索结果标签
let filter = [];
......@@ -388,11 +388,14 @@ export default {
...params.area,
...params.company_industry,
...params.qualification,
params.innovate,
// params.innovate,
];
if (key == "keyword") {
params.keyword ? filter.push(params.keyword) : "";
}
if(key == "innovate"){
params.innovate?filter.push(params.innovate) : "";
}
}
this.filter = filter;
//请求接口
......
......@@ -3,7 +3,7 @@
<div class="company_con">
<div class="company_con_left">
<!-- 研发规模 -->
<div class="company_con1" id="researchDevelopment ">
<div class="company_con1" id="researchDevelopment">
<h2 class="title">研发规模</h2>
<a-descriptions
bordered
......@@ -108,7 +108,7 @@
</div>
</div>
<div class="company_con_anchor">
<a-anchor>
<a-anchor @click="handleAnchorClick">
<a-anchor-link
style="font-size: 20px; color: #1c1c28; font-weight: bold"
title="研发概要"
......@@ -554,6 +554,9 @@ export default {
},
];
},
handleAnchorClick(e,link){
e.preventDefault();
},
},
created() {
this.deveSustainData = this.$props.deveSustain;
......
......@@ -49,7 +49,7 @@
</div>
</div>
<div class="company_con_anchor">
<a-anchor>
<a-anchor @click="handleAnchorClick">
<a-anchor-link
style="font-size: 20px; color: #1c1c28; font-weight: bold"
title="科创能力评价"
......@@ -93,6 +93,9 @@ export default {
this.getOption2();
},
methods: {
handleAnchorClick(e,link){
e.preventDefault();
},
getOption1() {
let chart = echarts.init(document.getElementById("echartsraodar"));
let option1 = {
......
......@@ -31,9 +31,7 @@
>
<a-form-item
name="username"
:rules="[
{ required: true, message: '请输入用户名!' },
]"
:rules="[{ required: true, message: '请输入用户名!' }]"
>
<a-input v-model:value="formState.username">
<template #prefix>
......@@ -44,9 +42,7 @@
<a-form-item
name="password"
:rules="[
{ required: true, message: '请输入密码!' },
]"
:rules="[{ required: true, message: '请输入密码!' }]"
>
<a-input-password v-model:value="formState.password">
<template #prefix>
......@@ -56,7 +52,7 @@
</a-form-item>
<a-form-item>
<a-form-item name="remember" >
<a-form-item name="remember">
<a-checkbox v-model:checked="formState.remember"
>记住密码</a-checkbox
>
......@@ -79,7 +75,7 @@
</a-form-item>
<a-form-item>
<div class="admin_login">
<img src="../../static/login/icon-glydl.png" alt="">&nbsp;&nbsp;
<img src="../../static/login/icon-glydl.png" alt="" />&nbsp;&nbsp;
<router-link to="/login">账户登录</router-link>
</div>
<!-- <div style="float: right;">
......@@ -90,8 +86,16 @@
</div>
</div>
<footer>
<a style="color: #818A9F;" href="http://zhongyanrenzhi.com/#/product2" target="_blank">产品介绍&nbsp;&nbsp;&nbsp;&nbsp;</a>|
<a style="color: #818A9F;" target="_blank" href="http://zhongyanrenzhi.com/#/into/1"
<a
style="color: #818a9f"
href="http://zhongyanrenzhi.com/#/product2"
target="_blank"
>产品介绍&nbsp;&nbsp;&nbsp;&nbsp;</a
>|
<a
style="color: #818a9f"
target="_blank"
href="http://zhongyanrenzhi.com/#/into/1"
>&nbsp;&nbsp;&nbsp;&nbsp;关于中研认知</a
><br />
<span>版权所有:北京中研硕福科技有限公司&nbsp;&nbsp;&nbsp;&nbsp;</span
......@@ -114,33 +118,34 @@ export default {
},
};
},
methods:{
//账号登录
login(){
methods: {
//账号登录
login() {
let param = AES_Encrypt(
JSON.stringify({
login_name:this.formState.username,
password:this.formState.password,
login_name: this.formState.username,
password: this.formState.password,
})
);
login({
param,
}).then((res) => {
console.log(res)
if(res.code == 0){
message.success('登录成功')
// console.log(res);
if (res.code == 0) {
message.success("登录成功");
// this.$store.commit('setTOKEN',res.data.token)
this.$store.commit('setname',this.formState.username)
localStorage.setItem('token',res.data.token)
// this.$store.commit('setname',this.formState.username)
localStorage.setItem("login_name", this.formState.username);
localStorage.setItem("token", res.data.token);
this.$router.push({
path:'/adminset'
})
}else{
message.error(res.msg)
path: "/adminset",
});
} else {
message.error(res.msg);
}
});
},
}
},
};
</script>
<style lang="less" scoped>
......@@ -148,7 +153,7 @@ export default {
height: 50px;
}
/deep/.ant-form {
margin-top:30px;
margin-top: 30px;
}
/deep/.login-form-button {
width: 100%;
......@@ -156,8 +161,7 @@ export default {
font-weight: bold;
font-size: 18px;
}
/deep/.ant-form-item-control-input{
/deep/.ant-form-item-control-input {
height: 60px;
}
.login {
......@@ -240,8 +244,8 @@ export default {
}
}
}
.admin_login{
img{
.admin_login {
img {
width: 20px;
vertical-align: middle;
}
......
......@@ -22,13 +22,7 @@
<div class="login_title">
<span>账户登录</span>
</div>
<a-form
:model="formState"
name="normal_login"
class="login-form"
@finish="onFinish"
@finishFailed="onFinishFailed"
>
<a-form :model="formState" name="normal_login" class="login-form">
<a-form-item
name="username"
:rules="[{ required: true, message: '请输入用户名!' }]"
......@@ -132,6 +126,7 @@ export default {
methods: {
//账号登录
login() {
console.log(this.formState.password);
let param = AES_Encrypt(
JSON.stringify({
login_name: this.formState.username,
......@@ -142,21 +137,25 @@ export default {
param,
}).then((res) => {
if (res.code == 0) {
message.success("登录成功");
// this.$store.commit("setname", this.formState.username);
localStorage.setItem("login_name", this.formState.username);
//记住密码功能
if (this.formState.remember) {
//存在localstroge中
localStorage.setItem("password", this.formState.password);
if (res.data.is_admin) {
message.warning("请切换管理员登录页面");
} else {
message.success("登录成功");
// this.$store.commit("setname", this.formState.username);
localStorage.setItem("login_name", this.formState.username);
//记住密码功能
if (this.formState.remember) {
//存在localstroge中
localStorage.setItem("password", this.formState.password);
localStorage.setItem("login_name", this.formState.username);
}
localStorage.setItem("token", res.data.token);
this.$router.push({
path: "/index",
});
localStorage.setItem("current", "首页");
}
localStorage.setItem("token", res.data.token);
this.$router.push({
path: "/index",
});
localStorage.setItem("current",'首页');
} else {
message.error(res.msg);
}
......
......@@ -199,7 +199,7 @@
</div>
</div>
<div class="company_con_anchor">
<a-anchor>
<a-anchor @click="handleAnchorClick">
<!-- <a-anchor-link href="#technicalSummary" title="AI技术摘要" /> -->
<a-anchor-link href="#summary" title="摘要" />
<a-anchor-link href="#techAera" title="技术领域" />
......@@ -230,7 +230,7 @@
mode="multiple"
placeholder="请选择"
style="width: 300px"
></a-select>
></a-select><a-button type="primary">搜索</a-button>
<div class="result">
推荐
<span style="color: #4079ff; font-weight: bold">{{ count }}</span
......@@ -400,6 +400,9 @@ export default {
DownOutlined,
},
methods: {
handleAnchorClick(e,link){
e.preventDefault();
},
openModal() {
this.visible = true;
},
......
......@@ -14,13 +14,14 @@
:label-col="{ span: 2 }"
:wrapper-col="{ span: 5 }"
autocomplete="off"
ref="form"
>
<a-form-item label="头像" name="img" class="header_label">
<img src="../../static/user/img-tx-big.png" alt="" class="header" />
<a-upload
v-model:file-list="fileList"
name="file"
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
action="/api/api/common/uploadFile"
:headers="headers"
@change="handleChange"
>
......@@ -39,6 +40,7 @@
<a-form-item
label="手机号"
:rules="[
{ require: true, message: '请输入手机号' },
{
pattern:
/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/,
......@@ -131,6 +133,13 @@
import { AES_Encrypt, AES_Decrypt } from "@/utils/aes_util.js";
import { message } from "ant-design-vue";
import { sendSms } from "@/utils/loginAPI";
import {
uploadFile,
userInfo,
bduserInfo,
updateuserInfo,
} from "@/utils/userAPI";
export default {
name: "personalSetting",
data() {
......@@ -146,9 +155,10 @@ export default {
authorization: "authorization-text",
},
formState: {
name: "李建国",
name: "",
phone: "",
code: "",
head_img: "",
},
updateform: {
phone: "",
......@@ -160,58 +170,136 @@ export default {
created() {
//获取个人详细信息
// this.formState.phone = "1";
this.getUserInfo();
},
mounted() {
this.login_name = localStorage.getItem('login_name');
this.login_name = localStorage.getItem("login_name");
},
methods: {
handleChange(info) {
if (info.file.status !== "uploading") {
console.log(info.file, info.fileList);
}
if (info.file.status === "done") {
message.success(`${info.file.name} file uploaded successfully`);
} else if (info.file.status === "error") {
message.error(`${info.file.name} file upload failed.`);
//获取用户信息
getUserInfo() {
userInfo().then((res) => {
if (res.code == 0) {
this.formState.name = res.data.name;
this.formState.head_img = res.data.head_img;
this.formState.phone = res.data.phone;
this.phone = res.data.phone;
}
});
},
//修改手机号
handleOk() {
if (this.updateform.phone && this.updateform.code) {
this.visibleupdate = false;
this.formState.phone = this.updateform.phone;
} else {
message.error("请输入手机号和验证码");
}
},
//发送验证码
sendCode() {
if (this.formState.phone) {
sendSms({ phone: this.formState.phone }).then((res) => {
// console.log(res)
if (res.code == 0) {
this.isSend = true;
const TIME_COUNT = 60;
message.success(res.msg);
//获取验证码倒计时
if (!this.timer) {
this.RemainingTime = TIME_COUNT;
//修改手机号弹窗发送验证码
if (this.visibleupdate) {
if (this.updateform.phone) {
sendSms({ phone: this.updateform.phone }).then((res) => {
// console.log(res)
if (res.code == 0) {
this.updateform.phone = "";
this.updateform.code = "";
this.isSend = true;
this.timer = setInterval(() => {
if (
this.RemainingTime > 0 &&
this.RemainingTime <= TIME_COUNT
) {
this.RemainingTime--;
} else {
this.isSend = false;
clearInterval(this.timer);
this.timer = null;
}
}, 1000);
const TIME_COUNT = 60;
message.success(res.msg);
//获取验证码倒计时
if (!this.timer) {
this.RemainingTime = TIME_COUNT;
this.isSend = true;
this.timer = setInterval(() => {
if (
this.RemainingTime > 0 &&
this.RemainingTime <= TIME_COUNT
) {
this.RemainingTime--;
} else {
this.isSend = false;
clearInterval(this.timer);
this.timer = null;
}
}, 1000);
}
} else {
message.error(res.msg);
}
});
} else {
message.error(res.msg);
}
} else {
if (this.formState.phone) {
sendSms({ phone: this.formState.phone }).then((res) => {
if (res.code == 0) {
this.isSend = true;
const TIME_COUNT = 60;
message.success(res.msg);
//获取验证码倒计时
if (!this.timer) {
this.RemainingTime = TIME_COUNT;
this.isSend = true;
this.timer = setInterval(() => {
if (
this.RemainingTime > 0 &&
this.RemainingTime <= TIME_COUNT
) {
this.RemainingTime--;
} else {
this.isSend = false;
clearInterval(this.timer);
this.timer = null;
}
}, 1000);
}
} else {
message.error(res.msg);
}
});
} else {
message.error("请先输入手机号");
}
}
},
//保存个人信息
save() {
//更新手机号修改信息
if (this.phone != "" && this.formState.code == "") {
updateuserInfo({
head_img: this.formState.head_img,
name: this.formState.name,
phone: this.formState.phone,
}).then((res) => {
if (res.code == 0) {
// this.formState.phone = this.updateform.phone;
message.success(res.msg);
} else {
message.error(res.msg);
}
});
} else {
message.error("请先输入手机号");
//绑定手机号
if (this.formState.phone == "") {
bduserInfo({ ...this.formState }).then((res) => {
if (res.code == 0) {
message.success(res.msg);
location.reload();
} else {
message.error(res.msg);
}
});
} else {
message.error("请输入手机号");
}
}
//
},
//保存个人信息
save() {},
//修改手机号
updatePhone() {
this.visibleupdate = true;
......
......@@ -107,8 +107,8 @@ export default {
},
//发送验证码
sendCode() {
if (this.phone) {
sendSms({ phone: this.phone }).then((res) => {
if (this.formState.phone) {
sendSms({ phone: this.formState.phone }).then((res) => {
// console.log(res)
if (res.code == 0) {
this.isSend = true;
......
......@@ -18,12 +18,12 @@ module.exports = {
// 配置不同的后台API地址
proxy: {
'/api': {
target: 'http://39.100.39.50:5089/',
target: 'http://39.100.39.50:5089',
ws: false,
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
// pathRewrite: {
// '^/api': ''
// }
}
}
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment