Skip to content

Commit

Permalink
feat:优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
gzydong committed Dec 13, 2023
1 parent d29d4b5 commit baaa520
Show file tree
Hide file tree
Showing 18 changed files with 46 additions and 79 deletions.
2 changes: 1 addition & 1 deletion src/layout/MainLayout.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup>
<script lang="ts" setup>
import Menu from './component/Menu.vue'
import Sponsor from './component/Sponsor.vue'
import { useSettingsStore } from '@/store'
Expand Down
25 changes: 14 additions & 11 deletions src/layout/SubViewLayout.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
<script setup>
<script lang="ts" setup>
import { markRaw } from 'vue'
defineProps({
title: {
type: String,
default: '未定义标题'
},
menus: {
type: Array,
default: () => []
}
})
interface Menu {
name: string
path: string
icon: any
show?: boolean
size?: string
tips?: string
}
defineProps<{
title: string
menus: Menu[]
}>()
</script>

<template>
Expand Down
2 changes: 1 addition & 1 deletion src/layout/component/AccountCard.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup>
<script lang="ts" setup>
import { useUserStore } from '@/store'
import { Male, Female } from '@icon-park/vue-next'
const store = useUserStore()
Expand Down
6 changes: 3 additions & 3 deletions src/layout/component/Menu.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup>
<script lang="ts" setup>
import { reactive, computed, markRaw } from 'vue'
import { useRouter } from 'vue-router'
import { useUserStore, useSettingsStore, useTalkStore } from '@/store'
Expand All @@ -9,8 +9,8 @@ import {
SettingTwo,
Message,
NotebookAndPen,
People,
SmartOptimization
People
// SmartOptimization
} from '@icon-park/vue-next'
defineProps({
Expand Down
4 changes: 2 additions & 2 deletions src/layout/component/Sponsor.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script setup>
<script lang="ts" setup>
import { ref } from 'vue'
import { Close } from '@icon-park/vue-next'
import { storage } from '@/utils/storage'
let isShow = ref(false)
let num = storage.get('reward', 0)
let num = storage.get('reward', '0')
setTimeout(
() => {
Expand Down
9 changes: 1 addition & 8 deletions src/views/contact/apply.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup>
<script lang="ts" setup>
import { ref } from 'vue'
import { NTabs, NTab } from 'naive-ui'
import { Search } from '@icon-park/vue-next'
import FriendApply from './inner/FriendApply.vue'
import GroupApply from './inner/GroupApply.vue'
Expand All @@ -20,12 +19,6 @@ const components = {
<n-tab name="friend"> 好友申请 </n-tab>
<n-tab name="group"> 入群申请 </n-tab>
</n-tabs>

<!-- <n-input placeholder="搜索" clearable style="max-width: 200px" round>
<template #prefix>
<n-icon :component="Search" />
</template>
</n-input> -->
</header>

<main class="el-main me-scrollbar me-scrollbar-thumb">
Expand Down
13 changes: 2 additions & 11 deletions src/views/contact/layout.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
<script setup>
<script lang="ts" setup>
import { reactive, computed, markRaw } from 'vue'
import SubViewLayout from '@/layout/SubViewLayout.vue'
import { useUserStore } from '@/store'
import {
PeoplesTwo,
ChartGraph,
ShareThree,
PersonalCollection,
Peoples,
People,
AddUser,
Permissions
} from '@icon-park/vue-next'
import { PeoplesTwo, ChartGraph, Peoples, People, Permissions } from '@icon-park/vue-next'
const userStore = useUserStore()
Expand Down
6 changes: 3 additions & 3 deletions src/views/contact/open-group.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ const apply = reactive({
const search = reactive({
page: 1,
next: false,
name: '',
next: false,
loading: false
})
const items = ref([])
const items = ref<any[]>([])
const onLoadData = () => {
if (search.loading) return
Expand Down Expand Up @@ -53,7 +53,7 @@ const onLoadMore = () => {
onLoadData()
}
const onSearchInput = debounce((value) => {
const onSearchInput = debounce((value: string) => {
search.page = 1
search.name = value
Expand Down
2 changes: 1 addition & 1 deletion src/views/contact/organize.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { NTree, NEmpty } from 'naive-ui'
import { useRouter } from 'vue-router'
import { useUserStore, useTalkStore } from '@/store'
import { ServeDepartmentList, ServePersonnelList } from '@/api/organize'
import { Search, TreeList, AllApplication } from '@icon-park/vue-next'
import { Search, AllApplication } from '@icon-park/vue-next'
import MemberCard from './inner/MemberCard.vue'
const router = useRouter()
Expand Down
5 changes: 2 additions & 3 deletions src/views/message/inner/IndexContent.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { reactive, computed, inject } from 'vue'
<script lang="ts" setup>
import { reactive, computed } from 'vue'
import { NDrawer } from 'naive-ui'
import { useUserStore, useDialogueStore, useUploadsStore } from '@/store'
import PanelHeader from './panel/PanelHeader.vue'
Expand All @@ -9,7 +9,6 @@ import GroupPanel from '@/components/group/GroupPanel.vue'
import GroupNotice from '@/components/group/GroupNotice.vue'
import UploadsModal from '@/components/base/UploadsModal.vue'
const user = inject('$user')
const userStore = useUserStore()
const dialogueStore = useDialogueStore()
const uploadsStore = useUploadsStore()
Expand Down
2 changes: 1 addition & 1 deletion src/views/message/inner/Skeleton.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup>
<script lang="ts" setup>
import { NSkeleton } from 'naive-ui'
</script>

Expand Down
16 changes: 8 additions & 8 deletions src/views/message/inner/panel/MultiSelectFooter.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup>
<script lang="ts" setup>
import { ref } from 'vue'
import { useDialogueStore } from '@/store'
import { Share, ShareThree, Delete, Close } from '@icon-park/vue-next'
Expand All @@ -9,7 +9,7 @@ const dialogueStore = useDialogueStore()
const isShowContactModal = ref(false)
const forwardMode = ref(0)
const onShowContactModal = (type) => {
const onShowContactModal = (type: number) => {
forwardMode.value = type
isShowContactModal.value = true
}
Expand All @@ -32,19 +32,19 @@ const onSingleForward = () => {
const onMultiDelete = () => {
// 批量删除
let ids = dialogueStore.selectItems.map((item) => item.id)
let ids = dialogueStore.selectItems.map((item: any) => item.id)
if (!ids.length) return
dialogueStore.ApiDeleteRecord(ids)
}
const onContactModal = (data) => {
let ids = dialogueStore.selectItems.map((item) => item.id)
let user_ids = []
let group_ids = []
const onContactModal = (data: { id: number; type: number }[]) => {
let ids = dialogueStore.selectItems.map((item: any) => item.id)
let user_ids: number[] = []
let group_ids: number[] = []
for (const o of data) {
for (let o of data) {
if (o.type == 1) {
user_ids.push(o.id)
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/views/message/inner/panel/PanelHeader.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup>
<script lang="ts" setup>
import { Peoples, Announcement, MenuUnfoldOne, MenuFoldOne } from '@icon-park/vue-next'
import { useDialogueStore } from '@/store'
Expand Down
4 changes: 1 addition & 3 deletions src/views/setting/binding.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup>
import { reactive } from 'vue'
</script>
<script lang="ts" setup></script>

<template>
<section>
Expand Down
2 changes: 1 addition & 1 deletion src/views/setting/detail.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup>
<script lang="ts" setup>
import { reactive, ref } from 'vue'
import { useRouter } from 'vue-router'
import { NForm, NFormItem, NInput, NDatePicker, NRadio, NRadioGroup, NSpace } from 'naive-ui'
Expand Down
2 changes: 1 addition & 1 deletion src/views/setting/layout.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup>
<script lang="ts" setup>
import SubViewLayout from '@/layout/SubViewLayout.vue'
import { Tool, Protect, Remind, LinkThree, User } from '@icon-park/vue-next'
Expand Down
19 changes: 1 addition & 18 deletions src/views/setting/personalize.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup>
<script lang="ts" setup>
import { computed } from 'vue'
import { NSwitch } from 'naive-ui'
// import { Brightness, Moon, DarkMode } from '@icon-park/vue-next'
import { useSettingsStore } from '@/store'
import { isElectronMode } from '@/utils/common'
Expand All @@ -20,22 +19,6 @@ const darkTheme = computed({
settingsStore.setDarkTheme(!val)
}
})
const railStyle = ({ focused, checked }) => {
const style = {}
if (checked) {
style.background = '#d03050'
if (focused) {
style.boxShadow = '0 0 0 2px #d0305040'
}
} else {
style.background = '#2080f0'
if (focused) {
style.boxShadow = '0 0 0 2px #2080f040'
}
}
return style
}
</script>

<template>
Expand Down
4 changes: 2 additions & 2 deletions src/views/setting/security.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ const isShowChangePassword = ref(false)
const isShowChangeMobile = ref(false)
const isShowChangeEmail = ref(false)
const onChangeMobileSuccess = (value) => {
const onChangeMobileSuccess = (value: string) => {
isShowChangeMobile.value = false
userStore.mobile = value
}
const onChangeEmailSuccess = (value) => {
const onChangeEmailSuccess = (value: string) => {
isShowChangeEmail.value = false
userStore.email = value
}
Expand Down

0 comments on commit baaa520

Please sign in to comment.