|
|
@@ -13,8 +13,8 @@
|
|
|
<c-button v-if="isOwn" @click="handleDeleteComment" theme="red" text icon="delete">删除留言</c-button>
|
|
|
</div>
|
|
|
<show-transition-small>
|
|
|
- <div v-if="replyInputShow && !reply" class="reply-input-wrapper vertical-center">
|
|
|
- <c-input placeholder="在此输入回复内容" v-model="replyContent"></c-input>
|
|
|
+ <div v-show="replyInputShow && !reply" class="reply-input-wrapper vertical-center">
|
|
|
+ <input ref="reply" placeholder="在此输入回复内容" v-model="replyContent">
|
|
|
<icon-button :size="32" @click="handleReply" theme="green">send</icon-button>
|
|
|
</div>
|
|
|
</show-transition-small>
|
|
|
@@ -24,27 +24,42 @@
|
|
|
<script>
|
|
|
import IconButton from '@/components/Basic/IconButton'
|
|
|
import { mapState } from 'vuex'
|
|
|
-import CInput from '@/components/Basic/CInput'
|
|
|
import CButton from '@/components/Basic/CButton'
|
|
|
import ShowTransitionSmall from '@/animations/ShowTransitionSmall'
|
|
|
+import { FOCUS_ON_INPUT, USE_FOCUS } from '@/store/types/pdf-types'
|
|
|
|
|
|
export default {
|
|
|
props: {
|
|
|
userId: Number,
|
|
|
reply: String,
|
|
|
- topNumber: Number || String,
|
|
|
+ topNumber: [Number, String],
|
|
|
personal: Boolean
|
|
|
},
|
|
|
- components: { ShowTransitionSmall, CButton, CInput, IconButton },
|
|
|
+ components: { ShowTransitionSmall, CButton, IconButton },
|
|
|
data () {
|
|
|
return {
|
|
|
replyInputShow: false,
|
|
|
replyContent: ''
|
|
|
}
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ replyInputShow () {
|
|
|
+ if (this.replyInputShow) {
|
|
|
+ this.$store.commit(FOCUS_ON_INPUT)
|
|
|
+ } else {
|
|
|
+ this.$store.commit(USE_FOCUS)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ focus (newValue) {
|
|
|
+ if (this.replyInputShow && !newValue) {
|
|
|
+ this.replyInputShow = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
computed: {
|
|
|
...mapState({
|
|
|
- userInfo: state => state.main.userInfo
|
|
|
+ userInfo: state => state.main.userInfo,
|
|
|
+ focus: state => state.pdf.focus
|
|
|
}),
|
|
|
isOwn () {
|
|
|
return this.userId === this.userInfo.id
|
|
|
@@ -55,6 +70,9 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
handleShowHideReplyInput () {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$refs.reply.focus()
|
|
|
+ }, 10)
|
|
|
this.replyInputShow = !this.replyInputShow
|
|
|
},
|
|
|
handleReply () {
|
|
|
@@ -100,7 +118,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
.reply-input-wrapper {
|
|
|
- .c-input {
|
|
|
+ input {
|
|
|
background-color: rgba(255, 255, 255, 0.5);
|
|
|
height: 36px;
|
|
|
font-size: 14px;
|
|
|
@@ -111,4 +129,28 @@ export default {
|
|
|
margin: 0 12px 0 8px;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+input, textarea {
|
|
|
+ box-sizing: border-box;
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #3a4a5a;
|
|
|
+ background: $input-background-color;
|
|
|
+ border-radius: 8px;
|
|
|
+ border: none;
|
|
|
+ outline: none;
|
|
|
+ width: 100%;
|
|
|
+ height: 40px;
|
|
|
+ line-height: 1.5;
|
|
|
+ padding: 0 12px 0 12px;
|
|
|
+ transition: .2s;
|
|
|
+
|
|
|
+ &:hover {
|
|
|
+ background: $input-hover-background-color;
|
|
|
+ }
|
|
|
+
|
|
|
+ &::placeholder {
|
|
|
+ color: #8a9aaa;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|