first commit

This commit is contained in:
liuwu 2023-08-04 09:20:01 +08:00
commit 6fee032470
19 changed files with 839 additions and 0 deletions

181
.bin/main.js Normal file
View File

@ -0,0 +1,181 @@
(function() {
var Main = /*@__PURE__*/ (function(Component) {
function Main(props) {
Component.call(this, props);
this.data = {
listData: [
{
circuitName: "1路电流",
current: "3.21A",
typeName: "高压风冷:",
isTypeOpen: false
},
{
circuitName: "2路电流",
current: "3.21A",
typeName: "中压风冷:",
isTypeOpen: true
},
{
circuitName: "3路电流",
current: "3.21A",
typeName: "低压风冷:",
isTypeOpen: false
},
{
circuitName: "4路电流",
current: "3.21A",
typeName: "闭锁调压:",
isTypeOpen: true
}
]
};
}
if (Component) Main.__proto__ = Component;
Main.prototype = Object.create(Component && Component.prototype);
Main.prototype.constructor = Main;
Main.prototype.apiready = function() {};
Main.prototype.handleToSet = function() {
api.openWin({
name: "set",
url: "./main/set.stml"
});
};
Main.prototype.handleToHistory = function() {
api.openWin({
name: "history",
url: "./main/history.stml"
});
};
Main.prototype.render = function() {
return apivm.h(
"view",
{class: "index_wrap"},
apivm.h("text", {class: "index_title"}, "运行状态"),
apivm.h(
"view",
{class: "index_list"},
(Array.isArray(this.data.listData)
? this.data.listData
: Object.values(this.data.listData)
).map(function(item$1) {
return apivm.h(
"view",
{class: "index_inline"},
apivm.h(
"view",
{class: "inline_item"},
apivm.h("text", {class: "inline_item_text"}, item$1.circuitName),
apivm.h("text", {class: "inline_item_text"}, item$1.current)
),
apivm.h(
"view",
{class: "inline_item"},
apivm.h("text", {class: "inline_item_text"}, item$1.typeName),
apivm.h("text", {
class: item$1.isTypeOpen
? "inline_item_circle_open"
: "inline_item_circle_close"
}),
apivm.h(
"text",
{class: "inline_item_text"},
item$1.isTypeOpen ? "开" : "关"
)
)
);
})
),
apivm.h(
"view",
{class: "index_footer"},
apivm.h("text", {class: "footer_set", onClick: this.handleToSet}, "设置"),
apivm.h(
"text",
{class: "footer_history", onClick: this.handleToHistory},
"操作历史"
)
)
);
};
return Main;
})(Component);
Main.css = {
".index_wrap": {
width: "100%",
height: "100%",
boxSizing: "border-box",
padding: "20px",
backgroundImage: 'url("../image/login.png")',
backgroundSize: "120%",
backgroundRepeat: "no-repeat",
backgroundPosition: "center"
},
".index_title": {
width: "100%",
textAlign: "center",
fontSize: "60px",
color: "#ffffff",
fontWeight: "bold"
},
".index_list": {marginTop: "50px", display: "flex", alignItems: "center"},
".index_inline": {
display: "flex",
flexDirection: "row",
alignItems: "center",
margin: "10px 0"
},
".inline_item": {
margin: "0 40px",
display: "flex",
flexDirection: "row",
alignItems: "center"
},
".inline_item_text": {
fontSize: "40px",
fontWeight: "bold",
color: "#ffffff",
margin: "0 10px"
},
".inline_item_circle_open": {
width: "40px",
height: "40px",
backgroundColor: "#09be30",
borderRadius: "50%",
margin: "0 10px"
},
".inline_item_circle_close": {
width: "40px",
height: "40px",
backgroundColor: "#fd0101",
borderRadius: "50%",
margin: "0 10px"
},
".index_footer": {
width: "80%",
margin: "50px auto 0",
display: "flex",
flexDirection: "row",
alignItems: "center"
},
".footer_set": {
fontSize: "40px",
fontWeight: "bold",
boxSizing: "border-box",
padding: "10px 20px",
color: "#ffffff"
},
".footer_history": {
fontSize: "40px",
fontWeight: "bold",
marginLeft: "50px",
boxSizing: "border-box",
padding: "10px 20px",
color: "#ffffff"
}
};
apivm.define("main", Main);
apivm.render(apivm.h("main", null), "body");
})();

50
.bin/main/history.js Normal file
View File

@ -0,0 +1,50 @@
(function() {
var History = /*@__PURE__*/ (function(Component) {
function History(props) {
Component.call(this, props);
this.data = {};
}
if (Component) History.__proto__ = Component;
History.prototype = Object.create(Component && Component.prototype);
History.prototype.constructor = History;
History.prototype.apiready = function() {};
History.prototype.render = function() {
return apivm.h(
"view",
{class: "history_wrap"},
apivm.h("text", {class: "history_title"}, "历史操作记录"),
apivm.h(
"scroll-view",
{class: "history_list", "scroll-x": "false", "scroll-y": true},
apivm.h("view", {class: ""})
)
);
};
return History;
})(Component);
History.css = {
".history_wrap": {
width: "100%",
height: "100vh",
boxSizing: "border-box",
padding: "20px"
},
".history_title": {
width: "100%",
textAlign: "center",
fontSize: "40px",
fontWeight: "bold",
color: "#000000"
},
".history_list": {
marginTop: "30px",
border: "1px solid silver",
width: "100%",
height: "80vh"
}
};
apivm.define("history", History);
apivm.render(apivm.h("history", null), "body");
})();

209
.bin/main/set.js Normal file
View File

@ -0,0 +1,209 @@
(function() {
var Set = /*@__PURE__*/ (function(Component) {
function Set(props) {
Component.call(this, props);
this.data = {
setList: [
{
isSet: false,
setVal: "",
selectVal: "请选择",
selectIndex: 0,
name: "高压风冷"
},
{
isSet: true,
setVal: "",
selectVal: "请选择",
selectIndex: 0,
name: "中压风冷"
},
{
isSet: false,
setVal: "",
selectVal: "请选择",
selectIndex: 0,
name: "低压风冷"
},
{
isSet: true,
setVal: "",
selectVal: "请选择",
selectIndex: 0,
name: "闭锁调压"
}
],
//电流通道列表
currentList: ["1路", "2路", "3路", "4路"]
};
}
if (Component) Set.__proto__ = Component;
Set.prototype = Object.create(Component && Component.prototype);
Set.prototype.constructor = Set;
Set.prototype.apiready = function() {
var selector0 = document.getElementById("selector0");
var selector1 = document.getElementById("selector1");
var selector2 = document.getElementById("selector2");
var selector3 = document.getElementById("selector3");
selector0.setData({
data: this.data.currentList
});
selector1.setData({
data: this.data.currentList
});
selector2.setData({
data: this.data.currentList
});
selector3.setData({
data: this.data.currentList
});
};
Set.prototype.handleBackIndex = function() {
api.navigateBack({
delta: 2
});
};
Set.prototype.handleSwitchChange = function(e) {
var _index = e.target.attributes.index;
this.data.setList.forEach(function(item, index) {
if (index === _index) {
item.isSet = e.detail.value;
}
});
};
Set.prototype.handleSelectChange = function(e) {
var this$1 = this;
var _index = e.target.attributes.index;
this.data.setList.forEach(function(item, index) {
if (index === _index) {
item.selectIndex = e.detail.value;
item.selectVal = this$1.data.currentList[e.detail.value];
}
});
};
Set.prototype.render = function() {
var this$1 = this;
return apivm.h(
"view",
{class: "set_wrap"},
apivm.h(
"text",
{class: "set_back_text", onClick: this.handleBackIndex},
"返回"
),
apivm.h(
"view",
{class: "set_list"},
(Array.isArray(this.data.setList)
? this.data.setList
: Object.values(this.data.setList)
).map(function(item$1, index$1) {
return apivm.h(
"view",
{class: "list_inline"},
apivm.h(
"view",
{class: "inline_item"},
apivm.h("text", {class: "item_label"}, item$1.name, ""),
apivm.h(
"view",
{class: "item_content"},
apivm.h(
"view",
{class: "switch_box"},
apivm.h("switch", {
class: "switch",
index: index$1,
checked: item$1.isSet,
onChange: this$1.handleSwitchChange
})
),
apivm.h("input", {
class: "input",
type: "text",
disabled: !item$1.isSet,
placeholder: "请输入电流值"
})
)
),
apivm.h(
"view",
{class: "inline_item"},
apivm.h("text", {class: "item_label"}, "电流通道:"),
apivm.h(
"view",
{class: "item_content"},
apivm.h(
"picker",
{
class: "picker",
id: "selector" + index$1,
index: index$1,
mode: "selector",
value: item$1.selectIndex,
onChange: this$1.handleSelectChange
},
apivm.h("text", {class: "item_label"}, item$1.selectVal)
)
)
)
);
})
)
);
};
return Set;
})(Component);
Set.css = {
".set_wrap": {
width: "100%",
height: "100vh",
boxSizing: "border-box",
padding: "20px"
},
".set_back_text": {fontSize: "40px", color: "#000000", fontWeight: "bold"},
".set_list": {marginTop: "50px", display: "flex", alignItems: "center"},
".list_inline": {
display: "flex",
flexDirection: "row",
alignItems: "center",
margin: "10px 0"
},
".inline_item": {
margin: "0 40px",
display: "flex",
flexDirection: "row",
alignItems: "center"
},
".item_label": {fontSize: "40px", fontWeight: "bold", color: "#000000"},
".item_content": {
display: "flex",
flexDirection: "row",
alignItems: "center"
},
".switch_box": {
display: "flex",
justifyContent: "center",
alignItems: "center",
width: "76px",
height: "46px"
},
".switch": {transform: "scale(1.5, 1.5)"},
".input": {
boxSizing: "border-box",
padding: "5px",
border: "1px solid silver",
fontSize: "32px",
height: "60px",
width: "200px",
marginLeft: "20px",
borderRadius: "10px"
}
};
apivm.define("set", Set);
apivm.render(apivm.h("set", null), "body");
})();

1
.yonstudio/.labelinfo Normal file
View File

@ -0,0 +1 @@
{"main":"j:\\YouStudio\\test\\pages\\main.stml","set":"j:\\YouStudio\\test\\pages\\main\\set.stml","history":"j:\\YouStudio\\test\\pages\\main\\history.stml"}

1
.yonstudio/.project Normal file
View File

@ -0,0 +1 @@
{"appid":"A1785216780697862147","appname":"test","apptype":"app","synctime":1691110138}

1
components/.gitkeep Normal file
View File

@ -0,0 +1 @@
此目录是组件放置目录

55
config.xml Normal file
View File

@ -0,0 +1,55 @@
<widget id="A1785216780697862147" version="0.0.1">
<name>test</name>
<description>Example For yonyou.</description>
<author email="developer@yonyou.com" href="https://developer.yonyou.com/">Developer</author>
<preference name="avm" value="true"/>
<preference name="pageBounce" value="false"/>
<preference name="appBackground" value="rgba(0,0,0,0.0)"/>
<preference name="windowBackground" value="rgba(0,0,0,0.0)"/>
<preference name="frameBackgroundColor" value="rgba(0,0,0,0.0)"/>
<preference name="hScrollBarEnabled" value="false"/>
<preference name="vScrollBarEnabled" value="false"/>
<preference name="autoLaunch" value="true"/>
<preference name="fullScreen" value="false"/>
<preference name="autoUpdate" value="true"/>
<preference name="smartUpdate" value="false"/>
<preference name="debug" value="true"/>
<preference name="statusBarAppearance" value="true"/>
<content src="pages/main"/>
<access origin="*"/>
<permission name="readPhoneState"/>
<permission name="camera"/>
<permission name="record"/>
<permission name="location"/>
<permission name="fileSystem"/>
<permission name="internet"/>
<permission name="bootCompleted"/>
<permission name="hardware"/>
</widget>

1
css/.gitkeep Normal file
View File

@ -0,0 +1 @@
此目录是 css 样式资源目录

1
html/.gitkeep Normal file
View File

@ -0,0 +1 @@
此目录是 html 文件夹目录

BIN
icon/icon150x150.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
image/img.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
image/login.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB

BIN
launch/launch1080x1920.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

138
pages/main.stml Normal file
View File

@ -0,0 +1,138 @@
<template>
<view class="index_wrap">
<text class="index_title">运行状态</text>
<view class="index_list">
<view
class="index_inline"
v-for="item in listData"
>
<view class="inline_item">
<text class="inline_item_text">{{item.circuitName}}</text>
<text class="inline_item_text">{{item.current}}</text>
</view>
<view class="inline_item">
<text class="inline_item_text">{{item.typeName}}</text>
<text :class="item.isTypeOpen?'inline_item_circle_open':'inline_item_circle_close'"></text>
<text class="inline_item_text">{{item.isTypeOpen?'开':'关'}}</text>
</view>
</view>
</view>
<view class="index_footer">
<text class="footer_set" @click="handleToSet">设置</text>
<text class="footer_history" @click="handleToHistory">操作历史</text>
</view>
</view>
</template>
<script>
export default {
name: 'main',
data() {
return {
listData:[
{circuitName:'1路电流',current:'3.21A',typeName:'高压风冷:',isTypeOpen:false},
{circuitName:'2路电流',current:'3.21A',typeName:'中压风冷:',isTypeOpen:true},
{circuitName:'3路电流',current:'3.21A',typeName:'低压风冷:',isTypeOpen:false},
{circuitName:'4路电流',current:'3.21A',typeName:'闭锁调压:',isTypeOpen:true}
]
};
},
//初始化
apiready(){
},
methods: {
//跳转到设置页面
handleToSet(){
api.openWin({
name: 'set',
url:'./main/set.stml'
})
},
//跳转到历史记录页
handleToHistory(){
api.openWin({
name: 'history',
url:'./main/history.stml'
})
},
}
};
</script>
<style>
.index_wrap{
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 20px;
background-image: url("../image/login.png");
background-size: 120%;
background-repeat: no-repeat;
background-position: center;
}
.index_title{
width: 100%;
text-align: center;
font-size: 60px;
color: #ffffff;
font-weight: bold;
}
.index_list{
margin-top: 50px;
display: flex;
align-items: center;
}
.index_inline{
display: flex;
flex-direction: row;
align-items: center;
margin: 10px 0;
}
.inline_item{
margin: 0 40px;
display: flex;
flex-direction: row;
align-items: center;
}
.inline_item_text{
font-size: 40px;
font-weight: bold;
color: #ffffff;
margin: 0 10px;
}
.inline_item_circle_open{
width: 40px;
height: 40px;
background-color: #09be30;
border-radius: 50%;
margin: 0 10px;
}
.inline_item_circle_close{
width: 40px;
height: 40px;
background-color: #fd0101;
border-radius: 50%;
margin: 0 10px;
}
.index_footer{
width: 80%;
margin: 50px auto 0;
display: flex;
flex-direction: row;
align-items: center;
}
.footer_set{
font-size: 40px;
font-weight: bold;
box-sizing: border-box;
padding: 10px 20px;
color: #ffffff;
}
.footer_history{
font-size: 40px;
font-weight: bold;
margin-left: 50px;
box-sizing: border-box;
padding: 10px 20px;
color: #ffffff;
}
</style>

45
pages/main/history.stml Normal file
View File

@ -0,0 +1,45 @@
<template>
<view class="history_wrap">
<text class="history_title">历史操作记录</text>
<scroll-view class="history_list" scroll-x ="false" scroll-y>
<view class=""></view>
</scroll-view>
</view>
</template>
<script>
export default {
name: 'history',
data() {
return{
}
},
apiready(){
},
methods: {
}
}
</script>
<style>
.history_wrap{
width: 100%;
height: 100vh;
box-sizing: border-box;
padding: 20px;
}
.history_title{
width: 100%;
text-align: center;
font-size: 40px;
font-weight: bold;
color: #000000;
}
.history_list{
margin-top: 30px;
border: 1px solid silver;
width: 100%;
height: 80vh;
}
</style>

150
pages/main/set.stml Normal file
View File

@ -0,0 +1,150 @@
<template>
<view class="set_wrap">
<text class="set_back_text" @click="handleBackIndex">返回</text>
<view class="set_list">
<view
class="list_inline"
v-for="(item,index) in setList"
>
<view class="inline_item">
<text class="item_label">{{item.name}}</text>
<view class="item_content">
<view class="switch_box"><switch class="switch" index={index} :checked="item.isSet" @change="handleSwitchChange" /></view>
<input class="input" type="text" :disabled="!item.isSet" placeholder="请输入电流值" />
</view>
</view>
<view class="inline_item">
<text class="item_label">电流通道:</text>
<view class="item_content">
<picker class="picker" :id="'selector'+index" index={index} mode="selector" value={{item.selectIndex}} @change="handleSelectChange">
<text class="item_label">{{item.selectVal}}</text>
</picker>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'set',
data() {
return{
setList:[
{isSet:false,setVal:'',selectVal:'请选择',selectIndex:0,name:'高压风冷'},
{isSet:true,setVal:'',selectVal:'请选择',selectIndex:0,name:'中压风冷'},
{isSet:false,setVal:'',selectVal:'请选择',selectIndex:0,name:'低压风冷'},
{isSet:true,setVal:'',selectVal:'请选择',selectIndex:0,name:'闭锁调压'},
],
//电流通道列表
currentList: ['1路','2路','3路','4路'],
}
},
apiready(){
let selector0 = document.getElementById('selector0');
let selector1 = document.getElementById('selector1');
let selector2 = document.getElementById('selector2');
let selector3 = document.getElementById('selector3');
selector0.setData({
data: this.data.currentList
});
selector1.setData({
data: this.data.currentList
});
selector2.setData({
data: this.data.currentList
});
selector3.setData({
data: this.data.currentList
});
},
methods: {
//返回首页
handleBackIndex(){
api.navigateBack({
delta: 2,
});
},
//switch开关选择
handleSwitchChange(e){
let _index = e.target.attributes.index;
this.setList.forEach((item,index) => {
if(index === _index){
item.isSet = e.detail.value;
}
})
},
//下拉选择
handleSelectChange(e) {
let _index = e.target.attributes.index;
this.setList.forEach((item,index) => {
if(index === _index){
item.selectIndex = e.detail.value;
item.selectVal = this.data.currentList[e.detail.value];
}
})
},
}
}
</script>
<style>
.set_wrap{
width: 100%;
height: 100vh;
box-sizing: border-box;
padding: 20px;
}
.set_back_text{
font-size: 40px;
color: #000000;
font-weight: bold;
}
.set_list{
margin-top: 50px;
display: flex;
align-items: center;
}
.list_inline{
display: flex;
flex-direction: row;
align-items: center;
margin: 10px 0;
}
.inline_item{
margin: 0 40px;
display: flex;
flex-direction: row;
align-items: center;
}
.item_label{
font-size: 40px;
font-weight: bold;
color: #000000;
}
.item_content{
display: flex;
flex-direction: row;
align-items: center;
}
.switch_box{
display: flex;
justify-content: center;
align-items: center;
width: 76px;
height: 46px;
}
.switch{
transform: scale(1.5, 1.5);
}
.input{
box-sizing: border-box;
padding: 5px;
border: 1px solid silver;
font-size: 32px;
height: 60px;
width: 200px;
margin-left: 20px;
border-radius: 10px;
}
</style>

4
res/manifest.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<application name="targetSdkVersion" value="30"/>
</manifest>

1
script/.gitkeep Normal file
View File

@ -0,0 +1 @@
此目录是脚本目录

1
wgt/.gitkeep Normal file
View File

@ -0,0 +1 @@
此目录是资源包目录