|
@@ -134,9 +134,21 @@
|
|
|
/>
|
|
|
</a-form-item>
|
|
|
<a-form-item label="授权" name="scenes" style="margin-bottom: 2px">
|
|
|
- <a-button type="primary" ghost @click="authvisible = true">
|
|
|
+ <a-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ ghost
|
|
|
+ @click="authvisible = true"
|
|
|
+ >
|
|
|
<template #icon><plus-outlined /></template>添加用户</a-button
|
|
|
>
|
|
|
+
|
|
|
+ <a-button
|
|
|
+ style="margin-left: 5px"
|
|
|
+ v-for="lab in current.userObjList"
|
|
|
+ size="small"
|
|
|
+ >{{ lab.userName }}</a-button
|
|
|
+ >
|
|
|
</a-form-item>
|
|
|
<a-form-item
|
|
|
label="设置房间人数"
|
|
@@ -146,7 +158,7 @@
|
|
|
:rules="[{ required: true, message: t('room.form.titleRequired') }]"
|
|
|
>
|
|
|
<a-input-number
|
|
|
- v-model:value.trim="current.maxMan"
|
|
|
+ v-model:value="current.maxMan"
|
|
|
placeholder="请输入房间人数"
|
|
|
:min="5"
|
|
|
:max="50"
|
|
@@ -157,17 +169,6 @@
|
|
|
</template>
|
|
|
</a-input-number>
|
|
|
</a-form-item>
|
|
|
-
|
|
|
- <!-- <a-form-item label="设置模式" name="mode" style="margin-bottom: 2px">
|
|
|
- <a-checkbox-group
|
|
|
- v-model:value="current.isRoamMode"
|
|
|
- :options="[
|
|
|
- { label: '带看', value: 'Pear' },
|
|
|
- { label: '自由观看模式', value: 'Apple' }
|
|
|
- ]"
|
|
|
- />
|
|
|
-
|
|
|
- </a-form-item> -->
|
|
|
</a-form>
|
|
|
</div>
|
|
|
</a-modal>
|
|
@@ -178,18 +179,38 @@
|
|
|
centered
|
|
|
@ok="handleAuthConfirm"
|
|
|
>
|
|
|
- <a-form-item label="用户账号" name="authTargetUser">
|
|
|
- <a-input
|
|
|
- v-model:value="authTargetUser"
|
|
|
- placeholder="请输入完整的账号"
|
|
|
- />
|
|
|
- </a-form-item>
|
|
|
+ <a-form layout="inline" :model="authformState">
|
|
|
+ <a-form-item
|
|
|
+ label="用户账号"
|
|
|
+ name="userName"
|
|
|
+ style="margin-bottom: 20px"
|
|
|
+ :rules="[{ required: true, message: `请输入房间使用时间` }]"
|
|
|
+ >
|
|
|
+ <a-input
|
|
|
+ v-model:value="authformState.userName"
|
|
|
+ placeholder="请输入完整的账号"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item
|
|
|
+ label="使用时间"
|
|
|
+ name="useTimeList"
|
|
|
+ style="margin-bottom: 20px"
|
|
|
+ :rules="[{ required: true, message: `请输入房间使用时间` }]"
|
|
|
+ >
|
|
|
+ <a-range-picker
|
|
|
+ :show-time="{ format: 'HH:mm' }"
|
|
|
+ format="YYYY-MM-DD HH:mm:ss"
|
|
|
+ style="width: 90%"
|
|
|
+ v-model:value="authformState.useTimeList"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
+ </a-form>
|
|
|
</a-modal>
|
|
|
</a-config-provider>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
-import { ref, defineComponent, reactive, computed, unref } from 'vue'
|
|
|
+import { ref, UnwrapRef, defineComponent, reactive, computed, unref } from 'vue'
|
|
|
import { createRoom, useRoomStore } from '@/store/modules/room'
|
|
|
import { props } from './props'
|
|
|
import { message } from 'ant-design-vue'
|
|
@@ -201,7 +222,7 @@ import type { Scene } from '@/store/modules/scene'
|
|
|
import type { FormInstance } from 'ant-design-vue'
|
|
|
import { useI18n } from '@/hook/useI18n'
|
|
|
import { useLocale } from '@/locales/useLocale'
|
|
|
-import dayjs from 'dayjs'
|
|
|
+import dayjs, { Dayjs } from 'dayjs'
|
|
|
import { addAuthUser } from '@/api'
|
|
|
|
|
|
// const titleValidator = ref({
|
|
@@ -211,6 +232,11 @@ import { addAuthUser } from '@/api'
|
|
|
// : Promise.reject(new Error('No spaces allowed'))
|
|
|
// })
|
|
|
|
|
|
+interface AuthUserFormState {
|
|
|
+ userName: string
|
|
|
+ useTimeList: Dayjs[]
|
|
|
+}
|
|
|
+
|
|
|
export default defineComponent({
|
|
|
name: 'EditRoom',
|
|
|
components: { EditScenes, VOtpInput },
|
|
@@ -218,7 +244,11 @@ export default defineComponent({
|
|
|
setup(props) {
|
|
|
const visible = ref(true)
|
|
|
const authvisible = ref(false)
|
|
|
- const authTargetUser = ref('')
|
|
|
+
|
|
|
+ const authformState: UnwrapRef<AuthUserFormState> = reactive({
|
|
|
+ userName: '',
|
|
|
+ useTimeList: []
|
|
|
+ })
|
|
|
const { getAntdLocale } = useLocale()
|
|
|
const roomStore = useRoomStore()
|
|
|
const { getLocale } = useLocale()
|
|
@@ -235,9 +265,13 @@ export default defineComponent({
|
|
|
if (current.useTimeList?.length) {
|
|
|
current.useTimeList = current.useTimeList?.map(i => dayjs(i))
|
|
|
}
|
|
|
- if (!current.visitPassword?.length) {
|
|
|
+ if (!current.visitPassword) {
|
|
|
current.visitPassword = ''
|
|
|
}
|
|
|
+ if (!current.userObjList) {
|
|
|
+ current.userObjList = []
|
|
|
+ }
|
|
|
+
|
|
|
const deleteScene = (scene: Scene) => {
|
|
|
const index = current.scenes.indexOf(scene)
|
|
|
if (~index) {
|
|
@@ -255,9 +289,11 @@ export default defineComponent({
|
|
|
current.visitPassword.length < 4
|
|
|
) {
|
|
|
return message.error('密码缺失,请填写完整!')
|
|
|
+ } else {
|
|
|
+ current.takeLookLock = 1
|
|
|
}
|
|
|
current.cover = current.scenes[0].cover
|
|
|
- console.log('current', current)
|
|
|
+ console.log('save', current)
|
|
|
props.onSave && props.onSave(current)
|
|
|
visible.value = false
|
|
|
}
|
|
@@ -279,10 +315,21 @@ export default defineComponent({
|
|
|
}
|
|
|
|
|
|
const handleAuthConfirm = async () => {
|
|
|
- if (unref(authTargetUser)?.length) {
|
|
|
- const userName = unref(authTargetUser)
|
|
|
+ if (authformState.userName?.length) {
|
|
|
+ const userName = authformState.userName
|
|
|
const res = await addAuthUser(userName)
|
|
|
- console.log('res', res)
|
|
|
+ if (res) {
|
|
|
+ const isExist = current.userObjList?.findIndex(
|
|
|
+ i => i.userName === authformState.userName
|
|
|
+ )
|
|
|
+ console.log('isExist', isExist === -1)
|
|
|
+ if (isExist === -1) {
|
|
|
+ current.userObjList?.push(authformState)
|
|
|
+ }
|
|
|
+
|
|
|
+ authvisible.value = false
|
|
|
+ console.log('current', current)
|
|
|
+ }
|
|
|
} else {
|
|
|
message.error('用户账号不能为空!')
|
|
|
}
|
|
@@ -305,7 +352,9 @@ export default defineComponent({
|
|
|
otpInput,
|
|
|
authvisible,
|
|
|
handleAuthConfirm,
|
|
|
- authTargetUser
|
|
|
+ authformState
|
|
|
+ // authTargetUser,
|
|
|
+ // authTargetUserTime
|
|
|
}
|
|
|
}
|
|
|
})
|