examTeamApp/pages/index/index.vue

169 lines
4.6 KiB
Vue
Raw Normal View History

2024-05-02 15:59:36 +08:00
<template>
2024-05-29 16:35:45 +08:00
<view class="content indexCarList">
2024-05-02 15:59:36 +08:00
<!-- 头部 -->
2024-06-13 18:03:50 +08:00
<headerIndex :isArea="false"></headerIndex>
2024-05-02 15:59:36 +08:00
<!-- 卡片数据 -->
<view class="list">
2024-05-29 16:35:45 +08:00
<view v-for="(item,index) in user.card_data_list">
<!-- 标题 -->
2024-06-13 18:03:50 +08:00
<view class="card box" @click="handlerReport(item)">
<view class="title border-bottom">
2024-05-29 16:35:45 +08:00
<view class="name"><text>{{item.card_name}}</text>{{item.record_time}}</view>
<uni-icons type="right" size="20" v-if="item.inside_data[0].value"></uni-icons>
2024-05-02 15:59:36 +08:00
</view>
2024-05-29 16:35:45 +08:00
<!-- 内容 -->
<view class="item title"
:style="{'justifyContent':item.inside_data.length>2?'space-between':'center'}">
<view v-for="(ite,ind) in item.inside_data" :class="[item.inside_data.length>3?'item2':'']">
<view class="name">{{ite.name}}</view>
<view class="weight"><text>{{ite.value?ite.value:'-'}}</text>{{ite.unit}}</view>
<view class="standardBtn" v-if="ite.standard" :style="{'backgroundColor':ite.color}">
{{ite.standard}}
2024-05-02 15:59:36 +08:00
</view>
</view>
</view>
2024-05-29 16:35:45 +08:00
<!-- 手动记录 -->
<view class="target" @click.stop>
2024-07-22 14:13:19 +08:00
<view class="orangeBtn" v-if="item.acd_id==2"
@click="$Bluetooth.handleDevicesMac(item.device_determine,item.acd_id)">蓝牙连接</view>
<view v-else></view>
<view class="blueBtn" @click="handlerRecord(item.acd_id)">手动记录</view>
2024-05-02 15:59:36 +08:00
</view>
</view>
<!-- 小标签 -->
2024-05-29 16:35:45 +08:00
<!-- <view class=" card box small" v-if="ite.size=='small'">
<view class="title border-bottom">
<view class="name"><text>{{ite.name}}</text>{{ite.time}}</view>
<icon class="iconfont icon-arrow-right-bold size20"></icon>
2024-05-02 15:59:36 +08:00
</view>
2024-05-29 16:35:45 +08:00
<view class="item title">
<view>
<text>本次数据</text>
<view class="weight"><text>{{ite.cnt?ite.cnt:'-'}}</text>{{ite.unit}}</view>
<view class="standardBtn" :style="{'backgroundColor':ite.standardcolor}"
v-if="ite.standardtext">
{{ite.standardtext}}
</view>
</view>
</view>
<view class="target">
<view class="left">
<icon class="iconfont icon-notification"></icon>
教程
</view>
<view class="targetBtn">手动记录</view>
</view>
</view> -->
2024-05-02 15:59:36 +08:00
</view>
</view>
<!-- 设置数据卡片 -->
<view class="setcard" @click="handleCard">
设置数据页卡片
</view>
2024-05-29 16:35:45 +08:00
<!-- 手动 -->
<record :rtype="rtype"></record>
2024-05-02 15:59:36 +08:00
</view>
</template>
<script>
2024-05-29 16:35:45 +08:00
import {
mapState
} from "vuex";
import headerIndex from "@/components/headerIndex.vue"
import record from '@/components/manuallyAdd/record.vue';
2024-05-02 15:59:36 +08:00
export default {
data() {
return {
2024-07-22 14:13:19 +08:00
rtype: 0,
transition: 1.6
2024-05-02 15:59:36 +08:00
}
},
2024-05-29 16:35:45 +08:00
components: {
record,
headerIndex
},
computed: {
2024-06-13 18:03:50 +08:00
...mapState(["user", "familayList"]),
2024-05-29 16:35:45 +08:00
},
2024-06-13 18:03:50 +08:00
onLoad(options) {
2024-05-29 16:35:45 +08:00
let that = this
2024-06-13 18:03:50 +08:00
if (options && options.type == 1) {
that.handleUserList()
}
2024-05-02 15:59:36 +08:00
},
2024-07-22 14:13:19 +08:00
onShow() {
let that = this
that.$Bluetooth.stopBluetoothDevicesDiscovery()
uni.hideLoading()
},
2024-05-02 15:59:36 +08:00
methods: {
2024-07-22 14:13:19 +08:00
handlelenver(value) {
let that = this
let number = 0
let length = that.list.length
number = value / (that.list[0].max_val - that.list[length - 1].min_val) * 100
return number.toFixed(0)
},
2024-05-29 16:35:45 +08:00
// 成员列表
handleUserList() {
let that = this
that.$model.getUserList({
type: 2
}).then(res => {
2024-06-13 18:03:50 +08:00
console.log("用户列表", res, uni.getStorageSync('userid'))
2024-05-29 16:35:45 +08:00
if (res.code != 0) {
that.$tools.msg(res.msg)
return
}
that.$store.commit('changeFamilay', res.data)
if (res.data.length) {
that.$store.dispatch('getUserInfo', {
2024-06-13 18:03:50 +08:00
aud_id: uni.getStorageSync('userid') ? uni.getStorageSync('userid') : res.data[
0].id
2024-05-29 16:35:45 +08:00
})
that.$store.dispatch("getCardList", {
2024-06-13 18:03:50 +08:00
aud_id: uni.getStorageSync('userid') ? uni.getStorageSync('userid') : res.data[
0].id
2024-05-29 16:35:45 +08:00
})
}
}).catch(err => {})
2024-05-02 15:59:36 +08:00
},
2024-06-13 18:03:50 +08:00
2024-05-02 15:59:36 +08:00
// 设置数据页卡片
handleCard() {
uni.navigateTo({
url: "/pages/card/card"
})
2024-07-22 14:13:19 +08:00
// uni.navigateTo({
// url: "/pages/devices/PCT01"
// })
2024-05-02 15:59:36 +08:00
},
2024-05-29 16:35:45 +08:00
// 报告页
handlerReport(item) {
2024-07-08 10:50:07 +08:00
console.log("item", item)
2024-05-29 16:35:45 +08:00
uni.navigateTo({
2024-07-08 10:50:07 +08:00
url: item.page_url_report + "?acd_id=" + item.acd_id + '&device=' + item.device_determine
2024-05-29 16:35:45 +08:00
})
},
// 手动添加
handlerRecord(id) {
this.rtype = id
this.$store.commit('changeRecord', true)
},
2024-05-02 15:59:36 +08:00
navTo(url) {
console.log("url", url)
uni.navigateTo({
url: url
})
}
}
}
</script>
<style lang="scss" scoped>
.content {
min-height: 100vh;
2024-05-29 16:35:45 +08:00
padding-bottom: 15px;
2024-05-02 15:59:36 +08:00
background-color: #f7f7f7;
}
</style>