1.18整合
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const request_api = require("../../request/api.js");
|
||||
if (!Array) {
|
||||
const _easycom_up_picker2 = common_vendor.resolveComponent("up-picker");
|
||||
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
|
||||
(_easycom_up_picker2 + _easycom_u_popup2)();
|
||||
const _component_TabBar = common_vendor.resolveComponent("TabBar");
|
||||
(_easycom_up_picker2 + _easycom_u_popup2 + _component_TabBar)();
|
||||
}
|
||||
const _easycom_up_picker = () => "../../uni_modules/uview-plus/components/u-picker/u-picker.js";
|
||||
const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
|
||||
@@ -13,6 +15,10 @@ if (!Math) {
|
||||
const _sfc_main = {
|
||||
__name: "membermanagemen",
|
||||
setup(__props) {
|
||||
const list = common_vendor.ref([]);
|
||||
request_api.getMemberList().then((res) => {
|
||||
list.value = res.data;
|
||||
});
|
||||
const showPopup = common_vendor.ref(false);
|
||||
const showDeptPicker = common_vendor.ref(false);
|
||||
const formData = common_vendor.reactive({
|
||||
@@ -22,34 +28,90 @@ const _sfc_main = {
|
||||
password: "",
|
||||
department: ""
|
||||
});
|
||||
const handleSubmit = () => {
|
||||
const handleSubmit = async () => {
|
||||
if (!formData.username) {
|
||||
common_vendor.index.showToast({ title: "请输入用户名", icon: "none" });
|
||||
common_vendor.index.showToast({
|
||||
title: "请输入用户名",
|
||||
icon: "none"
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!formData.password || formData.password.length < 6 || formData.password.length > 16) {
|
||||
common_vendor.index.showToast({ title: "请输入6-16位密码", icon: "none" });
|
||||
common_vendor.index.showToast({
|
||||
title: "请输入6-16位密码",
|
||||
icon: "none"
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!formData.department) {
|
||||
common_vendor.index.showToast({ title: "请选择主部门", icon: "none" });
|
||||
return;
|
||||
const params = {
|
||||
userName: formData.username,
|
||||
nickName: formData.nickname || "",
|
||||
phonenumber: formData.phone || "",
|
||||
password: formData.password,
|
||||
roleType: "common"
|
||||
};
|
||||
try {
|
||||
const res = await request_api.addMember(params);
|
||||
if (res.code === 0) {
|
||||
common_vendor.index.showToast({
|
||||
title: "添加成功",
|
||||
icon: "success"
|
||||
});
|
||||
showPopup.value = false;
|
||||
formData.username = "";
|
||||
formData.nickname = "";
|
||||
formData.phone = "";
|
||||
formData.password = "";
|
||||
formData.department = "";
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: res.msg || "添加失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("添加成员失败:", error);
|
||||
common_vendor.index.showToast({
|
||||
title: "请求失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
console.log("提交数据:", formData);
|
||||
common_vendor.index.showToast({ title: "添加成功", icon: "success" });
|
||||
showPopup.value = false;
|
||||
};
|
||||
const Lock = () => {
|
||||
const Lock = (item) => {
|
||||
const isLocked = item.lockStatus === 1;
|
||||
const actionText = isLocked ? "解锁" : "锁定";
|
||||
const newLockStatus = isLocked ? 0 : 1;
|
||||
common_vendor.index.showModal({
|
||||
title: "提示",
|
||||
content: "确定要锁定该成员吗?",
|
||||
content: `确定要${actionText}该成员吗?`,
|
||||
confirmColor: "#2667E9",
|
||||
success: (res) => {
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
console.log("用户点击确定");
|
||||
common_vendor.index.showToast({ title: "锁定成功", icon: "success" });
|
||||
} else if (res.cancel) {
|
||||
console.log("用户点击取消");
|
||||
try {
|
||||
const result = await request_api.lockOrUnlockMember({
|
||||
userId: item.userId,
|
||||
lockStatus: newLockStatus
|
||||
});
|
||||
if (result.code === 0) {
|
||||
common_vendor.index.showToast({
|
||||
title: `${actionText}成功`,
|
||||
icon: "success"
|
||||
});
|
||||
item.lockStatus = newLockStatus;
|
||||
item.statusName = newLockStatus === 1 ? "已锁定" : "正常";
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: result.msg || `${actionText}失败`,
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`${actionText}成员失败:`, error);
|
||||
common_vendor.index.showToast({
|
||||
title: "请求失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -58,31 +120,58 @@ const _sfc_main = {
|
||||
const columns = common_vendor.reactive([
|
||||
["湘西自治州和谐网络科技有限公司", "湘西自治州和谐云科技有限公司"]
|
||||
]);
|
||||
const deptColumns = common_vendor.reactive([
|
||||
["湘西自治州和谐网络科技有限公司", "湘西自治州和谐云科技有限公司", "研发部门", "深圳总公司", "若依科技"]
|
||||
]);
|
||||
const onDeptConfirm = (e) => {
|
||||
console.log("选择的部门:", e);
|
||||
if (e.value && e.value.length > 0) {
|
||||
formData.department = e.value[0];
|
||||
}
|
||||
showDeptPicker.value = false;
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return {
|
||||
a: common_vendor.o(($event) => show.value = true),
|
||||
a: common_vendor.f(list.value, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.o(($event) => show.value = true, item.id),
|
||||
b: "06d9f81b-0-" + i0,
|
||||
c: common_vendor.t(item.nickName),
|
||||
d: common_vendor.t(item.statusName),
|
||||
e: common_vendor.t(item.phonenumber),
|
||||
f: common_vendor.t(item.lockStatus === 1 ? "解锁" : "锁定"),
|
||||
g: common_vendor.o(($event) => Lock(item), item.id),
|
||||
h: item.id
|
||||
};
|
||||
}),
|
||||
b: common_vendor.p({
|
||||
show: show.value,
|
||||
columns
|
||||
}),
|
||||
c: common_vendor.o(($event) => Lock()),
|
||||
d: common_vendor.o(($event) => showPopup.value = true),
|
||||
e: common_vendor.o(($event) => showPopup.value = false),
|
||||
f: formData.username,
|
||||
g: common_vendor.o(($event) => formData.username = $event.detail.value),
|
||||
h: formData.nickname,
|
||||
i: common_vendor.o(($event) => formData.nickname = $event.detail.value),
|
||||
j: formData.phone,
|
||||
k: common_vendor.o(($event) => formData.phone = $event.detail.value),
|
||||
l: formData.password,
|
||||
m: common_vendor.o(($event) => formData.password = $event.detail.value),
|
||||
n: common_vendor.t(formData.department || "请选择主部门"),
|
||||
o: common_vendor.n(formData.department ? "" : "text-gray"),
|
||||
p: common_vendor.o(($event) => showDeptPicker.value = true),
|
||||
q: common_vendor.o(($event) => showPopup.value = false),
|
||||
r: common_vendor.o(handleSubmit),
|
||||
s: common_vendor.o(($event) => showPopup.value = false),
|
||||
t: common_vendor.p({
|
||||
c: common_vendor.o(($event) => showPopup.value = true),
|
||||
d: common_vendor.o(($event) => showPopup.value = false),
|
||||
e: formData.username,
|
||||
f: common_vendor.o(($event) => formData.username = $event.detail.value),
|
||||
g: formData.nickname,
|
||||
h: common_vendor.o(($event) => formData.nickname = $event.detail.value),
|
||||
i: formData.phone,
|
||||
j: common_vendor.o(($event) => formData.phone = $event.detail.value),
|
||||
k: formData.password,
|
||||
l: common_vendor.o(($event) => formData.password = $event.detail.value),
|
||||
m: common_vendor.t(formData.department || "请选择主部门"),
|
||||
n: common_vendor.n(formData.department ? "" : "text-gray"),
|
||||
o: common_vendor.o(($event) => showDeptPicker.value = true),
|
||||
p: common_vendor.o(onDeptConfirm),
|
||||
q: common_vendor.o(($event) => showDeptPicker.value = false),
|
||||
r: common_vendor.o(($event) => showDeptPicker.value = false),
|
||||
s: common_vendor.p({
|
||||
show: showDeptPicker.value,
|
||||
columns: deptColumns
|
||||
}),
|
||||
t: common_vendor.o(($event) => showPopup.value = false),
|
||||
v: common_vendor.o(handleSubmit),
|
||||
w: common_vendor.o(($event) => showPopup.value = false),
|
||||
x: common_vendor.p({
|
||||
show: showPopup.value,
|
||||
mode: "center",
|
||||
round: "20"
|
||||
|
||||
@@ -1 +1 @@
|
||||
<view class="{{['page', 'padding', 'data-v-06d9f81b', virtualHostClass]}}" style="{{virtualHostStyle}}"><view class="padding bg-white radius data-v-06d9f81b"><view class="flex justify-between align-center data-v-06d9f81b"><view class="flex align-center data-v-06d9f81b"><view class="border-tite data-v-06d9f81b"></view><view class="text-bold margin-left-xs data-v-06d9f81b" bindtap="{{a}}">湘西自治州和谐网络科技有限公司</view><up-picker wx:if="{{b}}" class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" u-i="06d9f81b-0" bind:__l="__l" u-p="{{b}}"></up-picker></view><view class="tag-outline data-v-06d9f81b">负责人</view></view><view class="flex margin-top data-v-06d9f81b"><view class="cu-avatar radius lg data-v-06d9f81b" style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big81005.jpg)"></view><view class="margin-left data-v-06d9f81b"><view class="flex data-v-06d9f81b"><view class="data-v-06d9f81b">罗燚</view><view class="margin-left-xs light bg-olive padding-left-xs padding-right-xs data-v-06d9f81b">正常</view></view><view class="flex text-gray data-v-06d9f81b"><view class="data-v-06d9f81b">手机设置:</view><view class="data-v-06d9f81b">未设置</view></view><view class="flex text-gray data-v-06d9f81b"><view class="data-v-06d9f81b">登录IP:</view><view class="data-v-06d9f81b">45.135.228.172</view></view></view><button class="bg-blue btn-lock data-v-06d9f81b" bindtap="{{c}}">锁定</button></view></view><button class="lg cuIcon-add bg-blue round margin-top-xl data-v-06d9f81b" bindtap="{{d}}">添加成员</button><u-popup wx:if="{{t}}" class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" u-s="{{['d']}}" bindclose="{{s}}" u-i="06d9f81b-1" bind:__l="__l" u-p="{{t}}"><view class="popup-content data-v-06d9f81b"><view class="popup-header data-v-06d9f81b"><view class="popup-title text-bold data-v-06d9f81b">添加成员</view><view class="popup-close data-v-06d9f81b" bindtap="{{e}}">×</view></view><view class="popup-body data-v-06d9f81b"><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">用户名<text class="text-red data-v-06d9f81b">*</text></view><input class="form-input data-v-06d9f81b" placeholder="请输入用户名" value="{{f}}" bindinput="{{g}}"/></view><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">昵称</view><input class="form-input data-v-06d9f81b" placeholder="请输入昵称" value="{{h}}" bindinput="{{i}}"/></view><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">手机号</view><input class="form-input data-v-06d9f81b" placeholder="请输入手机号" type="number" value="{{j}}" bindinput="{{k}}"/></view><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">密码<text class="text-red data-v-06d9f81b">*</text></view><input class="form-input data-v-06d9f81b" placeholder="请输入密码(6-16位)" password value="{{l}}" bindinput="{{m}}"/></view><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">主部门<text class="text-red data-v-06d9f81b">*</text></view><view class="form-input form-select data-v-06d9f81b" bindtap="{{p}}"><text class="{{['data-v-06d9f81b', o]}}">{{n}}</text></view></view></view><view class="popup-footer data-v-06d9f81b"><button class="btn-cancel data-v-06d9f81b" bindtap="{{q}}">取消</button><button class="btn-confirm bg-blue data-v-06d9f81b" bindtap="{{r}}">确定</button></view></view></u-popup></view>
|
||||
<view class="{{['page', 'padding', 'data-v-06d9f81b', virtualHostClass]}}" style="{{virtualHostStyle}}"><view wx:for="{{a}}" wx:for-item="item" wx:key="h" class="padding bg-white radius margin-bottom data-v-06d9f81b"><view class="flex justify-between align-center data-v-06d9f81b"><view class="flex align-center data-v-06d9f81b"><view class="border-tite data-v-06d9f81b"></view><view class="text-bold margin-left-xs data-v-06d9f81b" bindtap="{{item.a}}">湘西自治州和谐网络科技有限公司</view><up-picker wx:if="{{b}}" class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" u-i="{{item.b}}" bind:__l="__l" u-p="{{b}}"></up-picker></view><view class="tag-outline data-v-06d9f81b">负责人</view></view><view class="flex margin-top data-v-06d9f81b"><view class="cu-avatar radius lg data-v-06d9f81b" style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big81005.jpg)"></view><view class="margin-left data-v-06d9f81b"><view class="flex data-v-06d9f81b"><view class="data-v-06d9f81b">{{item.c}}</view><view class="margin-left-xs light bg-olive padding-left-xs padding-right-xs data-v-06d9f81b">{{item.d}}</view></view><view class="flex text-gray data-v-06d9f81b"><view class="data-v-06d9f81b">手机设置:</view><view class="data-v-06d9f81b">{{item.e}}</view></view><view class="flex text-gray data-v-06d9f81b"><view class="data-v-06d9f81b">登录IP:</view><view class="data-v-06d9f81b">45.135.228.172</view></view></view><button class="bg-blue btn-lock data-v-06d9f81b" bindtap="{{item.g}}">{{item.f}}</button></view></view><button class="lg cuIcon-add bg-blue round margin-top-xl data-v-06d9f81b" bindtap="{{c}}">添加成员</button><u-popup wx:if="{{x}}" class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" u-s="{{['d']}}" bindclose="{{w}}" u-i="06d9f81b-1" bind:__l="__l" u-p="{{x}}"><view class="popup-content data-v-06d9f81b"><view class="popup-header data-v-06d9f81b"><view class="popup-title text-bold data-v-06d9f81b">添加成员</view><view class="popup-close data-v-06d9f81b" bindtap="{{d}}">×</view></view><view class="popup-body data-v-06d9f81b"><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">用户名<text class="text-red data-v-06d9f81b">*</text></view><input class="form-input data-v-06d9f81b" placeholder="请输入用户名" value="{{e}}" bindinput="{{f}}"/></view><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">昵称</view><input class="form-input data-v-06d9f81b" placeholder="请输入昵称" value="{{g}}" bindinput="{{h}}"/></view><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">手机号</view><input class="form-input data-v-06d9f81b" placeholder="请输入手机号" type="number" value="{{i}}" bindinput="{{j}}"/></view><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">密码<text class="text-red data-v-06d9f81b">*</text></view><input class="form-input data-v-06d9f81b" placeholder="请输入密码(6-16位)" password value="{{k}}" bindinput="{{l}}"/></view><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">主部门<text class="text-red data-v-06d9f81b">*</text></view><view class="form-input form-select data-v-06d9f81b" bindtap="{{o}}"><text class="{{['data-v-06d9f81b', n]}}">{{m}}</text></view><up-picker wx:if="{{s}}" class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" bindconfirm="{{p}}" bindcancel="{{q}}" bindclose="{{r}}" u-i="06d9f81b-2,06d9f81b-1" bind:__l="__l" u-p="{{s}}"></up-picker></view></view><view class="popup-footer data-v-06d9f81b"><button class="btn-cancel data-v-06d9f81b" bindtap="{{t}}">取消</button><button class="btn-confirm bg-blue data-v-06d9f81b" bindtap="{{v}}">确定</button></view></view></u-popup><tab-bar class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" u-i="06d9f81b-3" bind:__l="__l"/></view>
|
||||
Reference in New Issue
Block a user