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
});
......
/*
* @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
});
......@@ -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
});
......
......@@ -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;
......
......@@ -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:
*/
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
});
......
......@@ -8,7 +8,7 @@
*/
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
});
......
......@@ -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,7 +43,7 @@ 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
});
......
......@@ -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,7 +134,7 @@ const onLoad = () => {
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
......@@ -162,7 +162,7 @@ const onReload = () => {
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
......@@ -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,7 +265,7 @@ const submitCommentBox = (note) => {
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
showToast({
icon: 'close',
message: res.data.msg
});
......
......@@ -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()
}
......
......@@ -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
});
......
......@@ -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',
});
......@@ -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',
});
......
......@@ -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.