Skip to content

Commit 64bfdb2

Browse files
authored
[merge] Merge pull request #120 from segment-oj/refactory-code-tom
[refactory*] drop mess code and fix legency bugs
2 parents 1972046 + e5e29f6 commit 64bfdb2

36 files changed

+116
-107
lines changed

deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ cp -r dist /tmp/
1616
cd /tmp/dist
1717

1818
# 404 跳转
19-
echo "<script>fetch('index.html').then(d=>document.write(d.text()))</script>" > 404.html
19+
echo "<script>fetch('index.html').then(r=>r.text()).then(d=>document.write(d))</script>" > 404.html
2020

2121
# 部署到自定义域域名
2222
# echo 'www.example.com' > CNAME

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
"vue": "^2.6.11",
2222
"vue-router": "^3.3.4",
2323
"vue-unique-id": "^3.1.0",
24-
"vuex": "^3.5.1"
24+
"vuex": "^3.5.1",
25+
"vue-katex": "^0.4.0",
26+
"katex": "^0.11.1",
27+
"vue-template-compiler": "^2.6.11"
2528
},
2629
"devDependencies": {
2730
"@vue/cli-plugin-babel": "~4.4.0",
@@ -30,12 +33,9 @@
3033
"babel-eslint": "^10.1.0",
3134
"eslint": "^6.7.2",
3235
"eslint-plugin-vue": "^6.2.2",
33-
"katex": "^0.11.1",
3436
"stylelint": "^13.6.1",
3537
"stylelint-config-standard": "^20.0.0",
36-
"stylelint-scss": "^3.18.0",
37-
"vue-katex": "^0.4.0",
38-
"vue-template-compiler": "^2.6.11"
38+
"stylelint-scss": "^3.18.0"
3939
},
4040
"eslintConfig": {
4141
"root": true,

src/App.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
<script>
1616
import NavBar from './components/page/navbar.vue';
1717
import Footer from './components/page/footer.vue';
18-
import UserLogin from './components/user/login.vue';
19-
import UserRegister from './components/user/register.vue';
18+
import UserLogin from './components/account/login.vue';
19+
import UserRegister from './components/account/register.vue';
2020
2121
export default {
2222
name: 'App',

src/components/user/changePassword.vue renamed to src/components/account/ChangePassword.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ export default {
9999
})
100100
.then(() => {
101101
this.buttonLoading = false;
102-
this.$SegmentMessage.success(this, 'Changed successfully');
102+
this.$info.success('Changed successfully');
103103
})
104104
.catch(err => {
105105
if (err.request.status === 401) {
106-
this.$SegmentMessage.error(this, 'Please login first');
106+
this.$info.error('Please login first');
107107
this.$store.state.user.showlogin = true;
108108
}
109109
if (err.request.status === 403) {
110-
this.$SegmentMessage.error(this, 'Please enter your old password');
110+
this.$info.error('Please enter your old password');
111111
this.old_password_required = true;
112112
}
113113
this.buttonLoading = false;
File renamed without changes.
File renamed without changes.

src/components/user/content.vue renamed to src/components/account/content.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ export default {
5757
})
5858
.catch(err => {
5959
if(err.request.status === 404) {
60-
this.$SegmentMessage.error(this, 'User does not exist');
60+
this.$info.error('User does not exist');
6161
} else {
62-
this.$SegmentMessage.error(this, 'Unknown error');
62+
this.$info.error('Unknown error');
6363
}
6464
this.userLoading = false;
6565
});

src/components/user/edit.vue renamed to src/components/account/edit.vue

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ export default {
100100
})
101101
.catch(err => {
102102
if (err.request.status === 404) {
103-
this.$SegmentMessage.error(this, 'User not found');
103+
this.$info.error('User not found');
104104
} else if (err.request.status === 403) {
105-
this.$SegmentMessage.error(this, 'Permission denied');
105+
this.$info.error('Permission denied');
106106
} else {
107-
this.$SegmentMessage.error(this, 'Unknown error');
107+
this.$info.error('Unknown error');
108108
}
109109
});
110110
this.$axios
@@ -115,9 +115,9 @@ export default {
115115
})
116116
.catch(err => {
117117
if(err.request.status === 404) {
118-
this.$SegmentMessage.error(this, 'User does not exist');
118+
this.$info.error('User does not exist');
119119
} else {
120-
this.$SegmentMessage.error(this, 'Unknown error');
120+
this.$info.error('Unknown error');
121121
}
122122
this.userLoading = false;
123123
});
@@ -134,7 +134,7 @@ export default {
134134
})
135135
.then(() => {
136136
this.buttonLoading = false;
137-
this.$SegmentMessage.success(this, 'Your changes have been submitted');
137+
this.$info.success('Your changes have been submitted');
138138
if (this.isMine) {
139139
this.$store.commit('userStaffChange', {
140140
isStaff: this.isStaff,
@@ -153,21 +153,21 @@ export default {
153153
})
154154
.catch(err => {
155155
if(err.request.status === 404) {
156-
this.$SegmentMessage.error(this, 'User does not exist');
156+
this.$info.error('User does not exist');
157157
} else {
158-
this.$SegmentMessage.error(this, 'Unknown error');
158+
this.$info.error('Unknown error');
159159
}
160160
this.userLoading = false;
161161
});
162162
})
163163
.catch(err => {
164164
this.buttonLoading = false;
165165
if (err.request.status === 404) {
166-
this.$SegmentMessage.error(this, 'User not found');
166+
this.$info.error('User not found');
167167
} else if (err.request.status === 403) {
168-
this.$SegmentMessage.error(this, 'Permission denied');
168+
this.$info.error('Permission denied');
169169
} else {
170-
this.$SegmentMessage.error(this, 'Unknown error');
170+
this.$info.error('Unknown error');
171171
}
172172
});
173173
}

src/components/user/information.vue renamed to src/components/account/information.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,18 @@ export default {
179179
})
180180
.catch(err => {
181181
if(err.request.status === 404) {
182-
this.$SegmentMessage.error(this, 'User does not exist');
182+
this.$info.error('User does not exist');
183183
} else {
184-
this.$SegmentMessage.error(this, 'Unknown error');
184+
this.$info.error('Unknown error');
185185
}
186186
});
187187
this.userLoading = false;
188188
})
189189
.catch(err => {
190190
if(err.request.status === 404) {
191-
this.$SegmentMessage.error(this, 'User does not exist');
191+
this.$info.error('User does not exist');
192192
} else {
193-
this.$SegmentMessage.error(this, 'Unknown error');
193+
this.$info.error('Unknown error');
194194
}
195195
this.userLoading = false;
196196
});

src/components/user/login.vue renamed to src/components/account/login.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,19 @@ export default {
9999
username: this.ldata.username,
100100
userid: res.data.res.id
101101
});
102-
this.$SegmentMessage.success(this, 'Logged in');
102+
this.$info.success('Logged in');
103103
this.$store.state.user.showlogin = false;
104104
this.buttonLoading = false;
105105
})
106106
.catch(err => {
107107
if (err.request.status === 403) {
108-
this.$SegmentMessage.error(this, 'Username or password incorrect');
108+
this.$info.error('Username or password incorrect');
109109
} else if (err.request.status === 429) {
110110
// HTTP 429 Too Many Requests
111-
this.$SegmentMessage.error(this, 'Requesting too frequently');
111+
this.$info.error('Requesting too frequently');
112112
} else {
113113
// Unknown error
114-
this.$SegmentMessage.error(this, 'Unknown error');
114+
this.$info.error('Unknown error');
115115
}
116116
this.buttonLoading = false;
117117
});

0 commit comments

Comments
 (0)