update to v3.5

This commit is contained in:
RainSun 2020-09-13 11:19:29 +08:00
parent 7928f2c6ef
commit 3c171e7908
13 changed files with 455 additions and 174 deletions

View File

@ -9,7 +9,7 @@
<img src="../assets/logo.png" alt />
</div>
<p class="app-name">Cherry</p>
<p class="version">Version 3.1</p>
<p class="version">Version 3.5</p>
</div>
<div class="list">
<!-- <div class="list-item">
@ -20,8 +20,7 @@
<icon class="game" name="game"></icon>
<p>课表小游戏</p>
</div>
<div class="list-item" v-clipboard:copy="'https://canary.lacus.site'" v-clipboard:success="onCopyUrl"
v-clipboard:error="onErrorUrl">
<div class="list-item" @click="goToCanary()">
<icon class="game" name="canary"></icon>
<p>Canary密码本</p>
</div>
@ -73,6 +72,9 @@ export default {
this.setDrawerState([false, this])
}, 300)
},
goToCanary() {
window.open('https://canary.lacus.icu')
},
//
goToGame() {
this.setDrawerState([false, this])
@ -84,12 +86,6 @@ export default {
replaceState.call(this);
this.$router.replace('/login')
},
onCopyUrl(e) {
this.$message.success("网址复制成功!");
},
onErrorUrl(e) {
this.$message.success("网址复制失败!");
}
},
created() {
},

View File

@ -3,15 +3,15 @@
<div class="w">
<div class="content" @click="goToAddress('/schedule')">
<i :class="current_page == 'schedule'? 'select' : ''" class="el-icon-message-solid"></i>
<p :class="current_page == 'schedule'? 'select' : ''">课表</p>
<p v-if="!settings.hide_tab_text" :class="current_page == 'schedule'? 'select' : ''">课表</p>
</div>
<div class="content" @click="goToAddress('/grade')">
<i :class="current_page == 'grade'? 'select' : ''" class="el-icon-s-claim"></i>
<p :class="current_page == 'grade'? 'select' : ''">成绩</p>
<p v-if="!settings.hide_tab_text" :class="current_page == 'grade'? 'select' : ''">成绩</p>
</div>
<div class="content" @click="goToAddress('/myaccount')">
<i :class="current_page == 'myaccount'? 'select' : ''" class="el-icon-s-custom"></i>
<p :class="current_page == 'myaccount'? 'select' : ''">我的</p>
<p v-if="!settings.hide_tab_text" :class="current_page == 'myaccount'? 'select' : ''">我的</p>
</div>
</div>
</footer>
@ -21,7 +21,7 @@ import { mapState } from "vuex";
export default {
name: "FooterNav",
computed: {
...mapState(["current_page"])
...mapState(["current_page", "settings"])
},
methods: {
goToAddress(url) {

92
src/components/Input.vue Normal file
View File

@ -0,0 +1,92 @@
<template>
<div class="input">
<label :class="{'placeholder': input_focus ? false : value ? false : true}" for="input">{{label}}</label>
<input type="text" :value="value" @change="$emit('change', $event.target.value)" @focus="input_focus = true" @blur="input_focus = false" id="input"/>
<div class="line"></div>
</div>
</template>
<script>
export default {
name: "Input",
data: () => {
return {
input_focus: false,
}
},
model: {
prop: "value",
event: "change",
},
props: {
value: {
type: String,
default: "",
},
label: {
type: String,
default: "标题",
},
},
};
</script>
<style scoped lang="scss" type="text/scss">
@import "../style/main";
.input {
display: flex;
align-items: center;
flex: 1;
height: 1.8rem;
position: relative;
label {
position: absolute;
top: 0;
left: 0;
font-size: 0.35rem;
height: 0.5rem;
line-height: 0.5rem;
color: #989898;
transition: all 0.25s;
}
.placeholder {
top: .8rem;
font-size: 0.45rem;
height: 1rem;
line-height: 1rem;
line-height: 0.5rem;
}
input {
border: none;
border-bottom: 1px #333 solid;
outline: none;
flex: 1;
font-size: 0.45rem;
height: 1rem;
line-height: 1rem;
margin-top: 0.15rem;
appearance: none;
-moz-appearance: none; /* Firefox */
-webkit-appearance: none; /* Safari 和 Chrome */
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
}
input:focus {
& + .line {
width: 100%;
}
border: none;
}
.line {
position: absolute;
width: 0;
top: 1.45rem;
height: 2px;
background: $gradualGreen;
transition: width 0.25s;
}
.spread {
width: 100%;
}
}
</style>

View File

@ -1,14 +1,15 @@
<template>
<div class="select">
<label>{{label}}</label>
<input type="text" readonly :value="input_value"
<input type="text" readonly :value="input_value" :class="{'border': !open_options}"
@click="openOptions"
@keydown.down="openOptions"
@keydown.enter="openOptions"
@keydown.space="openOptions"/>
<div class="line" :class="{'spread': open_options}"></div>
<i class="el-icon-caret-bottom icon"></i>
<div class="options-table" v-if="open_options" :style="`top: ${top}rem;`">
<div class="options" v-for="(item, index) in options" @click="choseContent(item.value)">{{item.text}}</div>
<div class="options" v-for="(item, index) in options" @click="choseContent(item.value)" :key="index">{{item.text}}</div>
</div>
<div class="mask" v-if="open_options" @click="closeTable"></div>
</div>
@ -88,7 +89,6 @@
}
input {
border: none;
border-bottom: 1px #333 solid;
cursor: pointer;
outline: none;
flex: 1;
@ -102,6 +102,20 @@
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
-webkit-user-select: none;
}
.border {
border-bottom: 1px #333 solid;
}
.line {
position: absolute;
width: 0;
top: 1.45rem;
height: 2px;
background: $gradualGreen;
transition: width .25s;
}
.spread {
width: 100%;
}
.icon {
position: absolute;
font-size: .4rem;
@ -114,17 +128,18 @@
left: -.3rem;
background-color: #fff;
min-width: 7rem;
box-shadow: 1px 1px 15px $olive;
box-shadow: 1px 1px 15px #ababab;
padding-left: .3rem;
padding-top: .3rem;
z-index: 151;
opacity: 0;
.options {
font-size: .45rem;
height: 1rem;
line-height: 1rem;
margin-bottom: .3rem;
}
animation: toShow 0.25s ease;
animation: toShow 0.25s ease .1s;
animation-fill-mode: forwards;
}
.mask {

View File

@ -1,51 +1,62 @@
<template>
<div class="slider">
<input :value="value" type="range" @change="$emit('change', $event.target.value)" max="1" min="0" step="0.1" />
</div>
<div class="slider">
<input
:value="value"
type="range"
@change="$emit('change', $event.target.value)"
max="1"
min="0"
step="0.1"
/>
</div>
</template>
<script>
export default {
name: "Slider",
model: {
prop: 'value',
event: 'change'
},
props: {
value: {
type: Number,
default: 1
}
}
}
export default {
name: "Slider",
model: {
prop: "value",
event: "change",
},
props: {
value: {
type: Number,
default: 1,
},
},
};
</script>
<style scoped lang="scss" type="text/scss">
@import "../style/main";
.slider {
display: flex;
align-items: center;
justify-content: center;
input {
background-size: 98% 3px;
background: $gradualGreen;
outline: none;
appearance:none;
-moz-appearance:none; /* Firefox */
-webkit-appearance:none; /* Safari 和 Chrome */
height: 3px; /*横条的高度*/
}
input[type="range"]::-webkit-slider-thumb {
width: 20px;
height: 20px;
border-radius: 50%;
background-color: #fff;
box-shadow: 0 0 4px $olive;
cursor: pointer;
appearance:none;
-moz-appearance:none; /* Firefox */
-webkit-appearance:none; /* Safari 和 Chrome */
border: 0;
}
}
@import "../style/main";
.slider {
display: flex;
align-items: center;
justify-content: center;
input {
width: 4rem;
background-size: 98% 3px;
background: $gradualGreen;
outline: none;
appearance: none;
-moz-appearance: none; /* Firefox */
-webkit-appearance: none; /* Safari 和 Chrome */
height: 3px; /*横条的高度*/
}
input[type="range"]::-webkit-slider-thumb {
width: 20px;
height: 20px;
border-radius: 50%;
background-color: #fff;
box-shadow: 0 0 4px $olive;
cursor: pointer;
appearance: none;
-moz-appearance: none; /* Firefox */
-webkit-appearance: none; /* Safari 和 Chrome */
border: 0;
}
input[type="range"]:focus {
outline: none;
}
}
</style>

View File

@ -0,0 +1,86 @@
<template>
<div class="snake-bar" :class="snack_bar_class">
<div class="warp">
<div class="content">{{msg}}</div>
</div>
</div>
</template>
<script>
export default {
name: "SnakeBar",
props: ["msg"],
data() {
return {
snack_bar_class: ""
};
},
computed: {},
methods: {
openSnackBar(content) {
this.snack_bar_class = "higher-snake-bar";
setTimeout(() => {
this.snack_bar_class = "lower-snake-bar";
}, 1000);
},
},
created() {
this.openSnackBar();
},
mounted() {},
watch: {},
beforeDestroy() {},
components: {},
activated() {}
};
</script>
<style scoped lang="scss" type="text/scss">
@import "../../style/main";
.snake-bar {
position: fixed;
left: 0;
bottom: -1.2rem;
width: 100%;
.warp {
width: 100%;
max-width: 500px;
margin: 0 auto;
height: 1.2rem;
background: $gradualGreen;
.content {
margin-left: 0.3rem;
padding-left: 0.3rem;
font-size: 0.35rem;
line-height: 1.2rem;
letter-spacing: 2px;
color: #fff;
}
}
}
.higher-snake-bar {
animation: snakeToHigh 0.5s ease;
animation-fill-mode: forwards;
}
.lower-snake-bar {
animation: snakeToLow 0.5s ease;
animation-fill-mode: forwards;
}
@keyframes snakeToHigh {
0% {
bottom: -1.2rem;
}
100% {
bottom: 0rem;
}
}
@keyframes snakeToLow {
0% {
bottom: 0rem;
}
100% {
bottom: -1.2rem;
}
}
</style>

View File

@ -0,0 +1,31 @@
import SnakeBar from './SnakeBar.vue'
import Vue from 'vue'
let SnakeBarConstructor = Vue.extend(SnakeBar)
let instance
let seed = 1
let index = 2000
let eleList = []
const install = () => {
Object.defineProperty(Vue.prototype, '$snakebar', {
get () {
let id = 'snakebar_' + seed++
const alertMsg = options => {
instance = new SnakeBarConstructor({
propsData: {msg:options}
})
index++
instance.id = id
instance.vm = instance.$mount()
document.body.appendChild(instance.vm.$el)
eleList.push(instance.vm.$el)
setTimeout(()=> {
document.body.removeChild(eleList.shift())
},1500)
instance.vm.$el.style.zIndex = index
return instance.vm
}
return alertMsg
}
})
}
export default install

View File

@ -20,7 +20,9 @@ export function replaceState() {
// 课程以及节数的显示方式 无 衬底 阴影 => 0 1 2
bar_show_style: 0,
// 黑暗模式
dark_mode: false
dark_mode: false,
// 隐藏tab文字
hide_tab_text: false,
}
state[key] = content
}

View File

@ -33,6 +33,10 @@ Vue.use(VueTouch, {name: 'v-touch'})
import VueClipboard from "vue-clipboard2";
Vue.use(VueClipboard);
// 自己写的snakebar组件
import SnakeBar from '@/components/SnakeBar/index'
Vue.use(SnakeBar)
Vue.component('icon', Icon);
new Vue({
router,

View File

@ -36,7 +36,9 @@ export default new Vuex.Store({
// 课程以及节数的显示方式 无 衬底 阴影 => 0 1 2
bar_show_style: 0,
// 黑暗模式
dark_mode: false
dark_mode: false,
// 隐藏tab文字
hide_tab_text: false,
}
},
mutations: {

View File

@ -23,7 +23,7 @@
<div class="submit" @click="submit()">登录</div>
</div>
<div class="copyRight">
<p>Version&nbsp;3.3</p>
<p>Version&nbsp;3.5</p>
<p>Inspire Studio</p>
<p>&copy;2020 All Rights Reserved.</p>
</div>

View File

@ -4,7 +4,7 @@
<img src="../../assets/logo_nobg.png" alt="logo" />
<p>
Cherry
<span>v3.3</span>
<span>v3.5</span>
</p>
<div class="auth">By:Inspire Studio</div>
<img src="../../assets/wave.gif" mode="scaleToFill" class="gif-wave"/>
@ -46,6 +46,7 @@
coc主站地址=>
<span>cherry.lacus.site</span>
</div>
<div style="height: 1.5rem;"></div>
<FooterSpace></FooterSpace>
</div>
</template>

View File

@ -1,59 +1,80 @@
<template>
<div class="personal">
<header>
<div class="w">
<div class="icon-box">
<i class="el-icon-back title-icon" @click="back()"></i>
</div>
<div class="title-box">个性化</div>
</div>
</header>
<div style="height: 1.2rem;"></div>
<div class="main">
<div class="topic">课表设置</div>
<div class="option">
<icon name="firstPrize" class="option-icon"></icon>
<div class="label">隐藏周末</div>
<div class="handle-space">
<el-switch v-model="hide_weekend" active-color="#39b54a" @change="modifyConfig()"></el-switch>
</div>
</div>
<div class="option">
<icon name="firstPrize" class="option-icon"></icon>
<div class="label">开启背景图</div>
<div class="handle-space">
<el-switch v-model="user_bg_switch" active-color="#39b54a" @change="modifyConfig()"></el-switch>
</div>
</div>
<div class="option">
<icon name="firstPrize" class="option-icon"></icon>
<div class="label">深色背景适配</div>
<div class="handle-space">
<el-switch v-model="user_bg_is_dark" active-color="#39b54a" @change="modifyConfig()"></el-switch>
</div>
</div>
<div class="option">
<icon name="firstPrize" class="option-icon"></icon>
<div class="label">课表透明度</div>
<div class="handle-space">
<Slider :value="settings.lesson_opacity" @change="modifyOpacity"></Slider>
</div>
</div>
<div class="option">
<icon name="firstPrize" class="option-icon"></icon>
<Select label="时间显示类型" :options="bar_show_style_list" :value="settings.bar_show_style" @change="modifyBarShowStyle"></Select>
</div>
</div>
<FooterSpace></FooterSpace>
</div>
<div class="personal">
<header>
<div class="w">
<div class="icon-box">
<i class="el-icon-back title-icon" @click="back()"></i>
</div>
<div class="title-box">个性化</div>
</div>
</header>
<div style="height: 1.2rem;"></div>
<div class="main">
<div class="topic">课表设置</div>
<div class="option">
<icon name="firstPrize" class="option-icon"></icon>
<div class="label">隐藏周末</div>
<div class="handle-space">
<el-switch v-model="hide_weekend" active-color="#39b54a" @change="modifyConfig()"></el-switch>
</div>
</div>
<div class="option">
<icon name="firstPrize" class="option-icon"></icon>
<div class="label">开启背景图</div>
<div class="handle-space">
<el-switch v-model="user_bg_switch" active-color="#39b54a" @change="modifyConfig()"></el-switch>
</div>
</div>
<div class="option">
<icon name="firstPrize" class="option-icon"></icon>
<div class="label">深色背景适配</div>
<div class="handle-space">
<el-switch v-model="user_bg_is_dark" active-color="#39b54a" @change="modifyConfig()"></el-switch>
</div>
</div>
<div class="option">
<icon name="firstPrize" class="option-icon"></icon>
<div class="label">课表透明度</div>
<div class="handle-space">
<Slider :value="settings.lesson_opacity" @change="modifyOpacity"></Slider>
</div>
</div>
<div class="option">
<icon name="firstPrize" class="option-icon"></icon>
<Select
label="时间显示类型"
:options="bar_show_style_list"
:value="settings.bar_show_style"
@change="modifyBarShowStyle"
></Select>
</div>
<div class="option">
<icon name="firstPrize" class="option-icon"></icon>
<Input label="图片网络地址" :value="settings.user_bg_url" @change="modifyUserBgUrl" />
</div>
<div class="topic">应用设置</div>
<div class="option">
<icon name="firstPrize" class="option-icon"></icon>
<div class="label">关闭TAB文字</div>
<div class="handle-space">
<el-switch v-model="hide_tab_text" active-color="#39b54a" @change="modifyConfig()"></el-switch>
</div>
</div>
</div>
<FooterSpace></FooterSpace>
</div>
</template>
<script>
// @ is an alias to /src
// @ is an alias to /src
import FooterSpace from "@/components/FooterSpace.vue";
import Slider from "@/components/Slider.vue";
import Select from "@/components/Select.vue";
import Input from "@/components/Input.vue";
import { mapState, mapActions } from "vuex";
import { replaceState } from "@/lib/getStore.js";
import { Loading } from "element-ui";
@ -65,28 +86,30 @@ export default {
return {
//
hide_weekend: false,
//
user_bg_url: '',
//
user_bg_switch: false,
//
user_bg_is_dark: false,
// tab
hide_tab_text: false,
// => 0 1 2
bar_show_style: 0,
bar_show_style_list: [
{
value: 0,
text: '正常'
},{
value: 1,
text: '衬底'
}, {
value: 2,
text: '阴影'
}
],
bar_show_style_list: [
{
value: 0,
text: "正常",
},
{
value: 1,
text: "衬底",
},
{
value: 2,
text: "阴影",
},
],
//
dark_mode: false
dark_mode: false,
};
},
computed: {
@ -125,57 +148,74 @@ export default {
initData() {
this.hide_weekend = this.settings.hide_weekend;
this.user_bg_url = this.settings.user_bg_url;
this.user_bg_switch = this.settings.user_bg_switch;
this.user_bg_is_dark = this.settings.user_bg_is_dark;
this.bar_show_style = this.settings.bar_show_style;
this.hide_tab_text = this.settings.hide_tab_text;
},
back() {
this.$router.go(-1);
},
modifyConfig() {
let new_settings = {
...this.settings,
hide_weekend: this.hide_weekend,
user_bg_switch: this.user_bg_switch,
user_bg_is_dark: this.user_bg_is_dark
user_bg_switch: this.user_bg_switch,
user_bg_is_dark: this.user_bg_is_dark,
hide_tab_text: this.hide_tab_text,
};
this.setSettings([new_settings, this]);
console.log('设置信息写入完成')
console.log("设置信息写入完成");
this.$snakebar('个性化设置成功')
},
modifyOpacity(e) {
let new_settings = {
...this.settings,
lesson_opacity: Number(e),
};
this.setSettings([new_settings, this]);
console.log("设置信息写入完成");
this.$snakebar('个性化设置成功')
},
modifyBarShowStyle(e) {
let new_settings = {
...this.settings,
bar_show_style: Number(e),
};
this.setSettings([new_settings, this]);
console.log("设置信息写入完成");
this.$snakebar('个性化设置成功')
},
modifyUserBgUrl(e) {
let new_settings = {
...this.settings,
user_bg_url: e,
};
this.setSettings([new_settings, this]);
console.log("设置信息写入完成");
this.$snakebar('个性化设置成功')
},
modifyOpacity(e) {
let new_settings = {
...this.settings,
lesson_opacity: Number(e),
};
this.setSettings([new_settings, this]);
console.log('设置信息写入完成')
},
modifyBarShowStyle(e) {
let new_settings = {
...this.settings,
bar_show_style: Number(e),
};
this.setSettings([new_settings, this]);
console.log('设置信息写入完成')
}
},
created() {
this.init();
},
components: {
FooterSpace,
Slider,
Select
Slider,
Select,
Input,
},
watch: {
}
watch: {},
};
</script>
<style scoped lang="scss" type="text/scss">
@import "../../style/main";
@import "../../style/main";
.personal {
width: 100%;
max-width: 500px;
@ -222,32 +262,33 @@ export default {
}
.main {
max-width: 425px;
margin: 0.5rem .7rem;
.topic {
font-size: .35rem;
color: $green;
margin-bottom: 0.5rem;
}
margin: 0 0.7rem;
.topic {
margin-top: .5rem;
font-size: 0.35rem;
color: $green;
margin-bottom: 0.5rem;
}
.option {
display: flex;
align-items: center;
justify-content: flex-start;
min-height: 1.5rem;
.option-icon {
height: 0.6rem;
width: 0.6rem;
margin-right: 0.7rem;
}
.label {
font-size: .45rem;
}
.option-icon {
height: 0.6rem;
width: 0.6rem;
margin-right: 0.7rem;
}
.label {
font-size: 0.45rem;
}
.handle-space {
flex: 1;
min-height: 1.5rem;
display: flex;
align-items: center;
justify-content: flex-end;
}
flex: 1;
min-height: 1.5rem;
display: flex;
align-items: center;
justify-content: flex-end;
}
}
}
}