首页 > 其他分享 >5.3 居家养老web端控制台

5.3 居家养老web端控制台

时间:2024-05-03 16:36:17浏览次数:17  
标签:web 5.3 const color text 100% 广告位 container 控制台

基于vue3+ElementPlus做的一个居家养老静态界面,内容准备后期实现

以下是效果图 特别声明用到了百度地图JS API进行位置展示与iV Cam模拟实时监控

 以下是代码部分

<script setup>
import { onMounted, onBeforeUnmount } from 'vue'
import { ref } from 'vue'
const videoRef = ref(null)
let stream = null
function loadJScript() {
  const script = document.createElement('script')
  script.type = 'text/javascript'
  script.src =
    '//api.map.baidu.com/api?type=webgl&v=1.0&ak=llEL7o82KutbtrUpWu5GEz6y8HJ6mzQO&callback=init'
  document.body.appendChild(script)
}

function init() {
  const container = document.getElementById('container')
  if (!container) return

  const map = new window.BMapGL.Map(container) // 创建Map实例
  const point = new window.BMapGL.Point(116.404, 39.915) // 创建点坐标
  map.centerAndZoom(point, 10)
  map.enableScrollWheelZoom() // 启用滚轮放大缩小
  var marker = new window.BMapGL.Marker(point, {
    enableDragging: true
  })
  map.addOverlay(marker)
}
onMounted(async () => {
  loadJScript()
  try {
    // 获取媒体设备(通常是前置或后置摄像头)
    stream = await navigator.mediaDevices.getUserMedia({
      video: true,
      audio: false // 如果需要音频,设置为true
    })

    // 将视频流绑定到video元素
    if (videoRef.value) {
      videoRef.value.srcObject = stream
    }
  } catch (error) {
    console.error('Error accessing camera:', error)
  }
})

onBeforeUnmount(() => {
  // 组件卸载时记得关闭视频流
  if (stream) {
    stream.getTracks().forEach((track) => track.stop())
  }
})
if (typeof window !== 'undefined') {
  window.init = init
}
</script>

<template>
  <div class="common-layout">
    <el-container>
      <el-header>
        <div class="logo-container">
          <span style="font-weight: bold; font-size: 25px" class="logo-text"
            >智慧助老控制台</span
          >
        </div>
      </el-header>
      <el-container>
        <!----------------------------------------------- aside -->
        <el-aside width="250px">
          <div>
            <div class="as">
              <el-col style="height: 100%">
                <div
                  style="
                    width: 90%;
                    background-color: aqua;
                    border-radius: 10px;
                    margin: auto;
                    padding-top: 10px;
                    padding-bottom: 20px;
                  "
                >
                  <h1 style="text-align: center">信息卡片</h1>
                  <el-row style="margin-top: 30px; margin-left: 40px">
                    <el-avatar
                      src="https://b0.bdstatic.com/e002551e53878af3bbe5b7d1a2c7e73d.jpg@h_1280"
                    />
                    <h1 style="margin-left: 30px">ikun</h1></el-row
                  >
                  <el-divider style="width: 80%; margin-left: 8%" />
                  <el-row style="margin-left: 45px"> 性别:男 </el-row>
                  <el-divider style="width: 80%; margin-left: 10%" />
                  <el-row style="margin-left: 45px"> 年龄:2.5岁 </el-row>
                  <el-divider style="width: 80%; margin-left: 10%" />
                  <el-row style="margin-left: 45px"> 生肖:鸡 </el-row>
                  <el-divider style="width: 80%; margin-left: 10%" />
                  <el-row style="margin-left: 45px"> 爱好:唱跳rap篮球 </el-row>
                </div>
                <div
                  class="ad-text"
                  style="
                    background-color: yellow;
                    width: 90%;
                    margin: auto;
                    height: 35vh;
                    border-radius: 10px;
                    margin-top: 10px;
                  "
                >
                  <span>广告位招租。。。。</span>
                  <br />
                  <br />
                  <span>广告位招租。。。。</span>
                  <br />
                  <br />
                  <span>广告位招租。。。。</span>
                  <br />
                  <br />
                  <span>广告位招租。。。。</span>
                  <br />
                  <br />
                  <span>广告位招租。。。。</span>
                </div>
              </el-col>
            </div>
          </div>
        </el-aside>
        <el-container>
          <!-- main ------------------------------------------------>
          <el-main>
            <el-col style="width: 100%; height: 100vh">
              <div style="display: flex; flex-wrap: nowrap">
                <video
                  style="border-radius: 10px"
                  ref="videoRef"
                  autoplay
                  muted
                  width="400"
                  height="300"
                ></video>
                <div
                  style="
                    width: 350px;
                    background-color: white;
                    height: 300px;
                    border-radius: 10px;
                    margin-left: 80px;
                    margin-right: 30px;
                  "
                >
                  <div style="display: flex; flex-wrap: nowrap">
                    <img
                      style="
                        margin-left: 40px;
                        margin-top: 30px;
                        width: 30px;
                        height: 35px;
                      "
                      src="../../assets/heart-rate.png"
                    />
                    <h1
                      style="
                        margin-left: 10px;
                        font-weight: 200;
                        color: red;
                        margin-top: 40px;
                      "
                    >
                      心率
                    </h1>
                  </div>
                  <h1
                    style="font-size: 50px; margin-left: 14%; font-weight: 300"
                  >
                    79 次/分钟
                  </h1>
                </div>
                <div
                  style="
                    width: 350px;
                    background-color: white;
                    height: 300px;
                    border-radius: 10px;
                    margin: auto;
                  "
                >
                  <div style="display: flex; flex-wrap: nowrap">
                    <img
                      style="
                        margin-left: 40px;
                        margin-top: 30px;
                        width: 30px;
                        height: 35px;
                      "
                      src="src\assets\aawater.png"
                    />
                    <h1
                      style="
                        margin-left: 10px;
                        font-weight: 200;
                        color: red;
                        margin-top: 40px;
                      "
                    >
                      血压
                    </h1>
                  </div>
                  <h1
                    style="font-size: 50px; margin-left: 14%; font-weight: 300"
                  >
                    100 mmhg
                  </h1>
                </div>
              </div>
              <div style="display: flex; flex-wrap: nowrap">
                <div style="width: 400px; height: 400px; margin-top: 40px">
                  <div
                    style="
                      width: 100%;
                      background-color: white;
                      border-radius: 10px;
                      height: 180px;
                      display: flex;
                      flex-wrap: nowrap;
                    "
                  >
                    <div style="height: 100%; width: 50%">
                      <h1
                        style="
                          font-weight: 300;
                          color: #c4c4c4;
                          margin-left: 15px;
                          margin-top: 20px;
                          font-size: 20px;
                        "
                      >
                        uv
                      </h1>
                      <el-progress
                        style="
                          width: 180px;
                          margin-left: 10px;
                          margin-top: 30px;
                        "
                        :text-inside="true"
                        :stroke-width="20"
                        :percentage="80"
                        color="#ff6600"
                        status="exception"
                      >
                        <span></span>
                      </el-progress>
                      <h1
                        style="
                          font-weight: 300;
                          color: #333333;
                          margin-left: 15px;
                          font-weight: 500;
                          font-size: 30px;
                          margin-top: 20px;
                        "
                      >
                        强
                      </h1>
                    </div>
                    <div>
                      <h1
                        style="
                          font-size: 25px;
                          margin-left: 70px;
                          margin-top: 25px;
                          margin-bottom: 0px;
                        "
                      >
                        PA++
                      </h1>
                      <h2
                        style="
                          color: #bbbbbb;
                          margin-left: 85px;
                          margin-top: 10px;
                          margin-bottom: 1px;
                        "
                      >
                        SPF
                      </h2>
                      <span
                        style="
                          font-size: 45px;
                          font-weight: 800;
                          color: #ff6600;
                          margin-left: 75px;
                          margin-top: 0px;
                        "
                        >20</span
                      >
                    </div>
                  </div>

                  <div
                    style="
                      width: 100%;
                      display: flex;
                      flex-wrap: nowrap;
                      background-color: white;
                      border-radius: 10px;
                      height: 180px;
                      margin-top: 40px;
                    "
                  >
                    <div style="width: 50%; height: 100%">
                      <div
                        style="
                          font-size: 25px;
                          color: #bbbbbb;
                          margin-left: 25px;
                          margin-top: 25px;
                        "
                      >
                        PM2.5
                      </div>
                      <div
                        style="
                          font-size: 80px;
                          color: lightgreen;
                          margin-left: 17px;
                          margin-top: 5px;
                        "
                      >
                        32
                      </div>
                    </div>
                    <div>
                      <div style="margin-left: 30px; margin-top: 25px">
                        <span style="font-size: 20px">峰值</span>
                        <el-text tag="ins" style="font-size: 20px"
                          >21:00</el-text
                        >
                      </div>
                      <div style="display: flex; flex-wrap: nowrap">
                        <img
                          style="
                            width: 40px;
                            margin-top: 50px;
                            margin-left: 30px;
                          "
                          src="src\assets\平均值_average.png"
                        />
                        <div style="margin-left: 10px; margin-top: 65px">
                          <el-text
                            tag="ins"
                            style="font-size: 20px; margin-left: 15px"
                            >71</el-text
                          >
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <div
                  style="
                    background-color: white;
                    width: 60%;
                    margin-left: 80px;
                    border-radius: 20px;
                    margin-top: 40px;
                  "
                >
                  <div
                    id="container"
                    style="
                      overflow: hidden;
                      width: 100%;
                      height: 100%;
                      margin: 0;
                      border-radius: 20px;
                    "
                  ></div>
                </div>
              </div>
            </el-col>
          </el-main>
        </el-container>
      </el-container>
    </el-container>
  </div>
</template>

<style lang="scss" scoped>
.ad-text {
  font-weight: 800;
  font-size: 24px;
  width: 200px;
  height: 50px;
  overflow: hidden;
  position: relative;
  text-align: center;
}

.ad-text > span {
  position: absolute;
  width: 100%;
  animation:
    changeColor 1s infinite alternate,
    slideToLeft 5s linear infinite;
  white-space: nowrap;
  color: red; /* 初始颜色,动画会改变它 */
}

@keyframes changeColor {
  0% {
    color: red;
  }
  10% {
    color: blue;
  }
  20% {
    color: green;
  }
  30% {
    color: red;
  }
  40% {
    color: blue;
  }
  50% {
    color: green;
  }
  60% {
    color: red;
  }
  70% {
    color: blue;
  }
  80% {
    color: green;
  }
  90% {
    color: red;
  }
  100% {
    color: blue;
  }
}

@keyframes slideToLeft {
  0% {
    left: 100%;
  }
  100% {
    left: -100%;
  }
}

.demo-pagination-block + .demo-pagination-block {
  margin-top: 10px;
}
.demo-pagination-block .demonstration {
  margin-bottom: 16px;
}
.common-layout {
  height: 100vh;
  width: 100%;
  .el-header {
    background-color: #fff;
    display: flex; // 使用flex布局来放置Logo和文本
    align-items: center; // 垂直居中
    justify-content: center;
    padding: 10px; // 可以添加一些内边距

    .logo-container {
      display: flex; // Logo和文本也使用flex布局
      align-items: center; // 垂直居中

      .logo-image {
        height: 30px; // 根据你的Logo大小调整
        width: auto;
        margin-right: 10px; // Logo和文本之间的间距
      }

      .logo-text {
        font-size: 16px; // 根据需要调整文本大小
      }
    }
  }
  .el-aside {
    background-color: #fff;
    height: 100vh;
  }
}
</style>

 

标签:web,5.3,const,color,text,100%,广告位,container,控制台
From: https://www.cnblogs.com/zeyangshuaige/p/18171318

相关文章

  • 2024.5.3【比赛】高一下三调
    为了拓宽自己的英雄池,还是要写一下。分数&排名:理想:会牵挂的叫亲人,回不去的是故乡。现实:神虎一跃,威震天地!A.李时珍的皮肤衣今天输了,明天也要卷土重来。赛后加点卡赛时是不理解的。为啥这次就加点,上次数据范围错了都不把数据范围错的删了给我重测。自己手动模......
  • python web密码爆破脚本
    如下#-*-coding:utf-8-*-'''肉机爆破密码脚本由于是面向肉机的脚本,所以牺牲了一些速度,增加了准确性程序挂肉机上然后去睡觉等结果嘛从这里复制了代码:https://blog.csdn.net/tempulcc/article/details/108323499对于没pip的机器,可把模块打包成zip,上传的机器上用unz......
  • AWS S3 Lambda Python脚本函数实现图片自动转换为webp并上传至s3
    AmazonS3自动转换图片格式 AmazonS3存储桶新增文件自动触发AWSLambda。Lambda取S3文件做转换并存回去S3同一个目录下,并增加相应的后缀名。并且支持通过APIGateway的方式触发对图片进行修改并输出。本Lab使用PythonPillow做图片转换,读者可以参考Pillow文档......
  • webpack
    vue是基于es6的开发的let是局部变量什么是Webpack本质上,webpack是一个现代JavaScript应用程序的静态模块打包器(modulebundler)。当webpack处理应用程序时,它会递归地构建一个依赖关系图(dependencygraph),其中包含应用程序需要的每个模块,然后将所有这些模块打包成一个或多个b......
  • 前端 Vue webpack配置之 webpack.config.js 文件配置
     Webpack在执行的时候,除了在命令行传入参数,还可以通过指定的配置文件来执行。默认情况下,会搜索当前目录的 webpack.config.js 文件,这个文件是一个node.js模块,返回一个json格式的配置信息对象,或者通过 --config 选项来指定配置文件。.输入命令:webpack,即可按照webpack.c......
  • [web]cookie session和token(jwt)
    cookie:用户登录后,服务器生成一个cookie返回,并要求浏览器set-cookie,存储一下,下次访问时带上cookie,即可区分用户cookie可以被篡改session:信息存储在服务端,客户端cookie中存一个sessionid服务端有额外的存储成本负载均衡需要考虑session共享查询session是查库操作,耗时高......
  • Web命令执行笔记(持续更新)
    Web命令执行笔记会将web命令执行的题目放到这篇博客来记录,方便自己日后查阅。XYCTF-ezRCE(只允许数字、$、<、\)<?phphighlight_file(__FILE__);functionwaf($cmd){$white_list=['0','1','2','3','4','5','6','7'......
  • webapi创建和调用WebService
    首先需要引入soapcore包这个包提供了所需的类和soap终结点中间件。引入这个这个包之后,我们需要定义提供的服务。这里我写了一个用于查询省份面积的服务。省份信息服务///<summary>///省份信息服务接口///</summary>[ServiceContract]publicinterfaceIProvinceInfo......
  • Web Audio API
    WebAudioAPI:控制Web上的音频提供了一个功能强大的通用系统,允许开发人员选择音频源,为音频添加效果,创建音频可视化,应用空间效果(如平移)等等(oscillator)振荡器播放声音<buttontype="button"class="btn-play">play</button><script>//WebAudioAPI//创建一个Au......
  • 末路狂花钱迅雷BT下载[MP4/1.82GB/5.35GB]超级清晰[HD720p/1080p]
    电影《末路狂花钱》是一部由斯蒂文·索德伯格执导的黑色喜剧电影,于20xx年上映。这部电影讲述了一个普通女人在生活的困境中,决定通过偷窃银行来改变自己的生活轨迹的故事。这部影片将观众带入了一个离奇又荒诞的旅程,展现了金钱和欲望对一个人的影响。 影片的主角是......