Commit 390070b5 authored by “yiyousong”'s avatar “yiyousong”

feat: 添加应用配置

parent c033d8e4
......@@ -35,7 +35,7 @@ export default {
this.getDeviceInfo();
if (newVal == "/" || newVal == "/home") {
this.getHomeInfo();
// this.getSetinfo();
this.getSetinfo();
this.getAppList();
}
},
......@@ -98,6 +98,7 @@ export default {
"SET_deviceCode",
"SET_appList",
"SET_onlineSkin",
"SET_showApp",
]),
// 简析url
urlGet() {
......@@ -153,9 +154,9 @@ export default {
// [...data.hotDatumList, ...data.datumList],
// "id"
// ).slice(0, 7);
datumList = data.hotDatumList.slice(0, 7);
datumList = data.hotDatumList.slice(0, 5);
} else {
datumList = data.datumList.slice(0, 7);
datumList = data.datumList.slice(0, 5);
}
if (data.hotMatterList) {
// matterList = this.removeDuplication(
......@@ -207,6 +208,7 @@ export default {
let res = await getDeviceInfo();
if (res.data.code == 1) {
let { data } = res.data;
this.SET_showApp(!!data.source);
this.enabled = data.enabled;
}
},
......
......@@ -208,8 +208,10 @@ export default {
setTimeout(() => {
// 查询站点信息
this.getHomeInfo();
// 查询设备信息
this.getDeviceInfo();
// 查询皮肤
// this.getSetinfo();
this.getSetinfo();
// 查询应用列表
this.getAppList();
});
......
......@@ -51,9 +51,11 @@ export default {
appId,
newsSource,
devicenum,
// appName,
appName,
} = this.$route.query;
this.iframeUrl = `${custUrl}?siteId=${siteId}&baseUrl=${serviceApi}&appId=${appId}&newsSource=${newsSource}&devicenum=${devicenum}`;
this.iframeUrl = `${custUrl}?siteId=${siteId}&baseUrl=${serviceApi}&appId=${appId}&newsSource=${newsSource}&devicenum=${devicenum}&appName=${encodeURIComponent(
appName
)}`;
},
changeLoading() {
this.loading = false;
......
......@@ -150,11 +150,19 @@
<div v-else class="tac empty-text">暂无数据</div>
</div>
</div>
<div class="app-box" v-if="showApp && appList && appList.length">
<div class="app-list">
<div
class="app-item"
v-for="v in appList"
:key="v.id"
v-onEvent="{
eventName: '点击',
eventCode: 'Click',
businessCode: v.appCode,
businessName: v.appName,
routers: $route,
}"
@click="clickApp(v)"
>
<img
......@@ -168,6 +176,7 @@
</div>
</div>
</div>
</div>
<div class="right flex flexc aic jcb">
<div class="right-top flex aic jcb">
<router-link
......@@ -295,7 +304,7 @@ export default {
waitTime: 2500, // 单行停顿时间(singleHeight,waitTime)
};
},
...mapState(["homeInfo", "datumList", "matterList", "appList"]),
...mapState(["homeInfo", "datumList", "matterList", "appList", "showApp"]),
},
created() {
// this.getHomeInfo();
......@@ -485,7 +494,7 @@ export default {
}
.home {
width: 100%;
height: auto;
height: 100%;
padding-top: 40px;
background-size: 100% 100%;
}
......@@ -651,13 +660,20 @@ export default {
}
}
}
.app-list {
.app-box {
width: 100%;
height: 124px;
padding: 20px;
padding: 0px 20px;
}
.app-list {
width: 100%;
height: 100%;
padding: 0px 20px;
display: flex;
align-items: center;
gap: 46px;
background-color: #fff;
border-radius: 8px;
overflow: hidden;
.app-item {
display: flex;
......
......@@ -15,6 +15,7 @@ export default new Vuex.Store({
times: 0, // 倒计时时间
operTime: "", // 样表打开时间
appList: [], // 应用列表
showApp: false, // 是否展示应用
onlineSkin: "", // 皮肤地址
},
getters: {
......@@ -29,6 +30,9 @@ export default new Vuex.Store({
},
},
mutations: {
SET_showApp(state, showApp) {
state.showApp = showApp;
},
SET_onlineSkin(state, onlineSkin) {
state.onlineSkin = onlineSkin;
},
......
......@@ -136,13 +136,27 @@
:active-value="1"
:inactive-value="0"
v-model="scope.row.enabled"
@change="handleChange(scope.row)"
@change="handleChange(scope.row, 1)"
inactive-text="停用"
active-text="启用"
>
</el-switch>
</template>
</el-table-column>
<el-table-column align="center" prop="source" label="展示应用">
<template slot-scope="scope">
<el-switch
class="tableScopeSwitch"
:active-value="1"
:inactive-value="0"
v-model="scope.row.source"
@change="handleChange(scope.row, 2)"
inactive-text=""
active-text=""
>
</el-switch>
</template>
</el-table-column>
<el-table-column align="center" prop="deviceRemark" label="备注">
</el-table-column>
<el-table-column align="center" label="操作" width="200">
......@@ -207,6 +221,7 @@ import {
saveDeviceEnable,
saveDeviceActive,
delDevice,
saveDevice,
} from "@/api/device";
import local from "@/utils/local";
const typeList = {
......@@ -346,13 +361,38 @@ export default {
console.log("取消成功!");
});
},
// 启停用
async handleChange(row) {
let obj = {
// 启停用\展示应用
async handleChange(row, type) {
this.loading = true;
let obj = {};
if (type === 1) {
obj = {
id: row.id,
enabled: row.enabled,
};
let res = await saveDeviceEnable(obj);
this.handleUpdate(obj);
} else {
obj = {
id: row.id,
source: row.source,
};
this.handleUpdateDevice(obj);
}
},
// 修改设备起停用
async handleUpdate(row) {
let res = await saveDeviceEnable(row);
this.loading = false;
let { code } = res.data;
if (code == 1) {
this.$message.success("修改成功");
this.getDeviceList();
}
},
// 更新设备
async handleUpdateDevice(row) {
let res = await saveDevice(row);
this.loading = false;
let { code } = res.data;
if (code == 1) {
this.$message.success("修改成功");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment