Compare commits
1 Commits
main
...
feature/yo
Author | SHA1 | Date |
---|---|---|
ch | c3b3502e95 | 2 years ago |
@ -1,97 +1,98 @@
|
||||
/*
|
||||
* @Author: ch
|
||||
* @Date: 2022-05-03 22:14:16
|
||||
* @LastEditors: ch
|
||||
* @LastEditTime: 2022-07-15 11:39:08
|
||||
* @LastEditors: ch cwl_ch@163.com
|
||||
* @LastEditTime: 2022-08-03 15:30:44
|
||||
* @Description: file content
|
||||
*/
|
||||
export default {
|
||||
// Global page headers: https://go.nuxtjs.dev/config-head
|
||||
head: {
|
||||
title: '马士兵严选',
|
||||
htmlAttrs: {
|
||||
lang: 'zh'
|
||||
},
|
||||
meta: [
|
||||
{ charset: 'utf-8' },
|
||||
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
||||
{ hid: 'description', name: 'description', content: '' },
|
||||
{ name: 'format-detection', content: 'telephone=no' }
|
||||
],
|
||||
link: [
|
||||
{ rel: 'icon', type: 'image/x-icon', href: '/logo.ico' }
|
||||
]
|
||||
},
|
||||
router: {
|
||||
extendRoutes(routes, resolve) {
|
||||
routes.push({
|
||||
name: 'custom',
|
||||
path: '/',
|
||||
component: resolve(__dirname, 'pages/index/index.vue')
|
||||
})
|
||||
},
|
||||
middleware: ['redirect']
|
||||
},
|
||||
srcDir: "src/",
|
||||
dir: {
|
||||
layouts: "pages/layouts",
|
||||
static: "assets/static",
|
||||
middleware: "common/middleware",
|
||||
store: "common/store",
|
||||
},
|
||||
// Global page headers: https://go.nuxtjs.dev/config-head
|
||||
head: {
|
||||
title: "马士兵严选",
|
||||
htmlAttrs: {
|
||||
lang: "zh",
|
||||
},
|
||||
meta: [
|
||||
{ charset: "utf-8" },
|
||||
{ name: "viewport", content: "width=device-width, initial-scale=1" },
|
||||
{ hid: "description", name: "description", content: "" },
|
||||
{ name: "format-detection", content: "telephone=no" },
|
||||
],
|
||||
link: [{ rel: "icon", type: "image/x-icon", href: "/logo.ico" }],
|
||||
},
|
||||
router: {
|
||||
extendRoutes(routes, resolve) {
|
||||
routes.push({
|
||||
name: "custom",
|
||||
path: "/",
|
||||
component: resolve(__dirname, "src/pages/index/index.vue"),
|
||||
});
|
||||
},
|
||||
middleware: ["redirect"],
|
||||
},
|
||||
|
||||
// Global CSS: https://go.nuxtjs.dev/config-css
|
||||
css: [
|
||||
'@assets/scss/global.scss',
|
||||
'element-ui/lib/theme-chalk/index.css'
|
||||
],
|
||||
// Global CSS: https://go.nuxtjs.dev/config-css
|
||||
css: ["@/assets/scss/global.scss", "element-ui/lib/theme-chalk/index.css"],
|
||||
|
||||
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
|
||||
plugins: [
|
||||
'@/plugins/element-ui',
|
||||
'@/plugins/axios',
|
||||
'@/plugins/axiosTk.js',
|
||||
'@plugins/vue-inject.js',
|
||||
'@/plugins/v-distpicker',
|
||||
'@/plugins/router',
|
||||
'@/plugins/im',
|
||||
'@/plugins/chat'
|
||||
],
|
||||
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
|
||||
plugins: [
|
||||
"@/common/plugins/element-ui",
|
||||
"@/common/plugins/axios",
|
||||
"@/common/plugins/axiosTk.js",
|
||||
"@/common/plugins/vue-inject.js",
|
||||
"@/common/plugins/v-distpicker",
|
||||
"@/common/plugins/router",
|
||||
"@/common/plugins/im",
|
||||
"@/common/plugins/chat",
|
||||
],
|
||||
|
||||
// Auto import components: https://go.nuxtjs.dev/config-components
|
||||
components: true,
|
||||
// Auto import components: https://go.nuxtjs.dev/config-components
|
||||
components: true,
|
||||
|
||||
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
|
||||
buildModules: [
|
||||
],
|
||||
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
|
||||
buildModules: [],
|
||||
|
||||
build: {
|
||||
vendor: ['v-distpicker']
|
||||
vendor: ["v-distpicker"],
|
||||
},
|
||||
|
||||
styleResources: {
|
||||
scss: '@/assets/scss/global.scss'
|
||||
},
|
||||
styleResources: {
|
||||
scss: "@/assets/scss/global.scss",
|
||||
},
|
||||
|
||||
// Modules: https://go.nuxtjs.dev/config-modules
|
||||
modules: [
|
||||
'@nuxtjs/axios',
|
||||
'cookie-universal-nuxt',
|
||||
'@nuxtjs/style-resources'
|
||||
],
|
||||
// Modules: https://go.nuxtjs.dev/config-modules
|
||||
modules: [
|
||||
"@nuxtjs/axios",
|
||||
"cookie-universal-nuxt",
|
||||
"@nuxtjs/style-resources",
|
||||
],
|
||||
|
||||
// Build Configuration: https://go.nuxtjs.dev/config-build
|
||||
build: {
|
||||
transpile: [/^element-ui/],
|
||||
},
|
||||
axios: {
|
||||
// 表示开启代理
|
||||
// proxy: true,
|
||||
},
|
||||
proxy: {
|
||||
// '/mall/': {
|
||||
// target: 'https://you-gateway.mashibing.com/', // 目标接口域名
|
||||
// // target: 'https://k8s-horse-gateway.mashibing.cn/', // 目标接口域名
|
||||
// pathRewrite: {
|
||||
// changeOrigin: true, // 表示是否跨域
|
||||
// },
|
||||
// },
|
||||
},
|
||||
server: {
|
||||
port: 3000,
|
||||
host: '0.0.0.0'
|
||||
},
|
||||
}
|
||||
// Build Configuration: https://go.nuxtjs.dev/config-build
|
||||
build: {
|
||||
transpile: [/^element-ui/],
|
||||
},
|
||||
axios: {
|
||||
// 表示开启代理
|
||||
// proxy: true,
|
||||
},
|
||||
proxy: {
|
||||
// '/mall/': {
|
||||
// target: 'https://you-gateway.mashibing.com/', // 目标接口域名
|
||||
// // target: 'https://k8s-horse-gateway.mashibing.cn/', // 目标接口域名
|
||||
// pathRewrite: {
|
||||
// changeOrigin: true, // 表示是否跨域
|
||||
// },
|
||||
// },
|
||||
},
|
||||
server: {
|
||||
port: 3000,
|
||||
host: "0.0.0.0",
|
||||
},
|
||||
};
|
||||
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* @Author: ch
|
||||
* @Date: 2022-05-04 18:24:03
|
||||
* @LastEditors: ch
|
||||
* @LastEditTime: 2022-05-07 10:27:01
|
||||
* @Description: file content
|
||||
*/
|
||||
import {axiosTk} from "../axiosTk";
|
||||
import {axios} from "../axios";
|
||||
import { ToAsyncAwait } from "../utils";
|
||||
import ENV from '../config/env';
|
||||
|
||||
const BASE_URL = `${ENV.base_url}/uc`;
|
||||
|
||||
/**
|
||||
* 获取当前登录用户信息
|
||||
*/
|
||||
export const ApiGetCurrentUser = () =>
|
||||
ToAsyncAwait(axiosTk.get(`${BASE_URL}/user/current`));
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
* @param {*} data
|
||||
*/
|
||||
export const ApiPutUser = (data) =>
|
||||
ToAsyncAwait(axiosTk.put(`${BASE_URL}/user/`, data));
|
||||
|
||||
|
||||
/**
|
||||
* 登录
|
||||
* @param {*} data
|
||||
*/
|
||||
export const ApiPostLogin = (data) => ToAsyncAwait(axios.post(`${BASE_URL}/user/login`, data));
|
||||
/**
|
||||
* 退出登录
|
||||
*/
|
||||
export const ApiPostLogout = () => ToAsyncAwait(axiosTk.get(`${BASE_URL}/user/logout`));
|
||||
/**
|
||||
* 获取手机验证码
|
||||
* @param {*} params
|
||||
*/
|
||||
export const ApiGetCode = (params) => ToAsyncAwait(axios.get(`${BASE_URL}/user/login/verificationCode`, { params }));
|
||||
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* @Author: ch
|
||||
* @Date: 2022-05-31 11:17:38
|
||||
* @LastEditors: ch
|
||||
* @LastEditTime: 2022-06-01 15:53:53
|
||||
* @Description: file content
|
||||
*/
|
||||
|
||||
import {ToAsyncAwait} from '@/plugins/utils';
|
||||
import { AD_PLATFORM } from '../dicts/ad';
|
||||
import {axios} from "../axios";
|
||||
import ENV from '../config/env';
|
||||
|
||||
const BASE_URL = `${ENV.base_url}/mall/marketing`;
|
||||
|
||||
// 获取广告列表
|
||||
export const ApiGetAdList = (params) => ToAsyncAwait(axios.get(`${BASE_URL}/app/advertisement`, {
|
||||
params: {
|
||||
platform : AD_PLATFORM.PC,
|
||||
...params
|
||||
}
|
||||
}))
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* @Author: ch
|
||||
* @Date: 2022-05-04 18:24:03
|
||||
* @LastEditors: ch
|
||||
* @LastEditTime: 2022-05-07 10:28:22
|
||||
* @Description: file content
|
||||
*/
|
||||
import {axiosTk} from "../axiosTk";
|
||||
import { ToAsyncAwait } from "../utils";
|
||||
import ENV from '../config/env';
|
||||
|
||||
const BASE_URL = `${ENV.base_url}/mall/base`;
|
||||
|
||||
|
||||
/**
|
||||
* 获取收货地址
|
||||
*/
|
||||
export const ApiGetAddress = () =>
|
||||
ToAsyncAwait(axiosTk.get(`${BASE_URL}/receiveAddress`));
|
||||
/**
|
||||
* 新增收货地址
|
||||
*/
|
||||
export const ApiPostAddress = (data) =>
|
||||
ToAsyncAwait(axiosTk.post(`${BASE_URL}/receiveAddress`, data));
|
||||
/**
|
||||
* 收货地址修改
|
||||
*/
|
||||
export const ApiPutAddress = (data) =>
|
||||
ToAsyncAwait(axiosTk.put(`${BASE_URL}/receiveAddress`, data));
|
||||
/**
|
||||
* 收货删除
|
||||
*/
|
||||
export const ApiDeleteAddress = (data) =>
|
||||
ToAsyncAwait(axiosTk.delete(`${BASE_URL}/receiveAddress?idList=${data.idList}`));
|
@ -1,38 +0,0 @@
|
||||
/*
|
||||
* @Author: ch
|
||||
* @Date: 2022-05-04 18:24:03
|
||||
* @LastEditors: ch
|
||||
* @LastEditTime: 2022-05-07 10:29:08
|
||||
* @Description: file content
|
||||
*/
|
||||
import {axiosTk} from "../axiosTk";
|
||||
import { ToAsyncAwait } from "../utils";
|
||||
import ENV from '../config/env';
|
||||
|
||||
const BASE_URL = `${ENV.base_url}/mall/product`;
|
||||
|
||||
|
||||
/**
|
||||
* 设置购物车数量
|
||||
* @param {id,number} data
|
||||
*/
|
||||
export const ApiPutCartNum = (data) =>
|
||||
ToAsyncAwait(axiosTk.put(`${BASE_URL}/shoppingCart/number`, data));
|
||||
|
||||
/**
|
||||
* 往购物车中添加商品
|
||||
* @param {prodcutId, productSkuId, number} data
|
||||
*/
|
||||
export const ApiPutAddCart = (data) =>
|
||||
ToAsyncAwait(axiosTk.put(`${BASE_URL}/shoppingCart/increase`, data));
|
||||
/**
|
||||
* 删除购物车中的商品
|
||||
* @param {idList} data
|
||||
*/
|
||||
export const ApiDeleteCartGoods = (data) =>
|
||||
ToAsyncAwait(axiosTk.delete(`${BASE_URL}/shoppingCart?idList=${data.idList}`, data));
|
||||
/**
|
||||
* 获取购物车列表
|
||||
*/
|
||||
export const ApiGetCartList = () =>
|
||||
ToAsyncAwait(axiosTk.get(`${BASE_URL}/shoppingCart`));
|
@ -1,86 +0,0 @@
|
||||
/*
|
||||
* @Author: ch
|
||||
* @Date: 2022-06-20 11:38:48
|
||||
* @LastEditors: ch
|
||||
* @LastEditTime: 2022-06-30 11:48:53
|
||||
* @Description: file content
|
||||
*/
|
||||
|
||||
import {axiosTk} from "../axiosTk";
|
||||
import {axios} from "../axios";
|
||||
import { ToAsyncAwait } from "../utils";
|
||||
import ENV from '../config/env';
|
||||
|
||||
const BASE_URL = `${ENV.base_url}/mall/comment`;
|
||||
|
||||
/**
|
||||
* 根据商品获取评论列表未
|
||||
* @param {*} param0
|
||||
*/
|
||||
export const ApiGetCommentList = (params) =>
|
||||
ToAsyncAwait(axiosTk.get(`${BASE_URL}/app/comment`, {
|
||||
params,
|
||||
headers: {
|
||||
notVerifyToken : true
|
||||
}
|
||||
}));
|
||||
|
||||
/**
|
||||
* 根据商品获取评论总数
|
||||
* @param {*} param0
|
||||
*/
|
||||
export const ApiGetCommentCount = ({productId}) =>
|
||||
ToAsyncAwait(axiosTk.get(`${BASE_URL}/app/comment/getAllCommentCountByProductId/${productId}`,{
|
||||
headers: {
|
||||
notVerifyToken : true
|
||||
}
|
||||
}));
|
||||
/**
|
||||
* 根据商品获取标签评论总数
|
||||
* @param {*} param0
|
||||
*/
|
||||
export const ApiGetCommentTabCount = ({productId}) =>
|
||||
ToAsyncAwait(axiosTk.get(`${BASE_URL}/app/comment/listCommentLabel/${productId}`,{
|
||||
headers: {
|
||||
notVerifyToken : true
|
||||
}
|
||||
}));
|
||||
/**
|
||||
* 获取订单评论详情
|
||||
* @param {*} param0
|
||||
*/
|
||||
export const ApiGetOrderCommentDetail = ({orderId}) =>
|
||||
ToAsyncAwait(axiosTk.get(`${BASE_URL}/app/comment/listOrderCommentByOrderId/${orderId}`));
|
||||
/**
|
||||
* 获取商品满意度
|
||||
* @param {*} param0
|
||||
*/
|
||||
export const ApiGetProductSatisfaction = ({productId}) =>
|
||||
ToAsyncAwait(axios.get(`${BASE_URL}/app/comment/getProductSatisfaction/${productId}`));
|
||||
/**
|
||||
* 获取评论详情
|
||||
* @param {*} param0
|
||||
*/
|
||||
export const ApiGetCommentDetail = ({commentId}) =>
|
||||
ToAsyncAwait(axiosTk.get(`${BASE_URL}/app/comment/getCommentDetail/${commentId}`, {
|
||||
headers: {
|
||||
notVerifyToken : true
|
||||
}
|
||||
}));
|
||||
/**
|
||||
* 新增评论
|
||||
* @param {*} param0
|
||||
*/
|
||||
export const ApiPostComment = (data) =>
|
||||
ToAsyncAwait(axiosTk.post(`${BASE_URL}/app/comment`, data));
|
||||
|
||||
|
||||
/**
|
||||
* 更新评论有用数
|
||||
* @param {*} param0
|
||||
*/
|
||||
export const ApiPutCommentUseful = (data) =>
|
||||
ToAsyncAwait(axiosTk.put(`${BASE_URL}/app/comment/updateUsefulCount`, data));
|
||||
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* @Author: ch
|
||||
* @Date: 2022-06-12 14:06:01
|
||||
* @LastEditors: ch
|
||||
* @LastEditTime: 2022-06-14 21:14:54
|
||||
* @Description: file content
|
||||
*/
|
||||
|
||||
import {axiosTk} from "../axiosTk";
|
||||
import { ToAsyncAwait } from "../utils";
|
||||
import ENV from '../config/env';
|
||||
const BASE_URL = `${ENV.base_url}/mall/im`;
|
||||
|
||||
/**
|
||||
* 获取soket登录秘钥
|
||||
*/
|
||||
export const ApiGetSoketTicket = () => ToAsyncAwait(axiosTk.get(`${BASE_URL}/ticket`, {
|
||||
params: {
|
||||
ticketType: 'CONNECT_TICKET'
|
||||
}
|
||||
}));
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* @Author: ch
|
||||
* @Date: 2022-05-04 18:24:03
|
||||
* @LastEditors: ch
|
||||
* @LastEditTime: 2022-05-07 10:30:17
|
||||
* @Description: file content
|
||||
*/
|
||||
import {axiosTk} from "../axiosTk";
|
||||
import { ToAsyncAwait } from "../utils";
|
||||
import ENV from '../config/env';
|
||||
|
||||
const BASE_URL = `${ENV.base_url}/oss/oss`;
|
||||
|
||||
/**
|
||||
* 获取OOS信息
|
||||
* @param {*} data
|
||||
*/
|
||||
export const ApiPostGetOssConfig = (data) =>
|
||||
ToAsyncAwait(axiosTk.post(`${BASE_URL}/generateOssSignature`, data));
|
||||
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* @Author: ch
|
||||
* @Date: 2022-05-08 00:44:22
|
||||
* @LastEditors: ch
|
||||
* @LastEditTime: 2022-06-29 14:51:00
|
||||
* @Description: file content
|
||||
*/
|
||||
|
||||
|
||||
import {axiosTk} from "../axiosTk";
|
||||
import {ToAsyncAwait} from "@/plugins/utils";
|
||||
import ENV from '../config/env';
|
||||
|
||||
const BASE_URL = `${ENV.base_url}/mall/trade`;
|
||||
/**
|
||||
* 获取微信支付二维码
|
||||
* @param {*} data
|
||||
*/
|
||||
export const ApiPostWxPayCdoeImg = (data) =>
|
||||
ToAsyncAwait(axiosTk.post(`${BASE_URL}/payCenter/wxPay/nativeData`, data));
|
||||
/**
|
||||
* 获取支付宝支付二维码
|
||||
* @param {*} data
|
||||
*/
|
||||
export const ApiPostAliPayCdoeImg = (data) =>
|
||||
ToAsyncAwait(axiosTk.post(`${BASE_URL}/payCenter/aliPay/qr`, data));
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* @Author: ch
|
||||
* @Date: 2022-05-04 18:24:03
|
||||
* @LastEditors: ch
|
||||
* @LastEditTime: 2022-05-07 10:30:28
|
||||
* @Description: file content
|
||||
*/
|
||||
import {axios} from "../axios";
|
||||
import { ToAsyncAwait } from "../utils";
|
||||
import ENV from '../config/env';
|
||||
|
||||
const BASE_URL = `${ENV.base_url}/mall/marketing`;
|
||||
|
||||
export const ApiGetHomeSeckill = () =>
|
||||
ToAsyncAwait(axios.get(`${BASE_URL}/app/activity/home`));
|
||||
|
||||
/**
|
||||
* 获取当天秒杀时段
|
||||
*/
|
||||
export const ApiGetSeckillTimes = () =>
|
||||
ToAsyncAwait(axios.get(`${BASE_URL}/app/activity/time`));
|
||||
/**
|
||||
* 获取当天秒杀时段
|
||||
*/
|
||||
export const ApiGetSeckillGoods = (params) =>
|
||||
ToAsyncAwait(axios.get(`${BASE_URL}/app/activity/product`, { params }));
|
||||
|
||||
/**
|
||||
* 获取当前服务器时间
|
||||
*/
|
||||
export const ApiGetCurrentTime = () =>
|
||||
ToAsyncAwait(axios.get(`${BASE_URL}/app/activity/timestamp`));
|
||||
|
@ -1,43 +0,0 @@
|
||||
|
||||
|
||||
/*
|
||||
* @Author: ch
|
||||
* @Date: 2022-05-03 23:04:45
|
||||
* @LastEditors: ch
|
||||
* @LastEditTime: 2022-06-12 14:35:43
|
||||
* @Description: file content
|
||||
*/
|
||||
let axios = null;
|
||||
import { UUID_KEY } from "@/constants";
|
||||
import { CreateUUID } from "@/plugins/utils";
|
||||
export default function ({ app, $axios, store, req }) {
|
||||
let uuid = store.state.uuid;
|
||||
if (!uuid && req.headers.cookie) {
|
||||
uuid = req.headers.cookie.split(';').find(i => i.includes(UUID_KEY));
|
||||
uuid = uuid && uuid.replace(`${UUID_KEY}=`,'')
|
||||
}
|
||||
if (!uuid) {
|
||||
uuid = CreateUUID(16, 2);
|
||||
store.commit('setUUID', uuid);
|
||||
}
|
||||
|
||||
$axios.onRequest( config =>{
|
||||
config.headers.uid = uuid;
|
||||
return config;
|
||||
});
|
||||
|
||||
$axios.onResponse(response => {
|
||||
const result = response.data;
|
||||
if(response.status === 200){
|
||||
if(result.code === 'SUCCESS'){
|
||||
return result.data;
|
||||
}
|
||||
return Promise.reject(result);
|
||||
}
|
||||
return Promise.reject({message:'请求出错'});
|
||||
|
||||
});
|
||||
$axios.defaults.timeout = 3000;
|
||||
axios = $axios;
|
||||
}
|
||||
export { axios }
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* @Author: ch
|
||||
* @Date: 2022-05-04 17:11:07
|
||||
* @LastEditors: ch
|
||||
* @LastEditTime: 2022-06-29 16:01:55
|
||||
* @Description: file content
|
||||
*/
|
||||
import { CreateUUID } from "@/plugins/utils";
|
||||
import { UUID_KEY } from "@/constants";
|
||||
let axiosTk = null;
|
||||
export default function ({$axios, store, route, req}, inject) {
|
||||
const $axiosTk = $axios.create();
|
||||
let uuid = store.state.uuid;
|
||||
if (!uuid && req.headers.cookie) {
|
||||
uuid = req.headers.cookie.split(';').find(i => i.includes(UUID_KEY));
|
||||
uuid = uuid && uuid.replace(`${UUID_KEY}=`,'')
|
||||
}
|
||||
if (!uuid) {
|
||||
uuid = CreateUUID(16, 2);
|
||||
store.commit('setUUID', uuid);
|
||||
}
|
||||
|
||||
$axiosTk.defaults.timeout = 3000;
|
||||
$axiosTk.onRequest( config =>{
|
||||
config.headers.uid = uuid;
|
||||
if(!store.state.token && !config.headers.notVerifyToken){
|
||||
location.href = '/';
|
||||
return Promise.reject({message : '要先登录才能操作哦~'});
|
||||
}
|
||||
|
||||
delete config.headers.notVerifyToken;
|
||||
config.headers.Authorization = store.state.token;
|
||||
return config;
|
||||
});
|
||||
$axiosTk.onResponse(response => {
|
||||
const result = response.data;
|
||||
if(response.status === 200){
|
||||
if(result.code === 'SUCCESS'){
|
||||
return result.data;
|
||||
}
|
||||
if(result.code === 'TOKEN_FAIL'){
|
||||
store.commit('setLoginOut');
|
||||
store.commit('setLoginVisible');
|
||||
}
|
||||
return Promise.reject(result);
|
||||
}
|
||||
return Promise.reject({message:'请求出错'});
|
||||
|
||||
});
|
||||
inject('$axiosTk', $axiosTk);
|
||||
axiosTk = $axiosTk;
|
||||
|
||||
}
|
||||
export {axiosTk}
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* @Author: ch
|
||||
* @Date: 2022-06-12 14:04:56
|
||||
* @LastEditors: ch
|
||||
* @LastEditTime: 2022-06-13 20:27:34
|
||||
* @Description: file content
|
||||
*/
|
||||
|
||||
import MsbIm from '@/plugins/msbIm' ;
|
||||
import { ToAsyncAwait, FormatJsonSearch } from './utils';
|
||||
import { ApiGetSoketTicket } from '@/plugins/api/im';
|
||||
import ENV from '@/plugins/config/env';
|
||||
const Im = new MsbIm({
|
||||
reconnect: true,
|
||||
});
|
||||
let ImInit = null;
|
||||
export default ({store }) => {
|
||||
ImInit = async () => {
|
||||
const { error, result } = await ApiGetSoketTicket();
|
||||
if (error) {
|
||||
return false;
|
||||
}
|
||||
const par = FormatJsonSearch({
|
||||
client: result.client,
|
||||
ticket: result.ticket,
|
||||
// 1普通用户 2客服链接
|
||||
connect: 1,
|
||||
user: store.state.userInfo.id,
|
||||
nickname: store.state.userInfo.nickname,
|
||||
avatar : store.state.userInfo.avatar
|
||||
})
|
||||
return await ToAsyncAwait(Im.init({
|
||||
url: `${ENV.imUrl}/ws${par}`
|
||||
}))
|
||||
|
||||
};
|
||||
|
||||
Im.interceptors.dataChangeAfter = () => {
|
||||
let data = Im.sessionData.find(i => {
|
||||
return (i.type === 4 && (typeof i.payload === 'string' ? JSON.parse(i.payload).type === 'system' : false));
|
||||
}) || {}
|
||||
let msgCount = data.unreadCount || 0;
|
||||
store.commit('setSocketMsgData', JSON.parse(JSON.stringify(data)));
|
||||
store.commit('setUnreadCount', msgCount);
|
||||
}
|
||||
|
||||
Im.interceptors.onClose = () => {
|
||||
Im.setSessionData([]);
|
||||
Im.setCurSessionId(null);
|
||||
store.commit('setSocketMsgData', {});
|
||||
store.commit('setUnreadCount', 0);
|
||||
}
|
||||
|
||||
}
|
||||
export {
|
||||
Im,
|
||||
ImInit
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
# ignore page inside ignore folder
|
||||
pages/**/moudles/**
|
||||
pages/layouts/moudles/**
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 756 B After Width: | Height: | Size: 756 B |
Before Width: | Height: | Size: 762 B After Width: | Height: | Size: 762 B |
Before Width: | Height: | Size: 850 B After Width: | Height: | Size: 850 B |
Before Width: | Height: | Size: 613 B After Width: | Height: | Size: 613 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 972 B After Width: | Height: | Size: 972 B |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 928 B After Width: | Height: | Size: 928 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 763 B After Width: | Height: | Size: 763 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 752 B After Width: | Height: | Size: 752 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 812 B After Width: | Height: | Size: 812 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 290 KiB After Width: | Height: | Size: 290 KiB |
Before Width: | Height: | Size: 150 KiB After Width: | Height: | Size: 150 KiB |
Before Width: | Height: | Size: 207 KiB After Width: | Height: | Size: 207 KiB |
Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 172 KiB |
Before Width: | Height: | Size: 219 KiB After Width: | Height: | Size: 219 KiB |
Before Width: | Height: | Size: 199 KiB After Width: | Height: | Size: 199 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 445 B After Width: | Height: | Size: 445 B |
Before Width: | Height: | Size: 445 B After Width: | Height: | Size: 445 B |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 375 B After Width: | Height: | Size: 375 B |
Before Width: | Height: | Size: 386 B After Width: | Height: | Size: 386 B |
Before Width: | Height: | Size: 386 B After Width: | Height: | Size: 386 B |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 904 B After Width: | Height: | Size: 904 B |
Before Width: | Height: | Size: 700 B After Width: | Height: | Size: 700 B |
Before Width: | Height: | Size: 689 B After Width: | Height: | Size: 689 B |
Before Width: | Height: | Size: 671 B After Width: | Height: | Size: 671 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 179 KiB After Width: | Height: | Size: 179 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 330 B After Width: | Height: | Size: 330 B |
Before Width: | Height: | Size: 653 B After Width: | Height: | Size: 653 B |
Before Width: | Height: | Size: 728 B After Width: | Height: | Size: 728 B |
Before Width: | Height: | Size: 369 B After Width: | Height: | Size: 369 B |
Before Width: | Height: | Size: 374 B After Width: | Height: | Size: 374 B |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 928 B After Width: | Height: | Size: 928 B |
Before Width: | Height: | Size: 375 B After Width: | Height: | Size: 375 B |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 134 B After Width: | Height: | Size: 134 B |
Before Width: | Height: | Size: 133 B After Width: | Height: | Size: 133 B |
Before Width: | Height: | Size: 135 B After Width: | Height: | Size: 135 B |
Before Width: | Height: | Size: 135 B After Width: | Height: | Size: 135 B |
Before Width: | Height: | Size: 540 B After Width: | Height: | Size: 540 B |
Before Width: | Height: | Size: 553 B After Width: | Height: | Size: 553 B |
Before Width: | Height: | Size: 215 KiB After Width: | Height: | Size: 215 KiB |
Before Width: | Height: | Size: 242 KiB After Width: | Height: | Size: 242 KiB |
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 358 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 661 B After Width: | Height: | Size: 661 B |
Before Width: | Height: | Size: 842 B After Width: | Height: | Size: 842 B |
Before Width: | Height: | Size: 841 B After Width: | Height: | Size: 841 B |
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |