Manager web (#237)

* update:增加前端设计图

* 前端代码优化

* update:底部信息纠正

* 增加:flyio

* update:去除org.quartz

* update:登陆功能

* aliyunTTS常联token

* 新增aliyunTTS长期Token方式

* 获取用户信息和已绑设备

* update:验证码,登录,注册

* update:去掉依赖错误代码

---------

Co-authored-by: hrz <1710360675@qq.com>
Co-authored-by: CGD <3030332422@qq.com>
Co-authored-by: Ken <ulxiping@qq.com>
This commit is contained in:
欣南科技
2025-03-07 21:19:41 +08:00
committed by GitHub
co-authored by hrz CGD Ken
parent dc4b8a5002
commit 8b74dec910
28 changed files with 2120 additions and 1157 deletions
+1074 -307
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -7,11 +7,13 @@
"build": "vue-cli-service build"
},
"dependencies": {
"axios": "^1.8.1",
"element-ui": "^2.15.14",
"flyio": "^0.6.14",
"normalize.css": "^8.0.1",
"vue": "^2.6.14",
"vue-router": "^3.5.1",
"vue-axios": "^3.5.2",
"vue-router": "^3.6.5",
"vuex": "^3.6.2"
},
"devDependencies": {
+6 -4
View File
@@ -1,5 +1,6 @@
// 引入各个模块的请求
import user from './module/user.js'
/**
* 接口地址
* 在开发阶段,如果地址写的是相对路径,请与vue.config.js的devServer配置相结合,方便跨域请求
@@ -11,12 +12,13 @@ const DEV_API_SERVICE = 'https://apifoxmock.com/m1/5931378-5618560-default'
* 根据开发环境返回接口url
* @returns {string}
*/
export function getServiceUrl () {
return DEV_API_SERVICE
export function getServiceUrl() {
return DEV_API_SERVICE
}
/** request服务封装 */
export default {
getServiceUrl,
user
getServiceUrl,
user,
}
+27 -1
View File
@@ -16,5 +16,31 @@ export default {
this.login(loginForm, callback)
})
}).send()
}
},
// 获取用户信息
getUserInfo(callback) {
RequestService.sendRequest().url(`${getServiceUrl()}/api/v1/user/info`).method('GET')
.success((res) => {
RequestService.clearRequestTime()
callback(res)
})
.fail(() => {
RequestService.reAjaxFun(() => {
this.getUserInfo()
})
}).send()
},
// 获取设备信息
getHomeList(callback) {
RequestService.sendRequest().url(`${getServiceUrl()}/api/v1/user/device/bind`).method('GET')
.success((res) => {
RequestService.clearRequestTime()
callback(res)
})
.fail(() => {
RequestService.reAjaxFun(() => {
this.getUserInfo()
})
}).send()
},
}
+41 -13
View File
@@ -3,7 +3,7 @@
<el-container style="height: 100%;">
<el-header class="header">
<div style="display: flex;justify-content: space-between;">
<div style="display: flex;align-items: center;gap: 8px;">
<div style="display: flex;align-items: center;gap: 8px;margin-top: 10px;">
<img src="@/assets/xiaozhi-logo.png" alt="" style="width: 45px;height: 45px;" />
<img src="@/assets/xiaozhi-ai.png" alt="" style="width: 70px;height: 13px;" />
<div class="equipment-management" @click="settingDevice=false">
@@ -19,7 +19,7 @@
<img src="@/assets/home/close.png" alt="" style="width: 6px;height: 6px;" />
</div>
</div>
<div style="display: flex;align-items: center;gap: 8px;">
<div style="display: flex;align-items: center;gap: 8px;margin-top: 10px">
<div class="serach-box">
<el-input placeholder="输入名称搜索.." v-model="serach" style="border: none; background: transparent;" />
<img src="@/assets/home/search.png" alt=""
@@ -27,7 +27,8 @@
</div>
<img src="@/assets/home/avatar.png" alt="" style="width: 21px;height: 21px;" />
<div class="user-info">
158 3632 4642</div>
{{ userInfo.mobile }}
</div>
</div>
</div>
</el-header>
@@ -56,10 +57,11 @@
</div>
<div
style="display: flex;flex-wrap: wrap;margin-top: 15px;gap: 15px;justify-content: space-between;box-sizing: border-box;">
<div class="device-item" v-for="(item,index) in 10" :key="index">
<div class="device-item" v-for="(item,index) in deviceList" :key="index">
<div style="display: flex;justify-content: space-between;">
<div style="font-weight: 700;font-size: 18px;text-align: left;color: #3d4566;">
CC:ba:97:11:a6:ac
<!-- CC:ba:97:11:a6:ac-->
{{item.list[0]?.mac_address}}
</div>
<div>
<img src="@/assets/home/delete.png" alt=""
@@ -68,7 +70,7 @@
</div>
</div>
<div class="device-name">
设备型号:esp32-s3-touch-amoled-1.8
设备型号:{{item.list[0]?.device_type}}
</div>
<div style="display: flex;gap: 8px;align-items: center;">
<div class="settings-btn" @click="clickSettingDevice">
@@ -77,12 +79,12 @@
声纹识别</div>
<div class="settings-btn">
历史对话</div>
<el-switch v-model="switchValue" inactive-text="OTA升级:" :width="32"
<el-switch :value="item.list[0]?.ota_upgrade && true || false" inactive-text="OTA升级:" :width="32"
style="margin-left: auto;" />
</div>
<div class="version-info">
<div>最近对话:6天前</div>
<div>APP版本:1.1.0</div>
<div>最近对话:{{item.list[0]?.recent_chat_time}}</div>
<div>APP版本:{{item.list[0]?.app_version}}</div>
</div>
</div>
</div>
@@ -185,7 +187,8 @@
</div>
<div
style="font-size: 12px;font-weight: 400;margin-top: auto;padding-top: 30px;color: #979db1;">
©2025 xiaozhi-esp32-server</div>
©2025 xiaozhi-esp32-server
</div>
</el-main>
</el-container>
<el-dialog :visible.sync="addDeviceDialogVisible" width="400px" center>
@@ -220,6 +223,8 @@
<script>
// @ is an alias to /src
import Api from '@/apis/api';
export default {
name: 'home',
data() {
@@ -242,8 +247,12 @@ export default {
}, {
value: '选项2',
label: '双皮奶'
}]
}
}],
userInfo: {
mobile: '' // 初始化用户信息
},
deviceList:[]
};
},
methods: {
showAddDialog() {
@@ -251,10 +260,28 @@ export default {
},
clickSettingDevice() {
this.settingDevice = true
},
// 获取用户信息
fetchUserInfo() {
Api.user.getUserInfo(({data}) => {
this.userInfo = data.data
});
},
// 获取已绑设备
getList(){
Api.user.getHomeList(({data})=>{
console.log(data.data)
this.deviceList = data.data
})
}
},
mounted() {
this.fetchUserInfo(); // 组件加载时获取用户信息
this.getList()
}
}
</script>
<style scoped lang="scss">
.welcome {
min-width: 900px;
@@ -464,7 +491,7 @@ export default {
}
}
.device-item {
width: 350px;
width: 345px;
border-radius: 15px;
background: #fafcfe;
padding: 22px;
@@ -507,6 +534,7 @@ audio::-webkit-media-controls-panel {
line-height: 34px;
box-sizing: border-box;
cursor: pointer;
font-size: 12px;
}
.save-btn {
border-radius: 23px;