|
|
|
|
<template>
|
|
|
|
|
<!-- 背景 -->
|
|
|
|
|
<view class="background">
|
|
|
|
|
|
|
|
|
|
<!-- 人物 -->
|
|
|
|
|
<image class="human" src="/static/information/boy_weight/pictures/human.png"></image>
|
|
|
|
|
<!-- 滚动条 -->
|
|
|
|
|
<image class="roll" @click="goTob_roll()" src="/static/information/boy_weight/pictures/roll.png"></image>
|
|
|
|
|
<!-- 按钮 -->
|
|
|
|
|
<image class="button" @click="go_to_height()" src="/static/information/boy_weight/pictures/button.png"></image>
|
|
|
|
|
<!-- 进度条 -->
|
|
|
|
|
<image class="progress" src="/static/information/boy_weight/pictures/progress.png"></image>
|
|
|
|
|
<!-- 文本-->
|
|
|
|
|
<text class="text" @click="goTob_roll()">{{weight}}</text>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
weight: ''
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
this.weight = options.weight;
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
navigateTo(page) {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: page
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
go_to_height() {
|
|
|
|
|
// 获取全局变量
|
|
|
|
|
const app = getApp();
|
|
|
|
|
console.log(app.globalData.token);
|
|
|
|
|
console.log(app.globalData.fit_journey_basic_address);
|
|
|
|
|
|
|
|
|
|
// 转换 weight 字符串为数字,去掉 "kg" 后缀
|
|
|
|
|
const numericWeight = parseFloat(this.weight.replace('kg', '').trim());
|
|
|
|
|
|
|
|
|
|
// 向后端发送请求
|
|
|
|
|
uni.request({
|
|
|
|
|
url: app.globalData.fit_journey_basic_address + '/weight/write_user_weight',
|
|
|
|
|
method: 'POST',
|
|
|
|
|
header: {
|
|
|
|
|
'content-type': 'application/x-www-form-urlencoded',
|
|
|
|
|
'Authorization': app.globalData.token // TODO:暂时写为临时的token 后期替换
|
|
|
|
|
},
|
|
|
|
|
data: {
|
|
|
|
|
weight: numericWeight, // 发送数字类型
|
|
|
|
|
},
|
|
|
|
|
success: (res) => {
|
|
|
|
|
console.log("请求成功!请求数据是", res);
|
|
|
|
|
// 如果成功则跳转到身高界面
|
|
|
|
|
this.navigateTo('/pages/information/boy_height_start/boy_height_start');
|
|
|
|
|
},
|
|
|
|
|
error: (res) => {
|
|
|
|
|
console.log("请求失败!请求数据是", res);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
goTob_roll() {
|
|
|
|
|
this.navigateTo('/pages/information/boy_height_roll/boy_height_roll');
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
@import "/static/information/boy_weight/css/boy_weight_end.scss";
|
|
|
|
|
</style>
|