小程序测试

This commit is contained in:
qcl_123 2026-03-27 10:04:26 +08:00
parent 8f2e28012e
commit 89b12ff1db
182 changed files with 55194 additions and 50095 deletions

128
App.vue
View File

@ -1,4 +1,6 @@
<script>
let platform = ""
let SystemVersion = ""
export default {
data() {
return {}
@ -7,21 +9,30 @@
let that = this
// apk
// #ifdef APP-PLUS
if (uni.getSystemInfoSync().platform === 'ios') { // ios
uni.getSystemInfo({
success(e) {
platform = e.platform
that.$store.commit('changePhoneInfo', {
platform: e.platform
})
}
})
if (platform === 'ios') { // ios
uni.onNetworkStatusChange(function(res) {
if (res.isConnected == true) {
uni.reLaunch({
url: '/pageTwo/login/login'
})
that.handleoginversion()
}
});
}
plus.runtime.getProperty(plus.runtime.appid, function(info) {
uni.setStorageSync('VERSION', info.version)
SystemVersion = info.version
that.$store.commit('changePhoneInfo', {
info: info
})
})
// #endif
// #ifdef MP-WEIXIN
//
that.updataWeiXin()
// #endif
// that.handleConfigInfo()
that.handleoginversion()
console.log('App Launch')
},
onShow: function() {
@ -37,20 +48,103 @@
},
methods: {
//
handleConfigInfo() {
handleoginversion() {
let that = this
// 线
that.$model.getHomeConfig({}).then(res => {
that.$store.commit('changeConfigInfo', res.data)
that.$tools.handleCancelUpdate(res.data.login_status.code)
// #ifdef APP-PLUS
plus.runtime.getProperty(plus.runtime.appid, function(info) {
that.$tools.handleoginversion(info.version, res.data.version_msg.version) //
that.$model.getLoginVersion({}).then(res => {
that.$store.dispatch("getHomeConfig") //
if (res.code == 0) {
that.handleUserList()
} else {
uni.setStorageSync('token', null)
uni.setStorageSync('aan_id', null)
setTimeout(() => {
uni.reLaunch({
url: '/body/login/login',
})
}, 500);
}
// #ifdef APP-PLUS||APP
that.$store.commit('changePhoneInfo', {
versionUrl: res.data
})
//
let version = that.$tools.compareVersions(SystemVersion, res.data.version)
console.log("是否登录及版本号", res, res.data.version, SystemVersion, version)
if (version == -1) { // 01-1
uni.showModal({
title: '发现新版本',
content: '检查到新版本' + res.data.version + ',是否更新?',
success: (modalRes) => {
if (modalRes.confirm) { //
if (platform === 'android') { //
uni.setStorageSync('VERSION', res.data.version)
uni.navigateTo({
url: "/body/me/about"
})
} else { //ios
plus.runtime.launchApplication({
action: `itms-apps://itunes.apple.com/cn/app/id6654906497?mt=8`
})
}
} else {
that.$tools.msg("稍后可在'关于我们'内更新程序!")
}
}
});
}
// #endif
})
},
handleUserList() {
let that = this
that.$model.getUserList({
type: 2
}).then(res => {
that.isShow = true
if (res.code != 0) {
that.$tools.msg(res.msg)
return
}
that.$store.commit('changeFamilay', res.data.user_list)
if (res.data.user_list.length) {
let userid = ""
if (uni.getStorageSync('userid')) {
let found = res.data.user_list.find(e => e.id == uni.getStorageSync('userid'));
if (found !== undefined) {
userid = found.id
} else {
userid = res.data.user_list[0].id
uni.setStorageSync('userid', res.data.user_list[0].id)
}
} else {
userid = res.data.user_list[0].id
uni.setStorageSync('userid', res.data.user_list[0].id)
}
//
that.$store.dispatch('getUserInfo', {
aud_id: userid
})
//
that.$store.dispatch("getCountFoodInfo", {
aud_id: userid,
time: that.$tools.getDate("start")
})
//
that.$store.dispatch("getCardAllList", {
aud_id: userid
})
//
that.$store.dispatch("getResult", {
aud_id: userid
})
that.$store.dispatch("getPublicRecord", {
aud_id: userid
})
that.$store.commit("changehomeCard", 0);
}
}).catch(err => {})
},
//
updataWeiXin() {
let that = this

View File

@ -64,6 +64,7 @@
<image src="/static/arrow-down.png"></image>
</view>
</view>
<!-- #ifdef MP-WEIXIN -->
<view class="mic-icon" @touchstart="onVoiceTouchStart" @touchend="onVoiceTouchEnd"
@touchcancel="cancelRecording">
<uni-icons type="mic-filled" size="20" color="#fff"></uni-icons>
@ -73,6 +74,7 @@
<uni-icons type="scan" size="20" color="#fff"></uni-icons>
扫一扫
</view>
<!-- #endif -->
</view>
<!-- 搜索列表 -->
<view class="search_list" v-if="search_list.length">
@ -248,7 +250,9 @@
import {
mapState
} from "vuex";
// #ifdef MP-WEIXIN
const plugin = requirePlugin("WechatSI")
// #endif
import blueTooth from "@/components/foodIndex/bluetooth_food.vue"
import qiunDataCharts from '@/uni_modules/qiun-data-charts/components/qiun-data-charts.vue';
export default {
@ -312,6 +316,7 @@
},
mounted() {
let that = this
// #ifdef MP-WEIXIN
that.voiceManager = plugin.getRecordRecognitionManager()
that.voiceManager.onStop = function(res) {
that.search_value = res.result.replace('。', '')
@ -321,6 +326,7 @@
console.error("error msg", res.retcode)
}
that.voiceManager.stop()
// #endif
},
onReachBottom() {
let that = this
@ -468,7 +474,8 @@
let that = this
if (!that.ActiveList.length) {
that.foodInfo = that.configInfo.default_count_foot.nutrients_four
that.chartData.series[0].data = Number(that.configInfo.default_count_foot.nutrients_four[0].proportion) / 100
that.chartData.series[0].data = Number(that.configInfo.default_count_foot.nutrients_four[0]
.proportion) / 100
}
that.isShop = true
},
@ -848,7 +855,7 @@
display: flex;
padding: 0 20rpx;
flex-wrap: wrap;
margin: 95px 20rpx 90px;
margin: 110px 20rpx 90px;
width: calc(100% - 80rpx);
justify-content: space-between;
background: #fff;
@ -998,6 +1005,7 @@
font-size: 24rpx;
right: 0;
top: 5px;
z-index: 99;
}
image,

View File

@ -17,8 +17,7 @@
<image :src="item.icon"></image>
{{item.name}}
</view>
<view class="val" v-if="item.key_name=='body_level'||item.key_name=='body_type'"> - </view>
<view class="val" v-else>{{item.value?item.value:'0'}}{{item.unit}}</view>
<view class="val">{{item.value?item.value:'0'}}{{item.unit}}</view>
<view class="level">
<view class="btnf"
:style="{backgroundColor:(item.standard=='异常'?'#FFF':item.standard_color)}"
@ -157,7 +156,7 @@
box-shadow: 0px 1px 5px 2px #dfe2e1fc;
position: fixed;
top: 0;
z-index: 999;
z-index: 99999;
text {
color: #666;

View File

@ -132,9 +132,6 @@
that.$tools.msg("登录成功")
uni.setStorageSync('token', res.data.token)
uni.setStorageSync('aan_id', res.data.aan_id)
that.$store.dispatch('getFamilyList', {
type: 2
})
setTimeout(function() {
uni.reLaunch({
url: "/pages/index/index"

View File

@ -22,9 +22,6 @@
</view>
</view>
</view>
<!-- <view class="xieyi">
<a>隐私协议</a>
</view> -->
</view>
</template>
@ -36,7 +33,6 @@
export default {
data() {
return {
// 01-1
version: 0,
}
},
@ -46,10 +42,8 @@
onLoad() {
let that = this
if (!that.phoneInfo.versionUrl) {
console.log("111")
that.handleoginversion()
} else {
console.log("222")
that.version = that.$tools.compareVersions(that.phoneInfo.info.version, that.phoneInfo.versionUrl.version)
}
},
@ -97,7 +91,6 @@
});
dtask.onProgressUpdate((res) => {
showLoading.setTitle(" 正在下载" + res.progress + "% ");
// console.log('' + res.progress + '%');
});
} else {
plus.runtime.launchApplication({
@ -111,7 +104,7 @@
//
handleoginversion() {
let that = this
that.$model.getloginversion({}).then(res => {
that.$model.getLoginVersion({}).then(res => {
that.version = that.$tools.compareVersions(that.phoneInfo.info.version, res.data.version)
that.$store.commit('changePhoneInfo', {
versionUrl: res.data

View File

@ -5,7 +5,7 @@
<view class="item">
<view class="text">邮箱</view>
<view class="input">
<input v-model="phone" placeholder="请输入邮箱"/>
<input v-model="phone" placeholder="请输入邮箱" />
</view>
</view>
<view class="item ">
@ -13,7 +13,7 @@
<view class="input yanzhengma">
<input class="uni-input" v-model="code" />
<button class="code" type="none" @click="handleCode" v-model="code"
:disabled="disabled">{{second<60 ? second+'S后重发':$t("login.sendcode")}}
:disabled="disabled">{{second<60 ? second+'S后重发':'获取验证码'}}
</button>
</view>
</view>
@ -58,7 +58,7 @@
my_email: that.phone
})
uni.redirectTo({
url: "/pageTwo/setting/setting"
url: "/body/setting/setting"
})
}
}).catch(err => {})
@ -103,6 +103,7 @@
.content {
width: 100%;
height: 100vh;
background: #fff;
}
.login {

View File

@ -66,6 +66,7 @@
.content {
width: 100%;
height: 100vh;
background: #fff;
}
.login {

View File

@ -13,7 +13,7 @@
<view class="input yanzhengma">
<input class="uni-input" v-model="code" />
<button class="code" type="none" @click="handleCode" v-model="code"
:disabled="disabled">{{second<60 ? second+'S后重发':$t("login.sendcode")}}
:disabled="disabled">{{second<60 ? second+'S后重发':'获取验证码'}}
</button>
</view>
</view>
@ -37,7 +37,7 @@
//
handleTelLogin() {
let that = this
if (!phoneType && !(/^1[3456789]\d{9}$/.test(that.phone))) {
if (!(/^1[3456789]\d{9}$/.test(that.phone))) {
that.$tools.msg("请输入正确的手机号")
return
}
@ -58,7 +58,7 @@
my_tel: that.phone
})
uni.redirectTo({
url: "/pageTwo/setting/setting"
url: "/body/setting/setting"
})
}
}).catch(err => {})
@ -70,7 +70,7 @@
that.$tools.msg("请输入手机号")
return
}
if (!phoneType && !(/^1[3456789]\d{9}$/.test(that.phone))) {
if (!(/^1[3456789]\d{9}$/.test(that.phone))) {
that.$tools.msg("请输入正确的手机号")
return
}
@ -103,6 +103,7 @@
.content {
width: 100%;
height: 100vh;
background: #fff;
}
.login {

View File

@ -12,21 +12,21 @@
<uni-icons type="compose" color="#FEC407" @click="isEdit=true" class="ml-10" size="22"></uni-icons>
</view>
</view>
<view class="caritem" @click="navTo('/pageTwo/setting/phone')">
<view class="caritem" @click="navTo('/body/setting/phone')">
<view class="text">手机号</view>
<view class="text_r">
<text>{{user.my_tel}}</text>
<uni-icons type="right"></uni-icons>
</view>
</view>
<view class="caritem" @click="navTo('/pageTwo/setting/email')">
<view class="caritem" @click="navTo('/body/setting/email')">
<view class="text">邮箱</view>
<view class="text_r">
<text>{{user.my_email}}</text>
<uni-icons type="right"></uni-icons>
</view>
</view>
<view class="caritem" @click="navTo('/pageTwo/setting/password')">
<view class="caritem" @click="navTo('/body/setting/password')">
<view class="text">设置密码</view>
<uni-icons type="right"></uni-icons>
</view>
@ -69,7 +69,7 @@
uni.clearStorageSync()
setTimeout(() => {
uni.reLaunch({
url: "/pageTwo/login/login"
url: "/body/login/login"
})
}, 3000);
})

View File

@ -79,7 +79,7 @@
}
},
computed: {
...mapState(["user", "bleValue", "countFoodInfo"]),
...mapState(["user", "bleValue", "isBluetoothTyle"]),
weight() {
let weightNew = this.$ble.convertToGrams(this.bleValue.foodWeight, this.bleValue.foodUnit)
this.kcal = (Number(this.weightKcal) * weightNew).toFixed(1)
@ -95,26 +95,30 @@
bleTipsText() {
return this.bleValue.bleTipsText
},
// unitA() {
// let that = this
// that.unitListIndex = that.bleValue.unitList.findIndex(ite => ite.unit == that.bleValue.foodUnit)
// return that.bleValue.unitList
// }
},
mounted() {
let that = this
uni.onBluetoothAdapterStateChange(function(res) {
that.$store.commit("changeBluetooth", res.available);
})
},
watch: {
isBluetoothTyle: function() {
let that = this
if (!that.isBluetoothTyle) {
that.handleBack()
}
},
bleValue: {
handler(newVal, oldVal) {
let that = this
if (!newVal.isBluetoothTyle) {
that.handleBack()
}
if (newVal.serviceId) {
that.deviceId = newVal.deviceId
that.serviceId = newVal.serviceId
that.getBLEDeviceCharacteristics()
}
that.unitA = newVal.unitList
that.unitListIndex = newVal.unitList.findIndex(ite => ite.unit == newVal.foodUnit)
that.unitListIndex = newVal.unitList.findIndex(ite => ite == newVal.foodUnit)
},
deep: true,
immediate: true
@ -135,13 +139,14 @@
that.$store.commit('changeBluetoothValue', {
bleTipsText: "蓝牙搜索中",
isConnectStatus: 0,
isBleLink: false,
deviceId: "",
serviceId: "",
foodNotify: "",
foodType: 1,
foodWrite: "",
foodType: 1,
foodWeight: 0,
foodUnit: "g",
unitList: that.$json.unitMinus,
})
that.$ble.openBluetoothAdapter()
},
@ -254,7 +259,6 @@
unitList: start0.length ? start0 : that.$json
.unitMinus
})
console.log("22222222222222", start, start0)
break
}
}
@ -291,7 +295,7 @@
that.handletoggleUnit(that.$ble.unitInstruction(unit))
}
if (that.bleValue.serviceId == '') {
that.unitListIndex = [e.detail.value]
that.unitListIndex = e.detail.value
that.$store.commit('changeBluetoothValue', {
foodUnit: that.unitA[e.detail.value],
})
@ -342,7 +346,7 @@
foodType: 1
})
that.$ble.stopBluetoothDevicesDiscovery() //
that.$ble.closeBLEConnection(that.deviceId)
that.$ble.closeBLEConnection()
that.$ble.closeBluetoothAdapter()
},

View File

@ -75,7 +75,7 @@
}
},
computed: {
...mapState(["bleValue", "countFoodInfo", "user"]),
...mapState(["bleValue", "countFoodInfo", "isBluetoothTyle", ]),
weight() {
let weightNew = this.$ble.convertToGrams(this.bleValue.foodWeight, this.bleValue.foodUnit)
this.kcal = (Number(this.weightKcal) / 100 * weightNew).toFixed(1)
@ -92,20 +92,29 @@
return this.bleValue.bleTipsText
},
},
mounted() {
let that = this
uni.onBluetoothAdapterStateChange(function(res) {
that.$store.commit("changeBluetooth", res.available);
})
},
watch: {
isBluetoothTyle: function() {
let that = this
if (!that.isBluetoothTyle) {
that.handleBack()
}
},
bleValue: {
handler(newVal, oldVal) {
let that = this
if (!newVal.isBluetoothTyle) {
that.handleBack()
}
if (newVal.serviceId) {
that.deviceId = newVal.deviceId
that.serviceId = newVal.serviceId
that.getBLEDeviceCharacteristics()
}
that.unitA = newVal.unitList
that.unitListIndex = newVal.unitList.findIndex(ite => ite.unit == newVal.foodUnit)
that.unitListIndex = newVal.unitList.findIndex(ite => ite == newVal.foodUnit)
},
deep: true,
immediate: true
@ -120,13 +129,14 @@
that.$store.commit('changeBluetoothValue', {
bleTipsText: "蓝牙搜索中",
isConnectStatus: 0,
isBleLink: false,
deviceId: "",
serviceId: "",
foodNotify: "",
foodType: 1,
foodWrite: "",
foodWeight: 0
foodWeight: 0,
foodUnit: "g",
unitList: that.$json.unitMinus,
})
that.$ble.openBluetoothAdapter()
},
@ -254,12 +264,12 @@
changleUnits(e) {
let that = this
let unit = that.unitA[e.detail.value]
console.log("danwei", that.unit, unit)
console.log("danwei", that.unit, unit, e.detail.value)
if (that.isShow && that.unit != unit) {
that.handletoggleUnit(that.$ble.unitInstruction(unit))
}
if (that.bleValue.serviceId == '') {
that.unitListIndex = [e.detail.value]
that.unitListIndex = e.detail.value
that.$store.commit('changeBluetoothValue', {
foodUnit: that.unitA[e.detail.value],
})
@ -340,7 +350,7 @@
let that = this
that.$store.commit("changeBluetoothValue", {
foodWeight: value,
foodUnit: that.$json.unitMinus[that.unitListIndex]
foodUnit: that.unitA[that.unitListIndex]
})
that.$refs.popup.close()
},
@ -458,6 +468,7 @@
.textTipe {
color: #8284f0;
display: flex;
align-items: center;
}
image {

View File

@ -1,35 +1,35 @@
{
"name": "Reedaw",
"appid": "__UNI__20604F1",
"description": "面向儿童青少年的健康体质测量APP",
"versionName": "1.3.4",
"versionCode": 134,
"transformPx": false,
"sassImplementationName": "node-sass",
"name" : "Reedaw",
"appid" : "__UNI__20604F1",
"description" : "面向儿童青少年的健康体质测量APP",
"versionName" : "1.3.4",
"versionCode" : 134,
"transformPx" : false,
"sassImplementationName" : "node-sass",
/* 5+App */
"app-plus": {
"usingComponents": true,
"nvueStyleCompiler": "uni-app",
"compilerVersion": 3,
"splashscreen": {
"alwaysShowBeforeRender": true,
"waiting": true,
"autoclose": true,
"delay": 0
"app-plus" : {
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
},
"template": "index.html",
"template" : "index.html",
/* */
"modules": {
"Bluetooth": {}
"modules" : {
"Bluetooth" : {}
},
"compattible": {
"ignoreVersion": true // true
"compattible" : {
"ignoreVersion" : true // true
},
/* */
"distribute": {
"distribute" : {
/* android */
"android": {
"permissions": [
"android" : {
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
@ -46,127 +46,129 @@
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
],
"abiFilters": ["arm64-v8a", "x86"]
"abiFilters" : [ "arm64-v8a", "x86" ]
},
/* ios */
"ios": {
"dSYMs": false,
"idfa": false,
"privacyDescription": {
"NSBluetoothAlwaysUsageDescription": "需要蓝牙权限来连接设备",
"NSBluetoothPeripheralUsageDescription": "使用蓝牙与外设通信"
"ios" : {
"dSYMs" : false,
"idfa" : false,
"privacyDescription" : {
"NSBluetoothAlwaysUsageDescription" : "需要蓝牙权限来连接设备",
"NSBluetoothPeripheralUsageDescription" : "使用蓝牙与外设通信"
}
},
/* SDK */
"sdkConfigs": {
"share": {},
"ad": {},
"geolocation": {
"system": {
"__platform__": ["ios"]
"sdkConfigs" : {
"share" : {},
"ad" : {},
"geolocation" : {
"system" : {
"__platform__" : [ "ios" ]
}
}
},
"icons": {
"android": {
"hdpi": "unpackage/res/icons/72x72.png",
"xhdpi": "unpackage/res/icons/96x96.png",
"xxhdpi": "unpackage/res/icons/144x144.png",
"xxxhdpi": "unpackage/res/icons/192x192.png"
"icons" : {
"android" : {
"hdpi" : "unpackage/res/icons/72x72.png",
"xhdpi" : "unpackage/res/icons/96x96.png",
"xxhdpi" : "unpackage/res/icons/144x144.png",
"xxxhdpi" : "unpackage/res/icons/192x192.png"
},
"ios": {
"appstore": "unpackage/res/icons/1024x1024.png",
"ipad": {
"app": "unpackage/res/icons/76x76.png",
"app@2x": "unpackage/res/icons/152x152.png",
"notification": "unpackage/res/icons/20x20.png",
"notification@2x": "unpackage/res/icons/40x40.png",
"proapp@2x": "unpackage/res/icons/167x167.png",
"settings": "unpackage/res/icons/29x29.png",
"settings@2x": "unpackage/res/icons/58x58.png",
"spotlight": "unpackage/res/icons/40x40.png",
"spotlight@2x": "unpackage/res/icons/80x80.png"
"ios" : {
"appstore" : "unpackage/res/icons/1024x1024.png",
"ipad" : {
"app" : "unpackage/res/icons/76x76.png",
"app@2x" : "unpackage/res/icons/152x152.png",
"notification" : "unpackage/res/icons/20x20.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"proapp@2x" : "unpackage/res/icons/167x167.png",
"settings" : "unpackage/res/icons/29x29.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"spotlight" : "unpackage/res/icons/40x40.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png"
},
"iphone": {
"app@2x": "unpackage/res/icons/120x120.png",
"app@3x": "unpackage/res/icons/180x180.png",
"notification@2x": "unpackage/res/icons/40x40.png",
"notification@3x": "unpackage/res/icons/60x60.png",
"settings@2x": "unpackage/res/icons/58x58.png",
"settings@3x": "unpackage/res/icons/87x87.png",
"spotlight@2x": "unpackage/res/icons/80x80.png",
"spotlight@3x": "unpackage/res/icons/120x120.png"
"iphone" : {
"app@2x" : "unpackage/res/icons/120x120.png",
"app@3x" : "unpackage/res/icons/180x180.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"notification@3x" : "unpackage/res/icons/60x60.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"settings@3x" : "unpackage/res/icons/87x87.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png",
"spotlight@3x" : "unpackage/res/icons/120x120.png"
}
}
},
"splashscreen": {
"androidStyle": "common",
"android": {
"hdpi": "static/logo.png",
"xhdpi": "static/logo.png",
"xxhdpi": "static/logo.png"
"splashscreen" : {
"androidStyle" : "common",
"android" : {
"hdpi" : "static/logo.png",
"xhdpi" : "static/logo.png",
"xxhdpi" : "static/logo.png"
},
"useOriginalMsgbox": true
"useOriginalMsgbox" : true
}
}
},
"permissions": {
"Android": [{
"name": "android.permission.READ_EXTERNAL_STORAGE",
"desc": "读取外部存储"
"permissions" : {
"Android" : [
{
"name" : "android.permission.READ_EXTERNAL_STORAGE",
"desc" : "读取外部存储"
},
{
"name": "android.permission.WRITE_EXTERNAL_STORAGE",
"desc": "写入外部存储"
"name" : "android.permission.WRITE_EXTERNAL_STORAGE",
"desc" : "写入外部存储"
}
]
},
/* */
"quickapp": {},
"quickapp" : {},
/* */
"mp-weixin": {
"appid": "wx1f32af4f93c913f6",
"setting": {
"urlCheck": false,
"postcss": true,
"mp-weixin" : {
"appid" : "wx9c0b7a436ada6d1e",
"setting" : {
"urlCheck" : false,
"postcss" : true,
"es6" : true,
"minified": true
"minified" : true
},
"usingComponents": true,
"usingComponents" : true,
//
"optimization": {
"Package8s": true
"optimization" : {
"Package8s" : true
},
"plugins": {
"sdkPlugin": {
"plugins" : {
"sdkPlugin" : {
// 线
"version": "2.4.0", //
"provider": "wx17e93aad47cdae1a" //appid
"version" : "2.4.0", //
"provider" : "wx17e93aad47cdae1a" //appid
},
"WechatSI": {
"version": "0.3.6",
"provider": "wx069ba97219f66d99"
"WechatSI" : {
"version" : "0.3.6",
"provider" : "wx069ba97219f66d99"
}
}
},
"mp-alipay": {
"usingComponents": true
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu": {
"usingComponents": true
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao": {
"usingComponents": true
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics": {
"enable": false,
"version": "2"
"uniStatistics" : {
"enable" : false,
"version" : "2"
},
"vueVersion": "2",
"locale": "zh-Hans",
"h5": {
"template": "index.html"
"vueVersion" : "2",
"locale" : "zh-Hans",
"h5" : {
"template" : "index.html"
},
"fallbackLocale": "zh-Hans"
"fallbackLocale" : "zh-Hans"
}
/* SDK */

View File

@ -61,10 +61,11 @@
isFinished: false, //
IsLing: false, //
IsNum: false, //
Unload: false,
}
},
computed: {
...mapState(["user", "bleValue"]),
...mapState(["user", "bleValue", "isBluetoothTyle", ]),
userInfo() {
return this.user
},
@ -78,8 +79,6 @@
that.height = that.userInfo.height
that.head = that.userInfo.head_data
that.deviceId = options.deviceId
that.$ble.createBLEConnection("FFF0")
that.$ble.onBLEConnectionStateChange()
},
onUnload: function() {
let that = this
@ -88,17 +87,15 @@
console.log("返回首页onUnload")
},
watch: {
isBluetoothTyle: function() {
let that = this
if (!that.isBluetoothTyle) {
that.$tools.showModal('蓝牙连接已断开,请重新连接后测量')
}
},
bleValue: {
handler(newVal, oldVal) {
let that = this
if (!newVal.isBluetoothTyle) {
that.$tools.showModal('蓝牙连接已断开,请重新连接后测量')
setTimeout(function() {
uni.switchTab({
url: "/pages/index/index"
})
}, 1000)
}
if (newVal.serviceId) {
that.deviceId = newVal.deviceId
that.serviceId = newVal.serviceId
@ -290,6 +287,7 @@
return
}
that.$model.getmeasurefunit({
adc: 0,
weight: that.weight + that.unit,
height: that.height,
aud_id: that.userInfo.aud_id,
@ -308,11 +306,12 @@
} else {
that.$tools.msg("测量失败")
}
setTimeout(function(){
setTimeout(function() {
uni.switchTab({
url: "/pages/index/index"
})
},500)
}, 500)
})
},
//
@ -365,8 +364,8 @@
}
.quan2 {
width: 460rpx;
height: 460rpx;
width: 480rpx;
height: 480rpx;
border: 8px solid #feaa50;
border-radius: 50%;
margin: 15px auto;
@ -378,7 +377,7 @@
animation: pulse 1s infinite;
.weight {
font-size: 50px;
font-size: 42px;
color: #000;
font-weight: bold;
}

View File

@ -47,14 +47,14 @@
write: "",
notify: "",
unit: "cm",
Unload: false,
isHeight: false,
isConnection: 0,
isdevice: false,
Unload: false,
}
},
computed: {
...mapState(["user", "bleValue"]),
...mapState(["user", "bleValue", "isBluetoothTyle"]),
userInfo() {
return this.user
},
@ -66,27 +66,23 @@
let that = this
that.weight = that.userInfo.weight
that.deviceId = options.deviceId
that.$ble.createBLEConnection("FFF0")
that.$ble.onBLEConnectionStateChange()
},
onUnload: function() {
let that = this
that.$ble.closeBLEConnection()
that.$ble.closeBluetoothAdapter()
console.log("返回首页onUnload")
console.log("页面返回onUnload")
},
watch: {
isBluetoothTyle: function() {
let that = this
if (!that.isBluetoothTyle) {
that.$tools.showModal('蓝牙连接已断开,请重新连接后测量')
}
},
bleValue: {
handler(newVal, oldVal) {
let that = this
if (!newVal.isBluetoothTyle) {
that.$tools.showModal('蓝牙连接已断开,请重新连接后测量')
setTimeout(function() {
uni.switchTab({
url: "/pages/index/index"
})
}, 1000)
}
if (newVal.serviceId) {
that.deviceId = newVal.deviceId
that.serviceId = newVal.serviceId
@ -224,11 +220,11 @@
} else {
that.$tools.msg("测量失败")
}
setTimeout(function(){
setTimeout(function() {
uni.switchTab({
url: "/pages/index/index"
})
},500)
}, 500)
})
},
handleHeight() {

View File

@ -49,7 +49,7 @@
}
},
computed: {
...mapState(["user", "bleValue"]),
...mapState(["user", "bleValue", "isBluetoothTyle"]),
info() {
return this.user
},
@ -62,11 +62,22 @@
that.height = that.user.height
that.onBluetoothDeviceFound()
},
onUnload: function() {
let that = this
that.$ble.closeBluetoothAdapter()
that.$store.commit("changehomeCard", 0);
that.$ble.stopBluetoothDevicesDiscovery() //
},
watch: {
isBluetoothTyle: function() {
let that = this
if (!that.isBluetoothTyle) {
that.$tools.showModal('蓝牙连接已断开,请重新连接后测量')
}
},
stopblue: function() {
let that = this
if (!that.stopblue) {
clearTimeout(myTime);
that.isHeight = true
}
}
@ -134,7 +145,6 @@
aud_id: that.user.aud_id,
}).then(res => {
that.isHeight = false
console.log("res", res, that.imp)
if (res.code == 0) {
that.$store.dispatch('getUserInfo', {
aud_id: that.user.aud_id
@ -147,9 +157,7 @@
that.$tools.msg("测量失败")
}
setTimeout(function() {
uni.switchTab({
url: "/pages/index/index"
})
that.handleBack()
}, 200)
})
},
@ -157,14 +165,6 @@
handleBack() {
let that = this
that.text = ""
that.$store.commit("changeBluetoothValue", {
bleTipsText: "连接超时,点击重新连接",
isConnectStatus: 1,
isBleLink: false,
deviceId: "",
serviceId: "",
});
that.$ble.stopBluetoothDevicesDiscovery() //
uni.switchTab({
url: "/pages/index/index"
})

View File

@ -63,6 +63,12 @@
that.height = that.user.height
that.onBluetoothDeviceFound()
},
onUnload: function() {
let that = this
that.$ble.closeBluetoothAdapter()
that.$store.commit("changehomeCard", 0);
that.$ble.stopBluetoothDevicesDiscovery() //
},
watch: {
stopblue: function() {
let that = this
@ -156,9 +162,7 @@
that.$tools.msg("测量失败")
}
setTimeout(function() {
uni.switchTab({
url: "/pages/index/index"
})
that.handleBack()
}, 200)
})
},
@ -166,14 +170,6 @@
handleBack() {
let that = this
that.text = ""
that.$store.commit("changeBluetoothValue", {
bleTipsText: "连接超时,点击重新连接",
isConnectStatus: 1,
isBleLink: false,
deviceId: "",
serviceId: "",
});
that.$ble.stopBluetoothDevicesDiscovery() //
uni.switchTab({
url: "/pages/index/index"
})

View File

@ -64,6 +64,13 @@
that.height = that.user.height
that.onBluetoothDeviceFound()
},
onUnload: function() {
let that = this
that.$ble.closeBLEConnection()
that.$ble.closeBluetoothAdapter()
that.$store.commit("changehomeCard", 0);
that.$ble.stopBluetoothDevicesDiscovery() //
},
watch: {
stopblue: function() {
let that = this
@ -138,9 +145,7 @@
that.$tools.msg("测量失败")
}
setTimeout(function() {
uni.switchTab({
url: "/pages/index/index"
})
that.handleBack()
}, 200)
})
},
@ -148,14 +153,6 @@
handleBack() {
let that = this
that.text = ""
that.$store.commit("changeBluetoothValue", {
bleTipsText: "连接超时,点击重新连接",
isConnectStatus: 1,
isBleLink: false,
deviceId: "",
serviceId: "",
});
that.$ble.stopBluetoothDevicesDiscovery() //
uni.switchTab({
url: "/pages/index/index"
})

View File

@ -87,7 +87,10 @@
}
},
computed: {
...mapState(["bleValue","user"]),
...mapState(["bleValue", "user", "isBluetoothTyle"]),
},
onHide() {
console.log("PCT01返回onHide", innerAudioContext)
},
onLoad(options) {
let that = this
@ -104,20 +107,17 @@
}, 1200)
}
that.handleAudioStart()
that.$ble.onBLEConnectionStateChange()
},
onUnload: function() {
let that = this
if (innerAudioContext) {
innerAudioContext.destroy(); //
}
innerAudioContext.destroy();
that.handleEnd()
console.log("PCT01返回onUnload")
console.log("PCT01返回onUnload", innerAudioContext)
},
watch: {
"bleValue.isBluetoothTyle": function() {
isBluetoothTyle: function() {
let that = this
if (!bleValue.isBluetoothTyle) {
if (!that.isBluetoothTyle) {
uni.showModal({
title: '连接已断开',
content: '训练过程中已与设备连接中断,请重新连接设备再开始训练',
@ -128,7 +128,7 @@
}
}
})
console.log("蓝牙是否连接", that.isConnected)
console.log("蓝牙是否连接", that.isBluetoothTyle)
}
},
@ -390,7 +390,8 @@
that.time_m = Math.floor((that.time % 3600) / 60)
that.time_s = that.time % 60
}
console.log("111111保存", that.weight, that.Ycount, that.time_m, that.time_s)
console.log("111111保存", that.user.aud_id, Math.floor(that.kcal), that.weight, Number(that.time_m), that
.time_s, that.info.active)
that.$model.getSkipResult({
aud_id: that.user.aud_id,
kcal: Math.floor(that.kcal),

View File

@ -2,9 +2,9 @@
<view class="weightPages">
<view class="content ">
<view class="status">{{bleTipsText}}</view>
<view class="quan">
<view class="quan2">
<view>
<text class="weight">{{weight?weight:'0.00'}}</text>{{unit}}
<text class="weight">{{weightPage?weightPage:'0.00'}}</text>
</view>
<view class="typeInfo" v-if="typeInfo!=0">{{typeInfo==2?'稳定重量':'实时重量'}}</view>
</view>
@ -14,21 +14,6 @@
<text>2.请确定手机蓝牙位置信息已打开</text>
</view>
</view>
<!-- 手动记录 -->
<view class="wrapper" v-if="isHeight">
<view class="bg"></view>
<view class="Blue">
<view class="h4">测量结果提示</view>
<view class="Blue-box">
本次测量身高为<text>{{height}}{{unit}}</text>
</view>
<view class="Blue-box">
上次测量体重为<input v-model="weight" type="digit" placeholder="请输入体重" />kg
</view>
<view class="Blue-btn Blue-close" @click="handleHeight">重新测量</view>
<view class="Blue-btn" @click="handleGetMeasure">保存测量结果</view>
</view>
</view>
</view>
</template>
@ -39,26 +24,26 @@
export default {
data() {
return {
text: "",
typeInfo: 0,
head: "",
weightPage: "",
weight: "",
height: "",
unit: "kg",
isHeight: false,
isSave: true, //
deviceId: "",
serviceId: "",
write: "",
notify: "",
isFinished: false, //
devicesList: [],
IsLing: false, //
IsNum: false, //
imp: 0,
leftHandImp: 0,
rightHandImp: 0,
leftFootImp: 0,
rightFootImp: 0,
text: "",
stopblue: true
}
},
computed: {
...mapState(["user", "bleValue"]),
...mapState(["user", "bleValue", "isBluetoothTyle"]),
userInfo() {
return this.user
},
@ -70,41 +55,57 @@
let that = this
that.typeInfo = 0
that.height = that.userInfo.height
that.head = that.userInfo.head_data
that.deviceId = options.deviceId
that.$ble.createBLEConnection("FFF0")
that.$ble.onBLEConnectionStateChange()
},
onUnload: function() {
let that = this
that.$ble.closeBLEConnection()
that.$ble.closeBluetoothAdapter()
console.log("onUnload")
},
watch: {
'bleValue.isBluetoothTyle'() {
isBluetoothTyle() {
let that = this
if (!that.bleValue.isBluetoothTyle) {
if (!that.isBluetoothTyle) {
that.$tools.showModal('蓝牙连接已断开,请重新连接后测量')
setTimeout(function() {
}
},
bleValue: {
handler(newVal, oldVal) {
let that = this
if (newVal.serviceId) {
that.deviceId = newVal.deviceId
that.serviceId = newVal.serviceId
that.getBLEDeviceCharacteristics(newVal.serviceId)
}
},
deep: true,
immediate: true
},
stopblue: function() {
let that = this
if (!that.stopblue) {
if (that.imp == 0 || that.leftHandImp == 0 || that.rightHandImp ==
0 || that.leftFootImp == 0 || that.rightFootImp == 0) {
uni.showModal({
title: '提示',
content: "体脂测量失败,是否保存本次测量结果?",
cancelText: "放弃",
confirmText: "保存",
success(res) {
if (res.confirm) {
that.imp = 0
that.handleGetMeasure()
} else {
uni.switchTab({
url: "/pages/index/index"
})
}, 1000)
}
},
'bleValue.serviceId'() {
let that = this
if (that.bleValue.serviceId) {
that.serviceId = that.bleValue.serviceId
that.getBLEDeviceCharacteristics(that.bleValue.serviceId)
}
},
isFinished: function() {
let that = this
console.log("是否开启弹框", that.weight, that.isFinished, that.typeInfo)
if (!that.isFinished) {
that.isHeight = false
return
})
} else {
that.handleGetMeasure()
}
if (that.isFinished && that.typeInfo == 2) {
setTimeout(function() {
that.isHeight = true
}, 1500)
}
}
},
@ -118,14 +119,13 @@
deviceId: that.deviceId,
serviceId: serviceId,
success: res => {
// * read: true, //,write: true, //,notify: true
for (let i = 0; i < res.characteristics.length; i++) {
let item = res.characteristics[i];
if (item.uuid.indexOf('0000FFF1') != -1) {
if (item.uuid.indexOf('0000FFE2') != -1) {
that.notify = item.uuid
} else if (item.uuid.indexOf('0000FFF2') != -1) {
} else if (item.uuid.indexOf('0000FFE3') != -1) {
that.write = item.uuid
that.writeBLECharacteristicValue("A6020500076A") //
that.writeBLECharacteristicValue("a603420100466a")
}
}
that.$store.commit("changeBluetoothValue", {
@ -145,110 +145,97 @@
characteristicId: that.write,
state: true,
})
that.isFinished = false
setTimeout(function() {
that.notifyBLECharacteristicValue(serviceId)
}, 800)
},
fail: res => {
console.log('获取特征值失败:', JSON.stringify(res))
}
})
},
/**
* 开启订阅特征值
* read: true, //,write: true, //,notify: true, //广
*/
notifyBLECharacteristicValue(serviceId) {
let that = this;
uni.notifyBLECharacteristicValueChange({
state: true, // notify
deviceId: that.deviceId,
serviceId: serviceId,
characteristicId: that.notify,
success(res) {
that.isSave = true
uni.onBLECharacteristicValueChange(function(res) {
let value = that.$tools.ab2hex(res.value, "");
let type = value.substring(4, 6) //
let typeInfo = value.substring(6, 8) //
let weight = parseInt(value.substring(8, 14), 16) //
let digit = value.substring(18, 19) //
let unit = value.substring(19, 20) //
let weight1 = ""
let weight2 = ""
//
if (digit == "0") {
weight = weight
}
uni.onBLECharacteristicValueChange((characteristic) => {
let payload = that.$tools.ab2hex(characteristic.value, '')
let type = payload.substring(8, 10) //
let weight = parseInt(payload.substring(12, 18), 16) //
let digit = payload.substring(18, 19) //
let unit = payload.substring(19, 20) //
let typeInfo = payload.substring(10, 12) //
console.log("开始测量", payload)
if (type == "01") { //
if (digit == "1") {
weight = weight / 10
}
if (digit == '2') {
if (digit == "2") {
weight = weight / 100
}
if (digit == "3") {
weight = weight / 1000
}
//
if (unit == "0") {
that.unit = "kg"
}
if (unit == "1") {
that.unit = "斤"
}
if (unit == "2") {
console.log("st:lb", weight)
weight1 = Math.floor(weight / 14)
weight2 = weight - weight1 * 14
weight = weight1 + ":" + weight2.toFixed(2)
that.unit = "st:lb"
}
if (unit == "3") {
if (unit == "6") {
that.unit = "lb"
}
if (unit == "4") {
that.unit = "g"
let y = weight - Math.trunc(weight / 14) * 14
let y0 = y >= 10 ? Math.trunc(y) : y.toFixed(1)
let data0 = Math.trunc(weight / 14) + ':' + y0
that.weightPage = data0 + "st:lb"
that.weight = weight + "lb"
that.unit = "lb"
} else {
that.weightPage = weight + that.unit
that.weight = weight + that.unit
}
//
if (typeInfo == "01") {
that.typeInfo = 1
that.weight = weight
that.IsLing = false
that.isHeight = false
that.isFinished = false
that.typeInfo = typeInfo
}
//
if (typeInfo == "02" && !that.isFinished) {
that.typeInfo = 2
that.weight = weight
if (weight > 0 || toString(weight) != '0:0.00') {
that.isFinished = true
if (type == "02") { //
if (typeInfo == "02") {
that.imp = 0
that.leftHandImp = 0
that.rightHandImp = 0
that.leftFootImp = 0
that.rightFootImp = 0
}
if (typeInfo == "03") {
let mcu = payload.substring(12, 14)
let Imp = parseInt(payload.substring(14, 22), 16)
console.log("阻抗类型:", mcu)
if (mcu == "02") {
that.leftHandImp = Imp
console.log("左手阻抗", that.leftHandImp)
}
if (mcu == "03") {
that.rightHandImp = Imp
console.log("右手阻抗", that.rightHandImp)
}
if (mcu == "04") {
that.leftFootImp = Imp
console.log("左脚阻抗", that.leftFootImp)
}
if (mcu == "05") {
that.rightFootImp = Imp
console.log("右脚阻抗", that.rightFootImp)
}
if (mcu == "07") {
that.imp = Imp
console.log("躯干阻抗", that.imp, that.weight)
}
}
console.log("状态:", value, type, typeInfo, weight, that.unit, that.isFinished)
});
}
if (type == "0f" || type == "ff") { //
that.stopblue = false
}
})
},
fail(res) {
console.log("测量失败", res.value);
fail: res => {
console.log('获取特征值失败:', JSON.stringify(res))
}
});
},
//
handleIsLing() {
let that = this
if (!that.IsLing) {
that.writeBLECharacteristicValue("A6020500076A")
that.IsLing = true
}
},
//
handleIsNum() {
let that = this
that.writeBLECharacteristicValue("A6020400066A")
})
},
writeBLECharacteristicValue(str) {
var that = this;
let buf = new Uint8Array(str.match(/[\da-f]{2}/gi).map(function(h) {
@ -276,15 +263,14 @@
return
}
that.$model.getmeasurefunit({
weight: that.weight + that.unit,
weight: that.weight,
height: that.height,
adc: that.imp,
aud_id: that.userInfo.aud_id,
head_data: that.head ? that.head : 0,
lefthand: 0,
righthand: 0,
leftfoot: 0,
rightfoot: 0,
heart_rate: 0,
lefthand: that.leftHandImp,
righthand: that.rightHandImp,
leftfoot: that.leftFootImp,
rightfoot: that.rightFootImp,
}).then(res => {
that.isHeight = false
that.isSave = false
@ -299,34 +285,11 @@
} else {
that.$tools.msg("测量失败")
}
setTimeout(function() {
uni.switchTab({
url: "/pages/index/index"
})
})
},
//
handleBack() {
let that = this
let str = "A6020500076A"
let buf = new Uint8Array(str.match(/[\da-f]{2}/gi).map(function(h) {
return parseInt(h, 16)
}))
uni.writeBLECharacteristicValue({
deviceId: that.deviceId,
serviceId: that.serviceId,
characteristicId: that.write,
value: buf.buffer,
success: res => {
console.log('下发指令成功', res.errMsg)
uni.showToast({
title: '数据重置中',
icon: "none"
})
console.log("重置", that.typeInfo, that.weight)
},
fail: res => {
console.log("下发指令失败", res);
},
}, 500)
})
},
},
@ -353,9 +316,9 @@
background: linear-gradient(-90deg, #feaa50, #e96b13 80%) !important;
}
.quan {
width: 460rpx;
height: 460rpx;
.quan2 {
width: 480rpx;
height: 480rpx;
border: 8px solid #feaa50;
border-radius: 50%;
margin: 15px auto;
@ -367,7 +330,7 @@
animation: pulse 1s infinite;
.weight {
font-size: 50px;
font-size: 42px;
color: #000;
font-weight: bold;
}

View File

@ -20,7 +20,7 @@
<view>{{item.v1}}<text>{{item.v1_name}}</text></view>
<view v-if="item.v2">{{item.v2}}<text>{{item.v2_name}}</text></view>
<view v-if="item.v3">{{item.v3}}<text>{{item.v3_name}}</text></view>
<uni-icons type="right" v-if="acd_id!=6"></uni-icons>
<uni-icons type="right" v-if="item.is_have_details == 'yes'"></uni-icons>
</view>
</uni-swipe-action-item>
</uni-swipe-action>
@ -187,7 +187,7 @@
.history {
width: calc(100% - 30px);
height: auto;
margin: 50px 15px 0;
margin: 60px 15px 0;
padding-bottom: 40px;
.list {
@ -226,12 +226,13 @@
.time {
width: 100%;
font-size: 28rpx;
font-size: 30rpx;
color: #666;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
margin-bottom: 10px;
icon {
width: 40rpx;

View File

@ -41,7 +41,7 @@
</picker>
</view>
</view>
<view :class="[isConnection?'start':'start Nstart']" @click="handleStart(2)">开始</view>
<view :class="[islink==2?'start':'start Nstart']" @click="handleStart(2)">开始</view>
</view>
<!--定数训练 -->
<view class="box1 box" v-if="active==3">
@ -54,7 +54,7 @@
</view>
<text class="tips" @click="disabled=true">调整目标</text>
</view>
<view :class="[isConnection?'start':'start Nstart']" @click="handleStart(3)">开始</view>
<view :class="[islink==2?'start':'start Nstart']" @click="handleStart(3)">开始</view>
</view>
<!-- -->
</view>
@ -83,7 +83,7 @@
}
},
computed: {
...mapState(['user', "MeasureSkip", "bleValue"]),
...mapState(['user', "MeasureSkip", "bleValue", "isBluetoothTyle"]),
info() {
return this.MeasureSkip
},
@ -91,7 +91,7 @@
return this.bleValue.bleTipsText
},
isConnection() {
return this.bleValue.isBluetoothTyle
return this.isBluetoothTyle
},
islink() {
return this.bleValue.isConnectStatus
@ -109,7 +109,6 @@
that.$store.dispatch("getSkipResult", {
aud_id: that.user.aud_id
})
that.$ble.onBLEConnectionStateChange()
},
onPullDownRefresh() {
setTimeout(() => {
@ -133,19 +132,31 @@
aud_id: that.user.aud_id
})
}
that.$ble.onBLEConnectionStateChange()
console.log('监听到事件来自 updateData', data);
})
},
onUnload: function() {
let that = this
clearTimeout(myTime);
that.$ble.closeBLEConnection()
that.$ble.closeBluetoothAdapter()
uni.$off("updateData")
setTimeout(() => {
uni.switchTab({
url: '/pages/index/index'
})
}, 300)
console.log("返回首页onUnload")
},
watch: {
isBluetoothTyle() {
let that = this
if (!that.isBluetoothTyle) {
that.$store.commit("changeBluetoothValue", {
bleTipsText: "连接失败,点击重新连接",
isConnectStatus: 1,
})
}
},
bleValue: {
handler(newVal, oldVal) {
let that = this
@ -154,12 +165,6 @@
that.serviceId = newVal.serviceId
that.getBLEDeviceCharacteristics()
}
if (!newVal.isBluetoothTyle) {
that.$store.commit("changeBluetoothValue", {
bleTipsText: "连接失败,点击重新连接",
isConnectStatus: 1,
})
}
},
deep: true,
immediate: true
@ -173,7 +178,6 @@
that.$store.commit('changeBluetoothValue', {
bleTipsText: "蓝牙搜索中",
isConnectStatus: 0,
isBleLink: false,
deviceId: "",
serviceId: "",
})
@ -261,7 +265,8 @@
setTimeout(function() {
uni.$off("updateData")
uni.navigateTo({
url: "/pageTwo/devices/PCT01?info=" + JSON.stringify(info)
url: "/pageTwo/devices/PCT01?info=" + JSON
.stringify(info)
})
}, 200)
}
@ -295,7 +300,7 @@
let that = this
let m = null
let send = null
if (!that.bleValue.isBluetoothTyle) {
if (that.islink != 2) {
that.$tools.msg("请先连接设备!")
return
}

View File

@ -13,7 +13,7 @@
</view>
<view class="t-icon t-icon-qiehuan1" @click="$store.commit('changeDrawe', true)"></view>
</view>
<view class="top" v-else @click="handleAddUser(2)">
<view class="top top2" v-else @click="handleAddUser(2)">
<view class="info">
暂无成员请先添加~
</view>
@ -42,7 +42,7 @@
<view :class="{'active':toolsIndex==2}" class="toolsItem" @click="handleToolsIndex(2)">健康工具</view>
</view>
<view v-if="token">
<body v-if="toolsIndex==0"></body>
<bodypage v-if="toolsIndex==0"></bodypage>
<food v-if="toolsIndex==1"></food>
<card v-if="toolsIndex==2"></card>
</view>
@ -59,7 +59,7 @@
import {
mapState
} from "vuex";
import body from "@/components/bodyIndex/bodyHome.vue"
import bodypage from "@/components/bodyIndex/bodyHome.vue"
import food from "@/components/foodIndex/foodHome.vue"
import card from "@/components/cardIndex/cardHome.vue"
import drawer from "@/components/bodyIndex/drawer.vue"
@ -72,12 +72,12 @@
},
components: {
food,
body,
bodypage,
card,
drawer,
},
computed: {
...mapState(["user", "familayList", 'MeasureResult', "configInfo", "bleValue", "homeCardIndex"]),
...mapState(["user", "familayList", 'isBluetoothTyle', "configInfo", "bleValue", "homeCardIndex"]),
info() {
return this.user
},
@ -93,20 +93,19 @@
bleTipsText() {
return this.bleValue.bleTipsText
},
toolsIndex(){
toolsIndex() {
return this.homeCardIndex
}
},
onLoad() {
let that = this
that.token = uni.getStorageSync("token")
that.$store.dispatch("getHomeConfig")
that.handleUserList()
if (that.token && that.bleValue.isConnectStatus != 2) {
that.$ble.openBluetoothAdapter()
}
that.$ble.onBLEConnectionStateChange()
uni.onBluetoothAdapterStateChange(function(res) {
that.$store.commit("changeBluetoothValue", {
isBluetoothTyle: res.available
});
that.$store.commit("changeBluetooth", res.available);
})
},
onPullDownRefresh() {
@ -116,10 +115,14 @@
uni.stopPullDownRefresh()
},
watch: {
'bleValue.isBluetoothTyle'() {
isBluetoothTyle() {
let that = this
if (!that.bleValue.isBluetoothTyle) {
that.handleBack()
if (!that.isBluetoothTyle) {
that.$store.commit("changeBluetoothValue", {
bleTipsText: "重新连接",
isConnectStatus: 1,
})
that.$ble.stopBluetoothDevicesDiscovery() //
}
},
'bleValue.isFood'() {
@ -218,16 +221,6 @@
})
that.$ble.openBluetoothAdapter()
},
handleBack() {
let that = this
that.$store.commit("changeBluetoothValue", {
bleTipsText: "连接失败,点击重新连接",
isConnectStatus: 1,
})
that.$ble.stopBluetoothDevicesDiscovery() //
that.$ble.closeBLEConnection(that.bleValue.deviceId)
that.$ble.closeBluetoothAdapter()
},
//
handleAddUser(ind) {
@ -259,7 +252,7 @@
.header {
width: 100%;
height: 240rpx;
padding: 15px 0;
background: $maincolor;
.top {
@ -268,12 +261,13 @@
}
.top2 {
color: #fff;
font-size: 16px;
font-weight: bold;
width: 100%;
display: flex;
align-items: center;
background: #fff;
margin: 0 15px;
padding:10px 15px;
border-radius: 10px;
justify-content: center;
padding-top: 15px;
}
.headimg {

View File

@ -1,14 +1,14 @@
<template>
<view class="content">
<!-- 头部 -->
<view class="top" v-if="token" @click="navTo('/pageTwo/setting/setting')">
<view class="top" v-if="token" @click="navTo('/body/setting/setting')">
<view class="headimg">
<image :src="user.head_pic" class="image"></image>
<view class="size20 bold">{{user.nickname}}</view>
</view>
<text class="t-icon t-icon-arrow-right-bold"></text>
</view>
<view class="top" v-else @click="handleLogin">
<view class="top top2" v-else @click="handleLogin">
登录后查看更多
</view>
<!-- -->
@ -97,7 +97,7 @@
headerIndex
},
computed: {
...mapState(["accountNumber", "familayList", "CooperationUrl",]),
...mapState(["accountNumber", "familayList", "CooperationUrl", ]),
nickname() {
return this.accountNumber.nickname
},
@ -218,6 +218,13 @@
}
}
.top2 {
color: #fff;
text-align: center;
justify-content: center;
background: $maincolor;
}
.wxlist {
width: 100%;
height: auto;

View File

@ -77,6 +77,17 @@ export default {
})
},
getPublicRecord({
commit
}, account) {
let that = this
return model.getPublicRecord(account).then(res => {
if (res.code == 0) {
commit('changePublicRecord', res.data)
}
})
},
// 跳绳数据
getSkipResult({ //报告
commit

View File

@ -56,7 +56,6 @@ export default new Vuex.Store({
foodType: 1, //食物称 1实时2锁定 状态类型
bleTipsText: "", //蓝牙提示语
isConnectStatus: 0, //蓝牙连接状态 0搜索中1失败2成功
isBluetoothTyle: false, //蓝牙状态
},
// 计食器
countFoodInfo: {
@ -100,6 +99,11 @@ export default new Vuex.Store({
},
top_list: []
},
phoneInfo: {
info: {},
versionUrl: null,
platform: ""
},
MeasureSkip: null,
MeasureLung: null,
familayList: [],
@ -116,8 +120,13 @@ export default new Vuex.Store({
isFirst: false, //初始体重
isRecord: false, //手动记录
isPublicRecord: false, //公共手动记录弹框
isBluetoothTyle: false,
},
mutations: {
// 版本信息
changePhoneInfo(state, newData) {
Object.assign(state.phoneInfo, newData)
},
// 账户信息
changeAccountNumber(state, newData) {
Object.assign(state.accountNumber, newData)
@ -218,6 +227,10 @@ export default new Vuex.Store({
changeBluetoothValue(state, newData) {
Object.assign(state.bleValue, newData)
},
//蓝牙状态
changeBluetooth(state, newData) {
state.isBluetoothTyle = newData
},
},
// 模块化vuex
modules: {},

View File

@ -35,7 +35,6 @@ function openBluetoothAdapter() {
bleTipsText: "蓝牙搜索中",
unitList: $data.unitMinus,
isConnectStatus: 0,
isBleLink: false,
deviceId: "",
serviceId: "",
})
@ -43,10 +42,9 @@ function openBluetoothAdapter() {
},
fail: err => {
$store.commit("changeBluetoothValue", {
bleTipsText: "连接超时,点击重新连接",
bleTipsText: "点击重新连接",
unitList: $data.unitMinus,
isConnectStatus: 1,
isBleLink: false,
deviceId: "",
serviceId: "",
})
@ -67,7 +65,7 @@ function startBluetoothDeviceDiscovery() {
if (!devicesList.length) {
clearTimeout(searchTimer);
$store.commit("changeBluetoothValue", {
bleTipsText: "连接超时,点击重新连接",
bleTipsText: "点击重新连接",
isConnectStatus: 1
});
}
@ -75,7 +73,7 @@ function startBluetoothDeviceDiscovery() {
},
fail: res => {
$store.commit("changeBluetoothValue", {
bleTipsText: "连接超时,点击重新连接",
bleTipsText: "点击重新连接",
isConnectStatus: 1
})
}
@ -123,13 +121,15 @@ function onBluetoothDeviceFound() {
device.name.toLowerCase().indexOf('ypc') != -1 ||
device.name.toLowerCase().indexOf('da') != -1 ||
device.name.toLowerCase().indexOf('pcl') != -1 ||
device.name.toLowerCase().indexOf('aiLink_') != -1 ||
device.name.toLowerCase().indexOf('ailink_') != -1 ||
device.name.toLowerCase().indexOf('pcf01') != -1 ||
device.name.toLowerCase().indexOf('chipsea_ble') != -1 ||
device.name.toLowerCase().indexOf('Yihejia_Lung') != -1) {
clearTimeout(searchTimer);
stopBluetoothDevicesDiscovery()
setTimeout(function() {
Bluetoothfilter(device)
}, 200)
return
}
})
@ -142,21 +142,22 @@ function Bluetoothfilter(device) {
if (idx === -1) {
devicesList.push(device);
deviceId = device.deviceId
// 体脂秤
console.log("deviceName", device.name)
// 广播体脂秤
if (device.name.toLowerCase().indexOf("pcl") != -1) {
uni.navigateTo({
url: "/pageTwo/devices/PCL?deviceId=" + device.deviceId
})
return
}
// 思迈德协议,假阻抗,体脂秤
// 广播思迈德协议,假阻抗,体脂秤
if (device.name.toLowerCase() == "c00002") {
uni.navigateTo({
url: "/pageTwo/devices/PCL22?deviceId=" + device.deviceId
})
return
}
// 思迈德协议,假阻抗,体脂秤
// 广播思迈德协议,假阻抗,体脂秤
if (device.name.toLowerCase() == "da") {
uni.navigateTo({
url: "/pageTwo/devices/PCL22S?deviceId=" + device.deviceId
@ -164,28 +165,27 @@ function Bluetoothfilter(device) {
return
}
// 身高仪
if (device.name.indexOf("G02") != -1) {
deviceName = 'G02'
if (device.name.toLowerCase().indexOf("g02") != -1) {
deviceName = 'heightName'
createBLEConnection("FFF0")
return
}
// 跳绳
if (device.name.indexOf("YPC") != -1) {
deviceName = 'YPC'
if (device.name.toLowerCase().indexOf("ypc") != -1) {
deviceName = 'skiping'
createBLEConnection("FFE0")
return
}
// 婴儿秤
if (device.name.indexOf("Chipsea_BLE") != -1) {
deviceName = 'Chipsea_BLE'
if (device.name.toLowerCase().indexOf('chipsea_ble') != -1) {
deviceName = 'bodyName'
createBLEConnection("FFF0")
return
}
// 八电极
if (device.name.toLowerCase().indexOf('aiLink_') != -1) {
deviceName = 'aiLink'
if (device.name.toLowerCase().indexOf('ailink_') != -1) {
deviceName = 'L06'
createBLEConnection("FFE0")
return
}
//厨房秤
@ -220,7 +220,7 @@ function handleDevType(device) {
foodType: 1,
isFood: false,
isConnectStatus: 1,
bleTipsText: "连接超时,点击重新连接",
bleTipsText: "点击重新连接",
})
}
})
@ -238,7 +238,7 @@ function createBLEConnection(serviceId) {
$store.commit("changeBluetoothValue", {
foodType: 1,
isConnectStatus: 1,
bleTipsText: "连接超时,点击重新连接",
bleTipsText: "点击重新连接",
})
}
});
@ -251,31 +251,8 @@ function getBLEDeviceServices(serviceId) {
uni.getBLEDeviceServices({
deviceId: deviceId,
success: res => {
console.log("获取设备的UUID成功", res)
console.log("获取设备的UUID成功", res, deviceName)
stopBluetoothDevicesDiscovery();
if (deviceName == 'CFC') { //厨房秤
$store.commit("changeBluetoothValue", {
isFood: true,
})
} else if (deviceName == 'YPC') {
uni.navigateTo({
url: "/pageTwo/skiping/skip?deviceId=" + deviceId
})
} else if (deviceName == 'aiLink') {
uni.navigateTo({
url: "/pageTwo/devices/pcL06?deviceId=" + deviceId
})
} else if (deviceName == 'Chipsea_BLE') {
uni.navigateTo({
url: "/pageTwo/devices/B20?deviceId=" + deviceId
})
}else if (deviceName == 'G02') {
uni.navigateTo({
url: "/pageTwo/devices/G02?deviceId=" + deviceId
})
}
serviceList = res.services;
for (let i = 0; i < serviceList.length; i++) {
let service = serviceList[i];
@ -290,12 +267,42 @@ function getBLEDeviceServices(serviceId) {
break;
}
}
if (deviceName == 'CFC') { //厨房秤
$store.commit("changeBluetoothValue", {
isFood: true,
})
return
}
if (deviceName == 'skiping') {
uni.navigateTo({
url: "/pageTwo/skiping/skip?deviceId=" + deviceId
})
return
}
if (deviceName == 'L06') {
uni.navigateTo({
url: "/pageTwo/devices/pcL06?deviceId=" + deviceId
})
return
}
if (deviceName == 'bodyName') {
uni.navigateTo({
url: "/pageTwo/devices/B20?deviceId=" + deviceId
})
return
}
if (deviceName == 'heightName') {
uni.navigateTo({
url: "/pageTwo/devices/G02?deviceId=" + deviceId
})
return
}
},
fail: res => {
$store.commit("changeBluetoothValue", {
foodType: 1,
isConnectStatus: 1,
bleTipsText: "连接超时,点击重新连接",
bleTipsText: "点击重新连接",
})
console.log('获取设备的UUID失败:', res)
}
@ -309,18 +316,6 @@ function closeBluetoothAdapter() {
uni.closeBluetoothAdapter({
success: res => {
clearTimeout(searchTimer);
$store.commit("changeBluetoothValue", {
deviceId: "",
serviceId: "",
foodUnit: "g",
foodNotify: "",
foodWrite: "",
foodType: 1,
foodWeight: 100,
unitList: $data.unitMinus,
isConnectStatus: 1,
bleTipsText: "连接超时,点击重新连接",
})
console.log('蓝牙模块关闭成功');
}
})
@ -341,21 +336,22 @@ function onBLEConnectionStateChange() {
uni.onBLEConnectionStateChange(function(res) {
console.log("监听蓝牙连接状态", res.connected)
if (!res.connected) {
clearTimeout(searchTimer);
$store.commit("changeBluetoothValue", {
bleTipsText: "连接超时,点击重新连接",
unitList: $data.unitMinus,
isConnectStatus: 1,
deviceId: "",
serviceId: "",
foodUnit: "g",
foodNotify: "",
foodWrite: "",
foodType: 1,
foodWeight: 100,
unitList: $data.unitMinus,
isConnectStatus: 1,
bleTipsText: "点击重新连接",
})
$store.commit("changeBluetooth", false);
closeBLEConnection()
closeBluetoothAdapter()
}
$store.commit("changeBluetoothValue", {
isBluetoothTyle: res.connected
});
})
}
/**

View File

@ -194,7 +194,7 @@ export default {
})
},
getSkipResult(param) { //跳绳新增设备记录
return http.post("skip/device_record", param).then(res => {
return http.post("/skip/device_record", param).then(res => {
return res
})
},

View File

@ -19,7 +19,6 @@ export default {
validatePhoneEmail,
checkPrivacyAgreement,
mergeAndDeduplicate,
handleCancelUpdate,
parseUnitMask
}
function parseUnitMask(hexValue, UNIT_MAP) {
@ -50,7 +49,7 @@ function NewsPtype(con) {
if (con.type == "wechat") { //跳小程序
// #ifdef APP
uni.navigateTo({
url: "/pageTwo/webview/webview?id=" + con.id + '&url=' + con.jump_url
url: "/body/webview/webview?id=" + con.id + '&url=' + con.jump_url
})
// #endif
// #ifdef MP-WEIXIN
@ -63,7 +62,7 @@ function NewsPtype(con) {
} else if (con.type != 'wechat') { //跳h5或文本
uni.navigateTo({
url: "/pageTwo/webview/webview?id=" + con.id + '&url=' + con.jump_url
url: "/body/webview/webview?id=" + con.id + '&url=' + con.jump_url
})
}
}
@ -84,7 +83,7 @@ function showModal(text) {
success: function(res) {
if (res.confirm) {
uni.switchTab({ //返回
url: "/pages/home/home"
url: "/pages/index/index"
})
}
}
@ -112,7 +111,7 @@ function compareVersions(version1, version2) {
if (modalRes.confirm) { //确定更新
if (platform === 'android') { //安卓更新
uni.navigateTo({
url: "/pageTwo/my/about"
url: "/body/my/about"
})
} else { //ios跳转
plus.runtime.launchApplication({
@ -317,18 +316,3 @@ function getTime() {
let Min = date.getMinutes() > 9 ? date.getMinutes() : '0' + date.getMinutes()
return y + '/' + m + '/' + d + " " + H + ':' + Min
}
// 未登录及取消更新
function handleCancelUpdate(code) {
if (code == 0) {
$store.dispatch('getFamilyList', {
type: 2
})
} else {
setTimeout(() => {
uni.reLaunch({
url: '/pageTwo/login/login'
})
}, 500);
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More