You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.3 KiB

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