1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
| <!--
| * @Description: 信息输出框
| * @Date: 2022-03-10 15:21:23
| * @LastEditTime: 2022-03-21 18:07:11
| -->
| <template>
| <el-input :placeholder="label" :type="type" v-model="infoValue">
| <template slot="prepend">
| <span class="label">{{ label }}</span>
| </template>
| </el-input>
| </template>
|
| <script>
| import { getUrlParam } from '@/utils/utils.js';
| export default {
| name: 'userIdInput',
| props: {
| label: String,
| },
| data() {
| return {
| type: 'string',
| infoValue: '',
| };
| },
| watch: {
| infoValue: {
| immediate: true,
| handler(val) {
| this.$emit('change', this.type === 'number' ? Number(val) : val);
| },
| },
| },
| mounted() {
| switch (this.label) {
| case 'userId': {
| const userId = getUrlParam('userId');
| this.infoValue = userId ? userId : `user_${parseInt(Math.random() * 100000000, 10)}`;
| break;
| }
| case 'roomId': {
| const roomId = getUrlParam('roomId');
| this.type = 'number';
| this.infoValue = roomId ? roomId : parseInt(Math.random() * 100000, 10);
| break;
| }
| case 'sdkAppId': {
| const sdkAppId = getUrlParam('sdkAppId');
| this.type = 'number';
| this.infoValue = sdkAppId ? sdkAppId : '';
| break;
| }
| case 'secretKey': {
| const secretKey = getUrlParam('secretKey');
| this.infoValue = secretKey ? secretKey : '';
| break;
| }
| default:
| break;
| }
| },
| };
| </script>
|
| <style lang="scss" scoped>
| .label {
| width: 80px;
| display: inline-block;
| font-weight: bold;
| }
| </style>
|
|