初始化仓库

This commit is contained in:
xxay
2023-01-12 14:48:20 +08:00
commit 40a4bdbc44
29 changed files with 791 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
export default {
onCreate() {
},
onDestroy() {
}
};
Binary file not shown.

After

Width:  |  Height:  |  Size: 744 B

@@ -0,0 +1,6 @@
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
@@ -0,0 +1,6 @@
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
@@ -0,0 +1,37 @@
.container {
flex-direction: column;
justify-content: center;
align-items: center;
width: 466px;
height: 466px;
}
.tip{
height: 100px;
width: 466px;
flex-direction:column;
justify-content:center;
align-items: center;
}
.box{
flex-direction:column;
justify-content:flex-start;
align-items: center;
width: 466px;
height: 200px;
}
.item{
border-radius:20px;
color:white;
font-size: 30px;
width: 200px;
height: 60px;
flex-direction:row;
justify-content:center;
align-items: center;
}
.txt{
color: white;
font-size: 30px;
}
@@ -0,0 +1,15 @@
<div class="container" @swipe="go_page">
<div class="tip">
<text style="color: white;">首选光源</text>
</div>
<div class="box">
<div class="item" style="background-color: {{bgc_color}};" @click="set_change">
<text class="txt" style="color: {{light_color}};">{{color_text}}</text>
</div>
</div>
</div>
<!--首选光源-->
<!--红光亮度-->
<!--白光亮度-->
@@ -0,0 +1,67 @@
import brightness from '@system.brightness';
import storage from '@system.storage';
import router from '@system.router';
export default {
data: {
color:'#ff0000',
light_color:'',
bgc_color:'',
color_text:'',
set_color:'',
},
init_color(data){
if (data == "red"){
this.bgc_color='#d03050'
this.light_color='#ffffff'
this.color_text='红色'
}else{
this.bgc_color='#f7dee3'
this.light_color='#d03050'
this.color_text='白色'
}
},
onInit() {
this.init_color(this.color)
this.set_color = this.color
brightness.setValue({
value: this.set_light,
});
},
go_page(e){
switch(e.direction){
// 返回主页面
case 'right':
router.replace({
uri:'pages/stat/stat',
params:{
data:this.set_color
}
})
break
}
},
set_change(){
if(this.bgc_color=='#d03050'){
storage.set({
key: 'first_light_color',
value: 'white',
})
this.bgc_color='#f7dee3'
this.light_color='#d03050'
this.color_text='白色'
this.set_color = "white"
}else{
this.bgc_color='#d03050'
this.light_color='#ffffff'
this.color_text='红色'
this.set_color='red'
storage.set({
key: 'first_light_color',
value: 'red',
})
}
},
onDestroy(){
}
}
@@ -0,0 +1,2 @@
<div class="container">
</div>
@@ -0,0 +1,40 @@
import storage from '@system.storage';
import router from '@system.router';
import brightness from '@system.brightness';
export default {
data: {
first_color: "",
new_brightness: 0,
},
onInit() {
var that = this
storage.get({
key: 'first_light_color',
success: function (data) {
if (data != 'red' && data != 'white'){
data = "red"
}
that.first_color = data
},
complete:function(){
var ss = that
brightness.getValue({
success: function (data) {
ss.new_brightness = data.value
},
complete:function(){
router.replace({
uri:"pages/stat/stat",
params:{
s_color:ss.first_color,
s_new_brightness:ss.new_brightness
}
})
}
});
}
})
},
}
@@ -0,0 +1,22 @@
.container {
width: 100%;
height: 100%;
justify-content: center;
align-items: center;
}
.light-color{
width: 466px;
height: 466px;
}
.light-set{
flex-direction: column;
justify-content:center;
align-items:center;
width: 466px;
height: 466px;
}
.Flashlight_icon{
height: 147px;
width: 69px;
}
@@ -0,0 +1,7 @@
<div class="container" @swipe="go_page">
<div class="light-color" style="background-color:red" if="{{is_red}}" @click="close_flashlight"></div>
<div class="light-color" style="background-color:white" if="{{is_white}}" @click="close_flashlight"></div>
<div class="light-set" if="{{is_set}}" @click="open_flashlight">
<image src="/common/Flashlight_icon.png" class="Flashlight_icon"></image>
</div>
</div>
@@ -0,0 +1,90 @@
import app from '@system.app';
import storage from '@system.storage';
import router from '@system.router';
import brightness from '@system.brightness';
export default {
data: {
is_red: false,
is_white: false,
is_set: false,
first_color: "",
new_brightness: 0,
},
onInit() {
this.first_color = this.s_color
this.new_brightness = this.s_new_brightness
if (this.first_color == 'red') {
this.first_color = 'red'
} else {
this.first_color = 'white'
}
if (this.data != undefined) {
if (this.data == "red") {
this.first_color = 'red'
} else {
this.first_color = 'white'
}
}
if (this.first_color == "red") {
this.is_red = true
} else {
this.is_white = true
}
},
onShow(){
this.open_flashlight()
},
go_page(e) {
switch (e.direction) {
case 'left':
router.replace({
uri: 'pages/app_set/app_set',
params: {
color: this.first_color,
set_light:this.new_brightness
}
})
break
// 退出
case 'right':
app.terminate()
break
case 'up':
if (!this.is_set) {
this.is_red = !this.is_red
this.is_white = !this.is_white
this.is_set = false
}
break
case 'down':
if (!this.is_set) {
this.is_red = !this.is_red
this.is_white = !this.is_white
this.is_set = false
}
break
}
},
open_flashlight() {
this.is_set = false
if (this.first_color == "red") {
this.is_red = true
} else {
this.is_white = true
}
this.set_brightness(255)
},
set_brightness(val) {
brightness.setValue({
value: val,
});
},
close_flashlight() {
this.is_red = false
this.is_white = false
this.is_set = true
this.set_brightness(this.new_brightness)
}
}