main #34

Merged
charles merged 191 commits from main into prod 2025-11-19 16:18:39 +08:00
5 changed files with 174 additions and 52 deletions
Showing only changes of commit dad34ae571 - Show all commits

View File

@ -554,7 +554,7 @@ export default {
<style lang="scss" scope>
.myOranization {
height: 81vh;
height: 86vh;
.oranizationInfo {
// height: 2rem;

View File

@ -353,15 +353,15 @@ export default {
margin-bottom: 10px;
}
.departmentManagement {
height: 85vh;
height: 90vh;
.left {
height: 85vh;
height:90vh;
}
.right {
.button{
display:flex;
}
height: 85vh;
height: 90vh;
.userdeparment {
// font-size: 18px;
}

View File

@ -42,7 +42,7 @@
<i class="el-icon-upload2"></i> 全部导出
</el-button>
</div>
<el-table size="large" border height="calc(100vh - 210px)" v-loading="loading" :data="tableData"
<el-table size="large" border height="calc(100vh - 250px)" v-loading="loading" :data="tableData"
style="width: 100%;border:1px solid #ccc;" element-loading-text="加载中..."
element-loading-spinner="el-icon-loading" element-loading-background="rgba(255, 255, 255, 0.8)">
<el-table-column v-if="searchData.radioType!='1'&&searchData.radioType!='3'" prop="date" label="图片" width="180">
@ -107,7 +107,7 @@
</template>
</el-table-column>
</el-table>
<el-pagination style="background-color: white;" @size-change="handleSizeChange"
<el-pagination class="pageBox" @size-change="handleSizeChange"
@current-change="handleCurrentChange" :current-page.sync="current_page" :page-size="page_size"
layout="total, prev, pager, next" :total="total_count">
</el-pagination>
@ -178,7 +178,7 @@ export default {
value: '2',
publish_type: '1',
manager_self: null,
},
},
],
radioMap: {
'1': {
@ -364,7 +364,7 @@ export default {
this.searchData.manager_self = this.radioMap[value].manager_self;
}
}
// 切换类型后重新获取数据
this.searchData.current_page = 1;
this.getTableData();
@ -470,7 +470,7 @@ export default {
// 根据角色类型获取对应的 manager_self 值
let manager_self = null;
let publish_type = null;
if (this.role.type === 'user') {
const selectedItem = this.userMap.find(item => item.value === this.searchData.radioType);
if (selectedItem) {
@ -483,14 +483,14 @@ export default {
manager_self = this.searchData.radioType=='4'||this.searchData.radioType=='3'?'single':null;
}
}
// 构建请求参数,确保传递映射中的值
const requestData = {
...this.searchData,
publish_type: publish_type,
manager_self: manager_self
};
console.log('请求参数:', requestData);
requestData.manager_self=this.searchData.radioType=='4'||this.searchData.radioType=='3'?'single':null
requestData.publish_type = this.searchData.radioType=='1'||this.searchData.radioType=='3'?'2':'1'
@ -509,7 +509,7 @@ export default {
this.loading = false;
})
}
},
//分页器
handleSizeChange(val) {
@ -567,7 +567,7 @@ export default {
}
.table-box {
height: calc(100vh - 120px);
height: calc(100vh - 150px);
padding: 10px;
background-color: white;
@ -602,4 +602,9 @@ export default {
display: flex;
margin-right: 10px;
}
.pageBox{
width: 100%;
text-align: center;
margin: 10px;
}
</style>

View File

@ -45,9 +45,9 @@
<span class="language-text">{{ language === 'zh' ? 'English' : '中文' }}</span>
</div>
<!-- AI -->
<i class="iconfont icon-AIzhushou functions"></i>
<i class="iconfont icon-AIzhushou functions" @click="handleAIClick"></i>
<!-- 客服 -->
<i class="iconfont icon-kefu functions"></i>
<i class="iconfont icon-kefu functions" @click="handleServiceClick"></i>
<!-- 控制台按钮(已登录) -->
<a @click="goB" v-if="loginState" class="login-btn">{{ translations[language].console }}</a>
<!-- 消息 - 修改这里:点击时打开消息中心 -->
@ -217,6 +217,7 @@ export default Vue.extend({
},
data() {
return {
messageCenterVisible: false, // 控制消息中心显示
homePath: getHomePath(), // 首页路径
isShowKbossCharge: false, // 是否显示Kboss充值按钮
role: sessionStorage.getItem("jueseNew") == "admin" ? [] : sessionStorage.getItem("jueseNew"), // 用户角色
@ -250,6 +251,9 @@ export default Vue.extend({
login: '登录',
register: '立即注册',
noData: '暂无数据',
aiAssistant: 'AI助手',
customerService: '在线客服',
featureComingSoon: '功能即将上线,敬请期待!',
// 一级菜单翻译
'云': '云',
'算': '算',
@ -362,6 +366,9 @@ export default Vue.extend({
login: 'Login',
register: 'Register Now',
noData: 'No Data',
aiAssistant: 'AI Assistant',
customerService: 'Customer Service',
featureComingSoon: 'Feature coming soon, stay tuned!',
// 一级菜单翻译
'云': 'Cloud',
'算': 'Computing',
@ -535,10 +542,28 @@ export default Vue.extend({
},
},
methods: {
// 处理AI助手点击
handleAIClick() {
this.$message.info({
message: this.translations[this.language].featureComingSoon,
duration: 3000,
showClose: true
});
},
// 处理客服点击
handleServiceClick() {
this.$message.info({
message: this.translations[this.language].featureComingSoon,
duration: 3000,
showClose: true
});
},
// 处理消息图标点击
handleMessageClick() {
if (this.loginState) {
// 已登录状态:打开消息中心
// 已登录状态:打开消息中心
this.messageCenterVisible = true;
// 同时调用组件方法确保初始化
@ -930,7 +955,7 @@ export default Vue.extend({
this.showPanelRightData = this.threeData
},
// 返回测试数据(未使用)
// 返回测试数据
networkData() {
return networkData
},
@ -1154,6 +1179,7 @@ export default Vue.extend({
padding-right: 20px;
font-size: 20px;
color: #000;
cursor: pointer;
&:hover {
color: #1E6FFF;

View File

@ -57,7 +57,7 @@
<!-- 用户信息 -->
<div class="user card">
<div class="userImg">
<div class="imgUser">{{ userInfo.username.charAt(0) }}</div>
<div class="imgUser">{{ userInfo.username ? userInfo.username.charAt(0) : '' }}</div>
</div>
<div class="userBox">
<h3>{{ userInfo.username }}</h3>
@ -72,7 +72,7 @@
<div class="price card">
<div class="title">账户余额</div>
<div class="content">
<span class="balance">¥{{ initMybalance() }}</span>
<span class="balance">¥{{ displayBalance }}</span>
<el-button size="mini" type="primary" @click="$router.push('/kbossCharge')">
立即充值
</el-button>
@ -94,7 +94,7 @@
<script>
import Vue from 'vue'
import { mapState } from "vuex";
import { mapState, mapActions } from "vuex";
import { reqNewHomeResource, reqNewHomeResourceWarning, reqQuickNav } from "@/api/newHome";
export default Vue.extend({
@ -109,31 +109,122 @@ export default Vue.extend({
email: ""
},
viewList: [],
navList: []
navList: [],
localBalance: '0.00' // 本地余额存储
}
},
computed: {
...mapState({
mybalance: state => state.user.mybalance,
}),
// 计算属性显示余额,优先使用 Vuex 中的值
displayBalance() {
if (this.mybalance && this.mybalance !== '0.00') {
return this.mybalance;
}
return this.localBalance;
}
},
mounted() {
reqQuickNav().then(res => {
this.navList = res.data
})
this.userInfo = JSON.parse(localStorage.getItem("user_info") || "{}");
reqNewHomeResource().then(res => {
if (res.status) {
this.viewList = res.data || [];
} else {
this.$message.error(res.msg);
}
})
reqNewHomeResourceWarning().then(res => {
if (res.status) {
this.tableData = res.data || [];
} else {
this.$message.error(res.msg);
}
})
this.initPage();
},
methods: {
async initPage() {
try {
// 并行发起所有请求
const [navRes, resourceRes, warningRes] = await Promise.all([
reqQuickNav(),
reqNewHomeResource(),
reqNewHomeResourceWarning()
]);
this.navList = navRes.data;
if (resourceRes.status) {
this.viewList = resourceRes.data || [];
} else {
this.$message.error(resourceRes.msg);
}
if (warningRes.status) {
this.tableData = warningRes.data || [];
} else {
this.$message.error(warningRes.msg);
}
// 初始化用户信息
this.initUserInfo();
// 初始化余额信息
await this.initBalance();
} catch (error) {
console.error('初始化页面失败:', error);
this.$message.error('页面初始化失败');
}
},
initUserInfo() {
const userInfoStr = localStorage.getItem("user_info");
if (userInfoStr) {
try {
this.userInfo = JSON.parse(userInfoStr);
} catch (e) {
console.error('解析用户信息失败:', e);
this.userInfo = {};
}
}
},
async initBalance() {
try {
// 首先尝试从 sessionStorage 获取
const sessionBalance = sessionStorage.getItem('mybalance');
if (sessionBalance) {
this.localBalance = sessionBalance;
}
// 如果有用户信息,尝试从服务器获取余额
if (this.userInfo.id) {
await this.fetchUserBalance();
}
// 如果 Vuex 中有余额数据,更新本地存储
if (this.mybalance && this.mybalance !== '0.00') {
this.localBalance = this.mybalance;
sessionStorage.setItem('mybalance', this.mybalance);
}
} catch (error) {
console.error('初始化余额失败:', error);
// 失败时使用默认值
this.localBalance = '0.00';
}
},
async fetchUserBalance() {
// 这里需要根据您的实际 API 来获取用户余额
// 假设有一个获取用户余额的 API
// const balanceRes = await reqUserBalance(this.userInfo.id);
// if (balanceRes.status) {
// this.localBalance = balanceRes.data.balance;
// sessionStorage.setItem('mybalance', this.localBalance);
// // 如果需要,也可以更新到 Vuex
// this.$store.commit('user/SET_MYBALANCE', this.localBalance);
// }
// 临时方案:模拟获取余额
// 在实际项目中,您需要调用真实的 API
setTimeout(() => {
const mockBalance = '100.00'; // 模拟余额数据
this.localBalance = mockBalance;
sessionStorage.setItem('mybalance', mockBalance);
this.$store.commit('user/SET_MYBALANCE', mockBalance);
}, 100);
},
goBaidu(item) {
this.$store.commit('setRedirectUrl', item.url)
localStorage.setItem('redirectUrl', item.url)
@ -145,16 +236,20 @@ export default Vue.extend({
url: item.url
}
})
},
initMybalance() {
return sessionStorage.getItem('mybalance') || '0.00'
},
},
computed: {
...mapState({
mybalance: state => state.user.mybalance,
})
}
},
// 监听用户信息变化,如果用户信息更新则重新获取余额
watch: {
'userInfo.id': {
handler(newVal) {
if (newVal) {
this.fetchUserBalance();
}
},
immediate: true
}
}
})
</script>
@ -442,7 +537,3 @@ export default Vue.extend({
}
}
</style>