zydx-plus 1.35.565 → 1.35.566

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zydx-plus",
3
- "version": "1.35.565",
3
+ "version": "1.35.566",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -333,8 +333,34 @@ export default {
333
333
  sampleRate: 16000, // 采样率,支持 11025、16000、22050、24000、44100、48000,根据浏览器默认值,我的chrome是48000
334
334
  numChannels: 1, // 声道,支持 1 或 2, 默认是1
335
335
  })
336
- const token = await this.getAccessToken('ai')
337
- this.token = token.data.data
336
+ const ais = this.getCookie('aiToken');
337
+ if(ais) {
338
+ this.token = ais
339
+ }else {
340
+ const token = await this.getAccessToken('ai')
341
+ this.setCookie('aiToken', token.data.data, 60)
342
+ this.token = token.data.data
343
+ }
344
+ },
345
+ setCookie(name, value, minutes) {
346
+ let now = new Date();
347
+ now.setMinutes(now.getMinutes() + minutes);
348
+ document.cookie = name + '=' + value + ';expires=' + now.toUTCString();
349
+ },
350
+ getCookie(cname) {
351
+ let name = cname + "=";
352
+ let decodedCookie = decodeURIComponent(document.cookie);
353
+ let ca = decodedCookie.split(';');
354
+ for(let i = 0; i < ca.length; i++) {
355
+ let c = ca[i];
356
+ while (c.charAt(0) === ' ') {
357
+ c = c.substring(1);
358
+ }
359
+ if (c.indexOf(name) === 0) {
360
+ return c.substring(name.length, c.length);
361
+ }
362
+ }
363
+ return "";
338
364
  },
339
365
  async getAccessToken(v) {
340
366
  return axios({
package/src/index.js CHANGED
@@ -89,7 +89,7 @@ function install(app) {
89
89
  }
90
90
 
91
91
  export default {
92
- version: '1.35.565',
92
+ version: '1.35.566',
93
93
  install,
94
94
  Calendar,
95
95
  Message,