Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wrong profile update url #105

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mysql_password=ANOTHER_SECRET_MYSQL_DJANGO_PASSWORD
mysql_root_password=ANOTHER_SECRET_MYSQL_ROOT_PASSWORD
public_host=vlab.ustc.edu.cn
rabbitmq_password=ANOTHER_SECRET_RABBITMQ_PASSWORD
docker_judger_host_path=/home/libreliu/Projects/Soft_Eng/DockerJudger
docker_judger_host_path=/Users/mac/Documents/workspaces/ustc_projects/VLAB/Verilog-OJ/DockerJudger
docker_host_dir=/host_dir
rabbitmq_default_user=user
rabbitmq_default_pass=ANOTHER_SECRET_RABBITMQ_PASSWORD
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
**/__pycache__
lib/
venv/
venv_new/

# Editor directories and files
.idea
Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ services:
USE_APK_MIRROR: "yes"
USE_MYSQL: "yes"
environment:
VERILOG_OJ_DEV: "TRUE"
VERILOG_OJ_HOST_STATIC: "yes"
#VERILOG_OJ_PROD_DEBUG: "yes"
# VERILOG_OJ_PROD_DEBUG: "yes"
VERILOG_OJ_JUDGER_SECRET: ${judger_secret}
VERILOG_OJ_SECRET_KEY: ${secret_key}
VERILOG_OJ_USE_MYSQL: "yes"
Expand Down
1 change: 0 additions & 1 deletion frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ export default {
if (command == "setting") {
this.$router.push({
name: "setting",
params: { username: this.username },
});
}
// if (command == "submittion") {
Expand Down
87 changes: 43 additions & 44 deletions frontend/src/components/mainpage/setting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div style="text-align: center; margin: 5px">昵称</div>
</el-col>
<el-col :span="12">
<el-input v-model="form.name" autocomplete="off"></el-input>
<el-input v-model="form.username" autocomplete="off"></el-input>
</el-col>
</el-row>
<el-row :gutter="10">
Expand Down Expand Up @@ -106,17 +106,16 @@
</template>

<script>
import { mapState } from "vuex";

export default {
name: "setting",
data() {
return {
username: "",
name: "",
form: {
username: "",
password: "",
confirm: "",
name: "",
username: "",
des: "",
school: "",
course: "",
Expand All @@ -126,17 +125,16 @@ export default {
qq: "",
email: "",
},
userid: -1,
};
},
methods: {
updateClick() {
if (!this.username) {
if (!this.userID) {
this.$message.error("非法访问!");
return;
}
if (
!this.form.name ||
!this.form.username ||
!this.form.school ||
!this.form.course ||
!this.form.classes ||
Expand All @@ -153,7 +151,7 @@ export default {
return;
}

if (this.form.name.length < 2) {
if (this.form.username.length < 2) {
this.$message.error("昵称太短!");
return;
}
Expand Down Expand Up @@ -183,44 +181,45 @@ export default {
).then(() => {
// TODO: fix this
//this.form.password = this.form.password;
this.$axios
.put("/changeone/", this.form)

.then(
(response) => {
this.$message({
message: "更新成功!",
type: "success",
});
sessionStorage.setItem("name", this.form.name);
this.$router.push({
name: "user",
query: { username: this.form.username },
});
},
(response) => {
this.$message.error("更新失败(" + response + ")");
}
);
this.$axios.put(`/users/${this.userID}/`, this.form).then(
(response) => {
this.$message({
message: "更新成功!",
type: "success",
});
this.$parent.showHome();
},
(response) => {
this.$message.error("更新失败(" + response + ")");
}
);
});
},
async updateUserInfo() {
if (this.userID) {
const resp_data = (await this.$axios.get(`/users/${this.userID}`)).data;
this.form.username = resp_data.username;
this.form.des = resp_data.des || "这个人很懒,什么都没有没有留下。";
this.form.school = resp_data.school;
this.form.course = resp_data.course;
this.form.classes = resp_data.classes;
this.form.number = resp_data.number;
this.form.realname = resp_data.realname;
this.form.qq = resp_data.qq;
this.form.email = resp_data.email;
}
},
},
created() {
this.username = this.$route.params.username;
this.form.username = this.username;
if (this.username) {
this.$axios.get("/user/?username=" + this.username).then((response) => {
this.form.name = response.data[0].name;
this.form.school = response.data[0].school;
this.form.course = response.data[0].course;
this.form.classes = response.data[0].classes;
this.form.number = response.data[0].number;
this.form.realname = response.data[0].realname;
this.form.qq = response.data[0].qq;
this.form.email = response.data[0].email;
this.userid = this.username;
});
}
computed: {
...mapState(["loggedIn", "userID", "username", "isSuperUser"]),
},
watch: {
userID: function () {
this.updateUserInfo();
},
},
created: async function () {
await this.updateUserInfo();
},
};
</script>
Expand Down