Skip to content

Commit 963fcbd

Browse files
committed
fix bug
1
1 parent ef9bb3f commit 963fcbd

File tree

6 files changed

+77
-9
lines changed

6 files changed

+77
-9
lines changed

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
{
2-
"name": "team_application",
3-
"version": "v1.0.0",
2+
"name": "@nesercode/team-application",
3+
"version": "v1.2.0",
44
"private": false,
55
"description": "A lot tool in a set which improves effictive power when work in Team_Beihua.",
6-
"author": "nesercode",
6+
"author": "NeserCode",
7+
"publishConfig": {
8+
"access": "public",
9+
"registry": "https://registry.npmjs.org/"
10+
},
711
"scripts": {
812
"serve": "vue-cli-service serve",
913
"build": "vue-cli-service build",

server/api/userApi.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,17 @@ router.post('/signin', (req, res) => {
6262
console.log('----------------------');
6363
})
6464

65+
router.post('/signin/username', (req, res) => {
66+
var sql = $sql.user.get.uid
67+
var params = req.body
68+
69+
conn.query(sql, [params.username], (err, result) => {
70+
if (err) return res.status(502).send(err)
71+
else res.status(200).send(result)
72+
})
73+
console.log('----------------------');
74+
})
75+
6576
//用户更新资料 |updateItem、username
6677

6778
router.post('/detail/update/all', (req, res) => {

server/teamServer.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ const bodyParser = require('body-parser');
55
const express = require('express');
66
const app = express();
77

8+
const port = 5999
9+
810
app.use(bodyParser.json());
911
app.use(bodyParser.urlencoded({ extended: false }));
1012

1113
// 后端api路由
1214
app.use('/api/user', userApi);
1315

1416
// 监听端口
15-
app.listen(5999);
17+
app.listen(port);
1618

17-
console.log('Server deployment finish | [Port:5999] | [Host:127.0.0.1]');
19+
console.log(`Server deployment finish | [Port:${port}] | [Host:127.0.0.1]`);

src/components/Sign/up/index.vue

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export default {
9898
sex: "m",
9999
bound: "",
100100
},
101+
isNameRepeat: false,
101102
clickable: true,
102103
checkText: "",
103104
};
@@ -109,7 +110,8 @@ export default {
109110
if (this.signUp.username.length < 3)
110111
this.checkText = "用户名长度非法 用户名应为3位及以上的纯英文";
111112
else if (!this.usernameFormat)
112-
this.checkText = "用户名非法 用户名应为3位及以上的纯英文";
113+
this.checkText =
114+
"用户名非法 用户名应为3位及以上的纯英文 若满足以上仍收到此信息则用户名重复";
113115
else if (!this.passwordFormat) {
114116
this.checkText =
115117
"密码长度非法 密码应为8位以上的数字、字母及符号组成的字符串";
@@ -118,14 +120,16 @@ export default {
118120
} else if (!this.boundFormat) {
119121
this.checkText = "邮箱格式错误";
120122
} else this.checkText = "";
123+
console.log(this.usernameFormat, this.isNameRepeat);
121124
},
122125
},
123126
},
124127
computed: {
125128
usernameFormat() {
126129
return (
127130
this.signUp.username.length >= 3 &&
128-
this.signUp.username == this.signUp.username.replace(/[^\w]/gi, "")
131+
this.signUp.username == this.signUp.username.replace(/[^\w]/gi, "") &&
132+
!this.isNameRepeat
129133
);
130134
},
131135
passwordFormat() {
@@ -144,7 +148,23 @@ export default {
144148
mounted() {},
145149
methods: {
146150
handleIAccount: function (s) {
147-
this.signUp.username = s;
151+
this.$conf.getHost().then((h) => {
152+
this.$conf
153+
.checkUsername({
154+
host: this.$conf.getHttpString(h.host),
155+
username: s,
156+
})
157+
.then((response) => {
158+
this.isNameRepeat = response.data.length != 0;
159+
this.signUp.username = s;
160+
})
161+
.catch((err) => {
162+
this.$public.emit("notice", {
163+
type: "error",
164+
msg: `验证发生错误 ${err}`,
165+
});
166+
});
167+
});
148168
},
149169
handleIPassword: function (s) {
150170
this.signUp.password = s;

src/plugins/appConfig.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ const appConfig = {
101101
, getUserDetailById: ({ host, id }) => {
102102
return Axios.post(`${host}/api/user/detail/all`, { id })
103103
}
104+
, checkUsername: ({ host, username }) => {
105+
return Axios.post(`${host}/api/user/signin/username`, { username })
106+
}
104107

105108
}
106109

src/views/Controller.vue

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,39 @@ export default {
103103
});
104104
}
105105
},
106+
handleSaveAppkey: function (key) {
107+
localStorage.setItem("appKey", key);
108+
this.$public
109+
.emit("notice", {
110+
type: "warning",
111+
time: 5000,
112+
msg: `⚙ 检测到新生成的应用键值 正在为您挂载`,
113+
fn: () => {
114+
this.$public.emit("notice", {
115+
type: "success",
116+
msg: `✔ 键值挂载完毕`,
117+
});
118+
},
119+
})
120+
.catch((err) => {
121+
this.$public.emit("notice", {
122+
type: "error",
123+
time: 5000,
124+
msg: `❌ 挂载失败 您将失去大部分可使用的功能 ${err}`,
125+
});
126+
});
127+
},
106128
handleCheckKey: function () {
107129
this.$conf
108130
.getConfPromise()
109131
.then((data) => {
110-
if (data.data.appInfo.key == null) this.handleRebuildKey("appkey");
132+
if (
133+
data.data.appInfo.key != null &&
134+
localStorage.getItem("appKey") == null
135+
)
136+
this.handleSaveAppkey(data.data.appInfo.key);
137+
else if (data.data.appInfo.key == null)
138+
this.handleRebuildKey("appkey");
111139
else if (data.data.userInfo.key == null)
112140
this.handleRebuildKey("userkey");
113141
})

0 commit comments

Comments
 (0)