提交 84a34baa 编写于 作者: yma16's avatar yma16

fix:用化名提示文案错误修复

上级 7ac4108d
...@@ -20,7 +20,7 @@ module.exports = { ...@@ -20,7 +20,7 @@ module.exports = {
}, },
}, },
"/ws_api/": { "/ws_api/": {
target: "ws://114.116.52.53/", target: "ws://yongma16.xyz/",
ws: true, //接受websocket请求 ws: true, //接受websocket请求
changeOrigin: true, //是否允许跨越 changeOrigin: true, //是否允许跨越
chunkOrigins: true, chunkOrigins: true,
......
...@@ -24,7 +24,12 @@ ...@@ -24,7 +24,12 @@
</template> </template>
<el-menu-item-group> <el-menu-item-group>
<el-submenu index="1-1"> <el-submenu index="1-1">
<template slot="title">yma16</template> <template slot="title"
>yma16
<span v-if="currentUserName">{{
currentUserName
}}</span></template
>
<el-menu-item index="1-1-1">stay hungry</el-menu-item> <el-menu-item index="1-1-1">stay hungry</el-menu-item>
<a @click="jumpToEcharts"> <a @click="jumpToEcharts">
<el-menu-item index="1-1-2">echarts</el-menu-item> <el-menu-item index="1-1-2">echarts</el-menu-item>
...@@ -129,153 +134,160 @@ ...@@ -129,153 +134,160 @@
</template> </template>
<script> <script>
import store from "@/store";
export default { export default {
name: 'App', name: "App",
data () { data() {
return { return {
authSlogan: 'yma16', authSlogan: "yma16",
chat_flag: false, chat_flag: false,
msg: 'yma16', msg: "yma16",
navigate_flag: true, navigate_flag: true,
value: new Date(), value: new Date(),
baseUrl: '/api/', baseUrl: "/api/",
src: 'https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg', src: "https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg",
url: '/image/logo/logo.jpg', url: "/image/logo/logo.jpg",
srcList: [ srcList: [
'https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg', "https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg",
'https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg' "https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg",
], ],
headerData: ['从现在开始,种一棵树', '从现在开始,种一棵树'], headerData: ["从现在开始,种一棵树", "从现在开始,种一棵树"],
readCount: 0 readCount: 0,
} currentUserName: "",
};
},
computed: {
currentUserName: function () {
return store.state.user.userInfo.name;
},
}, },
mounted () { mounted() {
this.addReadCountFun() this.addReadCountFun();
this.readCountFun() this.readCountFun();
}, },
methods: { methods: {
jumpIpDns: function () { jumpIpDns: function () {
try { try {
window.open('https://beian.miit.gov.cn') window.open("https://beian.miit.gov.cn");
} catch (r) { } catch (r) {
window.location.href = 'https://beian.miit.gov.cn' window.location.href = "https://beian.miit.gov.cn";
throw Error(r) throw Error(r);
} }
}, },
addReadCountFun: function () { addReadCountFun: function () {
const that = this const that = this;
let clientIp = '未知' let clientIp = "未知";
try { try {
console.log('ip待定') console.log("ip待定");
} catch (e) { } catch (e) {
console.log(e) console.log(e);
} }
that.$axios that.$axios
.post(this.baseUrl + 'count/add/', { .post(this.baseUrl + "count/add/", {
ip: clientIp ip: clientIp,
}) })
.then((res) => { .then((res) => {
console.log(res) console.log(res);
}) })
.catch((e) => { .catch((e) => {
throw Error(e) throw Error(e);
}) });
}, },
readCountFun: function () { readCountFun: function () {
let that = this let that = this;
that.$axios that.$axios
.get(that.baseUrl + 'count/get/') .get(that.baseUrl + "count/get/")
.then((res) => { .then((res) => {
this.readCount = res.data.num this.readCount = res.data.num;
}) })
.catch((error) => { .catch((error) => {
console.log(error) console.log(error);
}) });
}, },
changeNavigate: function () { changeNavigate: function () {
this.navigate_flag = !this.navigate_flag // 取反 this.navigate_flag = !this.navigate_flag; // 取反
}, },
handleOpen (key, keyPath) { handleOpen(key, keyPath) {
console.log(key, keyPath) console.log(key, keyPath);
if (key === '3') { if (key === "3") {
console.log('打开3号') console.log("打开3号");
this.chat_flag = true this.chat_flag = true;
this.onlineWebsocket() // 调用跳转 this.onlineWebsocket(); // 调用跳转
} }
if (key === '2-1') { if (key === "2-1") {
this.chat_flag = false this.chat_flag = false;
this.loginAction() // 调用跳转 this.loginAction(); // 调用跳转
} }
if (key === '2-2') { if (key === "2-2") {
this.chat_flag = false this.chat_flag = false;
this.registerAction() // 调用跳转 this.registerAction(); // 调用跳转
} }
}, },
handleClose (key, keyPath) { handleClose(key, keyPath) {
console.info(key, keyPath) console.info(key, keyPath);
if (key === '3') { if (key === "3") {
this.chat_flag = false this.chat_flag = false;
} }
}, },
jumpRouter: function (params) { jumpRouter: function (params) {
this.$router this.$router
.push({ .push({
name: `${params}` name: `${params}`,
}) })
.catch((error) => { .catch((error) => {
console.log(error) console.log(error);
}) });
}, },
onlineWebsocket: function () { onlineWebsocket: function () {
// console.log(this.$router); // console.log(this.$router);
this.$router this.$router
.push({ .push({
path: '/onlinewebsocket' path: "/onlinewebsocket",
}) })
.catch((error) => { .catch((error) => {
throw Error(error) throw Error(error);
}) });
}, },
jumpToEcharts: function () { jumpToEcharts: function () {
// console.log(this.$router); // console.log(this.$router);
this.$router this.$router
.push({ .push({
path: '/bilicom' path: "/bilicom",
}) })
.catch((error) => { .catch((error) => {
console.log(error) console.log(error);
}) });
}, },
jumpToAdmin: function () { jumpToAdmin: function () {
this.$router this.$router
.push({ .push({
path: '/mavoneditor' path: "/mavoneditor",
}) })
.catch((error) => { .catch((error) => {
console.log(error) console.log(error);
}) });
}, },
loginAction: function () { loginAction: function () {
this.$router this.$router
.push({ .push({
path: '/login' path: "/login",
}) })
.catch((error) => { .catch((error) => {
console.log(error) console.log(error);
}) });
}, },
registerAction: function () { registerAction: function () {
this.$router this.$router
.push({ .push({
path: '/register' path: "/register",
}) })
.catch((error) => { .catch((error) => {
console.log(error) console.log(error);
}) });
} },
} },
} };
</script> </script>
<style> <style>
......
...@@ -127,7 +127,7 @@ export default { ...@@ -127,7 +127,7 @@ export default {
// 添加cookie // 添加cookie
} else if (res.data.code == 0) { } else if (res.data.code == 0) {
// alter("失败!" res.data.msg) // alter("失败!" res.data.msg)
that.$message.error('用化名或密码错误'); that.$message.error("用户名或密码错误");
} }
}) })
.catch((error) => { .catch((error) => {
......
import { loginUser } from '@/service/user.service' import { loginUser } from "@/service/user.service";
export default { export default {
// 自带命名空间 // 自带命名空间
namespaced: true, namespaced: true,
state: { state: {
// 用户账号密码 // 用户账号密码
userInfo: null userInfo: {
name: null,
password: null,
},
}, },
getters: { getters: {
userInfo: state => { return state.userInfo } userInfo: (state) => {
return state.userInfo;
},
}, },
mutations: { mutations: {
// 配置用户登录信息 userInfo // 配置用户登录信息 userInfo
setUserInfo (state, userInfo) { setUserInfo(state, userInfo) {
state.userInfo = userInfo state.userInfo = userInfo;
} },
}, },
actions: { actions: {
// Promise // Promise
loginUserInfo ({ commit }, info) { loginUserInfo({ commit }, info) {
console.log('登录认证 store里面', 'info', info) console.log("登录认证 store里面", "info", info);
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
try { try {
let data = await loginUser(info) let data = await loginUser(info);
// 等待登录信息 // 等待登录信息
console.log('返回的post', data) console.log("返回的post", data);
// 调用 mutation // 调用 mutation
commit('setUserInfo', data) commit("setUserInfo", info);
resolve(data) resolve(data);
} catch (error) { } catch (error) {
reject(error) reject(error);
} }
}) });
} },
} },
} };
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册