feat:将 pages 里的 uni.showToast 替换成 wd-toast
This commit is contained in:
@@ -90,9 +90,10 @@ import type { Category } from '@/api/bpm/category'
|
||||
import type { ProcessDefinition } from '@/api/bpm/definition'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { computed, ref } from 'vue'
|
||||
import { useToast } from 'wot-design-uni'
|
||||
import { getCategorySimpleList } from '@/api/bpm/category'
|
||||
import { getProcessDefinitionList } from '@/api/bpm/definition'
|
||||
import { navigateBackPlus } from '@/utils';
|
||||
import { navigateBackPlus } from '@/utils'
|
||||
|
||||
definePage({
|
||||
style: {
|
||||
@@ -101,6 +102,8 @@ definePage({
|
||||
},
|
||||
})
|
||||
|
||||
const toast = useToast()
|
||||
|
||||
const searchName = ref('')
|
||||
const activeIndex = ref(0)
|
||||
const scrollIntoView = ref('')
|
||||
@@ -197,10 +200,7 @@ function getIconColor(index: number) {
|
||||
/** 选择流程定义 */
|
||||
function handleSelect(item: ProcessDefinition) {
|
||||
// TODO @芋艿:跳转到流程表单页面
|
||||
uni.showToast({
|
||||
title: `选择了: ${item.name}`,
|
||||
icon: 'none',
|
||||
})
|
||||
toast.show(`选择了: ${item.name}`)
|
||||
}
|
||||
|
||||
/** 加载分类列表 */
|
||||
@@ -211,8 +211,7 @@ async function loadCategoryList() {
|
||||
categoryList.value.forEach((cat) => {
|
||||
expandedCategories.value[cat.code] = true
|
||||
})
|
||||
}
|
||||
catch (error) {
|
||||
} catch (error) {
|
||||
console.error('[create] 加载分类失败:', error)
|
||||
}
|
||||
}
|
||||
@@ -221,8 +220,7 @@ async function loadCategoryList() {
|
||||
async function loadDefinitionList() {
|
||||
try {
|
||||
definitionList.value = await getProcessDefinitionList({ suspensionState: 1 })
|
||||
}
|
||||
catch (error) {
|
||||
} catch (error) {
|
||||
console.error('[create] 加载流程定义失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, reactive, ref } from 'vue'
|
||||
import { useToast } from 'wot-design-uni'
|
||||
import { approveTask, rejectTask } from '@/api/bpm/task'
|
||||
import { navigateBackPlus } from '@/utils'
|
||||
|
||||
@@ -61,6 +62,7 @@ definePage({
|
||||
|
||||
const taskId = computed(() => props.id || '')
|
||||
const isPass = computed(() => props.pass !== 'false') // true: 同意, false: 拒绝
|
||||
const toast = useToast()
|
||||
const submitting = ref(false)
|
||||
const formData = reactive({
|
||||
reason: '',
|
||||
@@ -76,19 +78,13 @@ function handleBack() {
|
||||
|
||||
/** 初始化校验 */
|
||||
if (!props.id) {
|
||||
uni.showToast({
|
||||
title: '参数错误',
|
||||
icon: 'none',
|
||||
})
|
||||
toast.show('参数错误')
|
||||
}
|
||||
|
||||
/** 校验表单 */
|
||||
function validateForm() {
|
||||
if (!formData.reason.trim()) {
|
||||
uni.showToast({
|
||||
title: '请输入审批意见',
|
||||
icon: 'none',
|
||||
})
|
||||
toast.show('请输入审批意见')
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@@ -109,10 +105,7 @@ async function handleSubmit() {
|
||||
reason: formData.reason,
|
||||
})
|
||||
if (result) {
|
||||
uni.showToast({
|
||||
title: '审批成功',
|
||||
icon: 'success',
|
||||
})
|
||||
toast.success('审批成功')
|
||||
setTimeout(() => {
|
||||
handleBack()
|
||||
}, 1500)
|
||||
|
||||
@@ -108,16 +108,17 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
// TODO @芋艿:缺少功能的补全!!!!
|
||||
import type { ProcessInstance } from '@/api/bpm/processInstance'
|
||||
import type { Task } from '@/api/bpm/task'
|
||||
// TODO @芋艿:缺少功能的补全!!!!
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { computed, ref } from 'vue'
|
||||
import { useToast } from 'wot-design-uni'
|
||||
import { getProcessInstance } from '@/api/bpm/processInstance'
|
||||
import { getTaskListByProcessInstanceId } from '@/api/bpm/task'
|
||||
import { useUserStore } from '@/store'
|
||||
import { navigateBackPlus } from '@/utils'
|
||||
import { formatDateTime, formatPast } from '@/utils/date'
|
||||
import { navigateBackPlus } from '@/utils';
|
||||
|
||||
definePage({
|
||||
style: {
|
||||
@@ -127,6 +128,7 @@ definePage({
|
||||
})
|
||||
|
||||
const userStore = useUserStore()
|
||||
const toast = useToast()
|
||||
const processInstanceId = ref('')
|
||||
const processInstance = ref<Partial<ProcessInstance>>({})
|
||||
const tasks = ref<Task[]>([])
|
||||
@@ -258,8 +260,7 @@ function handleReject() {
|
||||
async function loadProcessInstance() {
|
||||
try {
|
||||
processInstance.value = await getProcessInstance(processInstanceId.value)
|
||||
}
|
||||
catch (error) {
|
||||
} catch (error) {
|
||||
console.error('[detail] 加载流程实例失败:', error)
|
||||
}
|
||||
}
|
||||
@@ -268,8 +269,7 @@ async function loadProcessInstance() {
|
||||
async function loadTasks() {
|
||||
try {
|
||||
tasks.value = await getTaskListByProcessInstanceId(processInstanceId.value)
|
||||
}
|
||||
catch (error) {
|
||||
} catch (error) {
|
||||
console.error('[detail] 加载任务列表失败:', error)
|
||||
}
|
||||
}
|
||||
@@ -277,7 +277,7 @@ async function loadTasks() {
|
||||
/** 初始化 */
|
||||
onLoad(async (options) => {
|
||||
if (!options?.id) {
|
||||
uni.showToast({ title: '参数错误', icon: 'none' })
|
||||
toast.show('参数错误')
|
||||
return
|
||||
}
|
||||
processInstanceId.value = options.id
|
||||
|
||||
@@ -54,12 +54,12 @@
|
||||
<script lang="ts" setup>
|
||||
import type { ApiAccessLog } from '@/api/infra/apiAccessLog'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { useToast } from 'wot-design-uni'
|
||||
import { getApiAccessLog } from '@/api/infra/apiAccessLog'
|
||||
import { getDictLabel } from '@/hooks/useDict'
|
||||
import { navigateBackPlus } from '@/utils'
|
||||
import { DICT_TYPE } from '@/utils/constants'
|
||||
import { formatDateTime } from '@/utils/date'
|
||||
import { useToast } from 'wot-design-uni'
|
||||
import { navigateBackPlus } from '@/utils'
|
||||
|
||||
const props = defineProps<{
|
||||
id: number | any
|
||||
@@ -88,10 +88,7 @@ function handleCopyText(text?: string, title?: string) {
|
||||
uni.setClipboardData({
|
||||
data: text,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: `${title || '内容'}已复制`,
|
||||
icon: 'success',
|
||||
})
|
||||
toast.success(`${title || '内容'}已复制`)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -65,9 +65,9 @@ import { onMounted, ref } from 'vue'
|
||||
import { useToast } from 'wot-design-uni'
|
||||
import { getApiErrorLog, updateApiErrorLogStatus } from '@/api/infra/apiErrorLog'
|
||||
import { getDictLabel } from '@/hooks/useDict'
|
||||
import { navigateBackPlus } from '@/utils'
|
||||
import { DICT_TYPE, InfraApiErrorLogProcessStatusEnum } from '@/utils/constants'
|
||||
import { formatDateTime } from '@/utils/date'
|
||||
import { navigateBackPlus } from '@/utils'
|
||||
|
||||
const props = defineProps<{
|
||||
id: number | any
|
||||
@@ -97,10 +97,7 @@ function handleCopyText(text?: string, title?: string) {
|
||||
uni.setClipboardData({
|
||||
data: text,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: `${title || '内容'}已复制`,
|
||||
icon: 'success',
|
||||
})
|
||||
toast.success(`${title || '内容'}已复制`)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -166,6 +166,7 @@
|
||||
<script lang="ts" setup>
|
||||
import type { User } from '@/api/system/user'
|
||||
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||
import { useToast } from 'wot-design-uni'
|
||||
import { getSimpleUserList } from '@/api/system/user'
|
||||
import { useTokenStore } from '@/store/token'
|
||||
import { getEnvBaseUrlRoot, navigateBackPlus } from '@/utils'
|
||||
@@ -180,6 +181,7 @@ definePage({
|
||||
|
||||
// ======================= 状态定义 =======================
|
||||
const tokenStore = useTokenStore()
|
||||
const toast = useToast()
|
||||
|
||||
// WebSocket 相关状态
|
||||
const socketTask = ref<UniApp.SocketTask | null>(null)
|
||||
@@ -243,14 +245,14 @@ function connect() {
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('WebSocket 连接失败:', err)
|
||||
uni.showToast({ title: '连接失败', icon: 'error' })
|
||||
toast.error('连接失败')
|
||||
},
|
||||
})
|
||||
// 1.2 监听连接打开
|
||||
socketTask.value.onOpen(() => {
|
||||
console.log('WebSocket 连接已打开')
|
||||
isConnected.value = true
|
||||
uni.showToast({ title: '连接成功', icon: 'success' })
|
||||
toast.success('连接成功')
|
||||
// 开始心跳
|
||||
startHeartbeat()
|
||||
})
|
||||
@@ -273,7 +275,7 @@ function connect() {
|
||||
isConnected.value = false
|
||||
socketTask.value = null
|
||||
stopHeartbeat()
|
||||
uni.showToast({ title: '连接异常', icon: 'error' })
|
||||
toast.error('连接异常')
|
||||
})
|
||||
}
|
||||
|
||||
@@ -285,7 +287,7 @@ function disconnect() {
|
||||
socketTask.value.close({
|
||||
success: () => {
|
||||
console.log('WebSocket 连接已主动关闭')
|
||||
uni.showToast({ title: '已断开', icon: 'success' })
|
||||
toast.success('已断开')
|
||||
},
|
||||
})
|
||||
socketTask.value = null
|
||||
@@ -383,11 +385,11 @@ function handleMessage(data: string) {
|
||||
/** 发送消息 */
|
||||
function handleSend() {
|
||||
if (!sendText.value.trim()) {
|
||||
uni.showToast({ title: '请输入消息内容', icon: 'none' })
|
||||
toast.show('请输入消息内容')
|
||||
return
|
||||
}
|
||||
if (!socketTask.value || !isConnected.value) {
|
||||
uni.showToast({ title: '请先建立连接', icon: 'none' })
|
||||
toast.show('请先建立连接')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -406,12 +408,12 @@ function handleSend() {
|
||||
socketTask.value.send({
|
||||
data: jsonMessage,
|
||||
success: () => {
|
||||
uni.showToast({ title: '发送成功', icon: 'success' })
|
||||
toast.success('发送成功')
|
||||
sendText.value = ''
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('消息发送失败:', err)
|
||||
uni.showToast({ title: '发送失败', icon: 'error' })
|
||||
toast.error('发送失败')
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -468,8 +470,7 @@ onMounted(async () => {
|
||||
// 获取用户列表
|
||||
try {
|
||||
userList.value = await getSimpleUserList()
|
||||
}
|
||||
catch (error) {
|
||||
} catch (error) {
|
||||
console.error('获取用户列表失败:', error)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
import type { Dept } from '@/api/system/dept'
|
||||
import type { User } from '@/api/system/user'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { useToast } from 'wot-design-uni'
|
||||
import { getSimpleDeptList } from '@/api/system/dept'
|
||||
import { getSimpleUserList, getUser } from '@/api/system/user'
|
||||
import { findChildren, handleTree } from '@/utils/tree'
|
||||
@@ -94,6 +95,7 @@ definePage({
|
||||
const loading = ref(false)
|
||||
const deptList = ref<Dept[]>([]) // 完整部门列表(树形结构)
|
||||
const userList = ref<User[]>([]) // 用户列表
|
||||
const toast = useToast()
|
||||
|
||||
const currentDeptId = ref(0) // 当前层级的部门编号
|
||||
const breadcrumbRef = ref<InstanceType<typeof Breadcrumb>>()
|
||||
@@ -131,7 +133,7 @@ async function handleUserClick(item: User) {
|
||||
actions.push(`邮箱:${userInfo.email}`)
|
||||
}
|
||||
if (actions.length === 0) {
|
||||
uni.showToast({ title: '暂无联系方式', icon: 'none' })
|
||||
toast.show('暂无联系方式')
|
||||
return
|
||||
}
|
||||
uni.showActionSheet({
|
||||
@@ -143,7 +145,7 @@ async function handleUserClick(item: User) {
|
||||
uni.makePhoneCall({ phoneNumber: userInfo.mobile! })
|
||||
} else if (selected.startsWith('邮箱')) {
|
||||
uni.setClipboardData({ data: userInfo.email!, success: () => {
|
||||
uni.showToast({ title: '邮箱已复制', icon: 'success' })
|
||||
toast.success('邮箱已复制')
|
||||
} })
|
||||
}
|
||||
},
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { MenuItem } from '../index'
|
||||
import { useToast } from 'wot-design-uni'
|
||||
import { isTabBarPage } from '@/tabbar/config'
|
||||
import { parseUrl, setTabParams } from '@/utils/url'
|
||||
|
||||
@@ -33,11 +34,13 @@ defineProps<{
|
||||
menus: MenuItem[] // 菜单列表
|
||||
}>()
|
||||
|
||||
const toast = useToast()
|
||||
|
||||
/** 处理菜单点击 */
|
||||
function handleClick(menu: MenuItem) {
|
||||
console.log( '点击菜单:', menu )
|
||||
if (!menu.url) {
|
||||
uni.showToast({ title: '功能开发中', icon: 'none' })
|
||||
toast.show('功能开发中')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,7 +56,7 @@ function handleClick(menu: MenuItem) {
|
||||
uni.switchTab({
|
||||
url: path,
|
||||
fail: () => {
|
||||
uni.showToast({ title: '页面不存在', icon: 'none' })
|
||||
toast.show('页面不存在')
|
||||
},
|
||||
})
|
||||
} else {
|
||||
@@ -61,7 +64,7 @@ function handleClick(menu: MenuItem) {
|
||||
uni.navigateTo({
|
||||
url: menu.url,
|
||||
fail: () => {
|
||||
uni.showToast({ title: '页面不存在', icon: 'none' })
|
||||
toast.show('页面不存在')
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -76,9 +76,10 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { MenuGroup, MenuItem } from '../index'
|
||||
import { useToast } from 'wot-design-uni'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import { navigateBackPlus } from '@/utils'
|
||||
import { getMenuGroups, getMenuItemByKey } from '../index'
|
||||
import { navigateBackPlus } from '@/utils';
|
||||
|
||||
defineOptions({
|
||||
name: 'FavoriteSettings',
|
||||
@@ -91,6 +92,7 @@ definePage({
|
||||
})
|
||||
|
||||
const userStore = useUserStore()
|
||||
const toast = useToast()
|
||||
|
||||
const searchKeyword = ref('') // 搜索关键词
|
||||
const menuGroups = ref<MenuGroup[]>([]) // 菜单分组列表
|
||||
@@ -133,7 +135,7 @@ function handleAddFavorite(menu: MenuItem) {
|
||||
keys.push(menu.key)
|
||||
userStore.setFavoriteMenus(keys)
|
||||
}
|
||||
uni.showToast({ title: '已添加', icon: 'success' })
|
||||
toast.success('已添加')
|
||||
}
|
||||
|
||||
/** 处理移除常用服务 */
|
||||
@@ -144,7 +146,7 @@ function handleRemoveFavorite(menu: MenuItem) {
|
||||
keys.splice(index, 1)
|
||||
userStore.setFavoriteMenus(keys)
|
||||
}
|
||||
uni.showToast({ title: '已移除', icon: 'success' })
|
||||
toast.success('已移除')
|
||||
}
|
||||
|
||||
/** 检查菜单是否已添加到常用服务 */
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue'
|
||||
import { useToast } from 'wot-design-uni'
|
||||
import { navigateBackPlus } from '@/utils'
|
||||
import { saveImageToAlbum } from '@/utils/download'
|
||||
|
||||
@@ -63,6 +64,8 @@ definePage({
|
||||
},
|
||||
})
|
||||
|
||||
const toast = useToast()
|
||||
|
||||
const qrCodeUrl = ref('/static/images/qrcode.png') // 客服二维码图片地址
|
||||
const servicePhone = ref('18818818818') // 客服电话号码
|
||||
|
||||
@@ -76,10 +79,7 @@ function handleCallPhone() {
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: servicePhone.value,
|
||||
fail: (err) => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '拨打失败',
|
||||
})
|
||||
toast.show('拨打失败')
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
import type { UserProfileVO } from '@/api/system/user/profile'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { useToast } from 'wot-design-uni'
|
||||
import { getUserProfile } from '@/api/system/user/profile'
|
||||
import { LOGIN_PAGE } from '@/router/config'
|
||||
import { useUserStore } from '@/store'
|
||||
@@ -89,6 +90,7 @@ definePage({
|
||||
|
||||
const userStore = useUserStore()
|
||||
const tokenStore = useTokenStore()
|
||||
const toast = useToast()
|
||||
const { userInfo } = storeToRefs(userStore)
|
||||
const userProfile = ref<UserProfileVO | null>(null) // 用户详细信息
|
||||
|
||||
@@ -138,10 +140,7 @@ function handleLogout() {
|
||||
return
|
||||
}
|
||||
await tokenStore.logout()
|
||||
uni.showToast({
|
||||
title: '退出登录成功',
|
||||
icon: 'success',
|
||||
})
|
||||
toast.success('退出登录成功')
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({ url: LOGIN_PAGE })
|
||||
}, 500)
|
||||
|
||||
Reference in New Issue
Block a user