hookehuyr

🐞 fix: 修改Toast组件的引用方式

......@@ -26,7 +26,7 @@
"mui-player": "^1.6.0",
"typescript": "^4.7.3",
"uuid": "^8.3.2",
"vant": "^4.0.0-alpha.3",
"vant": "^4.9.9",
"vconsole": "^3.14.6",
"vite-plugin-dynamic-import": "^0.9.6",
"vite-plugin-mp": "^1.6.1",
......@@ -51,6 +51,7 @@
"qs": "^6.10.3",
"tslint": "^6.1.3",
"unplugin-auto-import": "^0.8.8",
"unplugin-vue-components": "^0.27.4",
"unplugin-vue-define-options": "^0.6.1",
"vite": "^2.9.9",
"vite-plugin-style-import": "1.4.1",
......
......@@ -19,7 +19,7 @@
import { mainStore, useTitle } from '@/utils/generatePackage'
import { computed, watchEffect, onMounted } from 'vue';
import { useRoute } from 'vue-router'
import { Toast } from 'vant';
import { showSuccessToast, showFailToast } from 'vant';
// 会根据配置判断是否显示调试控件
// eslint-disable-next-line no-unused-vars
import vConsole from '@/utils/vconsole'
......
/*
* @Date: 2022-05-18 22:56:08
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-07-05 23:27:51
* @LastEditTime: 2024-11-26 12:47:58
* @FilePath: /tswj/src/api/fn.js
* @Description: 文件描述
*/
import axios from '@/utils/axios';
import { Toast } from 'vant';
import { showToast } from 'vant';
import qs from 'Qs'
/**
......@@ -23,7 +23,7 @@ export const fn = (api) => {
// tslint:disable-next-line: no-console
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
......@@ -41,8 +41,8 @@ export const fn = (api) => {
/**
* 七牛返回格式
* @param {*} api
* @returns
* @param {*} api
* @returns
*/
export const uploadFn = (api) => {
return api
......
/*
* @Date: 2024-05-15 10:28:10
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-11-26 12:49:10
* @FilePath: /tswj/src/common/mixin.js
* @Description: 文件描述
*/
import axios from 'axios';
import { Toast } from 'vant';
import { showToast, showSuccessToast } from 'vant';
export default {
// 初始化设置
......@@ -25,22 +32,22 @@ export default {
if (res.data.msg === `${type}-add-OK`) { // 动作操作成功
this.getProductDetail(type, id);
if (type === 'favor') {
Toast('收藏成功');
showSuccessToast('收藏成功');
}
if (type === 'like') {
Toast('点赞成功');
showSuccessToast('点赞成功');
}
} else { // 取消操作
this.getProductDetail(type, id);
if (type !== 'play') {
Toast('取消成功');
showSuccessToast('取消成功');
}
}
} else {
// tslint:disable-next-line: no-console
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
......@@ -48,7 +55,7 @@ export default {
})
.catch(err => {
// tslint:disable-next-line: no-console
console.error(err);
console.error(err);
});
},
getProductDetail (type, id) { // 查询更新作品详情
......@@ -65,7 +72,7 @@ export default {
// tslint:disable-next-line: no-console
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
......@@ -73,7 +80,7 @@ export default {
})
.catch(err => {
// tslint:disable-next-line: no-console
console.error(err);
console.error(err);
});
}
}
......
......@@ -114,7 +114,7 @@ import _ from 'lodash';
import tools from '@/common/tool'
import { styleColor } from '@/constant.js';
import { Toast } from 'vant';
import { showSuccessToast, showFailToast } from 'vant';
import { DEFAULT_COVER } from '@/constant'
const props = defineProps({
......@@ -162,7 +162,7 @@ const onRefuse = () => { // 不通过审核
const handleAudit = async (status) => {
const { code } = await checkProdAPI({ prod_id: props.item.id, status, check_note: message.value, })
if (code === 1) {
Toast.success('操作成功');
showSuccessToast('操作成功');
message.value = '';
showNotice.value = false;
show.value = false;
......@@ -291,15 +291,15 @@ export default {
.book-handle {
padding: 0 1rem;
.disagree-btn {
background: #B4B4B3;
border-radius: 15px;
color: #FFFFFF;
background: #B4B4B3;
border-radius: 15px;
color: #FFFFFF;
padding: 0.25rem 0.8rem;
}
.agree-btn {
background: @base-color;
border-radius: 15px;
color: @base-font-color;
background: @base-color;
border-radius: 15px;
color: @base-font-color;
padding: 0.25rem 1.5rem;
}
}
......
......@@ -38,7 +38,7 @@
<script setup>
import icon_y from '@images/y.png'
import { Toast } from 'vant';
import { showSuccessToast, showFailToast } from 'vant';
import { ref, watch } from 'vue'
......@@ -64,7 +64,7 @@ const submitComment = () => {
emit('on-submit', message.value);
message.value = '';
} else {
Toast.fail('留言不能为空');
showFailToast('留言不能为空');
}
}
......
......@@ -66,7 +66,7 @@ import { useRoute, useRouter } from 'vue-router'
import axios from '@/utils/axios';
import _ from 'lodash'
import { Toast } from 'vant';
import { showSuccessToast, showFailToast } from 'vant';
import { ref, watch } from 'vue'
// 获取是否实名认证
......@@ -136,7 +136,7 @@ const submitCommentBox = (note) => {
.then(res => {
showCommentBoxPopup.value = false;
if (res.data.code === 1) {
Toast.success('发布成功')
showSuccessToast('发布成功')
onReload()
} else {
console.warn(res);
......
......@@ -2,12 +2,12 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-05-23 14:33:37
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-02 13:14:23
* @LastEditTime: 2024-11-26 12:49:30
* @FilePath: /tswj/src/components/MuiVideo/methods.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { prodActionAPI } from '@/api/C/prod.js'
import { Toast } from 'vant';
import { showSuccessToast } from 'vant';
export const goToDetail = ({ id, book_id, type, perf_id }, $router) => {
$router.push({
......@@ -35,14 +35,14 @@ export const prodAction = async (action_type, prod_id) => {
const { msg } = await prodActionAPI({ action_type, prod_id });
if (msg === `${action_type}-add-OK`) { // 动作操作成功
if (action_type === 'favor') {
Toast('收藏成功');
showSuccessToast('收藏成功');
}
if (action_type === 'like') {
Toast('点赞成功');
showSuccessToast('点赞成功');
}
} else { // 取消操作
if (action_type !== 'play') {
Toast('取消成功');
showSuccessToast('取消成功');
}
}
return true;
......
......@@ -2,13 +2,13 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-05-07 17:46:54
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-12 22:55:58
* @LastEditTime: 2024-11-26 12:49:46
* @FilePath: /tswj/src/composables/useBookList.js
* @Description:
* @Description:
*/
import { ref } from 'vue'
import axios from '@/utils/axios';
import { Toast } from 'vant';
import { showToast } from 'vant';
import { useRoute } from 'vue-router';
import { kgBookListAPI } from '@/api/C/kg'
......@@ -47,7 +47,7 @@ export const useBookList = () => {
// tslint:disable-next-line: no-console
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
......@@ -74,7 +74,7 @@ export const useBookList = () => {
// tslint:disable-next-line: no-console
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
......
......@@ -4,11 +4,11 @@
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-05-30 10:18:19
* @FilePath: /tswj/src/composables/useDefaultPerf.js
* @Description:
* @Description:
*/
import { ref } from 'vue'
import axios from '@/utils/axios';
import { Toast } from 'vant';
import { showToast } from 'vant';
/**
* @description: 获取默认儿童信息
......@@ -51,7 +51,7 @@ export const useDefaultPerf = (bookId) => {
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
......
import { ref } from 'vue'
import axios from '@/utils/axios';
import _ from 'lodash'
import { Toast } from 'vant';
import { showToast } from 'vant';
export const useUnwatchList = () => {
// 绑定页面数据
......@@ -51,7 +51,7 @@ export const useUnwatchList = () => {
// tslint:disable-next-line: no-console
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
......
/*
* @Date: 2024-05-15 10:28:10
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-11-26 12:50:03
* @FilePath: /tswj/src/composables/useValidIdCard.js
* @Description: 文件描述
*/
import { ref } from 'vue'
import axios from '@/utils/axios';
import { Toast } from 'vant';
import { showToast } from 'vant';
export const idCard = () => {
/**
......@@ -14,7 +21,7 @@ export const idCard = () => {
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
......
/*
* @Date: 2022-05-05 18:07:16
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-01 21:13:07
* @LastEditTime: 2024-11-26 12:50:17
* @FilePath: /tswj/src/composables/useVideoList.js
* @Description: 文件描述
*/
import { ref } from 'vue'
import axios from '@/utils/axios';
import _ from 'lodash'
import { Toast } from 'vant';
import { showToast } from 'vant';
import { useRoute } from 'vue-router'
import { bookInfoAPI } from '@/api/C/book'
import { flowFn } from '@/hooks/useFlowFn'
......@@ -62,7 +62,7 @@ export const useVideoList = () => {
// tslint:disable-next-line: no-console
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
......
......@@ -4,7 +4,7 @@
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-29 22:00:37
* @FilePath: /tswj/src/main.js
* @Description:
* @Description:
*/
import { createApp } from 'vue';
import { Button, Image as VanImage, Col, Row, Icon, Form, Field, CellGroup, ConfigProvider, Toast, Uploader, Empty, Tab, Tabs, Overlay, NumberKeyboard, Lazyload, List, PullRefresh, Popup, Picker, Sticky, Stepper, Tag, Swipe, SwipeItem, Dialog, ActionSheet, Loading, Checkbox, Search } from 'vant';
......@@ -14,6 +14,7 @@ import App from './App.vue';
import axios from '@/utils/axios';
// import 'default-passive-events'; // 解决Chrome控制台non-passive event listener输出问题
import { createPinia } from 'pinia';
import 'vant/lib/index.css';
const pinia = createPinia();
const app = createApp(App);
......
......@@ -33,7 +33,7 @@ import { ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import axios from '@/utils/axios';
import _ from 'lodash'
import { Toast } from 'vant';
import { showSuccessToast, showFailToast, showToast } from 'vant';
import { styleColor } from '@/constant.js';
const titleStyle = {
......@@ -114,7 +114,7 @@ const onLoad = () => {
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
......
......@@ -20,7 +20,7 @@ import { ref, reactive, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import axios from '@/utils/axios';
import _ from 'lodash'
import { Toast } from 'vant';
import { showSuccessToast, showFailToast, showToast } from 'vant';
const $route = useRoute();
const $router = useRouter();
......@@ -43,14 +43,14 @@ axios.get('/srv/?a=kg_prod_list')
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
}
})
.catch(err => {
console.error(err);
console.error(err);
});
</script>
......
......@@ -70,7 +70,7 @@ import { ref, onMounted } from 'vue'
import { useRoute } from 'vue-router'
import axios from '@/utils/axios';
import _ from 'lodash'
import { Toast } from 'vant';
import { showSuccessToast, showFailToast, showToast } from 'vant';
import { USER_STATUS } from '@/constant'
import { useGo } from '@/hooks/useGo'
......@@ -134,14 +134,14 @@ const onLoad = () => {
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
}
})
.catch(err => {
console.error(err);
console.error(err);
})
};
......@@ -162,14 +162,14 @@ const onReload = () => {
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
}
})
.catch(err => {
console.error(err);
console.error(err);
})
}
/******** 留言框列表相关操作 END *******/
......@@ -243,7 +243,7 @@ const submitCommentBox = (note) => {
.then(res => {
showCommentBoxPopup.value = false;
if (res.data.code === 1) {
Toast.success('发布成功')
showSuccessToast('发布成功')
// 刷新列表
if (commentType.value === 'comment') {
// 留言可以刷新列表
......@@ -265,14 +265,14 @@ const submitCommentBox = (note) => {
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
}
})
.catch(err => {
console.error(err);
console.error(err);
})
}
......
......@@ -62,7 +62,7 @@ import { no_image, icon_avatar } from '@/utils/generateIcons.js'
import CommentBox from '@/components/CommentBox/index.vue'
import { ref, onActivated } from 'vue'
import { useRoute, onBeforeRouteLeave } from 'vue-router'
import { Toast } from 'vant';
import { showSuccessToast, showFailToast } from 'vant';
// import { addPages, store } from '@/hooks/useKeepAlive'
import { myAtmeAPI } from '@/api/C/me'
import { addCommentAPI, addReplyAPI } from '@/api/C/perf'
......@@ -140,7 +140,7 @@ const submitCommentBox = async (note) => {
params.prod_id = $route.query.prod_id;
const { code } = await addCommentAPI(params);
if (code) {
Toast.success('发布成功')
showSuccessToast('发布成功')
// 刷新列表
location.reload()
}
......@@ -149,7 +149,7 @@ const submitCommentBox = async (note) => {
params.comment_id = commentId.value;
const { code } = await addReplyAPI(params);
if (code) {
Toast.success('发布成功')
showSuccessToast('发布成功')
// 刷新列表
location.reload()
}
......@@ -157,7 +157,7 @@ const submitCommentBox = async (note) => {
}
/**
* @param {*} v
* @param {*} v
* @description 关闭留言框回调
*/
const closeCommentBox = (v) => {
......
......@@ -42,7 +42,7 @@ import { useRoute, useRouter } from 'vue-router'
import axios from '@/utils/axios';
import $ from 'jquery'
import _ from 'lodash'
import { Toast } from 'vant';
import { showSuccessToast, showFailToast, showToast } from 'vant';
const $route = useRoute();
const $router = useRouter();
......@@ -57,7 +57,7 @@ axios.post('/srv/?a=my_donate')
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
......@@ -84,7 +84,7 @@ const showCert = (v) => {
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
......
......@@ -39,7 +39,7 @@ import { useUpload } from '@/composables/useUpload.js'
import { ref, reactive } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import axios from '@/utils/axios';
import { Toast } from 'vant';
import { showSuccessToast, showFailToast, showToast } from 'vant';
import _ from 'lodash'
import { styleColor } from '@/constant.js';
......@@ -66,11 +66,11 @@ if ($route.query.type === 'EDIT') {
// 验证输入项
const validForm = () => {
if (!user_info.name) {
Toast.fail('儿童姓名不能为空')
showFailToast('儿童姓名不能为空')
return false;
}
if (!fileList.value.length) {
Toast.fail('儿童头像不能为空')
showFailToast('儿童头像不能为空')
return false;
}
saveInfo()
......@@ -100,7 +100,7 @@ const selectSchool = () => {
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
......@@ -130,7 +130,7 @@ const saveInfo = () => {
})
.then(res => {
if (res.data.code === 1) {
Toast.success({
showSuccessToast({
message: '保存成功',
duration: 1000,
onClose: () => {
......@@ -144,7 +144,7 @@ const saveInfo = () => {
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
......@@ -179,21 +179,21 @@ export default {
.add-user-page {
padding: 1rem;
.title {
color: @base-color;
font-size: 1.25rem;
padding: 1rem;
text-align: center;
color: @base-color;
font-size: 1.25rem;
padding: 1rem;
text-align: center;
font-weight: bold;
}
.upload-text {
padding: 2vh 0;
.upload-text-1 {
font-size: 14px;
color: #323233;
font-size: 14px;
color: #323233;
margin-left: 2vh;
}
.upload-text-2 {
font-size: 12px;
font-size: 12px;
color: #B0B0B0;
}
}
......
......@@ -48,7 +48,7 @@ import { wxInfo } from '@/utils/tools';
import { ref, onMounted, nextTick } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import axios from '@/utils/axios';
import { Toast } from 'vant';
import { showSuccessToast, showFailToast, showToast } from 'vant';
import { styleColor } from '@/constant.js';
import { smsAPI } from '@/api/common'
import { useCountDown } from '@vant/use';
......@@ -119,7 +119,7 @@ const sendCode = async () => { // 发送验证码
// 验证码接口
const { code } = await smsAPI({ phone: phone.value });
if (code === 1) {
Toast.success('发送成功');
showSuccessToast('发送成功');
}
};
......@@ -141,7 +141,7 @@ let submit = () => {
})
.catch(error => {
console.error(error);
Toast({
showToast({
message: '请检查后再次提交',
icon: 'cross',
});
......@@ -151,7 +151,7 @@ let submit = () => {
/**
* 手机号码校验
* 函数返回 true 表示校验通过,false 表示不通过
* @param {*} val
* @param {*} val
*/
const validator = (val) => {
let flag = false;
......@@ -178,7 +178,7 @@ const onSubmit = (values) => {
})
.then(res => {
if (res.data.code === 1) {
Toast.success('录入成功')
showSuccessToast('录入成功')
if ($route.query.back_url) {
$router.push($route.query.back_url)
} else {
......@@ -187,7 +187,7 @@ const onSubmit = (values) => {
} else {
console.warn(res.data);
if (!res.data.show) return false;
Toast({
showToast({
message: res.data.msg,
icon: 'close',
});
......@@ -224,10 +224,10 @@ export default {
.verify-user-page {
padding: 1rem;
.title {
color: @base-color;
font-size: 1.25rem;
padding: 1rem;
text-align: center;
color: @base-color;
font-size: 1.25rem;
padding: 1rem;
text-align: center;
font-weight: bold;
}
.input-content {
......
......@@ -27,9 +27,9 @@ export default ({ command, mode }) => {
// define: '', // 定义全局常量替换方式。其中每项在开发环境下会被定义在全局,而在构建时被静态替换。
plugins: [ // 将要用到的插件数组。Falsy 虚值的插件将被忽略,插件数组将被扁平化(flatten)。查看 插件 API 获取 Vite 插件的更多细节。
vue(),
Components({
resolvers: [VantResolver()],
}),
// Components({
// resolvers: [VantResolver()],
// }),
// styleImport({
// resolves: [VantResolve()],
// libs: [
......
This diff is collapsed. Click to expand it.