ソースを参照

代码审计修改

fenghaoyang 1 年間 前
コミット
21b28eec48

+ 1 - 3
src/api/modules/sys.user.api.js

@@ -1,9 +1,7 @@
1 1
 import { find, assign } from 'lodash'
2 2
 
3 3
 const users = [
4
-  { username: 'admin', password: 'admin', uuid: 'admin-uuid', name: 'Admin' },
5
-  { username: 'editor', password: 'editor', uuid: 'editor-uuid', name: 'Editor' },
6
-  { username: 'user1', password: 'user1', uuid: 'user1-uuid', name: 'User1' }
4
+
7 5
 ]
8 6
 
9 7
 export default ({ service, request, serviceForMock, requestForMock, mock, faker, tools }) => ({

+ 2 - 2
src/store/modules/d2admin/modules/account.js

@@ -14,8 +14,8 @@ export default {
14 14
      * @param {Object} payload route {Object} 登录成功后定向的路由对象 任何 vue-router 支持的格式
15 15
      */
16 16
     async login ({ dispatch }, {
17
-      username = '',
18
-      password = ''
17
+      username,
18
+      password
19 19
     } = {}) {
20 20
       const res = await api.SYS_USER_LOGIN({ username, password })
21 21
      console.log(res,"llllllll")

+ 2 - 1
src/utils/index.js

@@ -318,8 +318,9 @@ export function uniqueArr(arr) {
318 318
  * @returns {string}
319 319
  */
320 320
 export function createUniqueString() {
321
+  let randomNumber = window.crypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000;
321 322
   const timestamp = +new Date() + ''
322
-  const randomNum = parseInt((1 + Math.random()) * 65536) + ''
323
+  const randomNum = parseInt((1 + randomNumber) * 65536) + ''
323 324
   return (+(randomNum + timestamp)).toString(32)
324 325
 }
325 326
 

+ 3 - 2
src/views/demo/equipmentManage/equipmentInfo/index.vue

@@ -661,19 +661,20 @@ export default {
661 661
   },
662 662
   methods: {
663 663
     connect() {
664
+      let randomNumber = window.crypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000;
664 665
       let options = {
665 666
         //本地
666 667
         // username: "admin",
667 668
         // password: "public",
668 669
         //测试
669
-           username: "admin",
670
+        username: "admin",
670 671
         password: "admin@123",
671 672
         //生产
672 673
         // username: "admin",
673 674
         // password: "admin@2Ld&DDrsk",
674 675
         cleanSession: true,
675 676
         keepAlive: 60,
676
-        clientId: "mqttjs_" + Math.random().toString(16).substr(2, 8),
677
+        clientId: "mqttjs_" + randomNumber.toString(16).substr(2, 8),
677 678
         connectTimeout: 4000,
678 679
       };
679 680
       //本地开发环境

+ 2 - 2
src/views/demo/productManage/compontents/addDialog.vue

@@ -107,8 +107,8 @@ export default {
107 107
   },
108 108
   data() {
109 109
     return {
110
-      //  imgAction:window.location.origin+'/smart-grp-basic/minio/testupload',
111
-      imgAction:'http://101.36.160.140:31005/smart-grp-basic/minio/testupload',
110
+       imgAction:window.location.origin+'/smart-grp-basic/minio/testupload',
111
+      // imgAction:'http://101.36.160.140:31005/smart-grp-basic/minio/testupload',
112 112
       defaultProps: {
113 113
         children: "children",
114 114
         label: "productCategoryName",

+ 3 - 1
src/views/demo/productManage/productInfo/realTime/index.vue

@@ -162,6 +162,8 @@ export default {
162 162
   },
163 163
   methods: {
164 164
     connect() {
165
+      let randomNumber = window.crypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000;
166
+
165 167
       let options = {
166 168
         //本地
167 169
         // username: "admin",
@@ -174,7 +176,7 @@ export default {
174 176
         // password: "admin@2Ld&DDrsk",
175 177
         cleanSession: true,
176 178
         keepAlive: 60,
177
-        clientId: "mqttjs_" + Math.random().toString(16).substr(2, 8),
179
+        clientId: "mqttjs_" + randomNumber.toString(16).substr(2, 8),
178 180
         connectTimeout: 4000,
179 181
       };
180 182
       //本地开发环境

+ 0 - 4
src/views/demo/system/userManagement/index.vue

@@ -455,10 +455,6 @@ export default {
455 455
         }
456 456
       });
457 457
       var data = {
458
-        // orgName: this.orgName,
459
-        // userRoleName: this.userRoleName,
460
-        // manageStoreName: this.manageStoreName,
461
-
462 458
         id: this.rowId,
463 459
         userId: this.form.userId,
464 460
         userRealName:this.form.userRealName,

+ 16 - 24
src/views/system/login/page.vue

@@ -92,32 +92,17 @@ export default {
92 92
   data () {
93 93
     return {
94 94
   
95
-      // seccodeImg:window.location.origin+'/smart-grp-basic/userInfo/identifyImage',
96
-      seccodeImg:'http://101.36.160.140:31005/smart-grp-basic/userInfo/identifyImage',
95
+      seccodeImg:window.location.origin+'/smart-grp-basic/userInfo/identifyImage',
96
+      // seccodeImg:'http://101.36.160.140:31005/smart-grp-basic/userInfo/identifyImage',
97
+      // seccodeImg:'http://23.99.21.201:59887/smart-grp-basic/userInfo/identifyImage',
97 98
     
98 99
       // 快速选择用户
99 100
       dialogVisible: false,
100
-      users: [
101
-        {
102
-          name: 'Admin',
103
-          username: 'admin',
104
-          password: 'admin'
105
-        },
106
-        {
107
-          name: 'Editor',
108
-          username: 'editor',
109
-          password: 'editor'
110
-        },
111
-        {
112
-          name: 'User1',
113
-          username: 'user1',
114
-          password: 'user1'
115
-        }
116
-      ],
101
+
117 102
       // 表单
118 103
       formLogin: {
119
-        username: '',
120
-        password: '',
104
+        username: null,
105
+        password: null,
121 106
         code: 'v9am'
122 107
       },
123 108
       // 表单校验
@@ -178,11 +163,13 @@ export default {
178 163
    
179 164
   
180 165
    loginBtn(){
166
+
181 167
      let data={
182 168
        userName:this.formLogin.username,
183
-       userPassword:this.formLogin.password,
169
+       userPassword:encodeURIComponent(this.formLogin.password),
184 170
        identifyCode:this.formLogin.seccode
185 171
      }
172
+     console.log(data,9999);
186 173
      api.login(data)
187 174
      .then(res=>{
188 175
        if(res.code==200){
@@ -209,13 +196,16 @@ export default {
209 196
      })
210 197
    },
211 198
    seccodeImgClick(){
199
+    let randomNumber = window.crypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000;
212 200
  
213
-    this.seccodeImg=this.seccodeImg+'?'+Math.random()
201
+    this.seccodeImg=this.seccodeImg+'?'+randomNumber
214 202
   
215 203
    },
216 204
   
217 205
     // 提交登录信息
218 206
     submit () {
207
+   console.log(this.formLogin,89898989);
208
+
219 209
       this.$refs.loginForm.validate((valid) => {
220 210
         if (valid) {
221 211
           // 登录
@@ -242,8 +232,10 @@ export default {
242 232
     },
243 233
     // 随机语录
244 234
     tipsrandom () {
235
+      let randomNumber = window.crypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000;
236
+      
245 237
       var index
246
-      index = Math.floor(Math.random() * this.tipsarr.length)
238
+      index = Math.floor(randomNumber * this.tipsarr.length)
247 239
       this.tips = this.tipsarr[index]
248 240
     }
249 241
   }

+ 0 - 487
src/views/system/login/page1.vue

@@ -1,487 +0,0 @@
1
-<template>
2
-  <div class="page-login">
3
-    <div class="page-login--layer page-login--layer-area">
4
-      <ul class="circles">
5
-        <li v-for="n in 10" :key="n"></li>
6
-      </ul>
7
-    </div>
8
-   
9
-    <div class="page-login--layer">
10
-      <div
11
-        class="page-login--content"
12
-        flex="dir:top main:justify cross:stretch box:justify">
13
-        <div class="page-login--content-header">
14
-          <!-- <p class="page-login--content-header-motto" >
15
-           
16
-            {{ tips }}
17
-          </p> -->
18
-        </div>
19
-        <div
20
-          class="page-login--content-main"
21
-          flex="dir:top main:center cross:center">
22
-          <!-- logo -->
23
-          <img class="page-login--logo" src="./image/logo.png">
24
-          <!-- form -->
25
-          <div class="page-login--form">
26
-            <el-card shadow="never">
27
-              <el-form
28
-                ref="loginForm"
29
-                label-position="top"
30
-                :rules="rules"
31
-                :model="formLogin"
32
-                size="default">
33
-                <el-form-item prop="username">
34
-                  <el-input
35
-                    type="text"
36
-                    v-model="formLogin.username"
37
-                    placeholder="用户名">
38
-                    <i slot="prepend" class="fa fa-user-circle-o"></i>
39
-                  </el-input>
40
-                </el-form-item>
41
-                <el-form-item prop="password">
42
-                  <el-input
43
-                    type="password"
44
-                    v-model="formLogin.password"
45
-                    placeholder="密码">
46
-                    <i slot="prepend" class="fa fa-keyboard-o"></i>
47
-                  </el-input>
48
-                </el-form-item>
49
-                <!-- <el-form-item prop="code">
50
-                  <el-input
51
-                    type="text"
52
-                    v-model="formLogin.code"
53
-                    placeholder="验证码">
54
-                    <template slot="append">
55
-                      <img class="login-code" src="./image/login-code.png">
56
-                    </template>
57
-                  </el-input>
58
-                </el-form-item> -->
59
-                <el-button
60
-                  size="default"
61
-                  @click="submit"
62
-                  type="primary"
63
-                  class="button-login">
64
-                  登录
65
-                </el-button>
66
-              </el-form>
67
-            </el-card>
68
-            <p
69
-              class="page-login--options"
70
-              flex="main:justify cross:center">
71
-              <!-- <span><d2-icon name="question-circle"/> 忘记密码</span>
72
-              <span>注册用户</span> -->
73
-            </p>
74
-            <!-- quick login -->
75
-            <!-- <el-button class="page-login--quick" size="default" type="info" @click="dialogVisible = true">
76
-              快速选择用户
77
-            </el-button> -->
78
-          </div>
79
-        </div>
80
-        <div class="page-login--content-footer">
81
-         <!--  <p class="page-login--content-footer-locales">
82
-            <a
83
-              v-for="language in $languages"
84
-              :key="language.value"
85
-              @click="onChangeLocale(language.value)">
86
-              {{ language.label }}
87
-            </a>
88
-          </p> -->
89
-          <!-- <p class="page-login--content-footer-copyright">
90
-            Copyright
91
-            <d2-icon name="copyright"/>
92
-            紫光软件 
93
-            <a href="https://github.com/FairyEver">
94
-              All&nbsp;Rights&nbsp;Reserved
95
-            </a>
96
-          </p> -->
97
-          <!-- <p class="page-login--content-footer-options">
98
-            <a href="#">帮助</a>
99
-            <a href="#">隐私</a>
100
-            <a href="#">条款</a>
101
-          </p> -->
102
-            <Foot></Foot>
103
-        </div>
104
-      </div>
105
-    </div>
106
-    <el-dialog
107
-      title="快速选择用户"
108
-      :visible.sync="dialogVisible"
109
-      width="400px">
110
-      <el-row :gutter="10" style="margin: -20px 0px -10px 0px;">
111
-        <el-col v-for="(user, index) in users" :key="index" :span="8">
112
-          <div class="page-login--quick-user" @click="handleUserBtnClick(user)">
113
-            <d2-icon name="user-circle-o"/>
114
-            <span>{{user.name}}</span>
115
-          </div>
116
-        </el-col>
117
-      </el-row>
118
-    </el-dialog>
119
-  </div>
120
-</template>
121
-
122
-<script>
123
-
124
-import Foot from "../../../layout/header-aside/components/footer";
125
-import dayjs from 'dayjs'
126
-import { mapActions } from 'vuex'
127
-import localeMixin from '@/locales/mixin.js'
128
-export default {
129
-  components: {Foot},
130
-  mixins: [
131
-    localeMixin
132
-  ],
133
-  data () {
134
-    return {
135
-      
136
-    
137
-      // 快速选择用户
138
-      dialogVisible: false,
139
-      users: [
140
-        {
141
-          name: 'Admin',
142
-          username: 'admin',
143
-          password: 'admin'
144
-        },
145
-        {
146
-          name: 'Editor',
147
-          username: 'editor',
148
-          password: 'editor'
149
-        },
150
-        {
151
-          name: 'User1',
152
-          username: 'user1',
153
-          password: 'user1'
154
-        }
155
-      ],
156
-      // 表单
157
-      formLogin: {
158
-        username: 'admin',
159
-        password: 'admin',
160
-        code: 'v9am'
161
-      },
162
-      // 表单校验
163
-      rules: {
164
-        username: [
165
-          {
166
-            required: true,
167
-            message: '请输入用户名',
168
-            trigger: 'blur'
169
-          }
170
-        ],
171
-        password: [
172
-          {
173
-            required: true,
174
-            message: '请输入密码',
175
-            trigger: 'blur'
176
-          }
177
-        ],
178
-        code: [
179
-          {
180
-            required: true,
181
-            message: '请输入验证码',
182
-            trigger: 'blur'
183
-          }
184
-        ]
185
-      },
186
-      
187
-    }
188
-  },
189
-  mounted () {
190
-
191
-   
192
-  },
193
-
194
-  methods: {
195
-    ...mapActions('d2admin/account', [
196
-      'login'
197
-    ]),
198
-    refreshTime () {
199
-      this.time = dayjs().format('HH:mm:ss')
200
-    },
201
-    /**
202
-     * @description 接收选择一个用户快速登录的事件
203
-     * @param {Object} user 用户信息
204
-     */
205
-    handleUserBtnClick (user) {
206
-      this.formLogin.username = user.username
207
-      this.formLogin.password = user.password
208
-      this.submit()
209
-    },
210
-    /**
211
-     * @description 提交表单
212
-     */
213
-    // 提交登录信息
214
-    submit () {
215
-      this.$refs.loginForm.validate((valid) => {
216
-        if (valid) {
217
-          // 登录
218
-          // 注意 这里的演示没有传验证码
219
-          // 具体需要传递的数据请自行修改代码
220
-          this.login({
221
-            username: this.formLogin.username,
222
-            password: this.formLogin.password
223
-          })
224
-            .then(() => {
225
-              // 重定向对象不存在则返回顶层路径
226
-              this.$router.replace(this.$route.query.redirect || '/')
227
-            })
228
-        } else {
229
-          // 登录表单校验失败
230
-          this.$message.error('表单校验失败,请检查')
231
-        }
232
-      })
233
-    },
234
-   
235
-  }
236
-}
237
-</script>
238
-
239
-<style lang="scss">
240
-.page-login {
241
-  @extend %unable-select;
242
-  $backgroundColor: #F0F2F5;
243
-  // ---
244
-  background-color: $backgroundColor;
245
-  background: url('./image/bg.png') center no-repeat ;
246
-  background-size:100% 100%;
247
-  height: 100%;
248
-  position: relative;
249
-  // 层
250
-  .page-login--layer {
251
-    @extend %full;
252
-    overflow: auto;
253
-  }
254
-  .page-login--layer-area {
255
-    overflow: hidden;
256
-  }
257
-  // 时间
258
-  .page-login--layer-time {
259
-    font-size: 24em;
260
-    font-weight: bold;
261
-    color: rgba(0, 0, 0, 0.03);
262
-    overflow: hidden;
263
-  }
264
-  // 登陆页面控件的容器
265
-  .page-login--content {
266
-    height: 100%;
267
-    min-height: 500px;
268
-  }
269
-  // header
270
-  .page-login--content-header {
271
-    padding: 1em 0;
272
-    .page-login--content-header-motto {
273
-      margin: 0px;
274
-      padding: 0px;
275
-      color: $color-text-normal;
276
-      text-align: center;
277
-      font-size: 12px;
278
-    }
279
-  }
280
-  // main
281
-  .page-login--logo {
282
-    width: 240px;
283
-    margin-bottom: 2em;
284
-    margin-top: -2em;
285
-  }
286
-  // 登录表单
287
-  .page-login--form {
288
-    width: 280px;
289
-    // 卡片
290
-    .el-card {
291
-      margin-bottom: 15px;
292
-    }
293
-    // 登录按钮
294
-    .button-login {
295
-      width: 100%;
296
-    }
297
-    // 输入框左边的图表区域缩窄
298
-    .el-input-group__prepend {
299
-      padding: 0px 14px;
300
-    }
301
-    .login-code {
302
-      height: 40px - 2px;
303
-      display: block;
304
-      margin: 0px -20px;
305
-      border-top-right-radius: 2px;
306
-      border-bottom-right-radius: 2px;
307
-    }
308
-    // 登陆选项
309
-    .page-login--options {
310
-      margin: 0px;
311
-      padding: 0px;
312
-      font-size: 14px;
313
-      color: $color-primary;
314
-      margin-bottom: 15px;
315
-      font-weight: bold;
316
-    }
317
-    .page-login--quick {
318
-      width: 100%;
319
-    }
320
-  }
321
-  // 快速选择用户面板
322
-  .page-login--quick-user {
323
-    @extend %flex-center-col;
324
-    padding: 10px 0px;
325
-    border-radius: 4px;
326
-    &:hover {
327
-      background-color: $color-bg;
328
-      i {
329
-        color: $color-text-normal;
330
-      }
331
-      span {
332
-        color: $color-text-normal;
333
-      }
334
-    }
335
-    i {
336
-      font-size: 36px;
337
-      color: $color-text-sub;
338
-    }
339
-    span {
340
-      font-size: 12px;
341
-      margin-top: 10px;
342
-      color: $color-text-sub;
343
-    }
344
-  }
345
-  // footer
346
-  .page-login--content-footer {
347
-    // padding: 1em 0;
348
-    .page-login--content-footer-locales {
349
-      padding: 0px;
350
-      margin: 0px;
351
-      margin-bottom: 15px;
352
-      font-size: 12px;
353
-      line-height: 12px;
354
-      text-align: center;
355
-      color: $color-text-normal;
356
-      a {
357
-        color: $color-text-normal;
358
-        margin: 0 .5em;
359
-        &:hover {
360
-          color: $color-text-main;
361
-        }
362
-      }
363
-    }
364
-    .page-login--content-footer-copyright {
365
-      padding: 0px;
366
-      margin: 0px;
367
-      margin-bottom: 10px;
368
-      font-size: 12px;
369
-      line-height: 12px;
370
-      text-align: center;
371
-      color: $color-text-normal;
372
-      a {
373
-        color: $color-text-normal;
374
-      }
375
-    }
376
-    .page-login--content-footer-options {
377
-      padding: 0px;
378
-      margin: 0px;
379
-      font-size: 12px;
380
-      line-height: 12px;
381
-      text-align: center;
382
-      a {
383
-        color: $color-text-normal;
384
-        margin: 0 1em;
385
-      }
386
-    }
387
-  }
388
-  // 背景
389
-  .circles {
390
-    position: absolute;
391
-    top: 0;
392
-    left: 0;
393
-    width: 100%;
394
-    height: 100%;
395
-    overflow: hidden;
396
-    margin: 0px;
397
-    padding: 0px;
398
-    // li {
399
-    //   position: absolute;
400
-    //   display: block;
401
-    //   list-style: none;
402
-    //   width: 20px;
403
-    //   height: 20px;
404
-    //   background: #FFF;
405
-    //   animation: animate 25s linear infinite;
406
-    //   bottom: -200px;
407
-    //   @keyframes animate {
408
-    //     0%{
409
-    //       transform: translateY(0) rotate(0deg);
410
-    //       opacity: 1;
411
-    //       border-radius: 0;
412
-    //     }
413
-    //     100%{
414
-    //       transform: translateY(-1000px) rotate(720deg);
415
-    //       opacity: 0;
416
-    //       border-radius: 50%;
417
-    //     }
418
-    //   }
419
-    //   &:nth-child(1) {
420
-    //     left: 15%;
421
-    //     width: 80px;
422
-    //     height: 80px;
423
-    //     animation-delay: 0s;
424
-    //   }
425
-    //   &:nth-child(2) {
426
-    //     left: 5%;
427
-    //     width: 20px;
428
-    //     height: 20px;
429
-    //     animation-delay: 2s;
430
-    //     animation-duration: 12s;
431
-    //   }
432
-    //   &:nth-child(3) {
433
-    //     left: 70%;
434
-    //     width: 20px;
435
-    //     height: 20px;
436
-    //     animation-delay: 4s;
437
-    //   }
438
-    //   &:nth-child(4) {
439
-    //     left: 40%;
440
-    //     width: 60px;
441
-    //     height: 60px;
442
-    //     animation-delay: 0s;
443
-    //     animation-duration: 18s;
444
-    //   }
445
-    //   &:nth-child(5) {
446
-    //     left: 65%;
447
-    //     width: 20px;
448
-    //     height: 20px;
449
-    //     animation-delay: 0s;
450
-    //   }
451
-    //   &:nth-child(6) {
452
-    //     left: 75%;
453
-    //     width: 150px;
454
-    //     height: 150px;
455
-    //     animation-delay: 3s;
456
-    //   }
457
-    //   &:nth-child(7) {
458
-    //     left: 35%;
459
-    //     width: 200px;
460
-    //     height: 200px;
461
-    //     animation-delay: 7s;
462
-    //   }
463
-    //   &:nth-child(8) {
464
-    //     left: 50%;
465
-    //     width: 25px;
466
-    //     height: 25px;
467
-    //     animation-delay: 15s;
468
-    //     animation-duration: 45s;
469
-    //   }
470
-    //   &:nth-child(9) {
471
-    //     left: 20%;
472
-    //     width: 15px;
473
-    //     height: 15px;
474
-    //     animation-delay: 2s;
475
-    //     animation-duration: 35s;
476
-    //   }
477
-    //   &:nth-child(10) {
478
-    //     left: 85%;
479
-    //     width: 150px;
480
-    //     height: 150px;
481
-    //     animation-delay: 0s;
482
-    //     animation-duration: 11s;
483
-    //   }
484
-    // }
485
-  }
486
-}
487
-</style>

File diff suppressed because it is too large
+ 0 - 1678
src/views/system/visualized/index copy1.vue


+ 3 - 1
src/views/system/visualized/index-click.vue

@@ -693,6 +693,8 @@ export default {
693 693
       this.getPointList();
694 694
     },
695 695
     connect() {
696
+      let randomNumber = window.crypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000;
697
+
696 698
       let options = {
697 699
         //本地
698 700
         username: "admin",
@@ -705,7 +707,7 @@ export default {
705 707
         // password: "admin@2Ld&DDrsk",
706 708
         cleanSession: true,
707 709
         keepAlive: 60,
708
-        clientId: "mqttjs_" + Math.random().toString(16).substr(2, 8),
710
+        clientId: "mqttjs_" + randomNumber.toString(16).substr(2, 8),
709 711
         connectTimeout: 4000,
710 712
       };
711 713
       //本地开发环境

+ 3 - 1
src/views/system/visualized/index-hover.vue

@@ -401,6 +401,8 @@ export default {
401 401
       this.getPointList();
402 402
     },
403 403
     connect() {
404
+      let randomNumber = window.crypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000;
405
+
404 406
       let options = {
405 407
      //本地
406 408
         username: "admin",
@@ -413,7 +415,7 @@ export default {
413 415
         // password: "admin@2Ld&DDrsk",
414 416
         cleanSession: true,
415 417
         keepAlive: 60,
416
-        clientId: "mqttjs_" + Math.random().toString(16).substr(2, 8),
418
+        clientId: "mqttjs_" + randomNumber.toString(16).substr(2, 8),
417 419
         connectTimeout: 4000,
418 420
       };
419 421
      //本地开发环境

+ 3 - 1
src/views/system/visualized/index.vue

@@ -440,6 +440,8 @@ export default {
440 440
       this.$refs.tempWetChange.getTempWet(this.cfCode)
441 441
     },
442 442
     connect() {
443
+      let randomNumber = window.crypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000;
444
+
443 445
       let options = {
444 446
         //本地
445 447
         // username: "admin",
@@ -452,7 +454,7 @@ export default {
452 454
         // password: "admin@2Ld&DDrsk",
453 455
         cleanSession: true,
454 456
         keepAlive: 60,
455
-        clientId: "mqttjs_" + Math.random().toString(16).substr(2, 8),
457
+        clientId: "mqttjs_" + randomNumber.toString(16).substr(2, 8),
456 458
         connectTimeout: 4000,
457 459
       };
458 460
       //本地开发环境