first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

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

View File

@@ -0,0 +1,19 @@
# online
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
{
"name": "online",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"axios": "^0.19.2",
"core-js": "^3.6.4",
"node-rsa": "^1.0.8",
"vant": "^2.8.1",
"vue": "^2.6.11",
"vue-router": "^3.1.6",
"vuex": "^3.1.3"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.3.0",
"@vue/cli-plugin-router": "~4.3.0",
"@vue/cli-plugin-vuex": "~4.3.0",
"@vue/cli-service": "~4.3.0",
"less": "^3.0.4",
"less-loader": "^5.0.0",
"pug": "^2.0.4",
"pug-html-loader": "^1.1.5",
"pug-plain-loader": "^1.0.0",
"style-resources-loader": "^1.3.3",
"stylus-loader": "^3.0.2",
"vue-template-compiler": "^2.6.11"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

View File

@@ -0,0 +1,69 @@
<template lang="pug">
#app
router-view(@hiddenNav="hiddenNabBar"
@showNab="showNabBar"
@hiddenTb="hiddenShowTabbar"
@showTb="ShowTabbar")
van-tabbar(v-if="isShowTabbar" v-model='active' @change="onChange" active-color="#F22E00")
van-tabbar-item(v-for="(item,index) in TabBar"
:icon='item.icon'
:to="item.href"
:key="index") {{item.title}}
</template>
<script>
export default {
data() {
return {
isShowNavBar: true,
isShowTabbar: true,
active: 0,
navTitle: '首页',
TabBar: [
{ title: '首页', icon: 'home-o', href: '/' },
{ title: '分类', icon: 'search', href: '/class' },
{ title: '购物车', icon: 'shopping-cart-o', href: '/car' },
{ title: '我的', icon: 'friends-o', href: '/me' },
]
}
},
methods: {
onChange(index) {
this.navTitle = this.TabBar[index].title
this.active = index
},
hiddenNabBar() {
this.isShowNavBar = false
},
showNabBar() {
this.isShowNavBar = true
},
hiddenShowTabbar() {
this.isShowTabbar = false
},
ShowTabbar() {
this.isShowTabbar = true
}
}
}
</script>
<style lang="less">
html,
body,
#app,
.class{
height: 100%;
}
.login{
height: 100%;
}
.content {
padding-top: 46px;
padding-bottom: 50px;
}
</style>

View File

@@ -0,0 +1,3 @@
@import "./tpl/color";
@import "./tpl/mixins";
@import "./tpl/normalize";

View File

@@ -0,0 +1,47 @@
.car {
.van-submit-bar {
bottom: 50px !important;
}
.van-checkbox-group {
display: flex;
align-items: center;
padding-left: 18px;
flex-direction: column;
.item {
width: 100%;
display: flex;
align-items: center;
}
}
.cart_action {
position: fixed;
width: 100%;
height: 50px;
background: #fff;
display: flex;
bottom: 50px;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding-left: 18px;
padding-right: 10px;
.van-button--danger {
width: 108px;
font-size: 16px;
margin-left: 19px;
}
.right {
em {
font-style: normal;
color: #ee0924;
}
}
}
.van-card {
background: #fff !important;
width: 100%;
}
.content {
padding-bottom: 100px!important;
}
}

View File

@@ -0,0 +1,12 @@
.class {
.content {
box-sizing: border-box;
height: 100%;
.van-tree-select {
height: 100%;
.van-tree-select__content {
flex: 3 !important;
}
}
}
}

View File

@@ -0,0 +1,66 @@
.home {
.search {
display: flex;
justify-content: space-between;
align-items: center;
position: fixed;
width: 100%;
left: 0;
right: 0;
top: 0;
z-index: 9;
background: #fff;
span {
width: 8%;
text-align: center;
margin-left: 10px;
font-size: 19px;
}
form {
flex: 1;
}
.van-icon {
width: 8%;
text-align: center;
margin-right: 10px;
}
}
.advertisement {
img {
width: 100%;
}
}
.list {
.item {
text-align: center;
margin-bottom: 25px;
img {
width: 198px;
}
h2 {
color: rgba(0,0,0,.87);
font-size: 16.1px;
}
span {
color: rgba(0,0,0,.54);
font-size: 12.65px;
margin-top: 3.450px;
}
.price {
color: #ea625b;
font-size: 16.1px;
}
.buy {
width: 115px;
height: 33px;
color: #fff;
text-align: center;
line-height: 33px;
border-radius: 3px;
font-size: 13px;
background: #ea625b;
margin: 0 auto;
}
}
}
}

View File

@@ -0,0 +1,97 @@
.info {
.swiper {
position: relative;
.nav {
position: fixed;
top:0;
left:0;
right: 0;
width: 100%;
height: 50px;
display: flex;
align-items: center;
box-sizing: border-box;
justify-content: space-between;
padding: 0 15px;
z-index: 99;
.van-icon {
width: 35px;
height: 35px;
text-align: center;
line-height: 35px;
color: #fff;
border-radius: 100%;
background: #00000078;
}
}
}
.info_content {
padding: 0 18px;
h2 {
font-size: 23px;
margin-top: 10px;
color: #3c3c3c;
margin-bottom: 9.2px;
}
.goods_brief {
font-size: 14px;
.active {
color: rgb(255, 74, 0);;
}
span {
color: rgba(0,0,0,.54);;
}
}
.price {
margin-top: 10px;
font-size: 26px;
color: #ff6700;
}
.configure {
margin-top: 12px;
.item {
.van-cell {
background-color: #f6f6f6 !important;
border-bottom: 1px solid #f2f2f2;
}
background: #e5e5e5;
.ddd {
display: flex;
justify-content: space-between;
.t {
display: flex;
.tex {
margin-right: 12px;
img{
margin-right: 5px;
width: 11.5px;
height: 11.5px;
}
span {
color: rgba(0,0,0,.54);
font-size: 12px;
}
}
}
}
}
}
}
.xqt {
img {
width: 100%;
}
}
.van-goods-action {
padding-right: 8px;
width: 90%;
box-shadow: 0 2px 4px -1px rgba(238, 238, 238, 0.2), 0 4px 5px rgba(229, 229, 229, 0.14), 0 1px 10px rgba(146, 145, 145, 0.12);
height: 57px;
border-radius: 11px;
left: 50%;
margin-left: -190px;
bottom: 11px;
border: 1px solid #e5e5e5;
}
}

View File

@@ -0,0 +1,33 @@
.login {
background: linear-gradient(to top right,#4c97d1,#43a8de,#3fb7eb);
.header {
width: 100%;
height: 200px;
display: flex;
justify-content: center;
align-items: center;
font-size: 18px;
color: #000;
}
.van-form {
padding: 0 65px;
}
.van-field {
margin-bottom: 20px;
border-radius: 5px;
background-color: #ffffff;
}
.action {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 75px;
margin-top: 10px;
box-sizing: border-box;
a {
color: #ffffff;
}
}
}

View File

@@ -0,0 +1,29 @@
.me {
.header {
height: 92px;
background: url("https://m.mi.com/static/img/bg.63c8e19851.png") center 0 #f37d0f;
display: flex;
align-items: center;
box-sizing: border-box;
padding-left: 20px;
img {
width: 50px;
height: 50px;
margin-right: 10px;
}
span {
color: #fff;
font-size: 15px;
}
}
.van-cell {
padding: 20px 16px;
}
.van-button{
width: 91%;
margin: 0 auto;
margin-top: 30px;
background: #f47d0e;
border: 1px solid #ffb501;
}
}

View File

@@ -0,0 +1,425 @@
/*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */
/**
* 1. Change the default font family in all browsers (opinionated).
* 2. Prevent adjustments of font size after orientation changes in IE and iOS.
*/
h1,h1,h2,h3,h4,h5,h6,p,ul,li {
margin: 0;
padding: 0;
list-style: none;
}
html {
font-family: sans-serif; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/**
* Remove the margin in all browsers (opinionated).
*/
body {
margin: 0;
}
/* HTML5 display definitions
========================================================================== */
/**
* Add the correct display in IE 9-.
* 1. Add the correct display in Edge, IE, and Firefox.
* 2. Add the correct display in IE.
*/
article,
aside,
details, /* 1 */
figcaption,
figure,
footer,
header,
main, /* 2 */
menu,
nav,
section,
summary { /* 1 */
display: block;
}
/**
* Add the correct display in IE 9-.
*/
audio,
canvas,
progress,
video {
display: inline-block;
}
/**
* Add the correct display in iOS 4-7.
*/
audio:not([controls]) {
display: none;
height: 0;
}
/**
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
progress {
vertical-align: baseline;
}
/**
* Add the correct display in IE 10-.
* 1. Add the correct display in IE.
*/
template, /* 1 */
[hidden] {
display: none;
}
/* Links
========================================================================== */
/**
* 1. Remove the gray background on active links in IE 10.
* 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
*/
a {
background-color: transparent; /* 1 */
-webkit-text-decoration-skip: objects; /* 2 */
}
/**
* Remove the outline on focused links when they are also active or hovered
* in all browsers (opinionated).
*/
a:active,
a:hover {
outline-width: 0;
}
/* Text-level semantics
========================================================================== */
/**
* 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;
}
/**
* Add the correct font style in Android 4.3-.
*/
dfn {
font-style: italic;
}
/**
* 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;
}
/**
* 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
========================================================================== */
/**
* Remove the border on images inside links in IE 10-.
*/
img {
border-style: none;
}
/**
* Hide the overflow in IE.
*/
svg:not(:root) {
overflow: hidden;
}
/* Grouping content
========================================================================== */
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
pre,
samp {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
* 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 */
}
/* Forms
========================================================================== */
/**
* 1. Change font properties to `inherit` in all browsers (opinionated).
* 2. Remove the margin in Firefox and Safari.
*/
button,
input,
select,
textarea {
font: inherit; /* 1 */
margin: 0; /* 2 */
}
/**
* Restore the font weight unset by the previous rule.
*/
optgroup {
font-weight: bold;
}
/**
* 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 */
}
/**
* Remove the default vertical scrollbar in IE.
*/
textarea {
overflow: auto;
}
/**
* 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 OS X.
*/
[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* Correct the text style of placeholders in Chrome, Edge, and Safari.
*/
::-webkit-input-placeholder {
color: inherit;
opacity: 0.54;
}
/**
* 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 */
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,50 @@
<template lang="pug">
.header
van-nav-bar(:title='navTitle', left-arrow, @click-left="onClickLeft")
template(#right v-if="isShowText")
van-icon(:name='rightIcon', size='18')
template(#right v-else)
span(@click="TextEdit") {{ShowText}}
</template>
<script>
export default {
props: {
navTitle: {
type: String,
default: ''
},
ShowText: {
type: String,
default: '编辑'
},
isShowText: {
type: Boolean,
default: true
},
rightIcon: {
type: String,
default: 'search'
}
},
methods: {
onClickLeft() {
this.$router.back()
},
TextEdit() {
this.$emit("textClick")
}
}
}
</script>
<style scoped lang="less">
.header {
position: fixed;
width: 100%;
left: 0;
right: 0;
top: 0;
z-index: 999;
}
</style>

View File

@@ -0,0 +1,59 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank" rel="noopener">router</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex" target="_blank" rel="noopener">vuex</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

View File

@@ -0,0 +1,32 @@
<template lang="pug">
.swiper
van-swipe.my-swipe(:autoplay='3000', indicator-color='white')
van-swipe-item(v-for="i in 4")
img(src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/d4c655696832aa6b16a3cf095e413f69.jpg?thumb=1&w=720&h=360")
</template>
<script>
export default {
data() {
return {}
},
created() {
},
methods: {
async getTvList() {
}
}
}
</script>
<style scoped lang="less">
.van-swipe {
img {
width: 100%;
}
}
</style>

View File

@@ -0,0 +1,18 @@
export default {
apiUrl: {
devUrl: 'http://127.0.0.1:9090/',
prodUrl: 'https://zbhapi.ahtv.cn/h5/',
list: {
index: '/home/index',
login: '/user/login',
add: '/user/add'
}
},
rsa_public_key: `-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9eo8WIbWS5Yql06imlhrW0ZXh
faivPavdULvYLIxIKyUaOwMPFrPuHqqBNGnYOpiPHAKL+zxk2j4u+6jhB6VK1SOD
ccSLxIRxd0HmSDS+hBzYRf4vKc8BLlhMrYhnLmcxCc+PJIIa4DfCZnu8FfQlu/5L
ljjpYN9kHOpHAT+xpQIDAQAB
-----END PUBLIC KEY-----`
}

View File

@@ -0,0 +1,86 @@
import axios from "axios";
import utils from "../utils"
import { Toast } from 'vant';
import rsa from "../utils/rsa"
class Axios {
constructor() {
// 测试请求基地址 http://115.159.153.142:9010/h5
// 正式请求基地址 http://115.159.153.142:9020/h5
console.log(utils.getApiurl())
this.instance = axios.create({
baseURL: utils.getApiurl(),
timeout: 3000
});
this.interceptorsRequest();
this.interceptorsResponse();
}
/**
*
* @param params
* {
* url: '',
* data: {}
* }
* @returns {Promise<void>}
*/
async get(params) {
return await this.instance.get(params.url, {
params: params.data
})
}
async post(params) {
return this.instance({
method: 'post',
url: params.url,
headers: {
data: rsa.PublicKeyEncryption(params.data),
token: localStorage.getItem("token") == null ? '' : localStorage.getItem("token")
}
});
}
// 添加请求拦截器
interceptorsRequest() {
this.instance.interceptors.request.use(function (config) {
// 在发送请求之前做些什么
Toast.loading({
message: '正在加载...',
forbidClick: true,
});
return config;
}, function (error) {
// 对请求错误做些什么
return Promise.reject(error);
});
}
// 添加响应拦截器
interceptorsResponse() {
this.instance.interceptors.response.use(function (response) {
// 对响应数据做点什么
Toast.clear();
switch (response.data.status) {
case 200:
return rsa.PublicKeyDecryption(response.data.result);
break;
case '500':
Toast(response.data.message);
break;
}
}, function (error) {
// 对响应错误做点什么
return Promise.reject(error);
});
}
}
export default new Axios();

View File

@@ -0,0 +1,10 @@
import http from "../";
import config from "../../config";
export default class BaseService {
constructor() {
this.config = config;
this.http = http
}
}

View File

@@ -0,0 +1,19 @@
import BaseService from "./BaseService"
export default class IndexService extends BaseService {
async login(params) {
return await this.http.post({
url: this.config.apiUrl.list.login,
data: params
})
}
async index(params) {
return await this.http.post({
url: this.config.apiUrl.list.index,
data: params
})
}
}

View File

@@ -0,0 +1,12 @@
import BaseService from "./BaseService"
export default class InfoService extends BaseService {
async getInfoList(params) {
return await http.get({
url: config.apiUrl.list.channelList,
data: params
})
}
}

View File

@@ -0,0 +1,17 @@
import BaseService from "./BaseService";
export default class UserService extends BaseService{
async login(params) {
return await this.http.post({
url: this.config.apiUrl.list.login,
data: params
})
}
async add(params) {
return await this.http.post({
url: this.config.apiUrl.list.add,
data: params
})
}
}

View File

@@ -0,0 +1,9 @@
import InfoService from "./InfoService";
import IndexService from "./IndexService";
import UserService from "./UserService";
export default {
InfoService: new InfoService(),
IndexService: new IndexService(),
UserService: new UserService(),
}

View File

@@ -0,0 +1,12 @@
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
Vue.config.productionTip = false
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')

View File

@@ -0,0 +1,120 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
Vue.use(VueRouter)
const routes = [
{
path: '/',
name: 'Home',
component: () => import(/* webpackChunkName: "home" */ '../views/Home'),
meta: {
title: '首页',
islogin: false
}
},
{
path: '/class',
name: 'class',
component: () => import(/* webpackChunkName: "Class" */ '../views/Class'),
meta: {
title: '分类',
islogin: false
}
},
{
path: '/car',
name: 'car',
component: () => import(/* webpackChunkName: "Car" */ '../views/Car'),
meta: {
title: '购物车',
islogin: false
}
},
{
path: '/me',
name: 'me',
component: () => import(/* webpackChunkName: "Me" */ '../views/Me'),
meta: {
title: '我的',
islogin: false
}
},
{
path: '/login',
name: 'login',
component: () => import(/* webpackChunkName: "Login" */ '../views/Login'),
meta: {
title: '登陆',
islogin: false
}
},
{
path: '/reg',
name: 'reg',
component: () => import(/* webpackChunkName: "reg" */ '../views/'),
meta: {
title: '注册',
islogin: false
}
},
{
path: '/search',
name: 'search',
component: () => import(/* webpackChunkName: "search" */ '../views/Login'),
meta: {
title: '搜索',
islogin: false
}
},
{
path: '/info',
name: 'info',
component: () => import(/* webpackChunkName: "info" */ '../views/Info'),
meta: {
title: '详情页',
islogin: false
}
},
{
path: '/order',
name: 'order',
component: () => import(/* webpackChunkName: "order" */ '../views/Order/index'),
meta: {
title: '我的订单',
islogin: true
}
},
{
path: '/Collection',
name: 'Collection',
component: () => import(/* webpackChunkName: "Collection" */ '../views/Collection'),
meta: {
title: '我的收藏',
islogin: true
}
}
];
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
})
router.beforeEach((to, from, next) => {
document.title = to.meta.title;
if (to.meta.isLogin) {
next({
path: '/login',
query: {
from: from.path
}
})
} else {
next()
}
})
export default router

View File

@@ -0,0 +1,15 @@
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
state: {
},
mutations: {
},
actions: {
},
modules: {
}
})

View File

@@ -0,0 +1,54 @@
import config from "../config"
import { Toast } from 'vant';
class utils {
getApiurl () {
if (process.env.NODE_ENV === 'production'){
return config.apiUrl.prodUrl
}
}
/**
*
* 校验用户名是否合法
*
*/
checKUserName(username) {
if (!(username.length > 5 && username.length < 20)) {
Toast({
message: '用户名长度应为6~20位'
});
return false
}
return true
}
checKUserPassword(pwd) {
if(!(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{8,16}$/.test(pwd))) {
Toast( {
message: '密码8~16位,至少含1个大写字母,1个小写字母,1个数字'
});
return false
}
return true
}
/**
* 本地保存数据
* key 名字
* value值
*/
setlocalStorage(key,value) {
typeof value == "string" || value == "number"
?localStorage.setItem('shop_'+key,value)
:localStorage.setItem('shop_'+key,JSON.stringify(value))
}
}
export default new Utils();

View File

@@ -0,0 +1,20 @@
import NodeRsa from "node-rsa";
import config from "../config";
class RSA {
constructor () {
this.public_key = config.rsa_public_key
}
// 公钥加密
PublicKeyEncryption(text) {
return (new NodeRsa(this.public_key)).encrypt(JSON.stringify(text), 'base64')
}
// 公钥解密
PublicKeyDecryption(text) {
return JSON.parse((new NodeRsa(this.public_key)).decryptPublic(text, 'utf8'))
}
}
export default new RSA();

View File

@@ -0,0 +1,75 @@
<template lang="pug">
.car
HeaderComponents(navTitle="购物车" :isShowText="false", :ShowText="editText", @textClick="editClick")
.content
.car_list
van-checkbox-group( v-model="result" ref="checkboxGroup")
.item(v-for="i in 10")
van-checkbox(:name="i")
van-card(num='3', price='2.00', desc='描述信息', title='商品标题', thumb='https://img.yzcdn.cn/vant/ipad.jpeg')
template(#num)
van-button(size='mini')
van-stepper(v-model="defaultValue")
.cart_action
.left
van-checkbox(v-model="isCheck", @change="checkAll") 全选
.right(v-if="isEdit")
span 合计:
em ¥0
van-button(type='danger' round) 结算
van-button.delete(v-else, plain='', type='danger' round) 删除
</template>
<script>
import HeaderComponents from "@/components/Header.vue"
export default {
components: {
HeaderComponents
},
data() {
return {
defaultValue: 1,
isCheck: false,
result: [],
isEdit: true,
editText: '编辑'
}
},
created() {
},
methods: {
async getTvList() {
},
editClick() {
if (this.isEdit) {
this.editText = "完成"
this.isEdit = false
} else {
this.editText = "编辑"
this.isEdit = true
}
console.log("编辑")
},
checkAll(checked) {
console.log("checked: ", checked)
if (checked) {
this.$refs.checkboxGroup.toggleAll(true);
} else {
this.$refs.checkboxGroup.toggleAll();
}
}
}
}
</script>
<style scoped lang="less">
@import "~@less/Car.less";
</style>

View File

@@ -0,0 +1,72 @@
<template lang="pug">
.class
HeaderComponents(navTitle="分类")
.content
van-tree-select(height='',
@click-nav="LeftNavClick",
:items='items',
:main-active-index.sync='active')
template(#content)
van-row(v-for="(item,index) in items" :key="index" v-if="active == index")
van-col(span='8', v-for="(its,ins) in item.children" :key="ins")
van-grid(:column-num="1")
van-grid-item(icon="photo-o" :text="its.text")
</template>
<script>
import HeaderComponents from "@/components/Header.vue"
export default {
components: {
HeaderComponents
},
data() {
return {
active: 0,
items: [
{
text: '分组 1',
children: [
{
text: '小米1',
},
{
text: '小米1',
},
{
text: '小米1',
}
]
},
{
text: '分组 2',
children: [
{
text: '小米2',
},
{
text: '小米2',
},
{
text: '小米2',
}
]
}
],
}
},
created() {
},
methods: {
LeftNavClick(index) {
console.log(index)
},
async getTvList() {
}
}
}
</script>
<style scoped lang="less">
@import "~@less/Class.less";
</style>

View File

@@ -0,0 +1,39 @@
<template lang="pug">
</template>
<script>
export default {
name: "Collection.vue"
beforeRouteEnter (to, from, next) {
next(vm => {
vm.$emit("hiddenNav")
vm.$emit("hiddenTb")
})
},
beforeRouteLeave (to, from, next) {
this.$emit("showNab")
this.$emit("showTb")
next()
}
}
</script>
<style scoped lang="less">
</style>

View File

@@ -0,0 +1,74 @@
<template lang="pug">
.home
.search
span 电
form(action="/")
van-search(v-model='SearchKey', :show-action='false', placeholder='请输入搜索关键词', @search='onSearch', @cancel='onCancel')
van-icon(name='manager-o' size="22px")
SwiperComponents
.content
van-grid(:column-num='3' :border="false")
van-grid-item(v-for='value in 6', :key='value', icon='photo-o', text='文字')
.advertisement
img(src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/489121f41279038693dbff01cbc03a1d.jpg?thumb=1&w=720&h=280")
.list
van-row
van-col(span='12' class="item" v-for="i in 10")
img(src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/7ed6090953a4edca0ee6bc4b36cb4a9e.jpg?thumb=1&w=344&h=280")
h2 小米10 Pro
span 骁龙865 / 50倍变焦
.price ¥4999起
.buy 立即购买
</template>
<script>
import SwiperComponents from "@/components/Swiper"
export default {
name: 'Home',
components: {
SwiperComponents
},
beforeRouteEnter (to, from, next) {
next(vm => {
vm.$emit("hiddenNav")
})
},
beforeRouteLeave (to, from, next) {
this.$emit("showNab")
next()
},
data() {
return {
SearchKey: ''
}
},
async created() {
// let res = await this.$http.IndexService.login({
// name: 'bmy',
// pwd: '123456'
// });
// localStorage.setItem("token", res.token)
//
//
// let index = await this.$http.IndexService.index({})
// console.log("获取首页的数据:",index)
},
methods: {
onSearch() {
},
onCancel() {
}
}
}
</script>
<style scoped lang="less">
@import "~@less/Home.less";
</style>

View File

@@ -0,0 +1,83 @@
<template lang="pug">
.info
.swiper
.nav
van-icon(name='arrow-left', size="18")
van-icon(name='share', size="18")
SwiperComponents
.info_content
h2 小米10 Pro
.goods_brief
span.active 「信用卡分期24期免息,低至7元起/天」
span 向往的生活同款 / 骁龙865处理器 / 1亿像素8K电影相机,50倍数字变焦,10倍混合光学变焦 / 双模5G / 新一代LPDDR5内存 / 50W极速闪充+30W无线闪充+10W无线反充 / 对称式立体声 / 90Hz刷新率+180Hz采样率 / UFS 3.0高速存储 / 全面适配WiFi 6 / 超强VC液冷散热 / 4500mAh大电量 / 多功能NFC
.price ¥4900
.configure
.item
van-cell(title='已选 小米10 Pro 8GB+256GB 珍珠白 x 1', icon='')
template(#right-icon)
van-icon(name='arrow', style='line-height: inherit;')
van-cell(title='送至', icon='')
template(#right-icon)
van-icon(name='arrow', style='line-height: inherit;')
van-cell(icon='', class="ddd")
template(#right-icon)
.t
.tex
img(src="/img/do_icon.png")
span xx自营
.tex
img(src="/img/do_icon.png")
span xx发货
.tex
img(src="/img/do_icon.png")
span 7天无理由退货
van-icon(name='arrow', style='line-height: inherit;')
.xqt
img(v-for="i in 4" src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/75a8abea38d8ebe9748c9903f12c9d77.jpg?f=webp&w=1080&h=2531&bg=FFFFFF")
van-goods-action
van-goods-action-icon(icon='chat-o', text='客服', color='#07c160')
van-goods-action-icon(icon='cart-o', text='购物车')
van-goods-action-icon(icon='star', text='已收藏', color='#ff5000')
van-goods-action-button(type='warning', text='加入购物车')
van-goods-action-button(type='danger', text='立即购买')
</template>
<script>
import SwiperComponents from "@/components/Swiper"
export default {
components: {
SwiperComponents
},
data() {
return {}
},
created() {
},
beforeRouteEnter (to, from, next) {
next(vm => {
vm.$emit("hiddenTb")
})
},
beforeRouteLeave (to, from, next) {
this.$emit("showTb")
next()
},
methods: {
async getTvList() {
}
}
}
</script>
<style scoped lang="less">
@import "~@less/info.less";
</style>

View File

@@ -0,0 +1,59 @@
<template lang="pug">
.login
.header 用户登陆
van-form
van-field(v-model='username', :name='用户名', label='用户名', placeholder='用户名', :rules="[{ required: true, message: '请填写用户名' }]")
van-field(v-model='userpassword', type='password', name='密码', label='密码', placeholder='密码', :rules="[{ required: true, message: '请填写密码' }]")
div
van-button(round='', block='', type='info', native-type='submit', @click="UserLogin") 登 录
.action
router-link(to="/") 首页
router-link(to="/reg") 注册
</template>
<script>
export default {
data() {
return {
username: '',
userpassword: ''
}
},
created() {
},
methods: {
async UserLogin() {
if (this.$utils.checkUserName(this.username) && this.$utils.checkUserPassword(this.userpassword)) {
let res = await this.$http.UserService.login( {
name: this.username,
pwd: this.userpassword
});
this.$utils.setlocalStorage("token", res.token)
this.$router.push({ path: '/'})
console.log("登陆成功的信息:",res)
}
}
},
beforeRouteEnter (to, from, next) {
next(vm => {
vm.$emit("hiddenNav")
vm.$emit("hiddenTb")
})
},
beforeRouteLeave (to, from, next) {
this.$emit("showNab")
this.$emit("showTb")
next()
}
}
</script>
<style scoped lang="less">
@import "~less/loginless";
</style>

View File

@@ -0,0 +1,38 @@
<template lang="pug">
.me
.header
img(src="https://m.mi.com/static/img/avatar.76a75b8f17.png")
span 登录/注册
.order
van-cell(title='我的订单', is-link='', value='全部订单')
van-grid(:column-num="3", :border="false")
van-grid-item(icon='photo-o', text='待付款')
van-grid-item(icon='photo-o', text='待收货')
van-grid-item(icon='photo-o', text='待退货')
van-cell(title='单元格', icon='shop-o' v-for="i in 4")
template(#right-icon='')
van-icon(name='arrow', color="#969799", size="17", style='line-height: inherit;')
van-button( type="danger" block) 退出登录
</template>
<script>
export default {
beforeRouteEnter (to, from, next) {
next(vm => {
vm.$emit("hiddenNav")
})
},
beforeRouteLeave (to, from, next) {
this.$emit("showNab")
next()
}
}
</script>
<style scoped lang="less">
@import "~@less/me.less";
</style>

View File

@@ -0,0 +1,23 @@
<template lang="pug">
.tv ceshi
</template>
<script>
export default {
data() {
return {}
},
created() {
},
methods: {
async getTvList() {
}
}
}
</script>
<style scoped lang="stylus">
@import "~@styl/test.styl"
</style>

View File

@@ -0,0 +1,22 @@
<template lang="pug">
.tv ceshi
</template>
<script>
export default {
data() {
return {}
},
created() {
},
methods: {
async getTvList() {
}
}
}
</script>
<style scoped lang="stylus">
</style>

View File

@@ -0,0 +1,64 @@
<template lang="pug">
.Reg
.header 用户注册
van-form
van-field(v-model='username', name='用户名', label='用户名', placeholder='用户名')
van-field(v-model='userpassword', type='password', name='密码', label='密码', placeholder='密码')
van-field(v-model='userphone', maxlength="11", type='tel', name='手机号', label='手机号', placeholder='手机号')
div(style='margin: 16px;')
van-button(round='', block='', type='info', native-type='submit', @click="Reg") 注 册
</template>
<script>
export default {
data() {
return {
username: '',
userpassword: '',
userphone: ''
}
},
created() {
},
methods:{
async Reg() {
if (this.username.length != 0 && this.userpassword.length !=0 && this.userphone.length != 0) {
if(!(/^1[3456789]\d{9}$/.test(this.userphone))) {
this.$toast({
message: '手机号不合法'
});
return false;
}
if (this.$utils.checkUserName(this.username) && this.$utils.checkUserPassword(this.userpassword)) {
let res =await this.$http.add({
name: this.username,
pwd: this.userpassword,
phone: this.userphone
});
this.$toast({
message: '注册成功,请登录',
onOpened: () => {
setTimeout( ()=> {
this.$http.push
},)
}
});
}
} else {
this.$toast({
message: '账户名、密码、手机号不能为空'
});
}
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,41 @@
const path = require("path");
module.exports = {
lintOnSave: false,
publicPath: './',
chainWebpack: config => {
config.module.rule('pug')
.test(/\.pug$/)
.use('pug-html-loader')
.loader('pug-html-loader')
.end();
config.resolve.alias
.set('@c',resolve('src/components'))
.set('@img',resolve('src/assets/img'))
.set('@less',resolve('src/assets/less/page'));
const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
types.forEach(type => addStyleResource(config.module.rule('less').oneOf(type)))
}
}
function addStyleResource (rule) {
rule.use('style-resource')
.loader('style-resources-loader')
.options({
patterns: [
path.resolve(__dirname, './src/assets/less/index.less'),
],
})
}
function resolve(dir) {
return path.join(__dirname, dir);
}