作者 陶霁轩

init

.vscode/
.idea/
node_modules
npm-debug.log
... ...
registry = https://registry.npm.taobao.org/
\ No newline at end of file
... ...
{
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid",
"bracketSpacing": true
}
\ No newline at end of file
... ...
## 项目名称
> vue2-mo
## 运行说明
- 安装依赖
```
npm i
```
- 本地运行(测试接口)
```
npm start
```
- 本地运行(正式接口)
```
npm test
```
- 构建(测试接口)
```
npm run build:test
```
- 构建(正式接口)
```
npm run build
```
## 适配相关
开发使用 px 即可,自动转化为 rem
### **modules/index.html**
最大响应宽度设置
### **postcss.config**
转化尺寸配置
## 配置相关
### **src/constants **
配置各个环境的常量,可自由添加
### **scripts/requests**
axios 请求封装,包括公共方法,api,上报等
### **scripts/utils**
工具函数
### **scripts/filters**
过滤器
... ...
/**
* @file babel 配置文件
*/
module.exports = {
plugins: ['@babel/plugin-syntax-dynamic-import'],
presets: [
[
'@babel/preset-env', {
'modules': false,
'useBuiltIns': 'usage'
}
]
]
}
\ No newline at end of file
... ...
Chrome >= 33
iOS >= 8
\ No newline at end of file
... ...
/**
* @file webpack 配置文件
*/
const path = require('path')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const { VueLoaderPlugin } = require('vue-loader')
const hashDigestLength = 6 // 文件名末尾 hash 值长度
/**
* webpack 配置项
* @param {Object} env - 环境对象
* @param {Object} argv - 命令行参数选项
* @param {String} argv.mode - 模式
*/
module.exports = function (env = {}, argv) {
let productionEnv = (!argv.host && argv.mode == 'production'); //生产环境下打包情况不一样,先清除旧的dist,部分文件的publicPath也不一样
let config = {
devtool: productionEnv ? '' : 'source-map',
resolve: {
alias: {
'@': path.resolve(__dirname, '../src'),
components: path.resolve(__dirname, '../src/components'),
images: path.resolve(__dirname, '../src/images'),
modules: path.resolve(__dirname, '../src/modules'),
scripts: path.resolve(__dirname, '../src/scripts'),
styles: path.resolve(__dirname, '../src/styles'),
}
},
entry: {
app: './src/scripts',
},
output: {
// filename: 'scripts/[name]_[chunkhash].js',
filename: 'scripts/[name].js',
hashDigestLength,
// path: path.resolve(__dirname, productionEnv ? '../../dist/m/' : '../dist/'),
path: path.resolve(__dirname, productionEnv ? '../dist/' : '../dist/'),
},
module: {
rules: [{
test: /\.(jpg|png|svg|gif)$/,
use: [{
loader: 'file-loader',
options: {
// name: `[name]_[hash:${hashDigestLength}].[ext]`,
name: `[name].[ext]`,
outputPath: 'images',
publicPath: productionEnv ? '/images/' : '/images/',
//https://inside.wx.luckyxp.com.cn/webup/data/User/wxtest/home/project/lls-m/dist/images/
}
}]
}, {
test: /\.(woff|ttf|woff2|eot)$/,
use: [
{
loader: 'file-loader',
options: {
outputPath: 'styles',
publicPath: './'
}
}
]
}, {
test: /\.(css|postcss)$/,
use: [{
loader: MiniCssExtractPlugin.loader
}, {
loader: 'css-loader',
options: {
importLoaders: 1
}
}, {
loader: 'postcss-loader',
}]
}, {
test: /\.js$/,
exclude: /node_modules/,
use: [{
loader: 'babel-loader'
}]
}, {
test: /\.vue$/,
use: [{
loader: 'vue-loader',
options: {
compilerOptions: {
preserveWhitespace: false
}
}
}]
}]
},
plugins: [
new VueLoaderPlugin(),
new MiniCssExtractPlugin({
filename: 'styles/[name]_[chunkhash].css'
// filename: 'styles/[name].css'
}),
new HtmlWebpackPlugin({
title: 'AFK Journey',
template: './src/index.html',
})
],
optimization: {
runtimeChunk: {
name: 'manifest'
},
splitChunks: {
chunks: 'all',
minChunks: 2
}
},
performance: {
hints: false
},
devServer: {
contentBase: path.join(__dirname, '../'),
disableHostCheck: true,
open: true,
host: 'localhost',
// host: '192.168.17.6',
// host: 'inside.wx.luckyxp.com.cn',
port: 8001,
proxy: {
}
}
}
config.plugins = config.plugins.concat([
// new CleanWebpackPlugin([productionEnv ? 'm' : 'dist'], {
// root: path.join(__dirname, productionEnv ? '../../dist/' : '../')
// }),
new CleanWebpackPlugin(['dist'], {
root: path.join(__dirname, '../')
}),
])
return config
}
... ...
此 diff 太大无法显示。
{
"name": "igame",
"version": "1.0.0",
"description": "igame",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --config build/webpack.config.js --mode=development --progress",
"test": "webpack-dev-server --config build/webpack.config.js --mode=production --progress",
"build:test": "webpack --config build/webpack.config.js --mode=development --progress",
"build": "webpack --config build/webpack.config.js --mode=production --progress"
},
"repository": {
"type": "git",
"url": ""
},
"author": "taojixuan",
"devDependencies": {
"@babel/core": "^7.3.4",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/preset-env": "^7.3.4",
"autoprefixer": "^9.4.9",
"axios": "^0.18.0",
"babel-loader": "^8.0.5",
"clean-webpack-plugin": "^1.0.1",
"css-loader": "^2.1.0",
"cssnano": "^4.1.10",
"file-loader": "^3.0.1",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.5.0",
"node-sass": "^7.0.1",
"postcss-import": "^12.0.1",
"postcss-loader": "^3.0.0",
"postcss-nested": "^4.1.2",
"sass-loader": "^13.0.2",
"style-loader": "^3.3.1",
"vue": "^2.6.10",
"vue-color": "^2.7.0",
"vue-loader": "^15.6.4",
"vue-router": "^3.0.2",
"vue-template-compiler": "^2.6.10",
"vuex": "^3.1.0",
"webpack": "^4.29.5",
"webpack-cli": "^3.2.3",
"webpack-dev-server": "^3.2.1"
},
"dependencies": {
"clipboard": "^2.0.11",
"core-js": "^2.5.7",
"postcss-px2rem": "^0.3.0",
"vant": "^2.12.50"
}
}
... ...
module.exports = {
plugins: [
require('postcss-import'),
require('postcss-nested'),
require('postcss-px2rem')({
'remUnit': 75
}),
require('autoprefixer'),
require('cssnano')({
preset: ['default', {
mergeLonghand: false,
}]
}),
]
}
\ No newline at end of file
... ...
<!DOCTYPE html>
<html lang="zh-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, viewport-fit=cover">
<title>
<%= htmlWebpackPlugin.options.title %>
</title>
<meta name="keywords"
content="afk journey,AFK,AFK2,RPG,RPGGAMES,MMORPG,FREEGAME,FARLIGHT,IDLE RPG,Strategy RPG,Gacha,Journey,Open World" />
<link rel="icon"
href="https://oss-resource.farlightgames.com/p/SDK/200000/0/100000/2023-04-23/D:/img/f92c62a9048640b522cdb0fd00eb379b.ico">
</head>
<body>
<div id="app"></div>
</body>
<style>
.grecaptcha-badge {
display: none !important;
opacity: 0;
}
</style>
<script>
(function (win) {
var doc = win.document;
var docEl = doc.documentElement;
var tid;
function refreshRem () {
var width = docEl.getBoundingClientRect().width;
if (width > 600) { // 最大宽度
width = 600;
}
var rem = width / 10;
docEl.style.fontSize = rem + 'px';
}
win.addEventListener('resize', function () {
clearTimeout(tid);
tid = setTimeout(refreshRem, 300);
}, false);
win.addEventListener('pageshow', function (e) {
if (e.persisted) {
clearTimeout(tid);
tid = setTimeout(refreshRem, 300);
}
}, false);
refreshRem();
})(window);
</script>
</html>
</html>
\ No newline at end of file
... ...
<template>
<router-view></router-view>
</template>
<script>
export default {
data() {
return {
};
},
methods: {
},
created() {
},
mounted() {
},
computed: {},
};
</script>
<style lang="postcss">
</style>
... ...
<template>
<div>not found</div>
</template>
... ...
.container {
width: 750px;
height: 4288px;
margin: auto;
background: url(../../images/bg.jpg) no-repeat top center/100% auto;
}
... ...
<template>
<div class="container">首页</div>
</template>
<script>
import Tracker from '@/scripts/tracker'
import { reqPublic } from 'scripts/requests/index.js'
import Clipboard from 'clipboard'
import { ALink, getParameterByName, getUrlSearchJson } from 'scripts/util'
import { URLS, ENV } from 'scripts/constants/index'
export default {
components: {},
data() {
return {}
},
computed: {},
methods: {},
created() {},
mounted() {},
watch: {},
}
</script>
<style lang="postcss" scoped>
@import './index.postcss';
</style>
... ...
<template>
<div class="root">
<transition name="el-fade-in" mode="out-in">
<router-view></router-view>
</transition>
</div>
</template>
<script>
export default {
data() {
return {}
},
methods: {
initMenu() {},
},
created() {},
mounted() {},
computed: {},
}
</script>
<style lang="postcss"></style>
... ...
/**
* @file 常量 - 环境
*/
const ENV = process.env.NODE_ENV === 'production' ? 'prod' : 'dev';
const HOSTNAME = process.env.NODE_ENV === 'production' ? 'https://game-reserve-api.farlightgames.com' : 'https://game-reserve-api-test.farlightgames.com';
const IOS_APPID = process.env.NODE_ENV === "production" ? "1628970855" : "1131944535";
const ANDROID_APPID = process.env.NODE_ENV === "production" ? "com.farlightgames.igame.gp" : "com.lilithgame.sgame.android.cn";
const IOS_LILITH_APPID = process.env.NODE_ENV === "production" ? "10013832" : "8876096";
const ANDROID_LILITH_APPID = process.env.NODE_ENV === "production" ? "10013832" : "5660453";
const FILTER_ID = process.env.NODE_ENV === "production" ? 85252 : 89032;
export default {
ENV,
HOSTNAME,
IOS_APPID,
ANDROID_APPID,
IOS_LILITH_APPID,
ANDROID_LILITH_APPID,
FILTER_ID
}
\ No newline at end of file
... ...
import ENV from './env'
import URLS from './urls'
export { ENV,URLS }
... ...
const kvUrl = 'https://oss-resource.farlightgames.com/p/SDK/200000/0/100000/2023-04-23/D:/video/7f42f378ea8a098ede28586170c4c056.mp4'
const videoUrl = 'https://oss-resource.farlightgames.com/p/SDK/200000/0/100000/2023-04-23/D:/video/b5f951cc9b914e98ea25dab668cfd1c6.mp4'
const mLink = process.env.NODE_ENV === 'production' ? 'https://afkjourney.farlightgames.com/m/index.html' : 'https://inside.wx.luckyxp.com.cn/webup/data/User/wxtest/home/project/lls-m/dist/index.html'
const pcLink = process.env.NODE_ENV === 'production' ? 'https://afkjourney.farlightgames.com/index.html' : 'https://inside.wx.luckyxp.com.cn/webup/data/User/wxtest/home/project/lls-pc/dist/index.html'
export default {
kvUrl,
videoUrl,
mLink,
pcLink
}
\ No newline at end of file
... ...
/**
* @file vue 全局过滤器
*/
import Vue from 'vue'
/**
* 时间格式化
* @param {Number|String} time - 时间戳或字符串
* @param {String} format - 时间格式:'YYYY-MM-DD hh:mm:ss'(默认值)
* @param {Boolean} simplify - 是否简化时间格式
*/
Vue.filter('adFormatTime', function (time, format = 'YYYY-MM-DD hh:mm:ss', simplify) {
if (typeof time == 'string' && time.indexOf('T') === -1) { //排除格林威治时间
time = time.replace(/-/g, '/')
}
if (String(time).length < 11) {
time += '000';
}
let date = new Date(Number(time));
// #region 简化时间格式,最多 7 天
if (simplify) {
let result = ''
let difference = Date.now() - date.getTime()
if (difference < 60000) {
result = '刚刚'
} else if (difference < 3600000) {
result = parseInt(difference / 60000) + ' 分钟前'
} else if (difference < 86400000) {
result = parseInt(difference / 3600000) + ' 小时前'
} else if (difference < 604800000) {
result = parseInt(difference / 86400000) + ' 天前'
}
if (result) {
return result
}
}
// #endregion
const patterns = {
'M+': date.getMonth() + 1,
'D+': date.getDate(),
'h+': date.getHours(),
'm+': date.getMinutes(),
's+': date.getSeconds()
}
if (/Y+/.test(format)) {
format = format.replace(RegExp.lastMatch, (date.getFullYear() + '').slice(4 - RegExp.lastMatch.length))
}
for (let p in patterns) {
if (new RegExp('(' + p + ')').test(format)) {
format = format.replace(RegExp.lastMatch, RegExp.lastMatch.length == 1 ? patterns[p] : String(patterns[p]).padStart(2, '0'))
}
}
return format
})
/**
* 数字格式化
* @param {Number} num - 待格式化的数字
*/
Vue.filter('adFormatNumber', function (num) {
if (typeof num == 'undefined') {
return ''
}
let result = num.toString()
if (num > 100000000) {
result = (num / 100000000).toFixed(1) + '亿'
} else if (num > 10000) {
result = (num / 10000).toFixed(1) + '万'
}
return result
})
\ No newline at end of file
... ...
/**
* @file 项目入口文件
*/
import Vue from 'vue'
import VueRouter from 'vue-router'
import Vuex from 'vuex'
import routes from './routes'
import store from './store'
import App from 'modules/app/index.vue'
import './landscape.js'
import './ipadLandscape.js'
import './common'
import './filters'
import 'styles/common.css'
import 'styles/commonStyle.css'
Vue.use(VueRouter)
Vue.use(Vuex)
import 'vant/es/toast/style';
import { Toast, Popup } from "vant";
Vue.use(Toast);
Vue.use(Popup);
// 配置发送请求拦截器,实现路由切换后取消之前的请求
let axiosPromiseArr = [];
import axios from 'axios'
axios.interceptors.request.use(config => {
config.cancelToken = new axios.CancelToken(cancel => {
axiosPromiseArr.push({ cancel });
})
return config;
}, err => {
var error = { message: '网络异常,请刷新重试', err: err, type: 'requestError' };
console.log(error);
return Promise.reject(error);
})
var Router = new VueRouter({ routes });
Router.beforeEach((to, from, next) => {
axiosPromiseArr.forEach((ele, index) => {
ele.cancel();
delete axiosPromiseArr[index];
})
next()
})
new Vue({
el: '#app',
render: h => h(App),
router: Router,
store: new Vuex.Store(store),
})
... ...
var supportsOrientationChange = "onorientationchange" in window,
orientationEvent = supportsOrientationChange ? "orientationchange" : "resize";
// 监听事件
window.addEventListener(orientationEvent, function () {
var ua = navigator.userAgent;
var deviceType = "";
//判断设备类型
if (ua.indexOf("iPad") > 0) {
deviceType = "isIpad";
} else if (ua.indexOf("Android") > 0) {
deviceType = "isAndroid";
} else {
// console.log("既不是ipad,也不是安卓!");
return;
}
let ipadId = document.getElementById('orientLayer')
// 判断横竖屏
if ("isIpad" == deviceType) {
if (Math.abs(window.orientation) == 90) {
ipadId.style.display = 'block'
// console.log("我是ipad的横屏",ipadId.style.display = 'block');
} else {
// console.log("我是ipad的竖屏");
ipadId.style.display = 'none'
}
}
}, false);
\ No newline at end of file
... ...
/* 横竖提示处理
* isVertical:不传默认为false,即显示竖屏提示,(false: 提示用户横屏, true:提示用户竖屏)
*/
(function landscape(config) {
var isVertical =true;
var showWay = isVertical ? "@media screen and (min-aspect-ratio: 12/7){#orientLayer{display:block;} }" :
"@media all and (orientation : portrait){#orientLayer{display: block;} }";
var color = config && config.color ? config.color : "#000",
txt = isVertical ? "Screen Auto-Rotate" : " ",
images = config && config.images ? config.images :
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIYAAADaCAMAAABU68ovAAAAXVBMVEUAAAD29vb////x8fH////////x8fH5+fn29vby8vL////5+fn39/f6+vr////x8fH////////+/v7////09PT////x8fH39/f////////////////////x8fH///+WLTLGAAAAHXRSTlMAIpML+gb4ZhHWn1c2gvHBvq1uKJcC6k8b187lQ9yhhboAAAQYSURBVHja7d3blpowFIDhTUIAOchZDkre/zE7ycySrbUUpsRN2/1fzO18KzEqxEVgTiZNfgmmtxRc8iaR8HNe8x4BtjQePKayYCIoyBSgvNNE1AkNSHqZyLqk97EgUCCHBzZ5mkg7ScvIJuIyOyXBRFxgpqWZyGsAZLB1KjsJi8nutHU4JCRbFRH8tmirI9k8Jx2sqNs8K/m0LQkrktO2crgcgXGB4AiTEsB0hJfo9MGgX7CGcYiYwQxmMOOvZwRhBG8tCoMXjBDeXvWCEcHbi14wgCBmMIMZzGAGM5jxETNwzMAxA8cMHDNwzMAxA8cMHDNwzMAxA8cMHDNwzMAxY6E2rUQxnH2tz9cirlJFwFBJedaPnUv0M7++egPDE8iAJcIDmxwH5wwv9vUviw2kLbVO3TJU5uul/EyB0FoLp4x60PdGUd3qPurrWyjGGTc05u+1dcgI7/+tCCPARWGhH7o5Y7RCf+bH9ctXLp6v2BVDxfqz0oPXeSVaNtINo/1SXDv4dck8IIkbhtC2ol+iouEonTBCbYvVMnXOjxww6s/RFrBUpXHh/gw1rHj5d/qhYn9Gpk2FWh6xRBRX5Oj3Znh2Sq49/L6+y8pB26q9GbE2dbA2mVbx6I+7MfBglLCttm73ZQi7AD3iL4HqjFYJHSPRppqaUaJ3ATpGa+ckpGak2hRRMyqjGMkvl+xyFeSMwjAqcsZgGDdyhl0oNTnDN4yenJGZFGxNChP5/Y3efh6SM2rDOJMzboYxkDMqwyjIGcIw6F+io2FU1IxIm1JqRmgXSkvNKNCXeTpGrU0JNSO2c6LIGPgCS8AuDHz9ta0SXWDtxoDRH+MqlbC2Dt2G2JFRadtQZt2qq/orGowdGb2euxYiqWEpVWhTBnszoNAPdStuQwxqf0aocdWKW4Z+DfszIh8pxJqbuCE4YAC+4bm0evtipjpgJHeFnyyt1Ku2xa0bhjxr27p75rECNwyI9ZwvXkHq+7aTaMEV44YYy/spfgjgjNHaWW+GeUhGEX7tLlVinIFDDSgnOwhi1V6bU0b6tVS9eAERe863g4dRrtiHdc6o+nn5vtyVVgR79Cqt4uL6gfHPQyGqtP2vf7HADGbcYwaOGThm4JiBYwaOGThm4JiBYwaOGThm4JiBYwaOGThm4JiBYwaOGThm4JjhtOM+J/AgT008yDMkN/dPP9hzS8zAMQN3OEYeekp5YU7KOKXwVXqiY+QS7smcinGKABWdiBgpPJTSMHJ4KidhhPBUSMLw4CmPhKHgKUXCkHsygum71ftNSgCX6bsl8FQyfbcL5EdYsDk0R3j7aiA5wpt5AjKg/2gLJEBD/0Hf2OOf/vRrj6z/7GtP4B3nMKyjHA12kIPSjnJs3FEO0TvKkYJHOWCR+rjJH0Vn6fI5PjNbAAAAAElFTkSuQmCC";
// style
var nodeStyle = document.createElement('style');
nodeStyle.setAttribute('type', 'text/css');
nodeStyle.innerHTML =
'@-webkit-keyframes rotation{10%{transform: rotate(90deg); -webkit-transform: rotate(90deg)} 50%, 60%{transform: rotate(0deg); -webkit-transform: rotate(0deg)} 90%{transform: rotate(90deg); -webkit-transform: rotate(90deg)} 100%{transform: rotate(90deg); -webkit-transform: rotate(90deg)} } @keyframes rotation{10%{transform: rotate(90deg); -webkit-transform: rotate(90deg)} 50%, 60%{transform: rotate(0deg); -webkit-transform: rotate(0deg)} 90%{transform: rotate(90deg); -webkit-transform: rotate(90deg)} 100%{transform: rotate(90deg); -webkit-transform: rotate(90deg)} } #orientLayer{display: none; z-index: 999999;} ' +
showWay +
' .mod-orient-layer{display: none; position: fixed; height: 100%; width: 100%; left: 0; top: 0; right: 0; bottom: 0; background: ' +
color +
'; z-index: 9997} .mod-orient-layer__content{position: absolute; width: 100%; top: 45%; margin-top: -75px; text-align: center} .mod-orient-layer__icon-orient{background-image: url(' +
images +
'); display: inline-block; width: 67px; height: 109px; transform: rotate(90deg); -webkit-transform: rotate(90deg); -webkit-animation: rotation infinite 1.5s ease-in-out; animation: rotation infinite 1.5s ease-in-out; -webkit-background-size: 67px; background-size: 67px} .mod-orient-layer__desc{margin-top: 20px; font-size: 15px; color: #fff}'
document.getElementsByTagName('body')[0].appendChild(nodeStyle);
// dom
var nodeDom = document.createElement('div');
nodeDom.setAttribute('id', 'orientLayer');
nodeDom.setAttribute('class', 'mod-orient-layer');
nodeDom.innerHTML =
'<div class="mod-orient-layer__content"> <i class="icon mod-orient-layer__icon-orient"></i> <div class="mod-orient-layer__desc">' +
txt + '</div> </div>';
document.getElementsByTagName('body')[0].appendChild(nodeDom);
}())
\ No newline at end of file
... ...
import axios from '../axios'
import { ENV } from 'scripts/constants/index'
// import { Message } from 'element-ui';
export default {
// 新增预约
appointment(data){
let params = {
...data
}
return axios
.post(`/gear/reserve/v2/nocode-add`, { ...params })
.then((res) => {
return res.data
})
.catch((err) => {
// Message.error(err, 2)
})
}
}
\ No newline at end of file
... ...
/**
* @file Axios 全局配置
*/
import axios from 'axios'
import { ENV } from '../constants/index'
const myAxios = axios.create({
baseURL: ENV.HOSTNAME,
// withCredentials: true
})
myAxios.defaults.timeout = 10000;
myAxios.interceptors.response.use((res) => {
if (res.status >= 200 && res.status < 300) {
return res;
}
return Promise.reject(res);
}, (error) => {
// 网络异常
if (axios.isCancel(error)) {
var err = { message: '路由切换,网络请求已取消', err: error, type: 'cancel' };
console.log(err);
return Promise.reject(err);
} else {
var err = { message: '网络异常,请刷新重试', err: error, type: 'responseError' };
console.log(err);
return Promise.reject(err);
}
});
export default myAxios
... ...
/**
* @file 请求接口
*/
import reqPublic from './api/public'
export {
reqPublic,
}
\ No newline at end of file
... ...
/**
* @file 路由信息
*/
export default [{
path: '/',
redirect: '/index',
component: () => import(/* webpackChunkName: 'entry' */ '../modules/app/index.vue')
}, {
path: '/index',
component: () => import(/* webpackChunkName: 'index' */ '../modules/layout/index.vue'),
children: [
{
path: '/index',
component: () => import(/* webpackChunkName: 'index' */ '../modules/index/index.vue'),
meta: {
name: '首页'
}
}
]
}, {
path: '*',
name: '404',
component: () => import(/* webpackChunkName: '404' */ '../modules/errorPages/my404.vue'),
meta: {
name: '404'
}
}]
... ...
/**
* @file 状态管理
*/
// import { reqPublic } from "scripts/requests/index.js";
export default {
state: {
},
mutations: {
},
actions: {
},
getters: {
}
}
\ No newline at end of file
... ...
/**
* 发送自定义上报时间
* @param {*} eventName 事件名称
* @param {*} eventParams 自定义参数
*/
let send = function (eventName, eventParams = {}) {
gtag('event', eventName, {
...eventParams
})
}
const Tracker = {
/**
* 点击预约按钮
*/
start_index: function () {
send('start_appointment_index')
},
}
export default Tracker
\ No newline at end of file
... ...
/**
* @file 工具函数
* 常用方法,公共方法
*/
/**
* @name GetLabelFormValue 对象数组中根据一个字段获取对象
* @param {Array[Object]} array - 对象数组
* @param {String} key - 字段名
* @param {any} value - 该字段的预设值
* @param {String} label - 可选,无匹配对象的空值字段
*/
const GetObjFormKey = function (array, key = 'value', value = '', label) {
if (!array) return {}
for (var item of array) {
if (String(item[key]) === String(value)) {
return item
}
}
if (label) {
var result = {}
result[label] = ''
return result
} else {
return {}
}
}
/**
* 模拟a标签跳转
* @param url
* @param target
* @return {*}
*/
const ALink = function(url, target = '_blank') {
const a = document.createElement('a');
a.href = url;
a.target = target;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
}
/**
* 获取url参数
* @param {*} name 参数名
* @param {*} url
* @returns
*/
const getParameterByName = function (name, url) {
if (!url) url = window.location.href;
name = name.replace(/[[]]/g, '$&');
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\\+/g, ' '));
}
function getUrlSearchJson() {
var url = location.search;
if(!url) {
return null;
}
var newObj = new Object();
if (url.indexOf("?") != -1) {
var strs = url.split('?')[1].split("&");
for (var i = 0; i < strs.length; i++) {
newObj[strs[i].split("=")[0]] = (strs[i].split("=")[1]) || '';
}
}
return newObj;
}
export { GetObjFormKey, ALink, getParameterByName, getUrlSearchJson }
\ No newline at end of file
... ...
/**
* @file 公共样式
*/
html,body{
/* we don't want to allow users to select text everywhere,
you can enable it on the places you think appropriate */
user-select: none;
-webkit-overflow-scrolling: touch;
font-family: -apple-system, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Source Han Sans", "Microsoft YaHei", sans-serif;
height: 100%;
scroll-behavior: smooth;
}
*, *:before, *:after {
/* suppressing the tap highlight */
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
box-sizing: border-box;
vertical-align: top;
padding: 0;
margin: 0;
-webkit-font-smoothing: antialiased;
}
*:focus {
/* the default outline doesn't play well with a mobile application,
I usually start without it,
but don't forget to research further to make your mobile app accessible. */
outline: 0;
}
a {
background: transparent;
text-decoration: none;
outline: none;
transition: all .1s linear;
}
a:active {
filter: brightness(1.1);
}
.clickBtn:active {
filter: brightness(1.1);
transform: scale(0.98);
}
*[contenteditable] {
user-select: auto !important;
-webkit-user-select: auto !important;
}
/**
* 有强迫症的同学总会觉得输入框文本位置整体偏上,感觉未居中心里就痒痒的。桌面端浏览器里声明line-height等于height就能解决,但移动端浏览器里还是未能解决,需将line-height声明为normal才行。
*/
input {
line-height: normal;
}
::-webkit-scrollbar {
width: 8px;
height: 8px;
background-color: transparent;
}
::-webkit-scrollbar-track {
background-color: transparent;
}
::-webkit-scrollbar-thumb {
border-radius: 3px;
background-color: #5d5d5d;
}
.van-toast {
min-width: 1.6rem!important;
border-radius: 0.08rem!important;
font-size: 0.38rem!important;
padding: 0.24rem 0.4rem!important;
line-height: 1.5!important;
}
.van-popup {
background-color: transparent!important;
width: 100%;
height: 100%;
}
.van-overlay{
background-color: rgba(0,0,0,.4)!important;
}
.van-overflow-hidden{
overflow: auto!important;
}
button {
border: none;
}
... ...