小程序测试

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> <script>
let platform = ""
let SystemVersion = ""
export default { export default {
data() { data() {
return {} return {}
@ -7,21 +9,30 @@
let that = this let that = this
// apk // apk
// #ifdef APP-PLUS // #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) { uni.onNetworkStatusChange(function(res) {
if (res.isConnected == true) { if (res.isConnected == true) {
uni.reLaunch({ that.handleoginversion()
url: '/pageTwo/login/login'
})
} }
}); });
} }
plus.runtime.getProperty(plus.runtime.appid, function(info) {
uni.setStorageSync('VERSION', info.version)
SystemVersion = info.version
that.$store.commit('changePhoneInfo', {
info: info
})
})
// #endif // #endif
// #ifdef MP-WEIXIN that.handleoginversion()
//
that.updataWeiXin()
// #endif
// that.handleConfigInfo()
console.log('App Launch') console.log('App Launch')
}, },
onShow: function() { onShow: function() {
@ -37,20 +48,103 @@
}, },
methods: { methods: {
// //
handleConfigInfo() { handleoginversion() {
let that = this let that = this
// 线 that.$model.getLoginVersion({}).then(res => {
that.$model.getHomeConfig({}).then(res => { that.$store.dispatch("getHomeConfig") //
that.$store.commit('changeConfigInfo', res.data) if (res.code == 0) {
that.$tools.handleCancelUpdate(res.data.login_status.code) that.handleUserList()
// #ifdef APP-PLUS } else {
plus.runtime.getProperty(plus.runtime.appid, function(info) { uni.setStorageSync('token', null)
that.$tools.handleoginversion(info.version, res.data.version_msg.version) // 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 // #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() { updataWeiXin() {
let that = this let that = this

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@
<view class="item"> <view class="item">
<view class="text">邮箱</view> <view class="text">邮箱</view>
<view class="input"> <view class="input">
<input v-model="phone" placeholder="请输入邮箱"/> <input v-model="phone" placeholder="请输入邮箱" />
</view> </view>
</view> </view>
<view class="item "> <view class="item ">
@ -13,7 +13,7 @@
<view class="input yanzhengma"> <view class="input yanzhengma">
<input class="uni-input" v-model="code" /> <input class="uni-input" v-model="code" />
<button class="code" type="none" @click="handleCode" 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> </button>
</view> </view>
</view> </view>
@ -58,7 +58,7 @@
my_email: that.phone my_email: that.phone
}) })
uni.redirectTo({ uni.redirectTo({
url: "/pageTwo/setting/setting" url: "/body/setting/setting"
}) })
} }
}).catch(err => {}) }).catch(err => {})
@ -103,6 +103,7 @@
.content { .content {
width: 100%; width: 100%;
height: 100vh; height: 100vh;
background: #fff;
} }
.login { .login {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -87,7 +87,10 @@
} }
}, },
computed: { computed: {
...mapState(["bleValue","user"]), ...mapState(["bleValue", "user", "isBluetoothTyle"]),
},
onHide() {
console.log("PCT01返回onHide", innerAudioContext)
}, },
onLoad(options) { onLoad(options) {
let that = this let that = this
@ -104,20 +107,17 @@
}, 1200) }, 1200)
} }
that.handleAudioStart() that.handleAudioStart()
that.$ble.onBLEConnectionStateChange()
}, },
onUnload: function() { onUnload: function() {
let that = this let that = this
if (innerAudioContext) { innerAudioContext.destroy();
innerAudioContext.destroy(); //
}
that.handleEnd() that.handleEnd()
console.log("PCT01返回onUnload") console.log("PCT01返回onUnload", innerAudioContext)
}, },
watch: { watch: {
"bleValue.isBluetoothTyle": function() { isBluetoothTyle: function() {
let that = this let that = this
if (!bleValue.isBluetoothTyle) { if (!that.isBluetoothTyle) {
uni.showModal({ uni.showModal({
title: '连接已断开', title: '连接已断开',
content: '训练过程中已与设备连接中断,请重新连接设备再开始训练', 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_m = Math.floor((that.time % 3600) / 60)
that.time_s = that.time % 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({ that.$model.getSkipResult({
aud_id: that.user.aud_id, aud_id: that.user.aud_id,
kcal: Math.floor(that.kcal), kcal: Math.floor(that.kcal),

View File

@ -2,9 +2,9 @@
<view class="weightPages"> <view class="weightPages">
<view class="content "> <view class="content ">
<view class="status">{{bleTipsText}}</view> <view class="status">{{bleTipsText}}</view>
<view class="quan"> <view class="quan2">
<view> <view>
<text class="weight">{{weight?weight:'0.00'}}</text>{{unit}} <text class="weight">{{weightPage?weightPage:'0.00'}}</text>
</view> </view>
<view class="typeInfo" v-if="typeInfo!=0">{{typeInfo==2?'稳定重量':'实时重量'}}</view> <view class="typeInfo" v-if="typeInfo!=0">{{typeInfo==2?'稳定重量':'实时重量'}}</view>
</view> </view>
@ -14,21 +14,6 @@
<text>2.请确定手机蓝牙位置信息已打开</text> <text>2.请确定手机蓝牙位置信息已打开</text>
</view> </view>
</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> </view>
</template> </template>
@ -39,26 +24,26 @@
export default { export default {
data() { data() {
return { return {
text: "",
typeInfo: 0, typeInfo: 0,
head: "", weightPage: "",
weight: "", weight: "",
height: "", height: "",
unit: "kg", unit: "kg",
isHeight: false,
isSave: true, //
deviceId: "", deviceId: "",
serviceId: "", serviceId: "",
write: "", write: "",
notify: "", notify: "",
isFinished: false, // imp: 0,
devicesList: [], leftHandImp: 0,
IsLing: false, // rightHandImp: 0,
IsNum: false, // leftFootImp: 0,
rightFootImp: 0,
text: "",
stopblue: true
} }
}, },
computed: { computed: {
...mapState(["user", "bleValue"]), ...mapState(["user", "bleValue", "isBluetoothTyle"]),
userInfo() { userInfo() {
return this.user return this.user
}, },
@ -70,41 +55,57 @@
let that = this let that = this
that.typeInfo = 0 that.typeInfo = 0
that.height = that.userInfo.height that.height = that.userInfo.height
that.head = that.userInfo.head_data
that.deviceId = options.deviceId 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: { watch: {
'bleValue.isBluetoothTyle'() { isBluetoothTyle() {
let that = this let that = this
if (!that.bleValue.isBluetoothTyle) { if (!that.isBluetoothTyle) {
that.$tools.showModal('蓝牙连接已断开,请重新连接后测量') 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({ uni.switchTab({
url: "/pages/index/index" 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() { } else {
let that = this that.handleGetMeasure()
console.log("是否开启弹框", that.weight, that.isFinished, that.typeInfo)
if (!that.isFinished) {
that.isHeight = false
return
} }
if (that.isFinished && that.typeInfo == 2) {
setTimeout(function() {
that.isHeight = true
}, 1500)
} }
} }
}, },
@ -118,14 +119,13 @@
deviceId: that.deviceId, deviceId: that.deviceId,
serviceId: serviceId, serviceId: serviceId,
success: res => { success: res => {
// * read: true, //,write: true, //,notify: true
for (let i = 0; i < res.characteristics.length; i++) { for (let i = 0; i < res.characteristics.length; i++) {
let item = res.characteristics[i]; let item = res.characteristics[i];
if (item.uuid.indexOf('0000FFF1') != -1) { if (item.uuid.indexOf('0000FFE2') != -1) {
that.notify = item.uuid that.notify = item.uuid
} else if (item.uuid.indexOf('0000FFF2') != -1) { } else if (item.uuid.indexOf('0000FFE3') != -1) {
that.write = item.uuid that.write = item.uuid
that.writeBLECharacteristicValue("A6020500076A") // that.writeBLECharacteristicValue("a603420100466a")
} }
} }
that.$store.commit("changeBluetoothValue", { that.$store.commit("changeBluetoothValue", {
@ -145,110 +145,97 @@
characteristicId: that.write, characteristicId: that.write,
state: true, 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 = ""
// uni.onBLECharacteristicValueChange((characteristic) => {
if (digit == "0") { let payload = that.$tools.ab2hex(characteristic.value, '')
weight = weight 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") { if (digit == "1") {
weight = weight / 10 weight = weight / 10
} }
if (digit == '2') { if (digit == "2") {
weight = weight / 100 weight = weight / 100
} }
if (digit == "3") { if (digit == "3") {
weight = weight / 1000 weight = weight / 1000
} }
//
if (unit == "0") { if (unit == "0") {
that.unit = "kg" that.unit = "kg"
} }
if (unit == "1") { if (unit == "1") {
that.unit = "斤" that.unit = "斤"
} }
if (unit == "2") { if (unit == "6") {
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") {
that.unit = "lb" that.unit = "lb"
} }
if (unit == "4") { 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
} }
// that.typeInfo = typeInfo
if (typeInfo == "01") {
that.typeInfo = 1
that.weight = weight
that.IsLing = false
that.isHeight = false
that.isFinished = false
} }
//
if (typeInfo == "02" && !that.isFinished) { if (type == "02") { //
that.typeInfo = 2 if (typeInfo == "02") {
that.weight = weight that.imp = 0
if (weight > 0 || toString(weight) != '0:0.00') { that.leftHandImp = 0
that.isFinished = true 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) { fail: res => {
console.log("测量失败", res.value); 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) { writeBLECharacteristicValue(str) {
var that = this; var that = this;
let buf = new Uint8Array(str.match(/[\da-f]{2}/gi).map(function(h) { let buf = new Uint8Array(str.match(/[\da-f]{2}/gi).map(function(h) {
@ -276,15 +263,14 @@
return return
} }
that.$model.getmeasurefunit({ that.$model.getmeasurefunit({
weight: that.weight + that.unit, weight: that.weight,
height: that.height, height: that.height,
adc: that.imp,
aud_id: that.userInfo.aud_id, aud_id: that.userInfo.aud_id,
head_data: that.head ? that.head : 0, lefthand: that.leftHandImp,
lefthand: 0, righthand: that.rightHandImp,
righthand: 0, leftfoot: that.leftFootImp,
leftfoot: 0, rightfoot: that.rightFootImp,
rightfoot: 0,
heart_rate: 0,
}).then(res => { }).then(res => {
that.isHeight = false that.isHeight = false
that.isSave = false that.isSave = false
@ -299,34 +285,11 @@
} else { } else {
that.$tools.msg("测量失败") that.$tools.msg("测量失败")
} }
setTimeout(function() {
uni.switchTab({ uni.switchTab({
url: "/pages/index/index" url: "/pages/index/index"
}) })
}) }, 500)
},
//
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);
},
}) })
}, },
}, },
@ -353,9 +316,9 @@
background: linear-gradient(-90deg, #feaa50, #e96b13 80%) !important; background: linear-gradient(-90deg, #feaa50, #e96b13 80%) !important;
} }
.quan { .quan2 {
width: 460rpx; width: 480rpx;
height: 460rpx; height: 480rpx;
border: 8px solid #feaa50; border: 8px solid #feaa50;
border-radius: 50%; border-radius: 50%;
margin: 15px auto; margin: 15px auto;
@ -367,7 +330,7 @@
animation: pulse 1s infinite; animation: pulse 1s infinite;
.weight { .weight {
font-size: 50px; font-size: 42px;
color: #000; color: #000;
font-weight: bold; font-weight: bold;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,7 +19,6 @@ export default {
validatePhoneEmail, validatePhoneEmail,
checkPrivacyAgreement, checkPrivacyAgreement,
mergeAndDeduplicate, mergeAndDeduplicate,
handleCancelUpdate,
parseUnitMask parseUnitMask
} }
function parseUnitMask(hexValue, UNIT_MAP) { function parseUnitMask(hexValue, UNIT_MAP) {
@ -50,7 +49,7 @@ function NewsPtype(con) {
if (con.type == "wechat") { //跳小程序 if (con.type == "wechat") { //跳小程序
// #ifdef APP // #ifdef APP
uni.navigateTo({ 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 // #endif
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
@ -63,7 +62,7 @@ function NewsPtype(con) {
} else if (con.type != 'wechat') { //跳h5或文本 } else if (con.type != 'wechat') { //跳h5或文本
uni.navigateTo({ 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) { success: function(res) {
if (res.confirm) { if (res.confirm) {
uni.switchTab({ //返回 uni.switchTab({ //返回
url: "/pages/home/home" url: "/pages/index/index"
}) })
} }
} }
@ -112,7 +111,7 @@ function compareVersions(version1, version2) {
if (modalRes.confirm) { //确定更新 if (modalRes.confirm) { //确定更新
if (platform === 'android') { //安卓更新 if (platform === 'android') { //安卓更新
uni.navigateTo({ uni.navigateTo({
url: "/pageTwo/my/about" url: "/body/my/about"
}) })
} else { //ios跳转 } else { //ios跳转
plus.runtime.launchApplication({ plus.runtime.launchApplication({
@ -317,18 +316,3 @@ function getTime() {
let Min = date.getMinutes() > 9 ? date.getMinutes() : '0' + date.getMinutes() let Min = date.getMinutes() > 9 ? date.getMinutes() : '0' + date.getMinutes()
return y + '/' + m + '/' + d + " " + H + ':' + Min 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