fix: 修改uuid不重复问题

feature/uuid-0609-ch
ch 2 years ago
parent ff49fedd42
commit af06861fc9

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-05-03 22:14:16 * @Date: 2022-05-03 22:14:16
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-01 09:36:44 * @LastEditTime: 2022-06-10 10:26:51
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -104,7 +104,6 @@ export default {
location : AD_LOCATION.HOME_BANNER location : AD_LOCATION.HOME_BANNER
}); });
bannerList = bannerList || []; bannerList = bannerList || [];
console.log('bannerList', bannerList);
return { return {

@ -4,13 +4,18 @@
* @Author: ch * @Author: ch
* @Date: 2022-05-03 23:04:45 * @Date: 2022-05-03 23:04:45
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-09 19:21:46 * @LastEditTime: 2022-06-10 11:01:12
* @Description: file content * @Description: file content
*/ */
let axios = null;
import { UUID_KEY } from "@/constants";
import { CreatUuid } from "@/plugins/utils"; import { CreatUuid } from "@/plugins/utils";
let axios = null
export default function ({ app, $axios, store, req }) { export default function ({ app, $axios, store, req }) {
let uuid = store.state.uuid; let uuid = store.state.uuid;
if (!uuid && req.headers.cookie) {
uuid = req.headers.cookie.split(';').find(i => i.includes(UUID_KEY));
uuid = uuid.replace(`${UUID_KEY}=`,'')
}
if (!uuid) { if (!uuid) {
uuid = CreatUuid(16, 2); uuid = CreatUuid(16, 2);
store.commit('setUUID', uuid); store.commit('setUUID', uuid);

@ -2,14 +2,19 @@
* @Author: ch * @Author: ch
* @Date: 2022-05-04 17:11:07 * @Date: 2022-05-04 17:11:07
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-09 19:22:06 * @LastEditTime: 2022-06-10 11:01:21
* @Description: file content * @Description: file content
*/ */
import { CreatUuid } from "@/plugins/utils"; import { CreatUuid } from "@/plugins/utils";
import { UUID_KEY } from "@/constants";
let axiosTk = null; let axiosTk = null;
export default function ({$axios, store, route}, inject) { export default function ({$axios, store, route, req}, inject) {
const $axiosTk = $axios.create(); const $axiosTk = $axios.create();
let uuid = store.state.uuid; let uuid = store.state.uuid;
if (!uuid && req.headers.cookie) {
uuid = req.headers.cookie.split(';').find(i => i.includes(UUID_KEY));
uuid = uuid.replace(`${UUID_KEY}=`,'')
}
if (!uuid) { if (!uuid) {
uuid = CreatUuid(16, 2); uuid = CreatUuid(16, 2);
store.commit('setUUID', uuid); store.commit('setUUID', uuid);

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-05-04 20:35:20 * @Date: 2022-05-04 20:35:20
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-10 10:03:32 * @LastEditTime: 2022-06-10 10:56:09
* @Description: file content * @Description: file content
*/ */
import { TOKEN_KEY,UUID_KEY } from "@/constants"; import { TOKEN_KEY,UUID_KEY } from "@/constants";

Loading…
Cancel
Save