Commit 52f7f6b2 by pangchong

feat: 调整

parent 0561260c
import { createSSRApp } from 'vue' import { createSSRApp } from 'vue'
import App from './App.vue' import App from './App.vue'
import pinia from './store' import pinia from './store'
import message from '@/utils/message' import * as message from '@/utils/message'
import * as tool from '@/utils/tool'
// 引入字体 // 引入字体
import '@/static/font/iconfont.css' import '@/static/font/iconfont.css'
//消息提示 //消息提示
uni.$message = message uni.$message = message
//工具方法
uni.$tool = tool
export function createApp() { export function createApp() {
const app = createSSRApp(App) const app = createSSRApp(App)
app.use(pinia) app.use(pinia)
......
<template> <template>
<global-page :showNavbar="false"> <global-page :showNavbar="false">
<template #top> <template #top>
<global-navbar :title="details.appraisee !== '-1' ? details.appraisee : ''"> <global-navbar :title="showData(details.appraisee)">
<template #left> <template #left>
<uni-icons type="left" size="16" @tap="goBack"></uni-icons> <uni-icons type="left" size="16" @tap="goBack"></uni-icons>
</template> </template>
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import CardDetails from './components/card-details.vue' import CardDetails from './components/card-details.vue'
import { ref } from 'vue' import { ref } from 'vue'
import { showData } from '@/utils/tool'
const details = ref({ const details = ref({
id: '1771004152946348034', id: '1771004152946348034',
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<view class="item-title"> <view class="item-title">
<view class="desc"> <view class="desc">
<view class="type">{{ item.status == 1 ? 'OPEN' : 'ClOSE' }}</view> <view class="type">{{ item.status == 1 ? 'OPEN' : 'ClOSE' }}</view>
<view class="txt">{{ item.appraisee !== '-1' ? item.appraisee : '' }}</view> <view class="txt">{{ showData(item.appraisee) }}</view>
<view class="place">{{ item.department !== '-1' ? item.department : '' }}</view> <view class="place">{{ showData(item.department) }}</view>
</view> </view>
<score-details v-if="item.score > 0" :type="item.eventType == 1 ? 'success' : 'warning'">{{ item.score }}</score-details> <score-details v-if="item.score > 0" :type="item.eventType == 1 ? 'success' : 'warning'">{{ item.score }}</score-details>
</view> </view>
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
import { ref } from 'vue' import { ref } from 'vue'
import { getRqmListApi, getRqmOptionsApi } from '@/api/appraisal-record' import { getRqmListApi, getRqmOptionsApi } from '@/api/appraisal-record'
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { showData } from '@/utils/tool'
const tabList = ref([ const tabList = ref([
{ name: 'OPEN', value: 1 }, { name: 'OPEN', value: 1 },
......
// utils/message.js // utils/message.js
export default { export const showToast = (msg, options) => {
showToast(msg, options) { uni.showToast({
uni.showToast({ title: msg || '操作失败',
title: msg || '操作失败', icon: 'none',
icon: 'none', duration: 2000,
duration: 2000, ...options
...options });
});
}
} }
\ No newline at end of file
// utils/tool.js
export const showData = (data) => {
if (typeof data === 'undefined' || data === null) {
return ''
}
if (typeof data === 'string' && data.trim() === '') {
return ''
}
if (data.trim() === '-1' || data.trim() === -1) {
return ''
}
if (Array.isArray(data) && data.length === 0) {
return ''
}
if (typeof data === 'object' && Object.keys(data).length === 0) {
return ''
}
return data
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment