作者 李芳银

第一次提交

正在显示 100 个修改的文件 包含 285 行增加0 行删除

要显示太多修改。

为保证性能只显示 100 of 100+ 个文件。

> 1%
last 2 versions
not dead
... ...
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
... ...
module.exports = {
root: true,
env: {
node: true
},
extends: [
'plugin:vue/essential',
// '@vue/standard'
],
parserOptions: {
parser: 'babel-eslint'
},
rules: {
"space-before-function-paren": 0,
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
},
globals: {
wx: true
},
}
... ...
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
... ...
module.exports = {
presets: [
["@vue/cli-plugin-babel/preset", {
useBuiltIns: "entry",
}]
]
}
... ...
此 diff 太大无法显示。
{
"name": "koudaishangcheng-pc",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "eslint --fix --ext .js,.vue src"
},
"dependencies": {
"axios": "^0.19.2",
"bignumber.js": "^9.0.0",
"core-js": "^3.6.4",
"element-ui": "^2.13.0",
"js-base64": "^3.5.2",
"json-bigint": "^0.3.0",
"qrcode2": "^1.2.3",
"qrcodejs2": "0.0.2",
"swiper": "^5.3.7",
"vue": "^2.6.11",
"vue-awesome-swiper": "^4.1.0",
"vue-clipboard2": "^0.3.1",
"vue-cropper": "^0.5.5",
"vue-lazyload": "^1.3.3",
"vue-quill-editor": "^3.0.6",
"vue-router": "^3.0.7",
"vue-video-player": "^5.0.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.3.0",
"@vue/cli-plugin-eslint": "^4.3.0",
"@vue/cli-service": "^4.3.0",
"@vue/eslint-config-standard": "^5.1.2",
"babel-eslint": "^10.1.0",
"babel-polyfill": "^6.26.0",
"compression-webpack-plugin": "^6.0.3",
"eslint": "^6.7.2",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^6.2.2",
"less": "^3.0.4",
"less-loader": "^5.0.0",
"lint-staged": "^9.5.0",
"vue-template-compiler": "^2.6.11",
"vuex": "^3.4.0",
"weixin-js-sdk": "^1.6.0"
},
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.{js,jsx,vue}": [
"vue-cli-service lint",
"git add"
]
}
}
... ...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<!-- <link rel="icon" href="<%= BASE_URL %>favicon.ico"> -->
<link rel="icon" href="<%= BASE_URL %>logo.png">
<title>口袋宇宙,专注英文教育的内容提供商</title>
<!-- <title><%= htmlWebpackPlugin.options.title %></title> -->
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
 <script src="https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>
</html>
\ No newline at end of file
... ...
<template>
<div id="app">
<!-- <keep-alive>
<router-view v-if="isRouterAlive"></router-view>
</keep-alive>-->
<keep-alive>
<router-view v-if="$route.meta.keepAlive"></router-view>
</keep-alive>
<router-view v-if="!$route.meta.keepAlive"></router-view>
</div>
</template>
<script>
export default {
provide() {
return {
reload: this.reload
};
},
data() {
return {
isRouterAlive: true,
};
},
meta: {
keepAlive: true,
},
created() {
this.IsPC()
var store = require('../src/store')
//在页面加载时读取sessionStorage里的状态信息
if (sessionStorage.getItem("store")) {
// this.$store.replaceState(Object.assign({}, this.$store.state, JSON.parse(sessionStorage.getItem("store"))))
}
// //在页面刷新时将vuex里的信息保存到sessionStorage里
window.addEventListener("beforeunload", () => {
// sessionStorage.setItem("store", JSON.stringify(this.$store.state))
})
},
mounted: function () {
},
methods: {
IsPC() {
var userAgentInfo = navigator.userAgent;
var Agents = ["Android", "iPhone",
"SymbianOS", "Windows Phone",
"iPad", "iPod"];
var flag = false;
for (var v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) != -1) {
// window.location.href = 'https://m.glaforteachers.com/'
flag = true;
// break;
}
}
if (flag) {
window.location.href = 'https://m.glaforteachers.com/'
}
return flag;
},
saveState() {
localStorage.setItem('KEY', JSON.stringify(this.$store.state.KEY))
},
reload() {
this.isRouterAlive = false;
this.$nextTick(function () {
this.isRouterAlive = true;
});
},
}
};
</script>
<style>
#app {
font-family: PingFang SC;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #0d1e2e;
overflow-y: hidden;
background-color: #fbf8fb;
}
.cropper-view-box img {
display: none !important;
}
</style>
... ...
// 导出一个配置好的axios提供给main挂载
import axios from 'axios'
import Vue from 'vue'
import local from '@/utils/local'
import router from '@/router'
import JSONBIG from 'json-bigint'
Vue.use(router)
axios.defaults.baseURL = 'https://glaforteachers.com/';
axios.defaults.transformResponse = [(data) => {
try {
return JSONBIG.parse(data)
} catch (e) {
return data
}
}]
// 请求拦截器
axios.interceptors.request.use(config => {
// 1. 获取token
const user = local.getUser() || {} // 这里得到的是一个字符串 是token 的字符串
// console.log("user", user)
config.headers.Authorization = `Bearer ${user}`
config.headers.token = user
return config;
}, err => {
return Promise.reject(err)
})
// 响应拦截器
axios.interceptors.response.use(res => {
if (res.data.code == 1) {
return Promise.resolve(res);
} else {
return Promise.reject(res);
}
}, err => {
console.log(err);
const status = err.response.status
// 2. 判断401
console.log(status);
if (status === 401) {
// this.$message.error('该页面登录后才可访问')
} else if (status === 404) {
router.push('/404')
} else if (err.response.code === 0) {
return router.replace('/404')
}
return Promise.reject(err)
})
export default axios
... ...