工作台和我的页面样式优化
This commit is contained in:
parent
8f202e50a1
commit
413a2dfca5
|
|
@ -96,8 +96,8 @@ const goToAddTask = () => {
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.workbench-scroll {
|
.workbench-scroll {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100vh;
|
//height: 100vh;
|
||||||
background: #f5f5f5;
|
//background: #f5f5f5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.workbench-card {
|
.workbench-card {
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@
|
||||||
<view class="profile-card" @click="goToProfile">
|
<view class="profile-card" @click="goToProfile">
|
||||||
<view class="profile-header">
|
<view class="profile-header">
|
||||||
<view class="avatar-wrapper">
|
<view class="avatar-wrapper">
|
||||||
<image
|
<image
|
||||||
v-if="userInfo?.user?.avatar"
|
v-if="userInfo?.user?.avatar"
|
||||||
class="avatar-img"
|
:src="userInfo.user.avatar"
|
||||||
:src="userInfo.user.avatar"
|
class="avatar-img"
|
||||||
mode="aspectFill"
|
mode="aspectFill"
|
||||||
/>
|
/>
|
||||||
<view v-else class="avatar-placeholder">
|
<view v-else class="avatar-placeholder">
|
||||||
<text class="avatar-text">{{ getAvatarText(userInfo?.user?.nickName) }}</text>
|
<text class="avatar-text">{{ getAvatarText(userInfo?.user?.nickName) }}</text>
|
||||||
|
|
@ -17,37 +17,37 @@
|
||||||
<view class="profile-info">
|
<view class="profile-info">
|
||||||
<view class="name-row">
|
<view class="name-row">
|
||||||
<text class="user-name">{{ userInfo?.user?.nickName || '--' }}</text>
|
<text class="user-name">{{ userInfo?.user?.nickName || '--' }}</text>
|
||||||
<!-- <text v-if="userInfo?.roles?.[0]" class="role-badge">{{ userInfo.roles[0] }}</text>-->
|
<!-- <text v-if="userInfo?.roles?.[0]" class="role-badge">{{ userInfo.roles[0] }}</text>-->
|
||||||
</view>
|
</view>
|
||||||
<text class="dept-name">{{ userInfo?.user?.deptName || '--' }}</text>
|
<text class="dept-name">{{ userInfo?.user?.deptName || '--' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="arrow-icon">›</view>
|
<view class="arrow-icon">›</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="profile-stats">-->
|
<!-- <view class="profile-stats">-->
|
||||||
<!-- <view class="stat-item">-->
|
<!-- <view class="stat-item">-->
|
||||||
<!-- <text class="stat-value">{{ userInfo?.user?.taskCount || 0 }}</text>-->
|
<!-- <text class="stat-value">{{ userInfo?.user?.taskCount || 0 }}</text>-->
|
||||||
<!-- <text class="stat-label">任务数</text>-->
|
<!-- <text class="stat-label">任务数</text>-->
|
||||||
<!-- </view>-->
|
<!-- </view>-->
|
||||||
<!-- <view class="stat-divider"></view>-->
|
<!-- <view class="stat-divider"></view>-->
|
||||||
<!-- <view class="stat-item">-->
|
<!-- <view class="stat-item">-->
|
||||||
<!-- <text class="stat-value">{{ userInfo?.user?.projectCount || 0 }}</text>-->
|
<!-- <text class="stat-value">{{ userInfo?.user?.projectCount || 0 }}</text>-->
|
||||||
<!-- <text class="stat-label">项目数</text>-->
|
<!-- <text class="stat-label">项目数</text>-->
|
||||||
<!-- </view>-->
|
<!-- </view>-->
|
||||||
<!-- <view class="stat-divider"></view>-->
|
<!-- <view class="stat-divider"></view>-->
|
||||||
<!-- <view class="stat-item">-->
|
<!-- <view class="stat-item">-->
|
||||||
<!-- <text class="stat-value">{{ userInfo?.user?.taskNum || 0 }}</text>-->
|
<!-- <text class="stat-value">{{ userInfo?.user?.taskNum || 0 }}</text>-->
|
||||||
<!-- <text class="stat-label">任务编号</text>-->
|
<!-- <text class="stat-label">任务编号</text>-->
|
||||||
<!-- </view>-->
|
<!-- </view>-->
|
||||||
<!-- </view>-->
|
<!-- </view>-->
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view
|
<view
|
||||||
class="card settings-card"
|
v-if="showPrivateSwitch"
|
||||||
v-if="showPrivateSwitch"
|
class="card settings-card"
|
||||||
>
|
>
|
||||||
<view class="setting-row">
|
<view class="setting-row">
|
||||||
<text class="setting-label">私有视角</text>
|
<text class="setting-label">私有视角</text>
|
||||||
<uv-switch v-model="filterSelf" />
|
<uv-switch v-model="filterSelf"/>
|
||||||
</view>
|
</view>
|
||||||
<text class="setting-desc">开启后仅展示分配给我的客户和任务数据</text>
|
<text class="setting-desc">开启后仅展示分配给我的客户和任务数据</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -57,43 +57,43 @@
|
||||||
<view class="version-header">
|
<view class="version-header">
|
||||||
<text class="version-title">版本管理</text>
|
<text class="version-title">版本管理</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="version-info">
|
<view class="version-info">
|
||||||
<view class="version-item">
|
<view class="version-item">
|
||||||
<text class="version-label">当前版本</text>
|
<text class="version-label">当前版本</text>
|
||||||
<text class="version-value">{{ currentVersion }}</text>
|
<text class="version-value">{{ currentVersion }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="version-item" v-if="latestVersion">
|
<view v-if="latestVersion" class="version-item">
|
||||||
<text class="version-label">最新版本</text>
|
<text class="version-label">最新版本</text>
|
||||||
<text class="version-value" :class="{ 'new-version': hasUpdate }">
|
<text :class="{ 'new-version': hasUpdate }" class="version-value">
|
||||||
{{ latestVersion }}
|
{{ latestVersion }}
|
||||||
<text v-if="hasUpdate" class="update-badge">有新版本</text>
|
<text v-if="hasUpdate" class="update-badge">有新版本</text>
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="version-item" v-else>
|
<view v-else class="version-item">
|
||||||
<text class="version-label">最新版本</text>
|
<text class="version-label">最新版本</text>
|
||||||
<text class="version-value">未检查</text>
|
<text class="version-value">未检查</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="version-actions">
|
<view class="version-actions">
|
||||||
<uv-button
|
<uv-button
|
||||||
type="primary"
|
:loading="checking"
|
||||||
:plain="true"
|
:plain="true"
|
||||||
size="small"
|
size="small"
|
||||||
@click="checkUpdate"
|
type="primary"
|
||||||
:loading="checking"
|
@click="checkUpdate"
|
||||||
>
|
>
|
||||||
{{ checking ? '检查中...' : '检查更新' }}
|
{{ checking ? '检查中...' : '检查更新' }}
|
||||||
</uv-button>
|
</uv-button>
|
||||||
|
|
||||||
<uv-button
|
<uv-button
|
||||||
v-if="hasUpdate && updateInfo"
|
v-if="hasUpdate && updateInfo"
|
||||||
type="error"
|
size="small"
|
||||||
size="small"
|
style="margin-left: 20rpx;"
|
||||||
@click="handleUpdate"
|
type="error"
|
||||||
style="margin-left: 20rpx;"
|
@click="handleUpdate"
|
||||||
>
|
>
|
||||||
立即更新
|
立即更新
|
||||||
</uv-button>
|
</uv-button>
|
||||||
|
|
@ -102,7 +102,7 @@
|
||||||
|
|
||||||
<view class="card">
|
<view class="card">
|
||||||
|
|
||||||
<uv-button type="error" :plain="true" @click="onLogout" :loading="loading">
|
<uv-button :loading="loading" :plain="true" type="error" @click="onLogout">
|
||||||
退出登录
|
退出登录
|
||||||
</uv-button>
|
</uv-button>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -110,11 +110,11 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted } from 'vue'
|
import {computed, onMounted, ref} from 'vue'
|
||||||
import { storeToRefs } from 'pinia'
|
import {storeToRefs} from 'pinia'
|
||||||
import { useUserStore } from '@/store/user'
|
import {useUserStore} from '@/store/user'
|
||||||
import { logout } from '@/api/user'
|
import {logout} from '@/api/user'
|
||||||
import { getCurrentVersion, checkForUpdate, showUpdateDialog } from '@/utils/update'
|
import {checkForUpdate, getCurrentVersion, showUpdateDialog} from '@/utils/update'
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const checking = ref(false)
|
const checking = ref(false)
|
||||||
|
|
@ -124,13 +124,13 @@ const updateInfo = ref(null)
|
||||||
const hasUpdate = ref(false) // 直接使用 API 返回的 hasUpdate 值
|
const hasUpdate = ref(false) // 直接使用 API 返回的 hasUpdate 值
|
||||||
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const { privateView, userInfo } = storeToRefs(userStore)
|
const {privateView, userInfo} = storeToRefs(userStore)
|
||||||
const filterSelf = computed({
|
const filterSelf = computed({
|
||||||
get: () => privateView.value,
|
get: () => privateView.value,
|
||||||
set: (val) => userStore.setPrivateView(val)
|
set: (val) => userStore.setPrivateView(val)
|
||||||
})
|
})
|
||||||
const showPrivateSwitch = computed(() =>
|
const showPrivateSwitch = computed(() =>
|
||||||
userInfo.value?.roles?.some(r => ['admin', 'sys_admin'].includes(r))
|
userInfo.value?.roles?.some(r => ['admin', 'sys_admin'].includes(r))
|
||||||
)
|
)
|
||||||
|
|
||||||
// 获取当前版本
|
// 获取当前版本
|
||||||
|
|
@ -143,18 +143,18 @@ onMounted(() => {
|
||||||
const checkUpdate = async () => {
|
const checkUpdate = async () => {
|
||||||
if (checking.value) return
|
if (checking.value) return
|
||||||
checking.value = true
|
checking.value = true
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await checkForUpdate(true) // 静默检查,不显示提示
|
const result = await checkForUpdate(true) // 静默检查,不显示提示
|
||||||
|
|
||||||
console.log('检查更新结果:', result)
|
console.log('检查更新结果:', result)
|
||||||
|
|
||||||
if (result && result.hasUpdate) {
|
if (result && result.hasUpdate) {
|
||||||
// 确保版本号有值,即使 API 返回为空也显示一个默认值
|
// 确保版本号有值,即使 API 返回为空也显示一个默认值
|
||||||
latestVersion.value = result.versionName || result.versionNumber || result.version || '未知版本'
|
latestVersion.value = result.versionName || result.versionNumber || result.version || '未知版本'
|
||||||
updateInfo.value = result
|
updateInfo.value = result
|
||||||
hasUpdate.value = true // 设置更新标志
|
hasUpdate.value = true // 设置更新标志
|
||||||
|
|
||||||
// 检查下载地址是否存在(兼容 packageUrl、downloadUrl、download_url)
|
// 检查下载地址是否存在(兼容 packageUrl、downloadUrl、download_url)
|
||||||
if (!result.downloadUrl && !result.packageUrl && !result.download_url) {
|
if (!result.downloadUrl && !result.packageUrl && !result.download_url) {
|
||||||
console.warn('更新信息缺少下载地址:', result)
|
console.warn('更新信息缺少下载地址:', result)
|
||||||
|
|
@ -202,10 +202,10 @@ const handleUpdate = () => {
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 兼容不同的字段名(packageUrl、downloadUrl 或 download_url)
|
// 兼容不同的字段名(packageUrl、downloadUrl 或 download_url)
|
||||||
const downloadUrl = updateInfo.value.downloadUrl || updateInfo.value.packageUrl || updateInfo.value.download_url
|
const downloadUrl = updateInfo.value.downloadUrl || updateInfo.value.packageUrl || updateInfo.value.download_url
|
||||||
|
|
||||||
if (!downloadUrl) {
|
if (!downloadUrl) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '下载地址无效',
|
title: '下载地址无效',
|
||||||
|
|
@ -213,13 +213,13 @@ const handleUpdate = () => {
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保 updateInfo 有 downloadUrl 字段
|
// 确保 updateInfo 有 downloadUrl 字段
|
||||||
const updateData = {
|
const updateData = {
|
||||||
...updateInfo.value,
|
...updateInfo.value,
|
||||||
downloadUrl: downloadUrl
|
downloadUrl: downloadUrl
|
||||||
}
|
}
|
||||||
|
|
||||||
// 显示更新确认对话框,用户确认后会自动下载和安装
|
// 显示更新确认对话框,用户确认后会自动下载和安装
|
||||||
showUpdateDialog(updateData)
|
showUpdateDialog(updateData)
|
||||||
}
|
}
|
||||||
|
|
@ -248,7 +248,7 @@ const onLogout = async () => {
|
||||||
userStore.logout()
|
userStore.logout()
|
||||||
uni.$uv.toast('已退出登录')
|
uni.$uv.toast('已退出登录')
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.reLaunch({ url: '/pages/login/index' })
|
uni.reLaunch({url: '/pages/login/index'})
|
||||||
}, 200)
|
}, 200)
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -258,8 +258,8 @@ const onLogout = async () => {
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.mine-page {
|
.mine-page {
|
||||||
padding: 24rpx;
|
padding: 24rpx;
|
||||||
background-color: #f6f7fb;
|
//background-color: #f6f7fb;
|
||||||
min-height: 100vh;
|
//min-height: 100vh;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user