121 lines
4.7 KiB
JavaScript
121 lines
4.7 KiB
JavaScript
|
|
"use strict";
|
|||
|
|
const common_vendor = require("../../../../common/vendor.js");
|
|||
|
|
require("../../../adapter-vue.js");
|
|||
|
|
const common_assets = require("../../../../common/assets.js");
|
|||
|
|
const TUIKit_components_common_Toast_index = require("../../common/Toast/index.js");
|
|||
|
|
const TUIKit_utils_env = require("../../../utils/env.js");
|
|||
|
|
const TUIKit_components_common_Toast_type = require("../../common/Toast/type.js");
|
|||
|
|
if (!Math) {
|
|||
|
|
Icon();
|
|||
|
|
}
|
|||
|
|
const Icon = () => "../../common/Icon.js";
|
|||
|
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|||
|
|
__name: "manage-name",
|
|||
|
|
props: {
|
|||
|
|
data: {
|
|||
|
|
type: Object,
|
|||
|
|
default: () => ({})
|
|||
|
|
},
|
|||
|
|
isAuthor: {
|
|||
|
|
type: Boolean,
|
|||
|
|
default: false
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
emits: ["update"],
|
|||
|
|
setup(__props, { emit: __emit }) {
|
|||
|
|
const props = __props;
|
|||
|
|
const groupProfile = common_vendor.ref({});
|
|||
|
|
const inputGroupName = common_vendor.ref("");
|
|||
|
|
const isEdit = common_vendor.ref(false);
|
|||
|
|
const nameInputRef = common_vendor.ref(null);
|
|||
|
|
common_vendor.watchEffect(() => {
|
|||
|
|
groupProfile.value = props.data;
|
|||
|
|
});
|
|||
|
|
const emit = __emit;
|
|||
|
|
const updateProfile = () => {
|
|||
|
|
if (!inputGroupName.value) {
|
|||
|
|
TUIKit_components_common_Toast_index.Toast({
|
|||
|
|
message: common_vendor.Wt.t("TUIGroup.群名称不能为空"),
|
|||
|
|
type: TUIKit_components_common_Toast_type.TOAST_TYPE.ERROR
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
if (inputGroupName.value !== groupProfile.value.name) {
|
|||
|
|
emit("update", { key: "name", value: inputGroupName.value });
|
|||
|
|
groupProfile.value.name = inputGroupName.value;
|
|||
|
|
inputGroupName.value = "";
|
|||
|
|
TUIKit_components_common_Toast_index.Toast({
|
|||
|
|
message: common_vendor.Wt.t("TUIGroup.群名称修改成功"),
|
|||
|
|
type: TUIKit_components_common_Toast_type.TOAST_TYPE.SUCCESS
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
toggleEditStatus();
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
const toggleEditStatus = () => {
|
|||
|
|
if (props.isAuthor) {
|
|||
|
|
isEdit.value = !isEdit.value;
|
|||
|
|
}
|
|||
|
|
if (isEdit.value) {
|
|||
|
|
inputGroupName.value = groupProfile.value.name;
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
common_vendor.watch(
|
|||
|
|
() => isEdit.value,
|
|||
|
|
(newVal) => {
|
|||
|
|
if (newVal) {
|
|||
|
|
common_vendor.nextTick$1(() => {
|
|||
|
|
var _a;
|
|||
|
|
(_a = nameInputRef.value) == null ? void 0 : _a.focus();
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
);
|
|||
|
|
return (_ctx, _cache) => {
|
|||
|
|
return common_vendor.e({
|
|||
|
|
a: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.群名称`)),
|
|||
|
|
b: common_vendor.unref(isEdit)
|
|||
|
|
}, common_vendor.unref(isEdit) ? common_vendor.e({
|
|||
|
|
c: !common_vendor.unref(TUIKit_utils_env.isPC)
|
|||
|
|
}, !common_vendor.unref(TUIKit_utils_env.isPC) ? {
|
|||
|
|
d: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.修改群聊名称`)),
|
|||
|
|
e: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.修改群聊名称后,将在群内通知其他成员`)),
|
|||
|
|
f: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`关闭`)),
|
|||
|
|
g: common_vendor.o$1(toggleEditStatus)
|
|||
|
|
} : {}, {
|
|||
|
|
h: common_vendor.unref(isEdit)
|
|||
|
|
}, common_vendor.unref(isEdit) ? {
|
|||
|
|
i: common_vendor.o$1(updateProfile),
|
|||
|
|
j: common_vendor.unref(inputGroupName),
|
|||
|
|
k: common_vendor.o$1(($event) => common_vendor.isRef(inputGroupName) ? inputGroupName.value = $event.detail.value : null)
|
|||
|
|
} : {}, {
|
|||
|
|
l: !common_vendor.unref(TUIKit_utils_env.isPC)
|
|||
|
|
}, !common_vendor.unref(TUIKit_utils_env.isPC) ? {
|
|||
|
|
m: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.仅限中文、字母、数字和下划线,2-20个字`))
|
|||
|
|
} : {}, {
|
|||
|
|
n: !common_vendor.unref(TUIKit_utils_env.isPC)
|
|||
|
|
}, !common_vendor.unref(TUIKit_utils_env.isPC) ? {
|
|||
|
|
o: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`确认`)),
|
|||
|
|
p: common_vendor.o$1(updateProfile)
|
|||
|
|
} : {}, {
|
|||
|
|
q: common_vendor.unref(TUIKit_utils_env.isMobile) ? 1 : ""
|
|||
|
|
}) : {}, {
|
|||
|
|
r: !common_vendor.unref(isEdit) || !common_vendor.unref(TUIKit_utils_env.isPC)
|
|||
|
|
}, !common_vendor.unref(isEdit) || !common_vendor.unref(TUIKit_utils_env.isPC) ? common_vendor.e({
|
|||
|
|
s: common_vendor.t(common_vendor.unref(groupProfile).name),
|
|||
|
|
t: __props.isAuthor
|
|||
|
|
}, __props.isAuthor ? {
|
|||
|
|
v: common_vendor.p({
|
|||
|
|
file: common_vendor.unref(common_assets.editIcon),
|
|||
|
|
width: "14px",
|
|||
|
|
height: "14px"
|
|||
|
|
})
|
|||
|
|
} : {}, {
|
|||
|
|
w: common_vendor.o$1(toggleEditStatus)
|
|||
|
|
}) : {});
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-0a71df72"]]);
|
|||
|
|
wx.createComponent(Component);
|
|||
|
|
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/TUIKit/components/TUIGroup/manage-group/manage-name.js.map
|