1.18整合

This commit is contained in:
2026-01-18 16:06:37 +08:00
parent 10c3fbb0d7
commit a11d3cc2f8
138 changed files with 7241 additions and 856 deletions

View File

@@ -1,6 +1,6 @@
<template>
<view class=" page padding ">
<view class=" padding bg-white radius">
<view class=" padding bg-white radius margin-bottom" v-for="(item,index) in list" :key="item.id">
<view class="flex justify-between align-center">
<view class="flex align-center">
<view class="border-tite"></view>
@@ -9,29 +9,31 @@
</view>
<view class="tag-outline">负责人</view>
</view>
<view class="flex margin-top">
<view class="cu-avatar radius lg" style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big81005.jpg);"></view>
<view class="cu-avatar radius lg"
style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big81005.jpg);">
</view>
<view class="margin-left">
<view class="flex">
<view>罗燚</view>
<view class="margin-left-xs light bg-olive padding-left-xs padding-right-xs">正常</view>
<view>{{item.nickName}}</view>
<view class="margin-left-xs light bg-olive padding-left-xs padding-right-xs">{{item.statusName}}</view>
</view>
<view class="flex text-gray">
<view>手机设置</view>
<view>未设置</view>
<view>{{item.phonenumber}}</view>
</view>
<view class="flex text-gray">
<view>登录IP</view>
<view>45.135.228.172</view>
</view>
</view>
<button class="bg-blue btn-lock" @click="Lock()">锁定</button>
<button class="bg-blue btn-lock" @click="Lock(item)">{{ item.lockStatus === 1 ? '解锁' : '锁定' }}</button>
</view>
</view>
<button class="lg cuIcon-add bg-blue round margin-top-xl" @click="showPopup = true">添加成员</button>
<!-- 添加成员弹出框 -->
<u-popup :show="showPopup" mode="center" round="20" @close="showPopup = false">
<view class="popup-content">
@@ -39,32 +41,32 @@
<view class="popup-title text-bold">添加成员</view>
<view class="popup-close" @click="showPopup = false">×</view>
</view>
<view class="popup-body">
<!-- 用户名 -->
<view class="form-item">
<view class="form-label">用户名<text class="text-red">*</text></view>
<input class="form-input" v-model="formData.username" placeholder="请输入用户名" />
</view>
<!-- 昵称 -->
<view class="form-item">
<view class="form-label">昵称</view>
<input class="form-input" v-model="formData.nickname" placeholder="请输入昵称" />
</view>
<!-- 手机号 -->
<view class="form-item">
<view class="form-label">手机号</view>
<input class="form-input" v-model="formData.phone" placeholder="请输入手机号" type="number" />
</view>
<!-- 密码 -->
<view class="form-item">
<view class="form-label">密码<text class="text-red">*</text></view>
<input class="form-input" v-model="formData.password" placeholder="请输入密码6-16位" password />
</view>
<!-- 主部门 -->
<view class="form-item">
<view class="form-label">主部门<text class="text-red">*</text></view>
@@ -73,76 +75,157 @@
{{ formData.department || '请选择主部门' }}
</text>
</view>
<up-picker :show="showDeptPicker" :columns="deptColumns" @confirm="onDeptConfirm"
@cancel="showDeptPicker = false" @close="showDeptPicker = false"></up-picker>
</view>
</view>
<view class="popup-footer">
<button class="btn-cancel" @click="showPopup = false">取消</button>
<button class="btn-confirm bg-blue" @click="handleSubmit">确定</button>
</view>
</view>
</u-popup>
<TabBar />
</view>
</template>
<script setup>
import { ref, reactive } from 'vue';
const showPopup = ref(false);
const showDeptPicker = ref(false);
const formData = reactive({
username: '',
nickname: '',
phone: '',
password: '',
department: ''
});
const handleSubmit = () => {
// 表单验证
if (!formData.username) {
uni.showToast({ title: '请输入用户名', icon: 'none' });
return;
}
if (!formData.password || formData.password.length < 6 || formData.password.length > 16) {
uni.showToast({ title: '请输入6-16位密码', icon: 'none' });
return;
}
if (!formData.department) {
uni.showToast({ title: '请选择主部门', icon: 'none' });
return;
}
// 提交逻辑
console.log('提交数据:', formData);
uni.showToast({ title: '添加成功', icon: 'success' });
showPopup.value = false;
};
// 锁定成员
const Lock = () => {
uni.showModal({
title: '提示',
content: '确定要锁定该成员吗?',
confirmColor: '#2667E9',
success: (res) => {
if (res.confirm) {
// 确认锁定
console.log('用户点击确定');
uni.showToast({ title: '锁定成功', icon: 'success' });
} else if (res.cancel) {
console.log('用户点击取消');
}
}
import { ref,reactive } from 'vue';
import { addMember,getMemberList,lockOrUnlockMember} from '@/request/api.js';
//成员列表
const list = ref([]);
getMemberList().then(res => {
list.value = res.data;
});
};
//选择部门
const show = ref(false);
const columns = reactive([
['湘西自治州和谐网络科技有限公司', '湘西自治州和谐云科技有限公司']
]);
const showPopup = ref(false);
const showDeptPicker = ref(false);
const formData = reactive({
username: '',
nickname: '',
phone: '',
password: '',
department: ''
});
const handleSubmit = async () => {
// 表单验证
if (!formData.username) {
uni.showToast({
title: '请输入用户名',
icon: 'none'
});
return;
}
if (!formData.password || formData.password.length < 6 || formData.password.length > 16) {
uni.showToast({
title: '请输入6-16位密码',
icon: 'none'
});
return;
}
// 构建请求参数(根据接口要求的字段名)
const params = {
userName: formData.username,
nickName: formData.nickname || '',
phonenumber: formData.phone || '',
password: formData.password,
roleType: 'common'
};
try {
const res = await addMember(params);
if (res.code === 0) {
uni.showToast({
title: '添加成功',
icon: 'success'
});
showPopup.value = false;
// 重置表单
formData.username = '';
formData.nickname = '';
formData.phone = '';
formData.password = '';
formData.department = '';
} else {
uni.showToast({
title: res.msg || '添加失败',
icon: 'none'
});
}
} catch (error) {
console.error('添加成员失败:', error);
uni.showToast({
title: '请求失败',
icon: 'none'
});
}
};
// 锁定/解锁成员
const Lock = (item) => {
// 当前是锁定状态则解锁,否则锁定
const isLocked = item.lockStatus === 1;
const actionText = isLocked ? '解锁' : '锁定';
const newLockStatus = isLocked ? 0 : 1;
uni.showModal({
title: '提示',
content: `确定要${actionText}该成员吗?`,
confirmColor: '#2667E9',
success: async (res) => {
if (res.confirm) {
try {
const result = await lockOrUnlockMember({
userId: item.userId,
lockStatus: newLockStatus
});
if (result.code === 0) {
uni.showToast({
title: `${actionText}成功`,
icon: 'success'
});
// 更新本地状态
item.lockStatus = newLockStatus;
item.statusName = newLockStatus === 1 ? '已锁定' : '正常';
} else {
uni.showToast({
title: result.msg || `${actionText}失败`,
icon: 'none'
});
}
} catch (error) {
console.error(`${actionText}成员失败:`, error);
uni.showToast({
title: '请求失败',
icon: 'none'
});
}
}
}
});
};
//选择部门(顶部切换用)
const show = ref(false);
const columns = reactive([
['湘西自治州和谐网络科技有限公司', '湘西自治州和谐云科技有限公司']
]);
// 主部门选择器数据
const deptColumns = reactive([
['湘西自治州和谐网络科技有限公司', '湘西自治州和谐云科技有限公司', '研发部门', '深圳总公司', '若依科技']
]);
// 主部门选择确认
const onDeptConfirm = (e) => {
console.log('选择的部门:', e);
// e.value 是选中的值数组
if (e.value && e.value.length > 0) {
formData.department = e.value[0];
}
showDeptPicker.value = false;
};
</script>
<style lang="scss" scoped>
@@ -161,8 +244,8 @@ const columns = reactive([
.tag-outline {
padding: 4rpx 16rpx;
border-radius: 8rpx;
background:#EEF3FF;
color: #2E7CF3 ;
background: #EEF3FF;
color: #2E7CF3;
font-size: 24rpx;
flex-shrink: 0;
margin-right: -30rpx;
@@ -263,4 +346,4 @@ const columns = reactive([
color: #fff;
font-size: 30rpx;
}
</style>
</style>