Skip to content

Commit dd60475

Browse files
committed
chore(web): remove vant package
1 parent 8beae9e commit dd60475

8 files changed

Lines changed: 39 additions & 266 deletions

File tree

rootfs/web/package-lock.json

Lines changed: 0 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rootfs/web/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"@element-plus/icons-vue": "^2.3.2",
1212
"axios": "^1.13.6",
1313
"element-plus": "^2.13.6",
14-
"vant": "^4.9.22",
1514
"vue": "^3.5.30",
1615
"vue-i18n": "^11.3.0",
1716
"vue-router": "^5.0.4",

rootfs/web/src/components/AccessTokenDelete.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { reactive, toRefs } from 'vue'
2-
import { showSuccessToast } from "vant";
2+
import { ElMessage } from "element-plus";
33
import {deleteAccessToken} from "../services/tokens";
44

55
export default {
@@ -19,7 +19,7 @@ export default {
1919
const deleteToken = () => {
2020
deleteAccessToken(state.token.id).then(res=>{
2121
if (res.status == 204) {
22-
showSuccessToast("OK")
22+
ElMessage.success("OK")
2323
context.emit('closeDelete', { hasAccessTokenDeleted: true })
2424
}
2525
})

rootfs/web/src/lang/en_US.js

Lines changed: 1 addition & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -7,97 +7,5 @@ const customEnUS = {
77
newToDrycc: "New To Drycc? Please contact your adminstrator",
88

99
}
10-
11-
const vantEnUS = {
12-
// vant default
13-
name: 'Name',
14-
tel: 'Phone',
15-
save: 'Save',
16-
confirm: 'Confirm',
17-
cancel: 'Cancel',
18-
delete: 'Delete',
19-
complete: 'Complete',
20-
loading: 'Loading...',
21-
telEmpty: 'Please fill in the tel',
22-
nameEmpty: 'Please fill in the name',
23-
nameInvalid: 'Malformed name',
24-
confirmDelete: 'Are you sure you want to delete?',
25-
telInvalid: 'Malformed phone number',
26-
vanCalendar: {
27-
end: 'End',
28-
start: 'Start',
29-
title: 'Calendar',
30-
startEnd: 'Start/End',
31-
weekdays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
32-
monthTitle: function monthTitle(year, month) {
33-
return year + "/" + month;
34-
},
35-
rangePrompt: function rangePrompt(maxRange) {
36-
return "Choose no more than " + maxRange + " days";
37-
}
38-
},
39-
vanContactCard: {
40-
addText: 'Add contact info'
41-
},
42-
vanContactList: {
43-
addText: 'Add new contact'
44-
},
45-
vanPagination: {
46-
prev: 'Previous',
47-
next: 'Next'
48-
},
49-
vanPullRefresh: {
50-
pulling: 'Pull to refresh...',
51-
loosing: 'Loose to refresh...'
52-
},
53-
vanSubmitBar: {
54-
label: 'Total:'
55-
},
56-
vanCoupon: {
57-
unlimited: 'Unlimited',
58-
discount: function discount(_discount) {
59-
return _discount * 10 + "% off";
60-
},
61-
condition: function condition(_condition) {
62-
return "At least " + _condition;
63-
}
64-
},
65-
vanCouponCell: {
66-
title: 'Coupon',
67-
tips: 'No coupons',
68-
count: function count(_count) {
69-
return "You have " + _count + " coupons";
70-
}
71-
},
72-
vanCouponList: {
73-
empty: 'No coupons',
74-
exchange: 'Exchange',
75-
close: 'Close',
76-
enable: 'Available',
77-
disabled: 'Unavailable',
78-
placeholder: 'Coupon code'
79-
},
80-
vanAddressEdit: {
81-
area: 'Area',
82-
postal: 'Postal',
83-
areaEmpty: 'Please select a receiving area',
84-
addressEmpty: 'Address can not be empty',
85-
postalEmpty: 'Wrong postal code',
86-
defaultAddress: 'Set as the default address',
87-
telPlaceholder: 'Phone',
88-
namePlaceholder: 'Name',
89-
areaPlaceholder: 'Area'
90-
},
91-
vanAddressEditDetail: {
92-
label: 'Address',
93-
placeholder: 'Address'
94-
},
95-
vanAddressList: {
96-
add: 'Add new address'
97-
}
98-
}
99-
100-
const message = Object.assign(customEnUS, vantEnUS)
101-
102-
export default message
10+
export default customEnUS
10311

rootfs/web/src/lang/zh_CN.js

Lines changed: 1 addition & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -7,97 +7,4 @@ const customZhCN = {
77
newToDrycc: "如果您是Drycc的新用户,请联系管理员",
88

99
}
10-
11-
const vantZhCN = {
12-
// vant default
13-
name: '姓名',
14-
tel: '电话',
15-
save: '保存',
16-
confirm: '确认',
17-
cancel: '取消',
18-
delete: '删除',
19-
complete: '完成',
20-
loading: '加载中...',
21-
telEmpty: '请填写电话',
22-
nameEmpty: '请填写姓名',
23-
nameInvalid: '请输入正确的姓名',
24-
confirmDelete: '确定要删除吗',
25-
telInvalid: '请输入正确的手机号',
26-
vanCalendar: {
27-
end: '结束',
28-
start: '开始',
29-
title: '日期选择',
30-
confirm: '确定',
31-
startEnd: '开始/结束',
32-
weekdays: ['日', '一', '二', '三', '四', '五', '六'],
33-
monthTitle: function monthTitle(year, month) {
34-
return year + "\u5E74" + month + "\u6708";
35-
},
36-
rangePrompt: function rangePrompt(maxRange) {
37-
return "\u9009\u62E9\u5929\u6570\u4E0D\u80FD\u8D85\u8FC7 " + maxRange + " \u5929";
38-
}
39-
},
40-
vanContactCard: {
41-
addText: '添加联系人'
42-
},
43-
vanContactList: {
44-
addText: '新建联系人'
45-
},
46-
vanPagination: {
47-
prev: '上一页',
48-
next: '下一页'
49-
},
50-
vanPullRefresh: {
51-
pulling: '下拉即可刷新...',
52-
loosing: '释放即可刷新...'
53-
},
54-
vanSubmitBar: {
55-
label: '合计:'
56-
},
57-
vanCoupon: {
58-
unlimited: '无使用门槛',
59-
discount: function discount(_discount) {
60-
return _discount + "\u6298";
61-
},
62-
condition: function condition(_condition) {
63-
return "\u6EE1" + _condition + "\u5143\u53EF\u7528";
64-
}
65-
},
66-
vanCouponCell: {
67-
title: '优惠券',
68-
tips: '暂无可用',
69-
count: function count(_count) {
70-
return _count + "\u5F20\u53EF\u7528";
71-
}
72-
},
73-
vanCouponList: {
74-
empty: '暂无优惠券',
75-
exchange: '兑换',
76-
close: '不使用优惠券',
77-
enable: '可用',
78-
disabled: '不可用',
79-
placeholder: '请输入优惠码'
80-
},
81-
vanAddressEdit: {
82-
area: '地区',
83-
postal: '邮政编码',
84-
areaEmpty: '请选择地区',
85-
addressEmpty: '请填写详细地址',
86-
postalEmpty: '邮政编码格式不正确',
87-
defaultAddress: '设为默认收货地址',
88-
telPlaceholder: '收货人手机号',
89-
namePlaceholder: '收货人姓名',
90-
areaPlaceholder: '选择省 / 市 / 区'
91-
},
92-
vanAddressEditDetail: {
93-
label: '详细地址',
94-
placeholder: '街道门牌、楼层房间号等信息'
95-
},
96-
vanAddressList: {
97-
add: '新增地址'
98-
}
99-
}
100-
101-
const message = Object.assign(customZhCN, vantZhCN)
102-
103-
export default message
10+
export default customZhCN

rootfs/web/src/main.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import router from './router'
33
import { createApp } from 'vue'
44
import { i18n, setLang, getUAgentLang } from './lang'
55
import './styles/unified.css'
6-
import 'vant/lib/index.css';
76
import ElementPlus from "element-plus";
87
import "element-plus/dist/index.css";
98
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

rootfs/web/src/utils/axios.js

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import axios from 'axios'
2-
import { closeToast, showLoadingToast, showToast } from 'vant'
2+
import { ElLoading, ElMessage } from 'element-plus'
33
import {getCookie} from "./array";
44

55
axios.defaults.baseURL = process.env.VUE_APP_BASE_URL
@@ -9,11 +9,11 @@ const loadingToast = [];
99

1010
axios.interceptors.request.use(
1111
(config)=>{
12-
loadingToast.push(showLoadingToast({
13-
duration: 0,
14-
forbidClick: true,
15-
message: "Loading..."
16-
}));
12+
loadingToast.push(ElLoading.service({
13+
lock: true,
14+
text: "Loading...",
15+
background: "rgba(0, 0, 0, 0.2)",
16+
}));
1717
let csrftoken = getCookie('csrftoken')
1818
if(csrftoken){
1919
config.headers['X-CSRFToken'] = csrftoken;
@@ -25,12 +25,7 @@ axios.interceptors.request.use(
2525
axios.interceptors.response.use(
2626
response => {
2727
if (loadingToast.length > 0) {
28-
const toast = loadingToast.pop();
29-
if (toast && typeof toast.close === 'function') {
30-
toast.close();
31-
} else {
32-
closeToast();
33-
}
28+
loadingToast.pop().close();
3429
}
3530
if ([200, 201, 204].indexOf(response.status) >= 0) {
3631
return Promise.resolve(response);
@@ -40,12 +35,7 @@ axios.interceptors.response.use(
4035
},
4136
error => {
4237
if (loadingToast.length > 0) {
43-
const toast = loadingToast.pop();
44-
if (toast && typeof toast.close === 'function') {
45-
toast.close();
46-
} else {
47-
closeToast();
48-
}
38+
loadingToast.pop().close();
4939
}
5040
if (error.response && error.response.status) {
5141
switch (error.response.status) {
@@ -68,33 +58,33 @@ axios.interceptors.response.use(
6858
case 404:
6959
console.log('error.response: ', error.response)
7060
if(error.response.data){
71-
showToast({
72-
message: error.response.data.replace("\"","").replace("\"",""),
73-
duration: 1500,
74-
forbidClick: true
75-
});
61+
ElMessage({
62+
message: error.response.data.replace("\"","").replace("\"",""),
63+
type: "error",
64+
duration: 1500,
65+
});
7666
}else {
77-
showToast({
78-
message: 'The request does not exist.',
79-
duration: 1500,
80-
forbidClick: true
81-
});
67+
ElMessage({
68+
message: 'The request does not exist.',
69+
type: "error",
70+
duration: 1500,
71+
});
8272
}
8373
break;
8474
case 400:
8575
console.log('error.response: ', error.response)
8676
if(error.response.data.detail){
87-
showToast({
88-
message: error.response.data.detail.replace("\"","").replace("\"",""),
89-
duration: 1500,
90-
forbidClick: true
91-
});
77+
ElMessage({
78+
message: error.response.data.detail.replace("\"","").replace("\"",""),
79+
type: "error",
80+
duration: 1500,
81+
});
9282
}else {
93-
showToast({
94-
message: 'The request parameter error',
95-
duration: 1500,
96-
forbidClick: true
97-
});
83+
ElMessage({
84+
message: 'The request parameter error',
85+
type: "error",
86+
duration: 1500,
87+
});
9888
}
9989
break;
10090
// other error

0 commit comments

Comments
 (0)