123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- <template>
- <view class="content">
- <view class="" v-if="show == true">
- <view class="" v-for="(obj, index) in tabList" :key="index">
- <view class="title">
- <text>设备ID:</text>
- <!-- :style="obj.status == 1 ? 'color: #00ff08;' : 'color: #ff0000;'" -->
- <text>
- {{ obj.deviceId }}
- </text>
- </view>
- <view class="">
- <view class="content_boby">
- <view class="content_boby_view">
- <text>设备名称:</text>
- <text :class="obj.status == 1 ? 'showFalw' : 'showTres'">
- {{ obj.deviceName }}
- </text>
- </view>
- </view>
- <view class="content_boby">
- <view class="content_boby_view" style="width: 100%">
- <text>日志内容:</text>
- <text :class="obj.status == 1 ? 'showFalw' : 'showTres'">
- {{ obj.content }}
- </text>
- </view>
- </view>
- <view class="content_boby">
- <view class="content_boby_view">
- <text>状态:</text>
- <text
- :class="obj.status == 1 ? 'showFalw' : 'showTres'"
- v-if="obj.status == 1">
- 连接正常
- </text>
- <text :class="obj.status == 1 ? 'showFalw' : 'showTres'" v-else>
- 连接中断
- </text>
- </view>
- </view>
- <view class="content_boby">
- <view class="content_boby_view">
- <text>时间:</text>
- <text :class="obj.status == 1 ? 'showFalw' : 'showTres'">
- {{ obj.createTime }}
- </text>
- </view>
- </view>
- <!-- <view class="content_boby">
- <view class="content_boby_view">
- <text>备注:</text>
- <text>{{ obj.remark }}</text>
- </view>
- </view> -->
- <view class="hr"></view>
- </view>
- </view>
- </view>
- <view class="text" style="text-align: center; margin: 10vw 0" v-else>
- <text>暂无数据</text>
- </view>
- </view>
- </template>
- <script>
- export default {
- components: {},
- data() {
- return {
- obj: {},
- show: true,
- page: 1,
- tabList: [],
- host: "",
- num: 1,
- deviceId: "",
- };
- },
- onLoad(option) {
- let _this = this;
- this.deviceId = option.id;
- uni.getStorage({
- key: "hostappst",
- success(res) {
- console.log("获取成功", res.data);
- _this.host = res.data;
- },
- });
- this.getData();
- },
- onShow() {},
- created() {},
- mounted() {},
- onReachBottom() {
- this.page = this.page + 1;
- this.getData("addList");
- },
- methods: {
- logReter(id) {
- uni.navigateTo({
- url: "/pages/index/me/log/log?id=" + id,
- });
- },
- getData(type) {
- let that = this;
- let data = { pageNum: this.page, pageSize: 10 };
- uni.getStorage({
- key: "GetPhone_Token",
- success: function (res) {
- uni.request({
- url: `http://${that.host}` + "/device/log/list",
- header: {
- Authorization: res.data,
- "content-type": "application/x-www-form-urlencoded",
- },
- data: data,
- method: "GET",
- success(respenon) {
- console.log("chaoShiPanDuan", respenon);
- if (respenon.data.code == 200) {
- if (type == "addList") {
- that.tabList = [...that.tabList, ...respenon.data.rows];
- } else {
- that.tabList = respenon.data.rows;
- if (that.tabList.length > 0) {
- that.show = true;
- } else {
- that.show = false;
- }
- }
- } else {
- uni.showToast({
- title: respenon.data.msg,
- icon: "none",
- });
- }
- },
- });
- },
- });
- },
- },
- };
- </script>
- <style scoped lang="scss">
- .content {
- color: #787878;
- font-size: 14px;
- font-weight: 400;
- .title {
- height: 44px;
- padding: 12px 15px;
- font-size: 17px;
- font-weight: 600;
- color: #000;
- }
- .content_boby {
- padding: 0 15px;
- display: flex;
- justify-content: space-between;
- margin-bottom: 10px;
- .showFalw {
- color: #0bbc11;
- }
- .showTres {
- color: red;
- // display: -webkit-box;
- // overflow-wrap: anywhere;
- word-wrap: break-word;
- }
- }
- .hr {
- width: 100%;
- height: 1px;
- background: #cfcfcf;
- }
- }
- </style>
|