Former-commit-id: 97d25b6e669424a5066fcb22bd1d37b209dfa557
Former-commit-id: 174a6a0e7481474081f2a91b89706ebc5939d373
TSXN
wanggang 5 years ago
commit b4452bf6da

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
@ -8,7 +8,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Confluent.Kafka" Version="1.5.1" /> <PackageReference Include="Confluent.Kafka" Version="1.5.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.8" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.8" />
<PackageReference Include="MySql.Data" Version="8.0.21" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -1,5 +1,7 @@
using Confluent.Kafka; using Confluent.Kafka;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using MySqlConnector;
using Newtonsoft.Json;
using System; using System;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -8,8 +10,9 @@ namespace KafkaEFTest
{ {
internal class Program internal class Program
{ {
static TimeSpan DefaultTimeout = TimeSpan.FromSeconds(30); private static readonly TimeSpan DefaultTimeout = TimeSpan.FromSeconds(30);
private static void Main(string[] args)
private static void Main()
{ {
using (var db = new TestDbContext()) using (var db = new TestDbContext())
{ {
@ -17,31 +20,37 @@ namespace KafkaEFTest
} }
Task.Run(async () => Task.Run(async () =>
{ {
var topic = "test-topic";
var config = new ProducerConfig
{
BootstrapServers = "localhost:9092",
TransactionalId = "test",
};
while (true) while (true)
{ {
var entity = new TestEntity(); using (var dbContext = new TestDbContext())
using (var db = new TestDbContext())
{ {
try try
{ {
using (var p = new ProducerBuilder<Null, string>(new ProducerConfig { BootstrapServers = "localhost:9092", TransactionalId = entity.Id.ToString() }).Build()) using (var producer = new ProducerBuilder<string, string>(config).Build())
{ {
try try
{ {
p.InitTransactions(DefaultTimeout); var entity = new TestEntity();
p.BeginTransaction(); producer.InitTransactions(DefaultTimeout);
db.Database.BeginTransaction(); producer.BeginTransaction();
db.Tests.Add(entity); dbContext.Database.BeginTransaction();
db.SaveChanges(); dbContext.Tests.Add(entity);
var dr = await p.ProduceAsync("test-topic", new Message<Null, string> { Value = entity.Id + ":" + entity.Value }); dbContext.SaveChanges();
db.Database.CommitTransaction(); var dr = await producer.ProduceAsync(topic, new Message<string, string> { Key = "test_table", Value = JsonConvert.SerializeObject(entity) });
p.CommitTransaction(DefaultTimeout); dbContext.Database.CommitTransaction();
Console.WriteLine($"Delivered '{dr.Value}' to '{dr.TopicPartitionOffset}'"); producer.CommitTransaction(DefaultTimeout);
Console.WriteLine($"send message offset: '{dr.TopicPartitionOffset}' value: '{dr.Value}");
} }
catch (Exception ex)//DbUpdateException//ProduceException<Null,string> catch (Exception ex)//DbUpdateException//ProduceException<Null,string>
{ {
db.Database.RollbackTransaction(); dbContext.Database.RollbackTransaction();
p.AbortTransaction(DefaultTimeout); producer.AbortTransaction(DefaultTimeout);
Console.WriteLine(ex.Message); Console.WriteLine(ex.Message);
} }
} }
@ -57,13 +66,17 @@ namespace KafkaEFTest
}); });
var conf = new ConsumerConfig var conf = new ConsumerConfig
{ {
GroupId = "test-consumer-group", GroupId = "group_test",
BootstrapServers = "localhost:9092", BootstrapServers = "localhost:9092",
AutoOffsetReset = AutoOffsetReset.Earliest EnableAutoCommit = false,
StatisticsIntervalMs = 5000,
SessionTimeoutMs = 6000,
AutoOffsetReset = AutoOffsetReset.Earliest,
EnablePartitionEof = true
}; };
using (var c = new ConsumerBuilder<Ignore, string>(conf).Build()) using (var consumer = new ConsumerBuilder<string, string>(conf).Build())
{ {
c.Subscribe("test-topic"); consumer.Subscribe("test-topic");
CancellationTokenSource cts = new CancellationTokenSource(); CancellationTokenSource cts = new CancellationTokenSource();
Console.CancelKeyPress += (_, e) => Console.CancelKeyPress += (_, e) =>
@ -78,8 +91,26 @@ namespace KafkaEFTest
{ {
try try
{ {
var cr = c.Consume(cts.Token); var consumeResult = consumer.Consume(cts.Token);
Console.WriteLine($"Consumed message '{cr.Value}' at: '{cr.TopicPartitionOffset}'."); if (consumeResult.IsPartitionEOF)
{
Console.WriteLine(
$"Reached end of topic {consumeResult.Topic}, partition {consumeResult.Partition}, offset {consumeResult.Offset}.");
continue;
}
Console.WriteLine($"group received message offset: '{consumeResult.TopicPartitionOffset}' key: {consumeResult.Message.Key} value: '{consumeResult.Message.Value}'");
Doris(consumeResult.Value);
try
{
consumer.Commit(consumeResult);
}
catch (KafkaException e)
{
Console.WriteLine($"Commit error: {e.Error.Reason}");
}
} }
catch (ConsumeException e) catch (ConsumeException e)
{ {
@ -90,9 +121,50 @@ namespace KafkaEFTest
catch (OperationCanceledException) catch (OperationCanceledException)
{ {
// Ensure the consumer leaves the group cleanly and final offsets are committed. // Ensure the consumer leaves the group cleanly and final offsets are committed.
c.Close(); consumer.Close();
}
} }
} }
//create database test;
//CREATE USER 'usr' IDENTIFIED BY 'pwd';
//GRANT ALL ON test TO usr;
//CREATE TABLE IF NOT EXISTS test
//(
// `id` VARCHAR(64),
// `value` VARCHAR(128),
// `number` INT
//)
//UNIQUE KEY(`id`)
//distributed by hash(id) buckets 1
//properties(
// "replication_num" = "1"
//);
private static void Doris(string value)
{
try
{
var entity = JsonConvert.DeserializeObject<TestEntity>(value);
var connectionString = "Server=localhost;Port=9030;Database=test;Uid=usr;Pwd=pwd;";
using (var conn = new MySqlConnection(connectionString))
{
conn.Open();
using (var cmd = conn.CreateCommand())
{
cmd.CommandTimeout = 60;
cmd.CommandText = $"insert into test (`id`,`value`,`number`) values ('{entity.Id}','{entity.Value}',{entity.Number})";
cmd.ExecuteNonQuery();
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.GetType().FullName);
//"Unknown database 'default_cluster:test'"
//errCode = 2, detailMessage = Unknown table 'test'
throw;
}
} }
} }
@ -112,9 +184,11 @@ namespace KafkaEFTest
{ {
this.Id = Guid.NewGuid(); this.Id = Guid.NewGuid();
this.Value = DateTime.Now.Ticks.ToString(); this.Value = DateTime.Now.Ticks.ToString();
this.Number = new Random((int)DateTime.Now.Ticks).Next();
} }
public Guid Id { get; set; } public Guid Id { get; set; }
public string Value { get; set; } public string Value { get; set; }
public int Number { get; set; }
} }
} }

@ -8,27 +8,55 @@ networks:
services: services:
zookeeper: zookeeper:
image: wurstmeister/zookeeper:latest image: wurstmeister/zookeeper:latest
restart: always
ports: ports:
- 2181:2181 - 2181:2181
networks: networks:
default: default:
ipv4_address: 172.172.0.171 ipv4_address: 172.172.0.201
kafka: kafka:
image: wurstmeister/kafka:2.13-2.6.0 image: wurstmeister/kafka:2.13-2.6.0
restart: always restart: always
environment: environment:
KAFKA_ZOOKEEPER_CONNECT: 172.172.0.171:2181 KAFKA_ZOOKEEPER_CONNECT: 172.172.0.201:2181
KAFKA_ADVERTISED_HOST_NAME: 172.172.0.170 KAFKA_ADVERTISED_HOST_NAME: localhost
KAFKA_HEAP_OPTS: "-Xmx256m -Xms256m"
volumes:
- ./docker/data/kafka:/kafka
ports:
- 9092:9092
networks:
default:
ipv4_address: 172.172.0.210
kafka-manager:
image: sheepkiller/kafka-manager
restart: always
environment:
ZK_HOSTS: 172.172.0.201
KAFKA_BROKERS: 172.172.0.210:9092
ports:
- "9010:9000"
networks:
default:
ipv4_address: 172.172.0.220
doris:
image: doris:0.12.0
restart: always
environment:
TZ: "Asia/Shanghai"
volumes: volumes:
- /etc/localtime:/etc/localtime #- ./conf/fe.conf:/opt/fe/conf/fe.conf
- /var/run/docker.sock:/var/run/docker.sock
- ./log/fe:/opt/fe/log - ./log/fe:/opt/fe/log
- ./data/fe/doris-meta:/opt/fe/doris-meta - ./data/fe/doris-meta:/opt/fe/doris-meta
- ./conf/be.conf:/opt/be/conf/be.conf #- ./conf/be.conf:/opt/be/conf/be.conf
- ./data/be/storage:/opt/be/storage - ./data/be/storage:/opt/be/storage
ports: ports:
- 9092:9092 - 8081:8081
- 8030:8030
- 9030:9030
- 9050:9050
command: bash -c "/opt/fe/bin/start_fe.sh & /opt/be/bin/start_be.sh" command: bash -c "/opt/fe/bin/start_fe.sh & /opt/be/bin/start_be.sh"
#mysql -h 127.0.0.1 -P9030 -u root -e 'ALTER SYSTEM ADD BACKEND "172.172.0.30:9050"'
networks: networks:
default: default:
ipv4_address: 172.172.0.170 ipv4_address: 172.172.0.30

@ -0,0 +1 @@
docker-compose -f docker-compose.yml up --remove-orphans --force-recreate -d

@ -0,0 +1 @@
docker-compose down --remove-orphans

@ -1,4 +1,4 @@
<template> <template>
<div class="card camera" style="box-sizing:border-box;height:490px;margin:10px;"> <div class="card camera" style="box-sizing:border-box;height:490px;margin:10px;">
<div class="card-header"> <div class="card-header">
{{device.displayName}} {{device.displayName}}
@ -23,21 +23,21 @@
<tr> <tr>
<td></td> <td></td>
<td></td> <td></td>
<td><img @click="execApi(device.number,'/Onvif/Up')" src="/images/up.svg" style="width:32px;" /></td> <td><img @click="execApi(device.number,'/Onvif/Up')" src="images/up.svg" style="width:32px;" /></td>
<td></td> <td></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td><img @click="execApi(device.number,'/Onvif/Zoomin')" src="/images/zoomin.svg" style="width:32px;" /></td> <td><img @click="execApi(device.number,'/Onvif/Zoomin')" src="images/zoomin.svg" style="width:32px;" /></td>
<td><img @click="execApi(device.number,'/Onvif/Left')" src="/images/left.svg" style="width:32px;" /></td> <td><img @click="execApi(device.number,'/Onvif/Left')" src="images/left.svg" style="width:32px;" /></td>
<td><img @click="execApi(device.number,'/Onvif/Stop')" src="/images/stop.svg" style="width:32px;" /></td> <td><img @click="execApi(device.number,'/Onvif/Stop')" src="images/stop.svg" style="width:32px;" /></td>
<td><img @click="execApi(device.number,'/Onvif/Right')" src="/images/right.svg" style="width:32px;" /></td> <td><img @click="execApi(device.number,'/Onvif/Right')" src="images/right.svg" style="width:32px;" /></td>
<td><img @click="execApi(device.number,'/Onvif/Zoomout')" src="/images/zoomout.svg" style="width:32px;" /></td> <td><img @click="execApi(device.number,'/Onvif/Zoomout')" src="images/zoomout.svg" style="width:32px;" /></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td></td> <td></td>
<td><img @click="execApi(device.number,'/Onvif/Down')" src="/images/down.svg" style="width:32px;" /></td> <td><img @click="execApi(device.number,'/Onvif/Down')" src="images/down.svg" style="width:32px;" /></td>
<td></td> <td></td>
<td></td> <td></td>
</tr> </tr>
@ -47,8 +47,7 @@
</div> </div>
</div> </div>
</template> </template>
<script> <script>export default {
export default {
props: ['device', 'edit'], props: ['device', 'edit'],
data() { data() {
return { return {
@ -261,5 +260,4 @@
return false; return false;
} }
} }
}; };</script>
</script>

@ -1,4 +1,4 @@
<template> <template>
<div class="card color-light" style="box-sizing:border-box;height:150px;margin:10px;"> <div class="card color-light" style="box-sizing:border-box;height:150px;margin:10px;">
<div class="card-header"> <div class="card-header">
{{device.displayName}} {{device.displayName}}
@ -18,8 +18,8 @@
</div> </div>
</div> </div>
<div class="col-2 align-self-center text-center"> <div class="col-2 align-self-center text-center">
<img style="height:32px;" v-if="getDeviceDataValue(device,'状态')==='开'" @click="execApi(device.number,'/Socket/Off')" src="/images/on.svg" /> <img style="height:32px;" v-if="getDeviceDataValue(device,'状态')==='开'" @click="execApi(device.number,'/Socket/Off')" src="images/on.svg" />
<img style="height:32px;" v-else="getDeviceDataValue(device,'状态')==='关'" @click="execApi(device.number,'/Socket/On')" src="/images/off.svg" /> <img style="height:32px;" v-else="getDeviceDataValue(device,'状态')==='关'" @click="execApi(device.number,'/Socket/On')" src="images/off.svg" />
</div> </div>
</div> </div>
</div> </div>

@ -1,4 +1,4 @@
<template> <template>
<div class="card" style="box-sizing:border-box;height:150px;margin:10px;"> <div class="card" style="box-sizing:border-box;height:150px;margin:10px;">
<div class="card-header"> <div class="card-header">
{{device.displayName}} {{device.displayName}}
@ -13,17 +13,15 @@
<div class="col-8 align-self-center"> <div class="col-8 align-self-center">
<div class="row" style="line-height:28px;"> <div class="row" style="line-height:28px;">
<span class="badge badge-info" style="line-height:26px;">{{getDeviceDataValue(device,'状态')}}</span> <span class="badge badge-info" style="line-height:26px;">{{getDeviceDataValue(device,'状态')}}</span>
<img style="height:32px;" @click="execApi(device.number,'/Curtain/On')" src="/images/left.svg" /> <img style="height:32px;" @click="execApi(device.number,'/Curtain/On')" src="images/left.svg" />
<img style="height:32px;" @click="execApi(device.number,'/Curtain/Stop')" src="/images/stop.svg" /> <img style="height:32px;" @click="execApi(device.number,'/Curtain/Stop')" src="images/stop.svg" />
<img style="height:32px;" @click="execApi(device.number,'/Curtain/Off')" src="/images/right.svg" /> <img style="height:32px;" @click="execApi(device.number,'/Curtain/Off')" src="images/right.svg" />
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>export default {
export default {
props: ['device'] props: ['device']
}; };</script>
</script>

@ -13,16 +13,15 @@
<div class="col-8 align-self-center"> <div class="col-8 align-self-center">
<div class="row" style="line-height:28px;"> <div class="row" style="line-height:28px;">
<!--<span class="badge badge-info" style="line-height:26px;">{{getDeviceDataValue(device,'状态')}}</span>--> <!--<span class="badge badge-info" style="line-height:26px;">{{getDeviceDataValue(device,'状态')}}</span>-->
<img style="height:32px;" @click="open" src="/images/on.svg" /> <img style="height:32px;" @click="open" src="images/on.svg" />
<!--<img style="height:32px;" @click="close" src="/IoTCenter/images/off.svg" />--> <!--<img style="height:32px;" @click="close" src="/IoTCenterimages/off.svg" />-->
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>export default {
export default {
props: ['device'], props: ['device'],
methods: { methods: {
open: function () { open: function () {
@ -38,5 +37,4 @@
} }
} }
} }
}; };</script>
</script>

@ -1,4 +1,4 @@
<template> <template>
<div class="card" style="box-sizing:border-box;height:150px;margin:10px;"> <div class="card" style="box-sizing:border-box;height:150px;margin:10px;">
<div class="card-header"> <div class="card-header">
{{device.displayName}} {{device.displayName}}
@ -14,16 +14,15 @@
<div class="row" style="line-height:28px;"> <div class="row" style="line-height:28px;">
<span class="badge badge-info" style="line-height:26px; margin-right: 10px;" v-if="isSmart">{{electricity}} kW‧h</span> <span class="badge badge-info" style="line-height:26px; margin-right: 10px;" v-if="isSmart">{{electricity}} kW‧h</span>
<span class="badge badge-info" style="line-height:26px; margin-right: 10px;" v-if="isSmart">{{power}} W</span> <span class="badge badge-info" style="line-height:26px; margin-right: 10px;" v-if="isSmart">{{power}} W</span>
<img style="height:32px;" v-if="getDeviceDataValue(device,'状态')==='开'" @click="execApi(device.number,'/Socket/Off')" src="/images/on.svg" /> <img style="height:32px;" v-if="getDeviceDataValue(device,'状态')==='开'" @click="execApi(device.number,'/Socket/Off')" src="images/on.svg" />
<img style="height:32px;" v-else="getDeviceDataValue(device,'状态')==='关'" @click="execApi(device.number,'/Socket/On')" src="/images/off.svg" /> <img style="height:32px;" v-else="getDeviceDataValue(device,'状态')==='关'" @click="execApi(device.number,'/Socket/On')" src="images/off.svg" />
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>export default {
export default {
props: ['device'], props: ['device'],
computed: { computed: {
isSmart: function () { isSmart: function () {
@ -36,5 +35,4 @@
return parseFloat(this.getDeviceDataValue(this.device, '功率') || 0).toFixed(2); return parseFloat(this.getDeviceDataValue(this.device, '功率') || 0).toFixed(2);
} }
} }
}; };</script>
</script>

@ -1,4 +1,4 @@
<template> <template>
<div class="card" style="box-sizing:border-box;height:150px;margin:10px;"> <div class="card" style="box-sizing:border-box;height:150px;margin:10px;">
<div class="card-header"> <div class="card-header">
{{device.displayName}} {{device.displayName}}
@ -12,16 +12,14 @@
</div> </div>
<div class="col-8 align-self-center"> <div class="col-8 align-self-center">
<div class="row" style="line-height:28px;"> <div class="row" style="line-height:28px;">
<img style="height:32px;" v-if="getDeviceDataValue(device,'状态')=='开'" @click="execApi(device.number,'/Switch/Off')" src="/images/on.svg" /> <img style="height:32px;" v-if="getDeviceDataValue(device,'状态')=='开'" @click="execApi(device.number,'/Switch/Off')" src="images/on.svg" />
<img style="height:32px;" v-if="getDeviceDataValue(device,'状态')=='关'" @click="execApi(device.number,'/Switch/On')" src="/images/off.svg" /> <img style="height:32px;" v-if="getDeviceDataValue(device,'状态')=='关'" @click="execApi(device.number,'/Switch/On')" src="images/off.svg" />
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>export default {
export default {
props: ['device'] props: ['device']
}; };</script>
</script>

@ -1,4 +1,4 @@
<template> <template>
<div class="card" style="box-sizing:border-box;height:150px;margin:10px;"> <div class="card" style="box-sizing:border-box;height:150px;margin:10px;">
<div class="card-header"> <div class="card-header">
{{device.displayName}} {{device.displayName}}
@ -12,20 +12,18 @@
</div> </div>
<div class="col-8 align-self-center"> <div class="col-8 align-self-center">
<div class="row" style="line-height:28px;"> <div class="row" style="line-height:28px;">
<img style="height:32px;" v-if="getDeviceDataValue(device,'L1状态')=='开'" @click="execApi(device.number,'/Switch3/L1Off')" src="/images/on.svg" /> <img style="height:32px;" v-if="getDeviceDataValue(device,'L1状态')=='开'" @click="execApi(device.number,'/Switch3/L1Off')" src="images/on.svg" />
<img style="height:32px;" v-if="getDeviceDataValue(device,'L1状态')=='关'" @click="execApi(device.number,'/Switch3/L1On')" src="/images/off.svg" /> <img style="height:32px;" v-if="getDeviceDataValue(device,'L1状态')=='关'" @click="execApi(device.number,'/Switch3/L1On')" src="images/off.svg" />
<img style="height:32px;" v-if="getDeviceDataValue(device,'L2状态')=='开'" @click="execApi(device.number,'/Switch3/L2Off')" src="/images/on.svg" /> <img style="height:32px;" v-if="getDeviceDataValue(device,'L2状态')=='开'" @click="execApi(device.number,'/Switch3/L2Off')" src="images/on.svg" />
<img style="height:32px;" v-if="getDeviceDataValue(device,'L2状态')=='关'" @click="execApi(device.number,'/Switch3/L2On')" src="/images/off.svg" /> <img style="height:32px;" v-if="getDeviceDataValue(device,'L2状态')=='关'" @click="execApi(device.number,'/Switch3/L2On')" src="images/off.svg" />
<img style="height:32px;" v-if="getDeviceDataValue(device,'L3状态')=='开'" @click="execApi(device.number,'/Switch3/L3Off')" src="/images/on.svg" /> <img style="height:32px;" v-if="getDeviceDataValue(device,'L3状态')=='开'" @click="execApi(device.number,'/Switch3/L3Off')" src="images/on.svg" />
<img style="height:32px;" v-if="getDeviceDataValue(device,'L3状态')=='关'" @click="execApi(device.number,'/Switch3/L3On')" src="/images/off.svg" /> <img style="height:32px;" v-if="getDeviceDataValue(device,'L3状态')=='关'" @click="execApi(device.number,'/Switch3/L3On')" src="images/off.svg" />
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>export default {
export default {
props: ['device'] props: ['device']
}; };</script>
</script>

@ -1,16 +1,14 @@
<template> <template>
<a ref="fancybox" style="display:block;" :href="src"><img style="height:32px;" :src="src" /></a> <a ref="fancybox" style="display:block;" :href="src"><img style="height:32px;" :src="src" /></a>
</template> </template>
<script> <script>export default {
export default {
props: ['value'], props: ['value'],
mounted: function () { mounted: function () {
$(this.$refs.fancybox).fancybox(); $(this.$refs.fancybox).fancybox();
}, },
computed: { computed: {
src: function () { src: function () {
return this.value || '/images/empty.png'; return this.value || 'images/empty.png';
} }
} }
}; };</script>
</script>

@ -1,10 +1,9 @@
<template> <template>
<div> <div>
<textarea :name="name">{{value}}</textarea> <textarea :name="name">{{value}}</textarea>
</div> </div>
</template> </template>
<script> <script>export default {
export default {
props: ['name', 'value'], watch: { props: ['name', 'value'], watch: {
value(val) { value(val) {
this.$emit('update:value', val) this.$emit('update:value', val)
@ -24,8 +23,7 @@
}, },
computed: { computed: {
src: function () { src: function () {
return this.value || '/images/empty.png'; return this.value || 'images/empty.png';
} }
} }
}; };</script>
</script>

@ -1,4 +1,4 @@
<template> <template>
<div> <div>
<input ref="input" type="text" style="visibility: hidden; position: absolute;" :value="currentValue" /> <input ref="input" type="text" style="visibility: hidden; position: absolute;" :value="currentValue" />
<a ref="link" :href="src"><img ref="img" style="height:32px;" :src="src" /></a> <a ref="link" :href="src"><img ref="img" style="height:32px;" :src="src" /></a>
@ -6,8 +6,7 @@
<button ref="btn" class="btn btn-sm btn-default" type="button" id="btn_Image" style="margin-top:5px;">上传</button> <button ref="btn" class="btn btn-sm btn-default" type="button" id="btn_Image" style="margin-top:5px;">上传</button>
</div> </div>
</template> </template>
<script> <script>export default {
export default {
props: ['name', 'value', 'data'], props: ['name', 'value', 'data'],
data: function () { data: function () {
return { return {
@ -49,8 +48,7 @@
}, },
computed: { computed: {
src: function () { src: function () {
return this.currentValue || '/images/empty.png'; return this.currentValue || 'images/empty.png';
} }
} }
}; };</script>
</script>

@ -382,8 +382,7 @@
</footer> </footer>
</div> </div>
</template> </template>
<script> <script>export default {
export default {
data: function () { data: function () {
return { return {
version: config.version, version: config.version,
@ -392,7 +391,7 @@
openKeys: ['sub1'], openKeys: ['sub1'],
url: config.baseUrl + '/IoTCenter/api/v1/site/getSite', url: config.baseUrl + '/IoTCenter/api/v1/site/getSite',
data: { data: {
logo: '/images/logo.png', logo: 'images/logo.png',
copyright: '', copyright: '',
version: '', version: '',
username: '', username: '',
@ -456,5 +455,4 @@
return window.location.protocol + "//" + window.location.hostname + ":" + port; return window.location.protocol + "//" + window.location.hostname + ":" + port;
} }
} }
} }</script>
</script>

@ -13,7 +13,7 @@
<link rel="stylesheet" href="lib/weui/style/weui.min.css" /> <link rel="stylesheet" href="lib/weui/style/weui.min.css" />
<link rel="stylesheet" href="lib/fancybox/jquery.fancybox.min.css" /> <link rel="stylesheet" href="lib/fancybox/jquery.fancybox.min.css" />
<link rel="stylesheet" href="lib/sweetalert2/dist/minimal.min.css" /> <link rel="stylesheet" href="lib/sweetalert2/dist/minimal.min.css" />
<link rel="stylesheet" href="/IoTCenter/lib/kindeditor/themes/default/default.css"> <link rel="stylesheet" href="lib/kindeditor/themes/default/default.css">
<link rel="stylesheet" href="lib/tree-multiselect/jquery.tree-multiselect.min.css" /> <link rel="stylesheet" href="lib/tree-multiselect/jquery.tree-multiselect.min.css" />
<link rel="stylesheet" href="lib/jqcron/jqCron.css" /> <link rel="stylesheet" href="lib/jqcron/jqCron.css" />
<link rel="stylesheet" href="css/site.css" /> <link rel="stylesheet" href="css/site.css" />

@ -1,25 +1,25 @@
Vue.component('pagination', function (resolve, reject) { Vue.component('pagination', function (resolve, reject) {
axios.get("/components/shared/pagination.html").then(function (response) { axios.get("components/shared/pagination.html").then(function (response) {
resolve(parseModel(response)); resolve(parseModel(response));
}); });
}); });
Vue.component('layout', function (resolve, reject) { Vue.component('layout', function (resolve, reject) {
axios.get("/components/shared/layout.html").then(function (response) { axios.get("components/shared/layout.html").then(function (response) {
resolve(parseModel(response)); resolve(parseModel(response));
}); });
}); });
Vue.component('list', function (resolve, reject) { Vue.component('list', function (resolve, reject) {
axios.get("/components/shared/list.html").then(function (response) { axios.get("components/shared/list.html").then(function (response) {
resolve(parseModel(response)); resolve(parseModel(response));
}); });
}); });
Vue.component('display', function (resolve, reject) { Vue.component('display', function (resolve, reject) {
axios.get("/components/shared/display.html").then(function (response) { axios.get("components/shared/display.html").then(function (response) {
resolve(parseModel(response)); resolve(parseModel(response));
}); });
}); });
Vue.component('update', function (resolve, reject) { Vue.component('update', function (resolve, reject) {
axios.get("/components/shared/update.html").then(function (response) { axios.get("components/shared/update.html").then(function (response) {
resolve(parseModel(response)); resolve(parseModel(response));
}); });
}); });

@ -21,6 +21,6 @@
]; ];
for (var i = 0; i < formComponents.length; i++) { for (var i = 0; i < formComponents.length; i++) {
var name = formComponents[i]; var name = formComponents[i];
var url = "/components/shared/" + name.replace('-', '/') + ".html"; var url = "components/shared/" + name.replace('-', '/') + ".html";
vueComponent(name, url); vueComponent(name, url);
} }

@ -88,7 +88,7 @@ var iotComponents = [
]; ];
for (var i = 0; i < iotComponents.length; i++) { for (var i = 0; i < iotComponents.length; i++) {
var name = 'iot-'+iotComponents[i]; var name = 'iot-'+iotComponents[i];
var url = "/components/iot/" + iotComponents[i] + ".html"; var url = "components/iot/" + iotComponents[i] + ".html";
vueComponent(name, url); vueComponent(name, url);
} }
var deviceInfo = []; var deviceInfo = [];

@ -19,7 +19,7 @@ router.beforeEach((to, from, next) => {
var name = url.replace(/\//g, "-").replace(/\./g, "-").substring(1); var name = url.replace(/\//g, "-").replace(/\./g, "-").substring(1);
var route = routes[name]; var route = routes[name];
if (!route) { if (!route) {
axios.get(url).then(function (response) { axios.get(url.substring(1)).then(function (response) {
var model = parseModel(response); var model = parseModel(response);
route = { route = {
name: name, name: name,

@ -24,6 +24,12 @@ http {
server 172.172.0.12; server 172.172.0.12;
} }
server {
listen 80;
server_name iot.edusoa.com;
return 301 https://$host$request_uri;
}
server { server {
#listen 80; #listen 80;
listen 443; listen 443;

@ -1,32 +0,0 @@
#docker-compose up -d
version: "3.8"
services:
zookeeper:
image: wurstmeister/zookeeper:latest
restart: always
ports:
- 2181:2181
networks:
default:
ipv4_address: 172.172.0.201
kafka:
image: wurstmeister/kafka:2.13-2.6.0
restart: always
environment:
KAFKA_ZOOKEEPER_CONNECT: 172.172.0.201:2181
KAFKA_ADVERTISED_HOST_NAME: localhost
KAFKA_HEAP_OPTS: "-Xmx256m -Xms256m"
volumes:
- ./docker/data/kafka:/kafka
ports:
- 9092:9092
networks:
default:
ipv4_address: 172.172.0.210
kafka-manager:
image: sheepkiller/kafka-manager
environment:
ZK_HOSTS: 172.172.0.201
KAFKA_BROKERS: 172.172.0.210:9092
ports:
- "9010:9000"

@ -29,7 +29,7 @@ http {
server_name localhost; server_name localhost;
location / { location / {
root /root/nginx/html/desktop; root /root/nginx/html;
if ($http_user_agent ~* "(mobile|android|ipad|iphone|ipod|tablet)") { if ($http_user_agent ~* "(mobile|android|ipad|iphone|ipod|tablet)") {
root /root/nginx/html/mobile; root /root/nginx/html/mobile;
} }

@ -1 +0,0 @@
docker-compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.temp.yml up --remove-orphans -d
Loading…
Cancel
Save