first commit

This commit is contained in:
编码猿
2024-09-27 01:32:49 +08:00
commit 28ebe05a64
7399 changed files with 1174529 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
> 1%
last 2 versions

22
芳林公司项目/stest/.gitignore vendored Normal file
View File

@@ -0,0 +1,22 @@
.DS_Store
node_modules
# local env files
.env.local
.env.*.local
./memo.txt
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

View File

@@ -0,0 +1 @@
13512a4f-8c7d-45f4-b97b-81e7708ca242

View File

@@ -0,0 +1,83 @@
# 1Vue3Template
使用Vue-cli3并基于 Vue3.0 Composition-Api + TypeScript 改造搭建的基础项目骨架(符合我的使用习惯),可以直接下载运行。
快来感受Vue3.0的魅力吧...
- 1: Vue3.0 Composition-Api 访问地址:[https://github.com/vuejs/composition-api](https://github.com/vuejs/composition-api)
- 2: TypeScript 中文网:[https://www.tslang.cn/docs/home.html](https://www.tslang.cn/docs/home.html)
## 运行
```
# 1下载
git clone https://github.com/helpcode/Vue3Template.git
# 2运行
npm run serve
# 3打包构建-发布
npm run build
```
## 2项目结构
项目的大致结构如下,具体更详细的请自行看源码!!!
```
├── dist 打包后用于部署到服务器上的版本
├── public 公共静态资源,图片,字体体积较大的放这!!
└── src
├── application 项目的页面组件部分
│   ├── assets 较小的且需要被webpack处理的资源放这
│   │   └── stylus stylus 样式
│   │   ├── color 公共全局样色
│   │   ├── common 公共css
│   │   ├── components 页面样式
│   │   └── mixin 公共css方法
│   ├── components Vue公共组件
│   └── page Vue页面组件
└── core
├── config 站点的核心配置文件,必看代码
├── dao Axios的封装
├── decorators 【已被抽离项目作为单独包】自定义的一些注解
├── directive Vue自定义指令
├── hooks Vue3 hooks
├── mixin Vue自定义mixin
├── run 项目的启动配置/启动文件
├── service Ajax请求的中间层实现接口规范主要给组件页面调用
│   └── impl 接口的具体实现逻辑
├── types 一些Typescript的声明文件
└── utils 公共方法
```
## 3注解包
这里不做篇幅介绍了,已实现的注解被抽离出去作为了一个单独的`npm`包,可以使用`npm`进行安装然后使用,具体注解用法看下面链接:
> vue3decorators 项目地址:[https://www.npmjs.com/package/vue3decorators](https://www.npmjs.com/package/vue3decorators)
## 4自动生成路由配置
借鉴 [Nuxt.js](https://zh.nuxtjs.org/) 的路由源码实现可以根据存放Vue-Router页面的文件夹结构自动生成Vue-Router配置文件。
> 插件包地址:[https://www.npmjs.com/package/vue-cli-plugin-autorouter](https://www.npmjs.com/package/vue-cli-plugin-autorouter)
## 5tsvue3-cli 脚手架
一键创建 `Vue3Template`项目,更加快速的享受编码的乐趣。
> 插件包地址:[https://www.npmjs.com/package/tsvue3-cli](https://www.npmjs.com/package/tsvue3-cli)
## 6项目运行思路
- 1: `vue.config.js``config.entry.app = './src/core/run/index.ts';` 设置了程序的入口文件,程序从这启动!
- 2: `class Index` 继承 父类 `Init`, 这里 `index.ts` 只负责做初始化`Vue`的工作所有的Vue参数插件等具体装载都在`init.ts`
- 3: `init.ts` 主要负责装载`Vue`和非`Vue`插件,`Vue Mixin``vue Directive``Vue-Router`等工作。而`init.ts`用到的一系列东西大部分都从`config/index.ts`中来。
- 4: `config/index.ts`很核心例如我们要安装UI框架`Vant`,那么请安装后再`config/index.ts`中导入,然后修改静态属性`VuePlugs`即可。具体请看代码,其它类似指令都类似。
额....好像就没有了,简单很。可以自己按照上面思路来看代码,代码里面都有注释。
**对了,记得看`src/application/page/Home.vue`里面的代码,还就是配置文件: `vue.config.js`也记得看下!**

View File

@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
};

View File

@@ -0,0 +1 @@
8914b54b-3022-4d37-a637-c411f5d719f0

View File

@@ -0,0 +1,66 @@
const path = require('path');
const VariableConfig = require('./variable');
/**
* 开发阶段的一些基础配置
*/
class DevConfig {
constructor(chainWebpack) {
this.chainWebpack = chainWebpack;
this.pubSetting();
}
pubSetting() {
/**
* 移除不必要的 prefetch 和 preload请求
*/
this.chainWebpack.plugins.delete('prefetch');
this.chainWebpack.plugins.delete('preload');
/**
* html 模板引擎 pug 配置
*/
this.chainWebpack.module.rule('pug')
.test(/\.pug$/)
.use('pug-html-loader')
.loader('pug-html-loader')
.end();
/**
* 导入全局css
* @type {*[]}
*/
const types = ['vue-modules', 'vue', 'normal-modules', 'normal'];
types.forEach(type => this.addStyleResource(this.chainWebpack.module.rule('less').oneOf(type)));
/**
* 配置路径别名,项目中引用资源的时候路径可以更简短
* 但是ts文件在用的时候编译器会报错需要添加 @ts-ignore
* 忽略开发工具的错误。
*/
this.chainWebpack.resolve.alias
.set('@public', this.resolve(VariableConfig.PublicConfig.alias.public))
.set('@core', this.resolve(VariableConfig.PublicConfig.alias.core))
.set('@', this.resolve(VariableConfig.PublicConfig.alias.root))
.set('@assets', this.resolve(VariableConfig.PublicConfig.alias.assets))
.set('@less', this.resolve(VariableConfig.PublicConfig.alias.less))
.set('@impl', this.resolve(VariableConfig.PublicConfig.alias.impl))
}
addStyleResource(rule) {
rule.use('style-resource')
.loader('style-resources-loader')
.options({
patterns: [
path.resolve(__dirname, VariableConfig.PublicConfig.alias.globalStyl)
],
});
}
resolve(dir) {
return path.join(__dirname, dir);
}
}
module.exports = DevConfig;

View File

@@ -0,0 +1,72 @@
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const CompressionPlugin = require('compression-webpack-plugin');
const VariableConfig = require('./variable');
/**
* 正式阶段的一些配置
*/
class ProdConfig {
constructor(configureWebpack) {
this.configureWebpack = configureWebpack
this.RemoveCommonPackage();
this.CompressedCode();
this.GzipCompressedCode();
}
/**
* 去除这些公共包让webpack不打包到项目源码的js中减小项目js体积
* 然后使用cdn 数组里面的资源外链来引入。
*/
RemoveCommonPackage() {
this.configureWebpack.externals = {
'vue': 'Vue',
'vue-router': 'VueRouter',
'axios': 'axios',
};
}
/**
* 部署阶段 代码压缩
*/
CompressedCode() {
this.configureWebpack.plugins.push(
// 生产环境自动删除 console如果需要显示 console 请修改
// drop_console 为 false
new UglifyJsPlugin({
uglifyOptions: {
compress: {
warnings: false,
drop_debugger: true,
drop_console: true,
},
},
sourceMap: false,
parallel: true,
}),
);
}
/**
* Gzip压缩开启 BundleAnalyzerPlugin分析打包后的js文件体积
*/
GzipCompressedCode() {
this.configureWebpack.mode = 'production';
return {
plugins: [
new CompressionPlugin({
test: /\.js$|\.html$|\.css/, //匹配文件名
threshold: 10240, //对超过10k的数据进行压缩
deleteOriginalAssets: false //是否删除原文件
}),
new BundleAnalyzerPlugin(),
]
}
}
}
module.exports = ProdConfig;

View File

@@ -0,0 +1,25 @@
// 基础变量配置
module.exports = {
PublicConfig: {
// 入口
entry: './src/core/run/index.run.ts',
// 别名
alias: {
public: '../public',
core: '../src/core',
impl: '../src/core/service/impl',
root: '../src/application',
assets: '../src/application/assets',
less: '../src/application/assets/less/components',
globalStyl: '../src/application/assets/less/imports.less'
}
},
cdn: {
css: [],
js: [
'https://cdn.bootcss.com/vue/2.6.11/vue.runtime.min.js',
'https://cdn.bootcss.com/vue-router/3.1.3/vue-router.min.js',
'https://cdn.bootcss.com/axios/0.19.2/axios.min.js',
]
}
};

View File

@@ -0,0 +1,4 @@
#!/usr/bin/env node
require('compressing').zip.compressDir('dist/', 'dist.zip')
.then(() => console.log('zip Success'))
.catch(err => console.error(err));

View File

@@ -0,0 +1,23 @@
const gulp = require('gulp');
const exec = require('child_process').exec;
/**
* 自动执行 vue-cli-service route 命令进行路由编译
*/
gulp.task('AutoCompileRouter', function(cb) {
return exec('npm run route', function (err, stdout, stderr) {
if (err) {
console.log("编译失败: ", err)
cb(err)
} else {
console.log("编译成功");
}
});
});
//
gulp.task('auto', function () {
gulp.watch('src/application/page/**/*', gulp.parallel('AutoCompileRouter'));
});
gulp.task('default', gulp.parallel('auto'));

View File

@@ -0,0 +1,15 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/application"],
"@core/*": ["src/core"],
"@assets/*": ["src/application/assets"]
},
"target": "ES6",
"module": "commonjs",
"allowSyntheticDefaultImports": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}

13659
芳林公司项目/stest/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,47 @@
{
"name": "tsvue",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "concurrently \"npm run route && npm run serve\" \"gulp\" ",
"serve": "NODE_ENV=dev vue-cli-service serve",
"build": "NODE_ENV=production vue-cli-service build && node ./build/zip",
"route": "vue-cli-service route"
},
"dependencies": {
"@vue/composition-api": "^0.3.4",
"amfe-flexible": "^2.2.1",
"axios": "^0.19.2",
"echarts": "^4.7.0",
"vant": "^2.5.0",
"vue": "^2.6.11",
"vue-router": "^3.1.5",
"weixin-js-sdk": "^1.4.0-test"
},
"devDependencies": {
"@types/echarts": "^4.6.0",
"@vue/cli-plugin-babel": "^4.2.0",
"@vue/cli-plugin-typescript": "^4.2.0",
"@vue/cli-service": "^4.2.0",
"babel-plugin-import": "^1.13.0",
"compressing": "^1.5.0",
"compression-webpack-plugin": "^3.1.0",
"concurrently": "^5.1.0",
"core-js": "^3.6.4",
"glob": "^7.1.3",
"gulp": "^4.0.2",
"less": "^3.11.1",
"less-loader": "^5.0.0",
"pify": "^4.0.1",
"postcss-pxtorem": "^5.1.1",
"pug-html-loader": "^1.1.5",
"pug-plain-loader": "^1.0.0",
"reflect-metadata": "^0.1.13",
"style-resources-loader": "^1.3.3",
"typescript": "~3.7.5",
"uglifyjs-webpack-plugin": "^1.1.1",
"vue-cli-plugin-autorouter": "^1.3.3",
"vue-template-compiler": "^2.6.11",
"vue3decorators": "^1.2.4"
}
}

View File

@@ -0,0 +1,18 @@
module.exports = {
plugins: {
'autoprefixer': {
overrideBrowserslist: [
'Android 4.1',
'iOS 7.1',
'Chrome > 31',
'ff > 31',
'ie >= 8'
]
},
'postcss-pxtorem': {
rootValue: 41.7,
propList: ['*']
}
}
};

View File

@@ -0,0 +1 @@
2f489e59-72bb-498a-9f73-fc9b4d17889e

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -0,0 +1 @@
5239d7ab-6c79-41f9-925a-121214a862e7

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" />
<meta name="format-detection"content="telephone=no, email=no" />
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<meta name="full-screen" content="yes">
<meta name="screen-orientation" content="portrait">
<meta name="screen-orientation" content="portrait">
<meta name="x5-fullscreen" content="true">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta http-equiv="Page-Enter" Content="revealTrans(Duration=0.5,tansition=10" />
<meta http-equiv="Page-Exit" Content="revealTrans(Duration=0.5,transition=12" />
</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 -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
<% } %>
</body>
</html>

View File

@@ -0,0 +1 @@
2786da6b-a9cc-4ca7-84e6-1d7c8a525bb8

View File

@@ -0,0 +1 @@
379a9f8a-6ddd-422e-9aa6-4bc70c693c0e

View File

@@ -0,0 +1,60 @@
<template lang="pug">
#app
router-view
</template>
<script lang="ts">
import {
toRefs,
Ref,
ref,
reactive,
createComponent,
provide,
onMounted,
watch,
PropOptions, SetupContext as SC
} from '@vue/composition-api';
//@ts-ignore
import { HelpingPopupBroadcastChannel } from '@core/hooks/BroadcastChannel.hooks';
import {UnwrapRef} from "@vue/composition-api/dist/reactivity";
//@ts-ignore
import { SetupContext } from "@core/types/ctx.d.ts";
export default createComponent({
setup(props: PropOptions, ctx: SC | SetupContext) {
// 向所有组件共享 广播,避免所有页面都导入文件
provide("Broadcast", HelpingPopupBroadcastChannel());
onMounted(() => {
console.log(HelpingPopupBroadcastChannel())
});
return {
}
}
});
</script>
<style lang="less">
.slide-fade-enter-active {
transition: all .4s ease;
}
.slide-fade-leave-active {
transition: all .8s cubic-bezier(1.0, 0.5, 0.8, 1.0);
}
.slide-fade-enter, .slide-fade-leave-to
/* .slide-fade-leave-active for below version 2.1.8 */ {
transform: translateX(10px);
opacity: 0;
}
.fade-enter-active, .fade-leave-active {
transition: opacity .5s;
}
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
opacity: 0;
}
@import "~@assets/less/common/normalize";
</style>

View File

@@ -0,0 +1 @@
88401b8e-3be5-4952-87c5-e32df07dd353

View File

@@ -0,0 +1 @@
18920023-f983-48cc-a512-51d570162e76

View File

@@ -0,0 +1 @@
41075675-2a38-47e6-8ae2-fb3674b8e408

View File

@@ -0,0 +1,309 @@
// 公共css样式可以在 页面组件中直接使用变量名称
// 具体看 components/home.styl
@theme-color: red;
@test-color: yellow;
@red50: #ffebee;
@red100: #ffcdd2;
@red200: #ef9a9a;
@red300: #e57373;
@red400: #ef5350;
@red500: #f44336;
@red600: #e53935;
@red700: #d32f2f;
@red800: #c62828;
@red900: #b71c1c;
@redA100: #ff8a80;
@redA200: #ff5252;
@redA400: #ff1744;
@redA700: #d50000;
@red: @red500;
@pink50: #fce4ec;
@pink100: #f8bbd0;
@pink200: #f48fb1;
@pink300: #f06292;
@pink400: #ec407a;
@pink500: #e91e63;
@pink600: #d81b60;
@pink700: #c2185b;
@pink800: #ad1457;
@pink900: #880e4f;
@pinkA100: #ff80ab;
@pinkA200: #ff4081;
@pinkA400: #f50057;
@pinkA700: #c51162;
@pink: @pink500;
@purple50: #f3e5f5;
@purple100: #e1bee7;
@purple200: #ce93d8;
@purple300: #ba68c8;
@purple400: #ab47bc;
@purple500: #9c27b0;
@purple600: #8e24aa;
@purple700: #7b1fa2;
@purple800: #6a1b9a;
@purple900: #4a148c;
@purpleA100: #ea80fc;
@purpleA200: #e040fb;
@purpleA400: #d500f9;
@purpleA700: #aa00ff;
@purple: @purple500;
@deepPurple50: #ede7f6;
@deepPurple100: #d1c4e9;
@deepPurple200: #b39ddb;
@deepPurple300: #9575cd;
@deepPurple400: #7e57c2;
@deepPurple500: #673ab7;
@deepPurple600: #5e35b1;
@deepPurple700: #512da8;
@deepPurple800: #4527a0;
@deepPurple900: #311b92;
@deepPurpleA100: #b388ff;
@deepPurpleA200: #7c4dff;
@deepPurpleA400: #651fff;
@deepPurpleA700: #6200ea;
@deepPurple: @deepPurple500;
@indigo50: #e8eaf6;
@indigo100: #c5cae9;
@indigo200: #9fa8da;
@indigo300: #7986cb;
@indigo400: #5c6bc0;
@indigo500: #3f51b5;
@indigo600: #3949ab;
@indigo700: #303f9f;
@indigo800: #283593;
@indigo900: #1a237e;
@indigoA100: #8c9eff;
@indigoA200: #536dfe;
@indigoA400: #3d5afe;
@indigoA700: #304ffe;
@indigo: @indigo500;
@blue50: #e3f2fd;
@blue100: #bbdefb;
@blue200: #90caf9;
@blue300: #64b5f6;
@blue400: #42a5f5;
@blue500: #2196f3;
@blue600: #1e88e5;
@blue700: #1976d2;
@blue800: #1565c0;
@blue900: #0d47a1;
@blueA100: #82b1ff;
@blueA200: #448aff;
@blueA400: #2979ff;
@blueA700: #2962ff;
@blue: @blue500;
@lightBlue50: #e1f5fe;
@lightBlue100: #b3e5fc;
@lightBlue200: #81d4fa;
@lightBlue300: #4fc3f7;
@lightBlue400: #29b6f6;
@lightBlue500: #03a9f4;
@lightBlue600: #039be5;
@lightBlue700: #0288d1;
@lightBlue800: #0277bd;
@lightBlue900: #01579b;
@lightBlueA100: #80d8ff;
@lightBlueA200: #40c4ff;
@lightBlueA400: #00b0ff;
@lightBlueA700: #0091ea;
@lightBlue: @lightBlue500;
@cyan50: #e0f7fa;
@cyan100: #b2ebf2;
@cyan200: #80deea;
@cyan300: #4dd0e1;
@cyan400: #26c6da;
@cyan500: #00bcd4;
@cyan600: #00acc1;
@cyan700: #0097a7;
@cyan800: #00838f;
@cyan900: #006064;
@cyanA100: #84ffff;
@cyanA200: #18ffff;
@cyanA400: #00e5ff;
@cyanA700: #00b8d4;
@cyan: @cyan500;
@teal50: #e0f2f1;
@teal100: #b2dfdb;
@teal200: #80cbc4;
@teal300: #4db6ac;
@teal400: #26a69a;
@teal500: #009688;
@teal600: #00897b;
@teal700: #00796b;
@teal800: #00695c;
@teal900: #004d40;
@tealA100: #a7ffeb;
@tealA200: #64ffda;
@tealA400: #1de9b6;
@tealA700: #00bfa5;
@teal: @teal500;
@green50: #e8f5e9;
@green100: #c8e6c9;
@green200: #a5d6a7;
@green300: #81c784;
@green400: #66bb6a;
@green500: #4caf50;
@green600: #43a047;
@green700: #388e3c;
@green800: #2e7d32;
@green900: #1b5e20;
@greenA100: #b9f6ca;
@greenA200: #69f0ae;
@greenA400: #00e676;
@greenA700: #00c853;
@green: @green500;
@lightGreen50: #f1f8e9;
@lightGreen100: #dcedc8;
@lightGreen200: #c5e1a5;
@lightGreen300: #aed581;
@lightGreen400: #9ccc65;
@lightGreen500: #8bc34a;
@lightGreen600: #7cb342;
@lightGreen700: #689f38;
@lightGreen800: #558b2f;
@lightGreen900: #33691e;
@lightGreenA100: #ccff90;
@lightGreenA200: #b2ff59;
@lightGreenA400: #76ff03;
@lightGreenA700: #64dd17;
@lightGreen: @lightGreen500;
@lime50: #f9fbe7;
@lime100: #f0f4c3;
@lime200: #e6ee9c;
@lime300: #dce775;
@lime400: #d4e157;
@lime500: #cddc39;
@lime600: #c0ca33;
@lime700: #afb42b;
@lime800: #9e9d24;
@lime900: #827717;
@limeA100: #f4ff81;
@limeA200: #eeff41;
@limeA400: #c6ff00;
@limeA700: #aeea00;
@lime: @lime500;
@yellow50: #fffde7;
@yellow100: #fff9c4;
@yellow200: #fff59d;
@yellow300: #fff176;
@yellow400: #ffee58;
@yellow500: #ffeb3b;
@yellow600: #fdd835;
@yellow700: #fbc02d;
@yellow800: #f9a825;
@yellow900: #f57f17;
@yellowA100: #ffff8d;
@yellowA200: #ffff00;
@yellowA400: #ffea00;
@yellowA700: #ffd600;
@yellow: @yellow500;
@amber50: #fff8e1;
@amber100: #ffecb3;
@amber200: #ffe082;
@amber300: #ffd54f;
@amber400: #ffca28;
@amber500: #ffc107;
@amber600: #ffb300;
@amber700: #ffa000;
@amber800: #ff8f00;
@amber900: #ff6f00;
@amberA100: #ffe57f;
@amberA200: #ffd740;
@amberA400: #ffc400;
@amberA700: #ffab00;
@amber: @amber500;
@orange50: #fff3e0;
@orange100: #ffe0b2;
@orange200: #ffcc80;
@orange300: #ffb74d;
@orange400: #ffa726;
@orange500: #ff9800;
@orange600: #fb8c00;
@orange700: #f57c00;
@orange800: #ef6c00;
@orange900: #e65100;
@orangeA100: #ffd180;
@orangeA200: #ffab40;
@orangeA400: #ff9100;
@orangeA700: #ff6d00;
@orange: @orange500;
@deepOrange50: #fbe9e7;
@deepOrange100: #ffccbc;
@deepOrange200: #ffab91;
@deepOrange300: #ff8a65;
@deepOrange400: #ff7043;
@deepOrange500: #ff5722;
@deepOrange600: #f4511e;
@deepOrange700: #e64a19;
@deepOrange800: #d84315;
@deepOrange900: #bf360c;
@deepOrangeA100: #ff9e80;
@deepOrangeA200: #ff6e40;
@deepOrangeA400: #ff3d00;
@deepOrangeA700: #dd2c00;
@deepOrange: @deepOrange500;
@brown50: #efebe9;
@brown100: #d7ccc8;
@brown200: #bcaaa4;
@brown300: #a1887f;
@brown400: #8d6e63;
@brown500: #795548;
@brown600: #6d4c41;
@brown700: #5d4037;
@brown800: #4e342e;
@brown900: #3e2723;
@brown: @brown500;
@blueGrey50: #eceff1;
@blueGrey100: #cfd8dc;
@blueGrey200: #b0bec5;
@blueGrey300: #90a4ae;
@blueGrey400: #78909c;
@blueGrey500: #607d8b;
@blueGrey600: #546e7a;
@blueGrey700: #455a64;
@blueGrey800: #37474f;
@blueGrey900: #263238;
@blueGrey: @blueGrey500;
@grey50: #fafafa;
@grey100: #f5f5f5;
@grey200: #eeeeee;
@grey300: #e0e0e0;
@grey400: #bdbdbd;
@grey500: #9e9e9e;
@grey600: #757575;
@grey700: #616161;
@grey800: #424242;
@grey900: #212121;
@grey: @grey500;
@black: #000000;
@white: #ffffff;
@transparent: rgba(0, 0, 0, 0);
@fullBlack: rgba(0, 0, 0, 1);
@darkBlack: rgba(0, 0, 0, 0.87);
@lightBlack: rgba(0, 0, 0, 0.54);
@minBlack: rgba(0, 0, 0, 0.26);
@faintBlack: rgba(0, 0, 0, 0.12);
@fullWhite: rgba(255, 255, 255, 1);
@darkWhite: rgba(255, 255, 255, 0.87);
@lightWhite: rgba(255, 255, 255, 0.54);

View File

@@ -0,0 +1 @@
429e676f-1dbb-434c-a1c4-d2f2725bee0a

View File

@@ -0,0 +1 @@
@import "normalize";

View File

@@ -0,0 +1,520 @@
/*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */
/**
* 1. Change the default font family in all browsers (opinionated).
* 2. Correct the line height in all browsers.
* 3. Prevent adjustments of font size after orientation changes in
* IE on Windows Phone and in iOS.
*/
/* Document
========================================================================== */
h1,h2,h3,h4,h5,h6,p,ul,li {
padding: 0;
margin: 0;
list-style: none;
}
html,body, #app, .home{
height: 100%;
}
.result {
.van-collapse-item__title--expanded {
color: #ff8600;
font-weight: bolder;
}
}
html {
font-family: sans-serif; /* 1 */
line-height: 1.15; /* 2 */
-ms-text-size-adjust: 100%; /* 3 */
-webkit-text-size-adjust: 100%; /* 3 */
}
@media (min-width: 1025px) {
body,
html {
max-width: 1624px !important;
margin: 0 auto;
}
html {
font-size: 150.8px !important;
}
}
.result {
.van-cell {
padding-left: 0 !important;
padding-right: 0 !important;
}
}
.calculation {
.van-swipe {
position: initial;
height: 100%;
}
}
/* Sections
========================================================================== */
/**
* Remove the margin in all browsers (opinionated).
*/
body {
margin: 0;
line-height: 1.5;
font-size: 14px;
font-weight: 400;
width: 100%;
-webkit-tap-highlight-color:rgba(0, 0, 0, 0);
color: rgba(0, 0, 0, 0.87);
}
li {
list-style: none;
}
/**
* Add the correct display in IE 9-.
*/
article,
aside,
footer,
header,
nav,
section {
display: block;
}
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/* Grouping content
========================================================================== */
/**
* Add the correct display in IE 9-.
* 1. Add the correct display in IE.
*/
figcaption,
figure,
main { /* 1 */
display: block;
}
/**
* Add the correct margin in IE 8.
*/
figure {
margin: 1em 40px;
}
/**
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
hr {
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
pre {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
white-space: pre-wrap;
word-break: break-all;
margin: 0;
}
/* Text-level semantics
========================================================================== */
/**
* 1. Remove the gray background on active links in IE 10.
* 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
*/
a {
text-decoration: none;
background-color: transparent; /* 1 */
-webkit-text-decoration-skip: objects; /* 2 */
user-select: none;
-webkit-user-select: none;
}
/**
* Remove the outline on focused links when they are also active or hovered
* in all browsers (opinionated).
*/
a:active,
a:hover {
outline-width: 0;
}
/**
* 1. Remove the bottom border in Firefox 39-.
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
abbr[title] {
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
text-decoration: underline dotted; /* 2 */
}
/**
* Prevent the duplicate application of `bolder` by the next rule in Safari 6.
*/
b,
strong {
font-weight: inherit;
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
b,
strong {
font-weight: bolder;
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
samp {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
* Add the correct font style in Android 4.3-.
*/
dfn {
font-style: italic;
}
/**
* Add the correct background and color in IE 9-.
*/
mark {
background-color: #ff0;
color: #000;
}
/**
* Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` elements from affecting the line height in
* all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/* Embedded content
========================================================================== */
/**
* Add the correct display in IE 9-.
*/
audio,
video {
display: inline-block;
}
/**
* Add the correct display in iOS 4-7.
*/
audio:not([controls]) {
display: none;
height: 0;
}
/**
* Remove the border on images inside links in IE 10-.
*/
img {
border-style: none;
}
/**
* Hide the overflow in IE.
*/
svg:not(:root) {
overflow: hidden;
}
/* Forms
========================================================================== */
/**
* 1. Change the font styles in all browsers (opinionated).
* 2. Remove the margin in Firefox and Safari.
*/
button,
input,
optgroup,
select,
textarea {
font-family: sans-serif; /* 1 */
font-size: 100%; /* 1 */
line-height: 1.15; /* 1 */
margin: 0; /* 2 */
}
/**
* Show the overflow in IE.
* 1. Show the overflow in Edge.
*/
button,
input { /* 1 */
overflow: visible;
}
/**
* Remove the inheritance of text transform in Edge, Firefox, and IE.
* 1. Remove the inheritance of text transform in Firefox.
*/
button,
select { /* 1 */
text-transform: none;
}
/**
* 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
* controls in Android 4.
* 2. Correct the inability to style clickable types in iOS and Safari.
*/
button,
html [type="button"], /* 1 */
[type="reset"],
[type="submit"] {
-webkit-appearance: button; /* 2 */
}
/**
* Remove the inner border and padding in Firefox.
*/
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
/**
* Restore the focus styles unset by the previous rule.
*/
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
/**
* Change the border, margin, and padding in all browsers (opinionated).
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/**
* 1. Correct the text wrapping in Edge and IE.
* 2. Correct the color inheritance from `fieldset` elements in IE.
* 3. Remove the padding so developers are not caught out when they zero out
* `fieldset` elements in all browsers.
*/
legend {
box-sizing: border-box; /* 1 */
color: inherit; /* 2 */
display: table; /* 1 */
max-width: 100%; /* 1 */
padding: 0; /* 3 */
white-space: normal; /* 1 */
}
/**
* 1. Add the correct display in IE 9-.
* 2. Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
progress {
display: inline-block; /* 1 */
vertical-align: baseline; /* 2 */
}
/**
* Remove the default vertical scrollbar in IE.
*/
textarea {
overflow: auto;
resize: vertical;
}
/**
* 1. Add the correct box sizing in IE 10-.
* 2. Remove the padding in IE 10-.
*/
[type="checkbox"],
[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Correct the cursor style of increment and decrement buttons in Chrome.
*/
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Correct the odd appearance in Chrome and Safari.
* 2. Correct the outline style in Safari.
*/
[type="search"] {
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
/**
* Remove the inner padding and cancel buttons in Chrome and Safari on macOS.
*/
[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* 1. Correct the inability to style clickable types in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
}
/* Interactive
========================================================================== */
/*
* Add the correct display in IE 9-.
* 1. Add the correct display in Edge, IE, and Firefox.
*/
details, /* 1 */
menu {
display: block;
}
/*
* Add the correct display in all browsers.
*/
summary {
display: list-item;
}
/* Scripting
========================================================================== */
/**
* Add the correct display in IE 9-.
*/
canvas {
display: inline-block;
}
/**
* Add the correct display in IE.
*/
template {
display: none;
}
/* Hidden
========================================================================== */
/**
* Add the correct display in IE 10-.
*/
[hidden] {
display: none;
}

View File

@@ -0,0 +1 @@
1459693c-475e-4d1c-9e07-47c808400670

View File

@@ -0,0 +1,3 @@
h1 {
color: @test-color;
}

View File

@@ -0,0 +1,87 @@
.calculation {
.calculation_f {
p {
font-size: 17px;
color: #101010;
text-align: left;
margin-left: 10px;
}
.action {
display: flex;
justify-content: center;
margin-top: 41px;
.active {
background: rgba(255, 94, 39, 1) !important;
.radio {
border: 2px solid #fff !important;
&:after {
position: absolute;
content: '';
width: 10px;
height: 10px;
background: #fff;
display: block;
border-radius: 100%;
left: 50%;
top: 50%;
margin-left: calc(-10px / 2);
margin-top: calc(-10px / 2);
}
}
span {
color: #fff !important;
}
}
.ac {
border-radius: 6px;
font-size: 16px;
width: 95px;
height: 35px;
background-color: #F7F3F3;
text-align: center;
border: 1px solid rgba(255, 255, 255, 0);
display: flex;
align-items: center;
justify-content: center;
color: #000;
margin-right: 43px;
.radio {
width: 16px;
height: 16px;
border-radius: 100%;
border: 2px solid #040404;
position: relative;
&:first-child {
margin-right: 8px;
}
}
span {
color: #000;
font-size: 16px;
}
}
}
.submit_question {
width: 227px;
height: 48px;
line-height: 48px;
border-radius: 13px;
background-color: rgba(255, 94, 39, 1);
text-align: center;
box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.4);
border: 1px solid rgba(255, 255, 255, 0);
font-size: 16px;
color: #FFFFFF;
margin: 0 auto;
margin-top: 80px;
margin-bottom: 60px;
}
}
.custom-indicator {
position: absolute;
bottom: 22px;
left: 14px;
font-size: 16px;
}
}

View File

@@ -0,0 +1,25 @@
.home {
.tips {
text-align: left;
li {
color: rgba(16, 16, 16, 1);
font-size: 14px;
margin-bottom: 18px;
}
}
.start {
width: 227px;
height: 48px;
line-height: 48px;
border-radius: 13px;
background-color: rgba(255, 94, 39, 1);
text-align: center;
box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.4);
border: 1px solid rgba(255, 255, 255, 0);
font-size: 16px;
color: #FFFFFF;
margin: 0 auto;
margin-top: 22px;
margin-bottom: 20px;
}
}

View File

@@ -0,0 +1,136 @@
.result {
.header {
height: 45px;
background: url("~@public/img/header_logo.jpg");
font-size: 16px;
color: #fff;
text-align: center;
line-height: 45px;
}
.like {
padding: 22px 22px;
.title {
margin-top: 5px;
font-size: 16px;
color: #000;
margin-bottom: 26px;
}
.weight {
font-weight: bolder;
}
.clear {
margin-bottom: 0 !important;
}
.list {
display: flex;
justify-content: space-between;
align-items: center;
.item {
display: flex;
justify-content: center;
flex-direction: column;
width: 112px;
height: 80px;
background-color: rgba(249, 209, 209, 1);
text-align: center;
box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.25);
border: 1px solid rgba(255, 255, 255, 0);
&:nth-child(2) {
background-color: rgba(251, 235, 235, 1);
}
&:nth-child(3) {
background-color: #F9F9F9;
}
h3 {
color: rgba(16, 16, 16, 1);
font-size: 28px;
font-weight: normal;
}
span {
color: rgba(0, 0, 0, 1);
font-size: 14px;
}
}
}
ul {
display: flex;
justify-content: space-between;
li {
text-align: center;
height: 112px;
display: flex;
flex-direction: column;
&:nth-child(2) .letter{
background: #FBDA8D !important;
}
&:nth-child(3) .letter{
background: #9FCEFC;
}
.letter {
width: 80px;
height: 80px;
border-radius: 100%;
color: #fff;
font-size: 28px;
line-height: 80px;
text-align: center;
background: #FF797A;
}
span {
margin-top: 10px;
font-size: 16px;
color: #BDB6B6;
}
}
}
.chart_list {
border-bottom: 1px solid #F0F0F0;
.item {
display: flex;
justify-content: space-around;
align-items: flex-start;
margin-bottom: 25px;
&:nth-child(2) .left {
background-color: #FDC570 !important;
}
&:nth-child(3) .left {
background-color: #6CCBFD !important;
}
.left {
width: 16px;
height: 16px;
background: #FE6173;
}
.right_text {
font-size: 13px;
color: #757575;
margin-left: 17px;
width: 90%;
}
}
}
.chart_l {
padding-top: 16px;
.item {
margin-bottom: 14px;
padding-bottom: 14px;
border-bottom: 1px solid #F0F0F0;
h2 {
color: #FF797A;
font-size: 18px;
margin-bottom: 5px;
}
p {
font-size: 14px;
color: #757575;
}
}
}
}
.line {
height: 5px;
width: 100%;
background: #F7F3F3;
display: block;
}
}

View File

@@ -0,0 +1,6 @@
// 公共css
@import "./common/index";
// 颜色配置
@import "./color/index";
// 公共css 方法
@import "./mixin/index";

View File

@@ -0,0 +1 @@
24a4b3c5-6b22-4438-865a-ffe3a106ae26

View File

@@ -0,0 +1,310 @@
.transition(@d) {
-webkit-transition-duration: @d;
transition-duration: @d;
}
.delay(@d) {
-webkit-transition-delay: @d;
transition-delay: @d;
}
.transform(@t) {
-webkit-transform: @t;
transform: @t;
}
.transform-origin(@to) {
-webkit-transform-origin: @to;
transform-origin: @to;
}
.translate3d(@x:0, @y:0, @z:0) {
-webkit-transform: translate3d(@x,@y,@z);
transform: translate3d(@x,@y,@z);
}
.animation (@a) {
-webkit-animation: @a;
animation: @a;
}
.scrollable() {
overflow: auto;
-webkit-overflow-scrolling: touch;
}
.flex-shrink(@fs) {
-webkit-box-flex: @fs;
-webkit-flex-shrink: @fs;
-ms-flex: 0 @fs auto;
flex-shrink: @fs;
}
.clearfix() {
&:after,
&:before {
content: " ";
display: table;
}
&:after {
clear: both;
}
}
.hairline(@position, @color) when (@position = top) {
&:before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: auto;
right: auto;
height: 1px;
width: 100%;
background-color: @color;
display: block;
z-index: 15;
// .transform-origin(50% 0%);
html.pixel-ratio-2 & {
.transform(scaleY(0.5));
}
html.pixel-ratio-3 & {
.transform(scaleY(0.33));
}
}
}
.hairline(@position, @color) when (@position = left) {
&:before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: auto;
right: auto;
width: 1px;
height: 100%;
background-color: @color;
display: block;
z-index: 15;
// .transform-origin(0% 50%);
html.pixel-ratio-2 & {
.transform(scaleX(0.5));
}
html.pixel-ratio-3 & {
.transform(scaleX(0.33));
}
}
}
.hairline(@position, @color) when (@position = bottom) {
&:after {
content: '';
position: absolute;
left: 0;
bottom: 0;
right: auto;
top: auto;
height: 1px;
width: 100%;
background-color: @color;
display: block;
z-index: 15;
html.pixel-ratio-2 & {
.transform(scaleY(0.5));
}
html.pixel-ratio-3 & {
.transform(scaleY(0.33));
}
}
}
.hairline(@position, @color) when (@position = right) {
&:after {
content: '';
position: absolute;
right: 0;
top: 0;
left: auto;
bottom: auto;
width: 1px;
height: 100%;
background-color: @color;
display: block;
z-index: 15;
// .transform-origin(100% 50%);
html.pixel-ratio-2 & {
.transform(scaleX(0.5));
}
html.pixel-ratio-3 & {
.transform(scaleX(0.33));
}
}
}
// For right and bottom
.hairline-remove(@position) when not (@position = left) and not (@position = top) {
&:after {
display: none;
}
}
// For left and top
.hairline-remove(@position) when not (@position = right) and not (@position = bottom) {
&:before {
display: none;
}
}
// For right and bottom
.hairline-color(@position, @color) when not (@position = left) and not (@position = top) {
&:after {
background-color: @color;
}
}
// For left and top
.hairline-color(@position, @color) when not (@position = right) and not (@position = bottom) {
&:before {
background-color: @color;
}
}
// Encoded SVG Background
.encoded-svg-background(@svg) {
@url: `encodeURIComponent(@{svg})`;
background-image: url("data:image/svg+xml;charset=utf-8,@{url}");
}
// Preserve3D
.preserve3d() {
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
transform-style: preserve-3d;
}
// Shadow
.depth(@level:1) {
& when (@level = 0) {
box-shadow: none;
}
& when (@level = 1) {
box-shadow: 0 2px 1px -1px rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 1px 3px 0 rgba(0,0,0,.12);
}
& when (@level = 2) {
box-shadow: 0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12);
}
& when (@level = 3) {
box-shadow: 0 3px 3px -2px rgba(0,0,0,.2),0 3px 4px 0 rgba(0,0,0,.14),0 1px 8px 0 rgba(0,0,0,.12);
}
& when (@level = 4) {
box-shadow: 0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12);
}
& when (@level = 5) {
box-shadow: 0 3px 5px -1px rgba(0,0,0,.2),0 5px 8px 0 rgba(0,0,0,.14),0 1px 14px 0 rgba(0,0,0,.12);
}
& when (@level = 6) {
box-shadow: 0 3px 5px -1px rgba(0,0,0,.2),0 6px 10px 0 rgba(0,0,0,.14),0 1px 18px 0 rgba(0,0,0,.12);
}
& when (@level = 7) {
box-shadow: 0 4px 5px -2px rgba(0,0,0,.2),0 7px 10px 1px rgba(0,0,0,.14),0 2px 16px 1px rgba(0,0,0,.12);
}
& when (@level = 8) {
box-shadow: 0 5px 5px -3px rgba(0,0,0,.2),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12);
}
& when (@level = 9) {
box-shadow: 0 5px 6px -3px rgba(0,0,0,.2),0 9px 12px 1px rgba(0,0,0,.14),0 3px 16px 2px rgba(0,0,0,.12);
}
& when (@level = 10) {
box-shadow: 0 6px 6px -3px rgba(0,0,0,.2),0 10px 14px 1px rgba(0,0,0,.14),0 4px 18px 3px rgba(0,0,0,.12);
}
& when (@level = 11) {
box-shadow: 0 6px 7px -4px rgba(0,0,0,.2),0 11px 15px 1px rgba(0,0,0,.14),0 4px 20px 3px rgba(0,0,0,.12);
}
& when (@level = 12) {
box-shadow: 0 7px 8px -4px rgba(0,0,0,.2),0 12px 17px 2px rgba(0,0,0,.14),0 5px 22px 4px rgba(0,0,0,.12);
}
& when (@level = 13) {
box-shadow: 0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px rgba(0,0,0,.12);
}
& when (@level = 14) {
box-shadow: 0 7px 9px -4px rgba(0,0,0,.2),0 14px 21px 2px rgba(0,0,0,.14),0 5px 26px 4px rgba(0,0,0,.12);
}
& when (@level = 15) {
box-shadow: 0 8px 9px -5px rgba(0,0,0,.2),0 15px 22px 2px rgba(0,0,0,.14),0 6px 28px 5px rgba(0,0,0,.12);
}
& when (@level = 16) {
box-shadow: 0 8px 10px -5px rgba(0,0,0,.2),0 16px 24px 2px rgba(0,0,0,.14),0 6px 30px 5px rgba(0,0,0,.12);
}
& when (@level = 17) {
box-shadow: 0 8px 11px -5px rgba(0,0,0,.2),0 17px 26px 2px rgba(0,0,0,.14),0 6px 32px 5px rgba(0,0,0,.12);
}
& when (@level = 18) {
box-shadow: 0 9px 11px -5px rgba(0,0,0,.2),0 18px 28px 2px rgba(0,0,0,.14),0 7px 34px 6px rgba(0,0,0,.12);
}
& when (@level = 19) {
box-shadow: 0 9px 12px -6px rgba(0,0,0,.2),0 19px 29px 2px rgba(0,0,0,.14),0 7px 36px 6px rgba(0,0,0,.12);
}
& when (@level = 20) {
box-shadow: 0 10px 13px -6px rgba(0,0,0,.2),0 20px 31px 3px rgba(0,0,0,.14),0 8px 38px 7px rgba(0,0,0,.12);
}
& when (@level = 21) {
box-shadow: 0 10px 13px -6px rgba(0,0,0,.2),0 21px 33px 3px rgba(0,0,0,.14),0 8px 40px 7px rgba(0,0,0,.12);
}
& when (@level = 22) {
box-shadow: 0 10px 14px -6px rgba(0,0,0,.2),0 22px 35px 3px rgba(0,0,0,.14),0 8px 42px 7px rgba(0,0,0,.12);
}
& when (@level = 23) {
box-shadow: 0 11px 14px -7px rgba(0,0,0,.2),0 23px 36px 3px rgba(0,0,0,.14),0 9px 44px 8px rgba(0,0,0,.12);
}
& when (@level = 24) {
box-shadow: 0 11px 15px -7px rgba(0,0,0,.2),0 24px 38px 3px rgba(0,0,0,.14),0 9px 46px 8px rgba(0,0,0,.12);
}
// & when (@level = 1) {
// box-shadow: rgba(0, 0, 0, 0.117647) 0px 1px 6px, rgba(0, 0, 0, 0.117647) 0px 1px 4px;
// }
// & when (@level = 2) {
// box-shadow: rgba(0, 0, 0, 0.156863) 0px 3px 10px, rgba(0, 0, 0, 0.227451) 0px 3px 10px;
// }
// & when (@level = 3) {
// box-shadow: rgba(0, 0, 0, 0.188235) 0px 10px 30px, rgba(0, 0, 0, 0.227451) 0px 6px 10px;
// }
// & when (@level = 4) {
// box-shadow: rgba(0, 0, 0, 0.247059) 0px 14px 45px, rgba(0, 0, 0, 0.219608) 0px 10px 18px;
// }
// & when (@level = 5) {
// box-shadow: rgba(0, 0, 0, 0.298039) 0px 19px 60px, rgba(0, 0, 0, 0.219608) 0px 15px 20px;
// }
}
// Highlighted Links
.active-highlight(@color:rgba(255, 255, 255, 0.15)){
&:before {
content: '';
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
background-color: @color;
background-repeat: no-repeat;
background-position: center;
background-size: 100% 100%;
opacity: 0;
pointer-events: none;
.transition(600ms);
}
&.active-state:before,
html:not(.watch-active-state) &:active:before {
opacity: 1;
.transition(150ms);
}
}
.active-highlight-color(@color) {
&:before {
background-image: -webkit-radial-gradient(center, circle cover, @color 66%, rgba(red(@color),green(@color),blue(@color),0) 66%);
background-image: radial-gradient(circle at center, @color 66%, rgba(red(@color),green(@color),blue(@color),0) 66%);
}
}
// No Scrollbar
.no-scrollbar() {
&::-webkit-scrollbar {
display: none !important;
width: 0 !important;
height: 0 !important;
-webkit-appearance: none;
opacity: 0 !important;
}
}
.ellipsis() {
white-space:nowrap;
text-overflow:ellipsis;
overflow:hidden;
word-wrap: break-word;
}

View File

@@ -0,0 +1 @@
07bcdb5e-76f3-4654-97b5-10acbdf6d0b2

View File

@@ -0,0 +1,47 @@
<template lang="pug">
.header
.content(:style="{ height: height }")
slot(name="content")
</template>
<script lang="ts">
import { toRefs, Ref, ref, reactive, createComponent, PropOptions, onMounted, SetupContext } from '@vue/composition-api'
export default createComponent({
props: {
height: {
type: String,
default: 'auto'
}
},
setup() {
}
})
</script>
<style scoped lang="less">
.header {
width: 100%;
height: 200px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
background: url("~@public/img/header_logo.jpg");
background-size: cover;
position: relative;
.content {
width: 95%;
box-sizing: border-box;
padding: 23px 10px;
position: absolute;
background: #fff;
top: calc(200px - 25px);
border-radius: 10px;
text-align: center;
box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.1);
border: 1px solid rgba(255, 255, 255, 0);
}
}
</style>

View File

@@ -0,0 +1,28 @@
<template>
<div class="hello">
<h1>{{ title }}</h1>
</div>
</template>
<script lang="ts">
import { toRefs, Ref, ref, reactive, createComponent, PropOptions, onMounted, SetupContext } from '@vue/composition-api'
export default createComponent({
name: 'hello-word',
props: {
title: {
type: String,
default: 'HelloWorld 子组件的默认Props值'
}
},
setup() {
}
})
</script>
<style scoped lang="less">
h3 {
margin: 40px 0 0
}
</style>

View File

@@ -0,0 +1 @@
54d32629-91c2-4e61-9575-263f0779f203

View File

@@ -0,0 +1,50 @@
<route-meta>
{
"isLogin": false,
"title": "关于我"
}
</route-meta>
<template lang="pug">
.about
h1(@click="addCount") {{ title }}
p {{count}}
p Test: {{ Test }}
</template>
<script lang="ts">
import { toRefs, Ref, ref, reactive, createComponent, PropOptions, onMounted, SetupContext } from '@vue/composition-api'
import { UnwrapRef } from '@vue/composition-api/dist/reactivity'
export default createComponent({
props: {},
setup(props: PropOptions, ctx: SetupContext) {
const state: UnwrapRef<{
title: Ref<string>,
count: Ref<number>
}> = reactive({
title: ref('关于我页面'),
count: ref(0)
});
const Test: Ref<string> = ref('张三');
const addCount = () => {
state.count+=1
};
onMounted(async () => {
console.log("Test: ",Test.value)
});
return {
...toRefs(state),
Test,
addCount
}
}
})
</script>
<style lang="less" scoped>
@import "~@less/about";
</style>

View File

@@ -0,0 +1,165 @@
<route-meta>
{
"isLogin": false,
"title": "测算"
}
</route-meta>
<template lang="pug">
.calculation
HeaderComponent()
template(v-slot:content)
van-swipe(@change='onChange', ref="questionList",
:touchable="false", :loop="false",
:show-indicators="current !== ProblemList.length - 1",
:duration="300")
van-swipe-item.calculation_f(v-for="(item,index) in ProblemList" :key="index")
p {{index+1}}. {{item.title}}
.action
//- 是 & 否 的按钮
div(:class="ix === AnswerIndex ? 'active ac' : 'ac' "
@click.stop="AnswerChoice(it.id, ix)"
v-for="(it, ix) in AnswerList")
.radio
span.text {{it.text}}
.submit_question(v-if="index === ProblemList.length - 1", @click="SubmitTest") 提交测试
template(#indicator="")
.custom-indicator
| 答题进度{{ current + 1 }}/{{ProblemList.length}}
</template>
<script lang="ts">
import { toRefs, Ref, ref, reactive, createComponent, PropOptions, onMounted, SetupContext as SC } from '@vue/composition-api'
import { UnwrapRef } from '@vue/composition-api/dist/reactivity'
import HeaderComponent from '../components/Header.vue'
//@ts-ignore
import { SetupContext } from "@core/types/ctx.d.ts";
//@ts-ignore
import HomeServiceImpl from '@impl/home.service.impl';
export default createComponent({
props: {},
setup(props: PropOptions, ctx: SC | SetupContext) {
const state: UnwrapRef<{
current: Ref<number>, // 当前轮播图的下标
ProblemList: Ref<{ [index: string]: any }[]>, // 存放60道问题的数组
AnswerList: Ref<{ [index: string]: any }>, // 答案的数组 A: 是B: 否
AnswerIndex: Ref<number>, // 当前答案点击的下标
test: Ref<number>, // 存放默认的选项
questionList: Ref<{ [key: string]: (...args: any[]) => any }>, // 保存轮播图的dom
TypeList: Ref<string[]>, // 分类的类型
}> = reactive({
current: 0,
ProblemList: ref([]),
AnswerList: ref([
{ id: 1, text: ' A: 是', clas: 'yes' },
{ id: 2, text: ' B: 否', clas: 'no' },
]),
AnswerIndex: -1,
test: 1,
questionList: {},
TypeList: ['R','A','I','S','E','C']
})
// 获取本地题目
onMounted(async ()=> state.ProblemList = ctx.root.$getLocalStorage('problem'))
// 点击答案,判断是否答对
const AnswerChoice = (name: number, index: number) => {
// 激活选中按钮
state.AnswerIndex = index
// 如果是第四部分的题目
if (state.ProblemList[state.current].part == 4) {
console.log("")
console.log("第四部分:",JSON.stringify(state.ProblemList[state.current]))
console.log("你选择的答案:", name)
console.log("正确答案是:", state.ProblemList[state.current].answer)
name == state.ProblemList[state.current].answer ? state.ProblemList[state.current].answer = 1 : state.ProblemList[state.current].answer = 0
// 正常题目
} else {
// 如果为正确答案
name === 1 ? state.ProblemList[state.current].answer = 1 : state.ProblemList[state.current].answer = 0
}
//
// // 如果已经点完了所有题目,那么不跳转
if (state.current+1 != state.ProblemList.length) {
// 延时跳转到下一页,为了让用户看见选中的按钮
setTimeout(()=> state.questionList.next(),200)
}
console.log("state.ProblemList[current]: ", state.ProblemList[state.current].answer)
}
/**
* 轮播图切换
* @param index
*/
const onChange = (index: number) => {
// 置空下标,默认不选中任何选项
state.AnswerIndex = -1;
state.current = index;
}
/**
* 提交测试 按钮被点击后
* @constructor
*/
const SubmitTest = async () => {
ctx.root.$toast.loading({
message: '加载中...',
forbidClick: true,
});
let Total: Array<Object> = []
state.TypeList.forEach(val => {
Total.push({ type: val, num: StatisticalScore(val) })
});
// 提交答案,请求结果
let res = await HomeServiceImpl.myResult({
testNum: Total
})
// 本地保存结果
ctx.root.$setLocalStorage("result", res.data)
if (ctx.root.$getLocalStorage("result") != null) {
ctx.root.$toast.clear();
// 跳转首结果页
// ctx.root.$router.push('/result') 跳转速度太慢
location.href="#/result"
}
}
// 计算总分
const StatisticalScore = (type: string) => {
let data: { [index: string]: any }[] = state.ProblemList.filter(((value, index) => {
return value.type == type && value.answer == 1
}));
console.log(`筛选出来类型${type}: 的数据为:`, data)
let score: number = 0;
data.forEach((value => score += value.answer));
console.log("分数为:", score)
return score
}
return {
...toRefs(state),
onChange,
AnswerChoice,
SubmitTest
}
},
components: {
HeaderComponent
},
})
</script>
<style lang="less" scoped>
@import "~@less/calculation";
</style>

View File

@@ -0,0 +1,72 @@
<route-meta>
{
"isLogin": false,
"title": "首页"
}
</route-meta>
<template lang="pug">
.home
HeaderComponent
template(v-slot:content)
ul.tips
li 1请在心态平和及时间充足的情况下才开始答题
li 2本问卷中的所有问题都取自于人们的日常生活而您的回答只是表明您通常是如何看待和处理事物的所有问题都是反映何种工作氛围和环境适合您无所谓对错更无好坏之分
li 3.本测试分为四部分共60题,请根据自己的实际情况在带有颜色的框内选择
li 4.每道题都要作答尽管有些题目不适合您同时测验中有测谎的题目如果发现您没有诚实回答整个问卷作废
li 5.{{resMyPart.title}}
div.start(@click="startTest") 开始测评
</template>
<script lang="ts">
import { inject, computed,toRefs, Ref, ref, reactive, createComponent, PropOptions, onMounted, SetupContext as SC } from '@vue/composition-api'
import { UnwrapRef } from '@vue/composition-api/dist/reactivity'
//@ts-ignore
import HomeServiceImpl from '@impl/home.service.impl';
import HeaderComponent from '../components/Header.vue'
//@ts-ignore
import { SetupContext } from "@core/types/ctx.d.ts";
export default createComponent({
setup(props: PropOptions, ctx: SC | SetupContext) {
const state: UnwrapRef<{
title: Ref<string>,
resMyPart: Ref<{partId: number}>
}> = reactive({
title: ref('首页'),
resMyPart: ref({ partId: 0 })
});
onMounted(async ()=> {
await getProblemList()
});
const getProblemList = async () => {
// 测试选题类型
let resMyPart: { data: { partId: number } } = await HomeServiceImpl.myPart({});
state.resMyPart = resMyPart.data;
// 测试试题接口
let res: { data: Array<Object> } = await HomeServiceImpl.myPaper({ partId: state.resMyPart.partId})
// 本地保存问题数据
ctx.root.$setLocalStorage("problem", res.data)
}
const startTest = () => {
ctx.root.$router.push({ path: '/calculation' })
}
return {
...toRefs(state),
startTest
}
},
components: {
HeaderComponent
},
})
</script>
<style lang="less" scoped>
@import "~@less/home";
</style>

View File

@@ -0,0 +1,304 @@
<route-meta>
{
"isLogin": false,
"title": "专业测试报告"
}
</route-meta>
<template lang="pug">
.result
.header 专业测试报告
.like
.title 您的专业兴趣倾向
ul
li(v-for="(item,index) in feature" :key="index")
.letter {{item.type}}
span {{item.title}}
.line
.like
.title 适合报考的专业
.list
.item(v-for="(value,index) in typeCount" :key="index" @click="ShowMajor(value.recType)")
h3 {{value.num}}
span {{index === 0 ? '推荐报考专业' : index === 1 ? '可考虑报考专业' : '不推荐报考' }}
.line
transition(name="slide-fade")
.like(v-if="typeCount.length !== 0 && isShowMajor")
.title.weight {{MajorCurrentIndex === 0 ? '推荐报考专业' : MajorCurrentIndex === 1 ? '可考虑报考专业' : '不推荐报考专业' }}
.li(v-for="(item,index) in typeCount" :key="index")
transition(name="fade")
van-collapse(accordion v-if="index == MajorCurrentIndex", v-model="activeMajor" @change="changeCollapse")
van-list(v-model='item.loading', :offset="200", :finished='item.finished', finished-text='没有更多了', @load='onLoad',
:immediate-check="true")
van-collapse-item(v-for="(ie,ex) in item.content"
:key="ex"
:title='ie.title', :name="ie.recType" , :value="ie.countSon+'个' ")
van-cell-group(v-if="mySonLevel.length !== 0" :border="false")
van-cell(v-for="(ef,ip) in mySonLevel" :title='ef.title' :key="ip")
.nodata(v-else) 加载中..
transition(name="slide-fade")
.like(v-show="typeCount.length === 0 || !isShowMajor ? true : false")
.title.clear 评测结果报告
div(ref="myChart" :style="{width: '100%', height: '250px'}")
.chart_list
.item(v-for="(im,index) in EvaluationResults" :key="index")
.left
.right_text {{im.text}}
.chart_l
.item(v-for="(item,index) in feature" :key="index")
h2 {{item.type}} {{item.title}}
p {{item.feature}}
</template>
<script lang="ts">
import { toRefs, Ref, ref, reactive, createComponent, PropOptions, onMounted, SetupContext as SC } from '@vue/composition-api'
import { UnwrapRef } from '@vue/composition-api/dist/reactivity'
//@ts-ignore
import { SetupContext } from "@core/types/ctx.d.ts";
import echarts, { ECharts } from "echarts";
//@ts-ignore
import HomeServiceImpl from '@impl/home.service.impl';
export default createComponent({
props: {},
setup(props: PropOptions, ctx: SC | SetupContext) {
const state: UnwrapRef<{
title: Ref<string>,
myChart: Ref<any>,
EvaluationResults: Ref<Array<Object>>, // 评测结果
feature: Array<{ type: string, title: string, feature: string }>,
typeCount: { [key: string]: any }[],
Echarts: Ref<any>, // 保存init后的 Echarts
isShowMajor: Ref<boolean>, // 是否展示展业列表
MajorCurrentIndex: Ref<number>, // 专业点击后的下标 0, 1, 2
activeMajor: Ref<number>, // 折叠面板 默认显示
mySonLevel: Ref<Array<any>> // 保存子节点数据
}> = reactive({
title: ref('专业测试报告'),
myChart: '',
EvaluationResults: [
{ text: '红色:说明你与其他人相比,此类智能非常突出,表现出来的特点也很鲜明,继续培养此类智能或从事相关活动会更为容易' },
{ text: '黄色:说明你与大部分人比较相近,此类能力表现一般。你可以通过从事相关活动,继续培养这些能力' },
{ text: '蓝色:说明在人群中,你此方面的兴趣相对比较弱,对相关活动不感兴趣,不喜欢。从事相关兴趣活动或者培养此类兴趣需要付出更多的努力' },
],
feature: ref([]),
typeCount: ref([]),
Echarts: ref({}),
isShowMajor: false,
MajorCurrentIndex: 0,
activeMajor: 0,
mySonLevel: ref([])
});
onMounted(() => {
StartAction()
})
/**
* 滚动加载数据
*/
const onLoad = ()=> {
setTimeout(()=> {
console.log("滚动到底部了")
state.typeCount[state.MajorCurrentIndex].loading = true
state.typeCount[state.MajorCurrentIndex].page += 1;
ShowMajor(state.typeCount[state.MajorCurrentIndex].recType, 'onload')
},300)
//
//
}
/**
* 从本地获取数据
*/
const StartAction = ()=> {
state.Echarts = echarts.init(state.myChart)
// 从本地读出数据
let data: {
typePic: Array<any>,
typeCount: { [key: string]: any }[],
feature: Array<{ type: string, title: string, feature: string }>
} = ctx.root.$getLocalStorage("result");
// 保存 您的专业兴趣倾向
state.feature = data.feature
// 适合报考的专业
// 追加content字段用于保存专业数据
data.typeCount.forEach((val:any,index: number) => {
val.content = []; // 保存列表数据
val.page = 1; // 请求的页数
val.recType = index + 1; // recType
val.ishow = false; // recType
val.loading = false; // 是否加载数据
val.finished = false; // 是否已经加载完数据
});
state.typeCount = data.typeCount
console.log("state.typeCount: ", state.typeCount)
let xAxisData: string[] = []; // 保存 X轴数据
let seriesData: number[] = []; // 保存 柱状图的数据
// 重新构造数据
data.typePic.forEach((val: { typeName: string, percent: number }) => {
xAxisData.push(val.typeName)
seriesData.push(val.percent)
});
drawLine(xAxisData, seriesData)
}
/**
* 获取父级专业的数据
* @constructor
*/
const ShowMajor = async (recType: number, from: string = 'null') => {
from == 'null' ? ctx.root.$toast.loading({
message: '加载中...',
forbidClick: true,
}): ''
state.MajorCurrentIndex = recType -1
if (state.typeCount[state.MajorCurrentIndex].content.length == 0 || from == 'onload') {
let params = {
testNum: ctx.root.$getLocalStorage("result").typeCount,
recType: recType,
page: state.typeCount[state.MajorCurrentIndex].page
};
let res = await HomeServiceImpl.myParentLevel(params)
state.typeCount[state.MajorCurrentIndex].loading = false
if (res.data.count == 0 || state.typeCount[state.MajorCurrentIndex].page > res.data.info.page_sum) {
state.typeCount[state.MajorCurrentIndex].finished = true
} else {
state.typeCount[state.MajorCurrentIndex].content = [...state.typeCount[state.MajorCurrentIndex].content,...res.data.data]
}
changeCollapse(0)
}
ctx.root.$toast.clear()
from == "null" ? changeOpen(recType) : ''
}
/**
* 父级面板被展开,获取子级数据
*/
const changeCollapse = async (activeNames: number)=> {
let params = {
testNum: ctx.root.$getLocalStorage("result").typeCount,
recType: state.typeCount[state.MajorCurrentIndex].recType,
pid: state.typeCount[state.MajorCurrentIndex].content[activeNames].pid
};
state.mySonLevel = []
let res = await HomeServiceImpl.mySonLevel(params);
state.mySonLevel = res.data
}
const changeOpen =(recType: number) => {
// 改变点击对象的转态,显示自己
state.typeCount.forEach(val => {
if (val.recType != recType) {
val.ishow = false
} else {
val.ishow = !val.ishow
}
});
state.typeCount[state.MajorCurrentIndex].ishow
? state.isShowMajor = state.typeCount[state.MajorCurrentIndex].ishow
: state.isShowMajor = false
}
/**
* 画饼状图
* @param xAxisData
* @param seriesData
*/
const drawLine = (xAxisData: string[], seriesData: number[]) => {
state.Echarts.setOption({
tooltip: {},
xAxis: {
data: xAxisData,
nameTextStyle: {
color: "#BDB6B6"
}
},
yAxis: {
show: true,
type: 'value',
max: 100,
axisLabel:{
formatter:function(value: number,index: number){
let texts = [];
if(index == 0){
texts.push(10);
}else if(index == 1){
texts.push(28);
}else if(index == 2){
texts.push(46);
}else if(index == 3){
texts.push(64);
}else if(index == 4){
texts.push(82);
}else if(index == 5){
texts.push(100);
}
return texts;
}
}
},
series: [{
type: 'bar',
data: seriesData,
barWidth: 30,
itemStyle: {
normal: {
color: function (params: any) {
if (params.dataIndex == 0) {
return "#FE6173"
}
if (params.dataIndex == 5) {
return "#6CCBFD"
}
return "#FDC570"
},
label: {
formatter: "{c}",
show: true,
position: "top",
textStyle: {
fontWeight: "bolder",
fontSize: "14",
color: "#BDB6B6"
}
}
}
}
}]
});
}
return {
...toRefs(state),
ShowMajor,
changeCollapse,
onLoad
}
}
})
</script>
<style lang="less" scoped>
@import "~@less/result";
</style>

View File

@@ -0,0 +1 @@
736036f8-be03-4c49-841e-ac95e9f5f1b3

View File

@@ -0,0 +1 @@
c117e891-d667-458d-8dd2-3d0743ca2889

View File

@@ -0,0 +1,53 @@
import { PluginObject } from 'vue';
import VueRouter, { RouterOptions } from 'vue-router';
import VueCompositionApi from '@vue/composition-api';
import { AutoRoutesConfig } from './route.config';
import { Injectable } from 'vue3decorators';
import Vant from 'vant';
import 'vant/lib/index.css';
import 'amfe-flexible/index.js';
@Injectable()
export class config {
/**
* 接口配置: 测试环境基地址,正式环境基地址,具体页面接口
*/
public static AjaxConfig: {
DevUrl: string,
ProdUrl: string,
ApiList: { [ key: string ]: string}
} = {
// DevUrl: 'http://www.zyhelp.test/api/',
DevUrl: 'http://www.zhiyuanhelp.com/index.php/api',
ProdUrl: 'http://www.zhiyuanhelp.com/index.php/api',
ApiList: {
myPaper: '/myPaper', //测试试题接口
myPart: '/myPart', //测试选题类型
myResult: '/myResult', //测试结果页
myParentLevel: '/myParentLevel', // 获取父级专业类型
mySonLevel: '/mySonLevel', // 获取子级专业
},
};
/**
* 需要被挂载的节点
*/
public static mountElement: string = '#app';
/**
* Vue插件
*/
public static VuePlugs: PluginObject<never>[] = [
Vant,
VueRouter,
VueCompositionApi
];
public static RouterConfigUrl: RouterOptions = {
mode: 'hash',
base: '/test',
routes: AutoRoutesConfig,
}
}

View File

@@ -0,0 +1,42 @@
// 根据page目录结构自动生成的路由配置文件
// 参考Nuxt.jshttps://zh.nuxtjs.org/guide/routing
// @ts-ignore
export const AutoRoutesConfig = [
{
name: "about",
path: "/about",
component: () => import(/* webpackChunkName: 'about' */ '@/page/about.vue'),
meta: {
isLogin: false,
title: "关于我"
}
},
{
name: "calculation",
path: "/calculation",
component: () => import(/* webpackChunkName: 'calculation' */ '@/page/calculation.vue'),
meta: {
isLogin: false,
title: "测算"
}
},
{
name: "result",
path: "/result",
component: () => import(/* webpackChunkName: 'result' */ '@/page/result.vue'),
meta: {
isLogin: false,
title: "专业测试报告"
}
},
{
name: "index",
path: "/",
component: () => import(/* webpackChunkName: 'index' */ '@/page/index.vue'),
meta: {
isLogin: false,
title: "首页"
}
}
];

View File

@@ -0,0 +1 @@
01fa2aaa-368d-4099-8caa-f3f925006186

View File

@@ -0,0 +1,99 @@
import { Utils } from '../utils/index.utils';
import axios, { AxiosInstance } from 'axios';
import { Injectable } from 'vue3decorators';
@Injectable()
export class Axios {
public constructor() {
// 设置接口请求基地址
axios.defaults.baseURL = Utils.CheckAjaxUrl();
this.ResponseInterceptor();
this.RequestInterceptor();
}
/**
* Get 请求
* 请求参数请参考接口RequestParams
* @param params
*/
public async get(params: { url: string, data: Object, header?: object }): Promise<Object> {
try {
return await axios.get(params.url, {
params: params.data,
headers: Object.assign({}, params.header)
});
} catch (e) {
throw new Error(`GET 请求出错:${e.message}`)
}
}
/**
* Post 请求
* 请求参数请参考接口RequestParams
* @param params
*/
public async post(params: { url: string, data: Object, header?: Object }): Promise<Object> {
try {
return await axios.post(params.url, params.data, {
headers: Object.assign({}, params.header)
})
} catch (e) {
throw new Error(`POST 请求出错:${e.message}`)
}
}
/**
* Put 请求
* 请求参数请参考接口RequestParams
* @param params
*/
public async put(params: { url: string, data: Object }): Promise<Object> {
try {
return await axios.put(params.url, params.data)
} catch (e) {
throw new Error(`PUT 请求出错:${e.message}`)
}
}
/**
* delete 请求
* 请求参数请参考接口RequestParams
* @param params
*/
public async delete(params: { url: string, data: Object }): Promise<Object> {
try {
return await axios.delete(params.url, {params: params.data})
} catch (e) {
throw new Error(`DELETE 请求出错:${e.message}`)
}
}
/**
* 添加响应拦截器
* @constructor
*/
public async ResponseInterceptor(): Promise<any> {
axios.interceptors.response.use(response => {
return response.data;
}, (error: Error) => {
return Promise.reject(error)
})
}
/**
* 添加请求拦截器
* @constructor
*/
public async RequestInterceptor(): Promise<any> {
axios.interceptors.request.use(config => {
/**
* 统一设置请求头
*/
return config
}, function (error: Error) {
return Promise.reject(error)
})
}
}

View File

@@ -0,0 +1 @@
c59d93ee-b9ae-45f0-85fc-ba501c04650f

View File

@@ -0,0 +1,34 @@
import { VNodeDirective, VNode } from 'vue'
import { Directive, Injectable } from 'vue3decorators';
/**
* 自定义指令
* 注意如果类的方法被加上了 @Directive() 注解
* 那么该方法就会被注册为vue的自定义指令。
* 例如public index() {}那么在组件中指令为v-index
* public index() {} 必须返回对象,看下面案例
*/
@Injectable()
export class DirectiveList {
@Directive()
public index() {
return {
bind: (el: Element, binding: VNodeDirective, vnode: VNode) => {
// console.log(el)
// console.log(binding)
console.log("v-index 指令接收到的数值:", binding.value);
// console.log(vnode);
}
}
}
@Directive()
public test() {
return {
bind: (el: Element) => {
console.log("test: ", el)
}
}
}
}

View File

@@ -0,0 +1 @@
50f3df00-5026-44ff-b2b3-60658f474180

View File

@@ -0,0 +1,19 @@
import { computed,toRefs, Ref, ref, reactive } from '@vue/composition-api';
import { UnwrapRef } from '@vue/composition-api/dist/reactivity';
/**
* 注意广播只能在androidChromeEdgeFirefoxOpera中使用
* 不支持IESafari 等浏览器,请注意兼容性
* @constructor
*/
export function HelpingPopupBroadcastChannel() {
const state: UnwrapRef<{
HelpingSuccess: BroadcastChannel
}> = {
HelpingSuccess: new BroadcastChannel('HelpingSuccess')
};
return {
...toRefs(state)
}
}

View File

@@ -0,0 +1 @@
326627c5-e6cd-47dd-904d-80ded8ea1a21

View File

@@ -0,0 +1,10 @@
import { Mixin, Injectable } from 'vue3decorators';
/**
* 类的方法上如果加上注解 @Mixin(),那么该方法
* 就可以作为Vue的全局mixin
*/
@Injectable()
export class MixinList {
}

View File

@@ -0,0 +1 @@
7107ace5-1ac1-4601-81a3-d06b1d75080a

View File

@@ -0,0 +1,18 @@
import { Init } from './init.run';
// import { config } from '../config/index.config';
import { CreateElement } from 'vue';
/**
* Vue项目的启动文件
* 从Init类中抽离出来的原因是方便后期如果要做Vue多端项目
*/
class Index extends Init {
constructor() {
super();
new this.Vues({
router: this.router,
render: (h: CreateElement) => h(Init.AppComponent)
}).$mount('#app');
}
}
new Index();

View File

@@ -0,0 +1,73 @@
import App from '@/App.vue';
import Vue, { VueConstructor , PluginObject} from 'vue';
import VueRouter, { RawLocation, Route } from 'vue-router';
import { Inject, directiveModel, mixinModel, globalMethodModel, StartBoot } from 'vue3decorators';
import { config } from '../config/index.config'
import { Axios } from '../dao/index.dao';
import { DirectiveList } from '../directive/index.directive';
import { MixinList } from '../mixin/index.mixin';
/**
* 项目初始化文件
*/
@StartBoot(false)
export class Init {
@Inject()
private readonly config!: config;
@Inject()
public readonly directiveList!: DirectiveList;
@Inject()
public readonly mixinList!: MixinList;
@Inject()
public readonly axios!: Axios;
private initVuePlugsArray = config.VuePlugs;
protected router!: VueRouter;
protected Vues: VueConstructor<Vue> = Vue;
public static AppComponent: VueConstructor = App;
constructor() {
this.Vues.config.productionTip = false;
this.initPlugs();
}
/**
* 初始化Vue和非Vue插件Vue Mixinvue directive
*/
private initPlugs(): void {
globalMethodModel.GlobalMethod.forEach(v => this.Vues.prototype[v['n']] = v['f']);
directiveModel.DirectiveContainer.forEach(v => this.Vues.directive(v['n'], v['f']));
mixinModel.MixinContainer.forEach(v => this.Vues.mixin(v));
this.initVuePlugsArray.forEach(v => this.Vues.use(v));
this.InitVueRouter();
}
/**
* 初始化配置全局路由
* @constructor
*/
private InitVueRouter(): void {
this.router = new VueRouter(config.RouterConfigUrl);
// 全局路由守卫
this.router.beforeEach((to: Route, from: Route, next: (to?: RawLocation | false | void) => void) => {
document.title = to.meta.title;
next()
});
// 重写路由Push
const routerPush: (location: RawLocation)
=> Promise<Route>
= VueRouter.prototype.push;
VueRouter.prototype.push = function push(location: RawLocation): Promise<Route> {
// @ts-ignore
return routerPush.call(this, location).catch((error: Error) => error)
};
}
}

View File

@@ -0,0 +1 @@
c1e5b860-483f-40bb-ac77-eb388709cb70

View File

@@ -0,0 +1,7 @@
export interface HomeService {
myPaper(data: object): Promise<any>;
myPart(data: object): Promise<any>;
myResult(data: object): Promise<any>;
myParentLevel(data: object): Promise<any>;
mySonLevel(data: object): Promise<any>;
}

View File

@@ -0,0 +1 @@
f482eb8c-2bc9-40dd-a7bc-f3820e4e7eb5

View File

@@ -0,0 +1,22 @@
import { HomeService } from "../Home.service";
import { GET, POST, PUT } from 'vue3decorators';
export class HomeServiceImpl implements HomeService {
@POST()
public async myPaper(data: object): Promise<any> {}
@POST()
public async myResult(data: object): Promise<any> {}
@POST()
public async myParentLevel(data: object): Promise<any> {}
@POST()
public async mySonLevel(data: object): Promise<any> {}
@GET()
public async myPart(data: object): Promise<any> {}
}
export default new HomeServiceImpl();

View File

@@ -0,0 +1 @@
8d6758b1-f79b-442a-a7fb-3f212e90a58e

View File

@@ -0,0 +1,3 @@
export interface SetupContext {
readonly root: { [key: string]: (...args: any[]) => any };
}

View File

@@ -0,0 +1,17 @@
import Vue, {VNode} from 'vue';
import {ComponentInstance} from "@vue/composition-api/dist/component/component";
declare module '@vue/composition-api/dist/component/component' {
interface SetupContext {
readonly attrs: Record<string, string>;
readonly slots: {
[key: string]: (...args: any[]) => VNode[];
};
readonly parent: ComponentInstance | null;
readonly root: ComponentInstance;
readonly listeners: {
[key: string]: Function;
};
emit(event: string, ...args: any[]): void;
}
}

View File

@@ -0,0 +1,4 @@
declare module '*.vue' {
import Vue from 'vue'
export default Vue
}

View File

@@ -0,0 +1,388 @@
/**
* Copyright (c) 2015,Egret-Labs.org
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Egret-Labs.org nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY EGRET-LABS.ORG AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Created by wibrst on 2015/1/10.
*/
declare class wx {
/**
* 通过config接口注入权限验证配置
* @param bodyConfig
*/
static config( bodyConfig:BodyConfig ):void;
/**
* 通过ready接口处理成功验证
* @param cbValidated 成功验证后的处理函数
*/
static ready( cbValidated:Function ):void;
/**
* 通过error接口处理失败验证
* @param cbError 处理失败验证后的处理函数
*/
static error( cbError:Function ):void;
/**
* 判断当前客户端版本是否支持指定JS接口
* @param bodyCheckJsAPISupport
*/
static checkJsApi( bodyCheckJsAPISupport:BodyCheckJsAPISupport ):void;
/**
* 获取“分享到朋友圈”按钮点击状态及自定义分享内容接口
* @param bodyMenuShareTimeline
*/
static onMenuShareTimeline( bodyMenuShareTimeline:BodyMenuShareTimeline ):void;
/**
* 获取“分享给朋友”按钮点击状态及自定义分享内容接口
* @param bodyMenuShareAppMessage
*/
static onMenuShareAppMessage( bodyMenuShareAppMessage:BodyMenuShareAppMessage ):void;
/**
* 获取“分享到QQ”按钮点击状态及自定义分享内容接口
* @param bodyMenuShareQQ
*/
static onMenuShareQQ( bodyMenuShareQQ:BodyMenuShareQQ ):void;
/**
* 获取“分享到腾讯微博”按钮点击状态及自定义分享内容接口
* @param bodyMenuShareWeibo
*/
static onMenuShareWeibo( bodyMenuShareWeibo:BodyMenuShareWeibo ):void;
/// 华丽的分界线, 以下接口参数结构较简单或使用较少均可自行查阅微信官方api文档给出适合的参数
/**
* 拍照或从手机相册中选图接口
* @param bodyChooseImage
*/
static chooseImage( body:Object ):void;
/**
* 预览图片接口
* @param body
*/
static previewImage( body:Object ):void;
/**
* 上传图片接口
* @param body
*/
static uploadImage( body:Object ):void;
/**
* 下载图片接口
* @param body
*/
static downloadImage( body:Object ):void;
/**
* 开始录音接口
* @param body
*/
static startRecord( body:Object ):void;
/**
* 停止录音接口
* @param body
*/
static stopRecord( body:Object ):void;
/**
* 监听录音自动停止接口
* @param body
*/
static onVoiceRecordEnd( body:Object ):void;
/**
* 播放语音接口
* @param body
*/
static playVoice( body:Object ):void;
/**
* 暂停播放接口
* @param body
*/
static pauseVoice( body:Object ):void;
/**
* 停止播放接口
* @param body
*/
static stopVoice( body:Object ):void;
/**
* 监听语音播放完毕接口
* @param body
*/
static onVoicePlayEnd( body:Object ):void;
/**
* 上传语音接口
* @param body
*/
static uploadVoice( body:Object ):void;
/**
* 下载语音接口
* @param body
*/
static downloadVoice( body:Object ):void;
// ---- 智能接口
/**
* 识别音频并返回识别结果接口
* @param body
*/
static translateVoice( body:Object ):void;
/// ---- 设备信息
/**
* 获取网络状态接口
* @param body
*/
static getNetworkType( body:Object ):void;
/// ---- 地理位置
/**
* 使用微信内置地图查看位置接口
* @param body
*/
static openLocation( body:Object ):void;
/**
* 获取地理位置接口
* @param body
*/
static getLocation( body:Object ):void;
/// ---- 界面操作
/**
* 隐藏右上角菜单接口
* @param body
*/
static hideOptionMenu( body:Object ):void;
/**
* 显示右上角菜单接口
* @param body
*/
static showOptionMenu( body:Object ):void;
/**
* 关闭当前网页窗口接口
* @param body
*/
static closeWindow( body:Object ):void;
/**
* 批量隐藏功能按钮接口
* @param body
*/
static hideMenuItems( body:Object ):void;
/**
* 批量显示功能按钮接口
* @param body
*/
static showMenuItems( body:Object ):void;
/**
* 隐藏所有非基础按钮接口
* @param body
*/
static hideAllNonBaseMenuItem( body:Object ):void;
/**
* 显示所有功能按钮接口
* @param body
*/
static showAllNonBaseMenuItem( body:Object ):void;
/// ---- 微信扫一扫
/**
* 调起微信扫一扫接口
* @param body
*/
static scanQRCode( body:Object ):void;
/// ---- 微信小店
/**
* 跳转微信商品页接口
* @param body
*/
static openProductSpecificView( body:Object ):void;
/// ---- 微信卡券
/**
* 调起适用于门店的卡券列表并获取用户选择列表
* @param body
*/
static chooseCard( body:Object ):void;
/**
* 批量添加卡券接口
* @param body
*/
static addCard( body:Object ):void;
/**
* 查看微信卡包中的卡券接口
* @param body
*/
static openCard( body:Object ):void;
/// ---- 微信支付
/**
* 发起一个微信支付请求
* @param body
*/
static chooseWXPay( body:Object ):void;
}
///////////////////////////////// 常用API的参数结构类
/**
* config 参数结构
* jsApiList: 所有要调用的 API
*/
declare class BodyConfig {
debug:boolean;
appId:string;
timestamp:number;
nonceStr:string;
signature:string;
jsApiList:Array<string>;
}
/**
* checkJsApi 参数结构
* jsApiList: 需要检测的JS接口列表
*/
declare class BodyCheckJsAPISupport {
success:Function;
jsApiList:Array<string>;
}
/**
* onMenuShareTimeline 参数结构
*/
declare class BodyMenuShareTimeline {
title:string;
link:string;
imgUrl:string;
success:Function;
cancel: Function;
}
/**
* onMenuShareAppMessage 参数结构
*/
declare class BodyMenuShareAppMessage {
title:string;
desc:string;
link:string;
imgUrl:string;
type:string;
dataUrl:string;
success:Function;
cancel: Function;
}
/**
* onMenuShareQQ 参数结构
*/
declare class BodyMenuShareQQ {
title:string;
desc:string;
link:string;
imgUrl:string;
type:string;
dataUrl:string;
success:Function;
cancel: Function;
}
/**
* onMenuShareWeibo 参数结构
*/
declare class BodyMenuShareWeibo {
title:string;
desc:string;
link:string;
imgUrl:string;
success:Function;
cancel: Function;
}
export default wx

View File

@@ -0,0 +1 @@
be85ff2f-ad21-4b2b-b7f3-3860c86832b7

View File

@@ -0,0 +1,97 @@
import { config } from '../config/index.config';
import { GlobalMethod } from 'vue3decorators';
// @ts-ignore
import wx from 'weixin-js-sdk';
/**
* utils 工具类
*/
export class Utils {
/**
* 检测当前环境动态返回ajax接口的对应的URL地址
* @constructor
*/
public static CheckAjaxUrl(): string {
if (process.env.NODE_ENV === 'production') {
return config.AjaxConfig.ProdUrl;
} else {
return config.AjaxConfig.DevUrl;
}
}
/**
* 动态设置网页title
* @param title
*/
@GlobalMethod()
public setTitle(title: string): void {
document.title = title;
}
@GlobalMethod()
public setLocalStorage(key: string, value: Object | Array<any>): void {
localStorage.setItem(key, JSON.stringify(value))
}
@GlobalMethod()
public getLocalStorage(key: string): Object {
return JSON.parse((localStorage.getItem(key) as string))
}
/**
* 获取配置
*
*/
@GlobalMethod()
public getConfig() {
return config;
}
/**
* 时间戳转正常时间
* @param data
*/
@GlobalMethod()
public formatDate(data: number): string {
let now=new Date(data*1000);
let year=now.getFullYear();
let month=now.getMonth()+1;
let date=now.getDate();
let hour=now.getHours();
let minute=now.getMinutes();
let second=now.getSeconds();
return month+"."+date;
}
/**
* 配置基本信息
* @param data
*/
@GlobalMethod()
public wxConfig(data: any): void {
wx.config({
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来若要查看传入的参数可以在pc端打开参数信息会通过log打出仅在pc端时才会打印。
// @ts-ignore
appId: "wxced93207e88f7576", // 必填,公众号的唯一标识
timestamp: data.timesTamp , // 必填,生成签名的时间戳
nonceStr: data.nonceStr, // 必填,生成签名的随机串
signature: data.signaTure,// 必填,签名
jsApiList: ["chooseImage","uploadImage", "updateAppMessageShareData", "updateTimelineShareData", "onMenuShareAppMessage"] // 必填需要使用的JS接口列表
});
}
/**
* 使用微信sdk
* data 初始号数据
* ready 初始号成功后后续操作需要在这使用
*/
@GlobalMethod()
public wxSdk(ready: Function): void {
wx.ready(function(){
ready(wx)
});
}
}

View File

@@ -0,0 +1,37 @@
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": ".",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": [
"node_modules"
]
}

View File

@@ -0,0 +1,51 @@
const isProduction = process.env.NODE_ENV === 'production';
const ProdConfig = require("./build/prod");
const DevConfig = require("./build/dev");
const VariableConfig = require('./build/variable');
module.exports = {
publicPath: './',
filenameHashing: true,
productionSourceMap: false,
parallel: require('os').cpus().length > 1,
lintOnSave: false,
/**
* vue-cli-plugin-autorouter 插件配置
* 参考文档https://www.npmjs.com/package/vue-cli-plugin-autorouter
*/
pluginOptions: {
route: {
TemplateFolderName: 'page',
RootFolderName: './src/application',
SaveConfigPath: '../../../src/core/config/route.config.ts'
}
},
devServer: {
hot: true,
hotOnly: true,
host: '0.0.0.0',
port: 9090,
compress: true,
open: true,
openPage: '#/',
overlay: {
warnings: true,
errors: true,
}
},
configureWebpack: (config) => {
// 设置程序核心入口
config.entry.app = './src/core/run/index.run.ts';
isProduction ? new ProdConfig(config) : ''
},
chainWebpack: (config) => {
isProduction ? config.plugin('html').tap(args => {
args[0].cdn = VariableConfig.cdn;
return args;
}) : '';
new DevConfig(config);
}
};

View File

@@ -0,0 +1,21 @@
'use strict'
const path = require('path')
function resolve (dir) {
return path.join(__dirname, '.', dir)
}
module.exports = {
context: path.resolve(__dirname, './'),
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'@public': resolve('public'), // eslint-disable-line
'@core': resolve('src/core'), // eslint-disable-line
'@': resolve('src/application'), // eslint-disable-line
'@assets': resolve('src/application/assets'), // eslint-disable-line
'@less': resolve('src/application/assets/stylus/components'), // eslint-disable-line
'@impl': resolve('src/core/service/impl') // eslint-disable-line
}
},
};