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,32 @@
<template lang="pug">
#app
keep-alive
router-view(v-if="$route.meta.keepAlive")
router-view(v-if="!$route.meta.keepAlive")
</template>
<script>
export default {
data() {
return {
scroll: 0
}
},
mouted() {
},
activated() {
console.log("activated");
if (this.scroll > 0) {
window.scrollTo(0, this.scroll);
this.scroll = 0;
window.addEventListener("scroll", this.handleScroll);
}
},
methods: {
},
};
</script>
<style lang="less">
@import "~@mixins/normalize";
</style>

View File

@@ -0,0 +1,3 @@
@themeColor: #fb7299;
@themeTextColor: #999;
@while: #fff;

View File

@@ -0,0 +1,316 @@
.flex (@justifyContent:space-between, @alignItems:center) {
display: flex;
justify-content: @justifyContent;
align-items: @alignItems;
}
.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,456 @@
/*! 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.
*/
.content {
margin-top: 45px;
}
.van-tab {
color: #d3d2d2 !important;
}
.van-tabs__wrap {
overflow: unset !important;
align-items: center;
padding-right: 15px;
}
.van-tab--active {
color: #ffffff !important;
}
.van-tabs__nav {
background: #fff0 !important;
flex: 1;
margin-right: 10px;
}
.van-tabs__nav--line {
padding-bottom: 0 !important;
}
.van-tabs--line .van-tabs__wrap {
height: 36px !important;
display: flex;
justify-content: space-between;
}
.icon-edit {
font-size: 18px;
color: #fff;
}
.van-tab__pane {
position: relative;
}
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,p,li,ul,h1,h2,h3,h4,h5,h6{
margin: 0;
padding: 0;
list-style: none;
}
/* 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 */
}

View File

@@ -0,0 +1,45 @@
@import "../colors/index";
@import "../mixins/index";
.home {
.header {
width: 100%;
height: 80px;
position: fixed;
left: 0;
top: 0;
background: @themeColor;
.search {
height: 44px;
.flex();
padding: 0 15px;
.icon-taozi1 {
font-size: 22.5px;
color: @while;
}
.search_input {
width: 82%;
background: @while;
height: 30px;
border-radius: 30px;
padding-left: 15px;
box-sizing: border-box;
.flex(flex-start,center);
i {
font-size: 13px;
color: @themeTextColor;
margin-right: 5px;
}
span {
font-size: 12px;
color: @themeTextColor;
}
}
.icon-wo {
font-size: 20px;
color: @while;
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,87 @@
<template lang="pug">
.item
.title(v-if="title != null") {{ title }}
van-row(v-if="list.length != 0")
van-col(span='12' v-for="(v,i) in list" :key="i")
.newest_img
router-link(:to="{ name: 'info', params: { id: v.id } }")
img(:src='v.preview', alt='')
span {{ v.total }}
.newest_text
router-link(to="")
.t {{ v.title }}
.source {{ v.source }}
.tags
.tags_item(v-for="(j,k) in v.tags" :key="k")
router-link(to="") {{ j.title }}
.nodata(v-else) 暂无数据
</template>
<script>
export default {
name: "ClassItem",
props: {
list: {
type: Array,
default: []
},
title: {
type: String,
default: null
}
}
}
</script>
<style scoped lang="less">
.newest_img {
position: relative;
img {
width: 100%;
border-radius: 0.1rem;
}
span {
position: absolute;
padding: 0.08rem 0.14rem;
background: rgb(251 114 153 / 73%);
color: rgb(255 255 255 / 73%);
font-size: 0.24rem;
right: 0.2rem;
bottom: 0.42rem;
border-radius: 0.28rem;
}
}
.newest_text {
.t {
color: #333;
font-size: 0.3rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-bottom: 0.08rem;
}
.source {
color: #666;
font-size: 0.26rem;
margin-bottom: 0.02rem;
}
.tags {
display: flex;
flex-wrap: wrap;
margin-top: 0.08rem;
}
.tags_item {
padding: 0.04rem 0.1rem;
font-size: 0.24rem;
background: #fb7299;
margin-right: 0.06rem;
color: #fff;
border-radius: 0.18rem;
margin-bottom: 0.06rem;
a {
color: #fff;
}
}
}
</style>

View File

@@ -0,0 +1,29 @@
<template lang="pug">
.headers
.left
i(class="iconfont icon-back1" @click="$router.back()")
span {{ title }}
.right
slot(name='icon')
</template>
<script>
export default {
props: {
title: {
type: String,
default: ''
}
},
data() {
return {
}
}
}
</script>
<style scoped lang="less">
</style>

View File

@@ -0,0 +1,58 @@
<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>
</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,13 @@
<template lang="pug">
van-nav-bar(title='标题', fixed , left-text='返回', right-text='按钮', left-arrow='')
</template>
<script>
export default {
name: "navbar"
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,22 @@
<template lang="pug">
van-tabbar(v-model='active' route)
van-tabbar-item(icon='home-o' to="/") 首页
van-tabbar-item(icon='search' to="/mechanism") 机构
van-tabbar-item(icon='friends-o' to="/model") 模特
van-tabbar-item(icon='setting-o' to="/me") 我的
</template>
<script>
export default {
name: "tabbar.vue",
data() {
return {
active: 0
}
},
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,23 @@
import Vant from 'vant';
import 'vant/lib/index.css';
import Service from '../service'
export default {
DevUrl: 'http://127.0.0.1:3000/api/json',
ProdUrl: 'http://103.91.219.114:3000/api/json',
ApiList: {
index: '/index', // 获取首页
info: '/info', // 进入详情
mechanism: '/mechanism', // 获取机构
mechanismList: '/mechanismList', // 获取机构下面的列表
type: '/class', // 获取首页顶部的分类
classList: '/classList', // 获取分类列表
allModel: '/allModel', // 所有模特
modelList: '/modelList', // 进入模特的个人主页
search: '/search', // 搜索
},
VuePlugs: [Vant],
NotVuePlugs: [
{ n: '$http', v: Service }
]
}

View File

@@ -0,0 +1,64 @@
import axios from 'axios'
import utils from '../utils'
class HTTP {
constructor () {
this.request()
this.response()
}
async get (params) {
this.SetBaseUrl()
return await axios.get(params.url, {
params: params.data,
headers: params.header
})
}
async post (params) {
this.SetBaseUrl()
return await axios.post(params.url, params.data, {
headers: params.header
})
}
/**
* 请求拦截器
*/
request () {
axios.interceptors.request.use(function (config) {
// 在发送请求之前做些什么
return config
}, function (error) {
// 对请求错误做些什么
return Promise.reject(error)
})
}
/**
* 添加响应拦截器
*/
response () {
axios.interceptors.response.use(function (response) {
// 对响应数据做点什么
switch (response.data.status) {
case 200:
return response.data.data;
break;
default:
throw new Error(response.data.msg)
break
}
}, function (error) {
// 对响应错误做点什么
return Promise.reject(error)
})
}
SetBaseUrl () {
axios.defaults.baseURL = utils.checkUrl()
}
}
export default new HTTP()

View File

@@ -0,0 +1,16 @@
import 'amfe-flexible'
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import config from './config'
import Headers from './components/Header'
Vue.config.productionTip = false
Vue.component("v-header", Headers)
config.NotVuePlugs.forEach(v=> Vue.prototype[v.n] = v.v)
config.VuePlugs.forEach(v=>Vue.use(v))
new Vue({
router,
render: h => h(App)
}).$mount('#app')

View File

@@ -0,0 +1,27 @@
export default {
data() {
return {
currentEl: null
}
},
methods: {
handleScroll(index) {
// localStorage.setItem("index", index)
this.currentEl = document.querySelectorAll(".van-tab__pane")[index];
if (this.currentEl != undefined) {
this.currentEl.addEventListener("scroll", () => {
// console.log("滚动距离:", this.currentEl.scrollTop);
localStorage.setItem(`${index}Y`, this.currentEl.scrollTop)
});
}
},
scrollTop(currentIndex) {
var Y = localStorage.getItem(`${currentIndex}Y`);
if (this.currentEl != undefined) {
this.currentEl.scrollTo(0, Y);
}
}
},
}

View File

@@ -0,0 +1,67 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
const routes = [
{
path: '/',
component: () => import(/* webpackChunkName: "Layout" */ '@/views/Layout'),
children: [
{
path: '/',
name: 'home',
meta: {
keepAlive: true
},
component: () => import(/* webpackChunkName: "Home" */ '@/views/Home')
},
{
path: '/mechanism',
name: 'mechanism',
meta: {
keepAlive: true
},
component: () => import(/* webpackChunkName: "Mechanism" */ '@/views/Mechanism')
},
{
path: '/model',
name: 'model',
meta: {
keepAlive: true
},
component: () => import(/* webpackChunkName: "Model" */ '@/views/Model')
},
{
path: '/me',
name: 'me',
meta: {
keepAlive: false
},
component: () => import(/* webpackChunkName: "Me" */ '@/views/Me')
},
]
},
{
path: '/info/:id',
name: 'info',
meta: {
keepAlive: false
},
component: () => import(/* webpackChunkName: "Info" */ '@/views/Info')
},
{
path: '/edit',
name: 'edit',
meta: {
keepAlive: false
},
component: () => import(/* webpackChunkName: "Edit" */ '@/views/Edit')
},
]
const router = new VueRouter({
routes
})
export default router

View File

@@ -0,0 +1,38 @@
import http from '../http'
import config from '../config'
class IndexService {
async GetIndex(data = {},header = {}) {
return await http.get({
url: config.ApiList.index,
data: data,
header: header
})
}
async type(data = {},header = {}) {
return await http.get({
url: config.ApiList.type,
data: data,
header: header
})
}
async classList(data = {},header = {}) {
return await http.get({
url: config.ApiList.classList,
data: data,
header: header
})
}
async GetInfo(data = {},header = {}) {
return await http.get({
url: config.ApiList.info,
data: data,
header: header
})
}
}
export default new IndexService()

View File

@@ -0,0 +1,5 @@
class PublicService {
}
export default new PublicService()

View File

@@ -0,0 +1,7 @@
import IndexService from './IndexService';
import PublicService from './PublicService';
export default {
index: IndexService,
public: PublicService
}

View File

@@ -0,0 +1,14 @@
import config from "../config"
class Utils {
checkUrl() {
if (!process.env.NODE_ENV == "development") {
return config.DevUrl
} else {
return config.ProdUrl
}
}
}
export default new Utils()

View File

@@ -0,0 +1,53 @@
<template lang="pug">
.edit 编辑页面
.tags
van-tag(
plain="",
type="primary",
v-for="(v, i) in AllType",
:key="i",
@click="removeTag(v)"
) {{ v.title }}
hr
.tags
van-tag(
plain="",
type="primary",
v-for="(v, i) in RemoveType",
:key="i",
@click="AddTag(v)"
) {{ v.title }}
</template>
<script>
export default {
data() {
return {
AllType: JSON.parse(localStorage.getItem("AllType")),
RemoveType: JSON.parse(localStorage.getItem("RemoveType")) || [],
};
},
created() {},
methods: {
removeTag(item) {
// 从原数组提取你点击的数据出来,然后本地存储
this.RemoveType.push(this.AllType.filter((v) => v.id == item.id)[0]);
localStorage.setItem("RemoveType", JSON.stringify(this.RemoveType));
// 从原数组删除你点击的对象
this.AllType = this.AllType.filter((v) => v.id !== item.id);
localStorage.setItem("AllType", JSON.stringify(this.AllType));
},
AddTag(item) {
this.AllType.push(item);
localStorage.setItem("AllType", JSON.stringify(this.AllType));
this.RemoveType = this.RemoveType.filter((v) => v.id !== item.id);
localStorage.setItem("RemoveType", JSON.stringify(this.RemoveType));
},
},
};
</script>
<style scoped lang="less">
</style>

View File

@@ -0,0 +1,179 @@
<template lang="pug">
.home
.header
.search
i.iconfont.icon-taozi1
.search_input
i.iconfont.icon-search
span 198万张图,有你想要的...
i.iconfont.icon-wo
.menu
van-tabs(
@change="TabsChange",
@edit="$router.push('/edit')",
line-height="0",
v-model="active",
swipeable,
animated
)
van-tab(v-for="(v, i) in TabsData", :title="v.title", :key="i")
.scroll(v-if="i == 0")
van-swipe.my-swipe(:autoplay="10000", indicator-color="white")
van-swipe-item(
v-for="(item, index) in IndexData.model.list",
:key="index"
)
span(v-for="(u, o) in item", :key="o") {{ u.title }}
ClassItem(
:title="IndexData.newest.title",
:list="IndexData.newest.list"
)
ClassItem(
:title="IndexData.recommended.title",
:list="IndexData.recommended.list"
)
.scroll(v-else)
van-list(
v-model="TabsData[active].loading",
:finished="TabsData[active].finished",
:immediate-check="false",
finished-text="没有更多了",
@load="onLoad"
)
ClassItem(:list="TabsData[active].content")
</template>
<script>
import ClassItem from "@/components/ClassItem";
import scroll from "@/mixins/scroll.js";
export default {
name: "Home",
data() {
return {
active: 0,
IndexData: {},
TabsData: [],
};
},
created() {
this.GetIndexData();
this.GetTypeData();
},
activated() {
this.scrollTop(this.active);
this.GetTypeData();
console.log("11111");
},
mixins: [scroll],
updated() {
// 设置页面滚动层的高度
var a = document.querySelectorAll(".van-tab__pane");
a.forEach((v) => {
v.style = `
overflow-y: scroll;
height: ${window.screen.height - 80 - 50}px
`;
});
},
methods: {
// 获取首页的数据
async GetIndexData() {
this.IndexData = await this.$http.index.GetIndex();
var newArr = [[], []];
// 将轮播分割成两个数组
this.IndexData.model.list.forEach((v, i) =>
i <= 3 ? newArr[0].push(v) : newArr[1].push(v)
);
this.IndexData.model.list = newArr;
console.log("this.IndexData: ", this.IndexData);
},
// tabs被切换的时候
TabsChange(id, title) {
this.active = id;
this.handleScroll(this.active);
this.scrollTop(this.active);
this.GetclassList("noscroll");
},
// 获取分类下的列表
async GetclassList(type = "noscroll") {
var getData = async () => {
let res = await this.$http.index.classList({
page: this.TabsData[this.active].page,
id: this.TabsData[this.active].id,
});
this.TabsData[this.active].loading = false;
// 保存总page
this.TabsData[this.active].TotalPage = res.total_page;
// 保存当前page
this.TabsData[this.active].page = res.current_page;
if (
this.TabsData[this.active].page >=
this.TabsData[this.active].TotalPage
) {
this.TabsData[this.active].finished = true;
}
//
this.TabsData[this.active].content = [
...this.TabsData[this.active].content,
...res.list,
];
}
if (this.active !== 0 && type == "noscroll") {
if (this.TabsData[this.active].content.length == 0) {
getData()
}
} else {
this.active == 0 ? '' : getData()
}
},
// 获取分类菜单
async GetTypeData() {
let res = [];
this.TabsData=[];
if (localStorage.getItem("AllType") == null) {
res = await this.$http.index.type();
// 本地存储分类
localStorage.setItem("AllType", JSON.stringify(res))
} else {
res = JSON.parse(localStorage.getItem("AllType"))
console.log("res:", res);
}
res.unshift({
id: -1,
title: "首页",
});
res.forEach((v) => {
this.TabsData.push({
id: v.id,
title: v.title,
page: 0,
TotalPage: 0,
loading: false,
finished: false,
content: [],
});
});
},
onLoad() {
this.TabsData[this.active].page += 1;
console.log(
"this.TabsData[this.active].page: ",
this.TabsData[this.active].page
);
this.GetclassList("scroll");
console.log("滚动到底部了");
},
},
components: {
ClassItem,
},
};
</script>
<style lang="less" scoped>
@import "~@views/Home";
</style>

View File

@@ -0,0 +1,32 @@
<template lang="pug">
.info
h2 {{ infoList.title }}
ul
li(v-for="(item,index) in infoList.list" :key="index") {{ item.title }}
</template>
<script>
export default {
data() {
return {
infoList: {}
};
},
created() {
this.GetInfoData()
},
methods: {
async GetInfoData() {
this.infoList = await this.$http.index.GetInfo({
id: this.$route.params.id,
page: 1
});
console.log("res: ", res);
}
}
};
</script>
<style scoped lang="less">
</style>

View File

@@ -0,0 +1,24 @@
<template lang="pug">
.layout
.content
router-view
TabBar
</template>
<script>
import TabBar from "@/components/tabbar";
import NavBar from "@/components/navbar";
export default {
name: "layout",
components: {
TabBar,
NavBar,
},
};
</script>
<style scoped lang="less">
.content {
margin-top: 46px;
}
</style>

View File

@@ -0,0 +1,5 @@
<template>
<div class="about">
<h1>This is an about page</h1>
</div>
</template>

View File

@@ -0,0 +1,19 @@
<template lang="pug">
.Mechanism
v-header(title="机构")
template(v-slot:icon)
i(class="iconfont icon-clean")
.content
h2 模特
</template>
<script>
export default {
name: "mechanism"
};
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,18 @@
<template lang="pug">
.model
v-header(title="模特")
.content
h2 模特
</template>
<script>
export default {
name: "model"
}
</script>
<style scoped>
</style>