| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 |
- <template>
- <uv-toast ref="toast"></uv-toast>
- <view class="">
- <navbar :title="$t('waistline')" size="48" :backtext="$t('back')" color="#fff"></navbar>
- </view>
- <view class="app_content">
- <view class='titlearea'>
- <text class='title_2' style="text-align: center;">{{$t('selectwaistline_text1')}}</text>
- <text class='title_member'>{{$t('report_user')}}:{{selectuser.membername}}</text>
- <text class='title_desstr' decode='true'>{{$t('selectwaistline_text2')}}</text>
- <text class='title_desstr' decode='true'>{{$t('selectwaistline_text3')}}</text>
- <text class='title_desstr' decode='true'>{{$t('selectwaistline_text4')}}</text>
- <text class='title_desstr' decode='true'>{{$t('selectwaistline_text5')}}</text>
- </view>
- <view class="info_div info_div_1">
- <view class="text_div">
- <text class="title3">{{$t('waistline')}}:</text>
- <text class="text">{{value}}</text>
- <text class="title3">CM</text>
- <!-- <text class="text" style="font-size: 20px;">{{cun}}</text>
- <text class="title3">{{$t('waistline_text2')}}</text> -->
- </view>
- <!-- <view class="text_div">
- <text class="text">{{chi}}</text>
- <text class="title3">{{$t('waistline_text1')}}</text>
- <text class="text">{{cun}}</text>
- <text class="title3">{{$t('waistline_text2')}}</text>
- </view> -->
- <view class="text_div">
- <text class="text" style="font-size: 20px;">{{cun}}</text>
- <text class="title3">{{$t('waistline_text2')}}</text>
- </view>
- </view>
- <!-- <view class="info_div info_div_2">
- <view class="mybtn" @click="setvalue">{{$t('select')}}</view>
- </view> -->
- <view class="showdiv" id="showdiv" :style="{height:style.canvasHeight}">
- <scroll-view style="width:100%;height: 100%;"
- :scroll-x="true" @scroll="scroll" :scroll-left="scroll_left" :show-scrollbar="false">
- <canvas :style="{width:style.canvasWidth,height:style.canvasHeight}"
- canvas-id="canvas_ruler" id="canvas_ruler" :width="canvasWidth">
- </canvas>
- </scroll-view>
- <canvas :style="{width:style.screenWidth,height:style.canvasHeight}"
- canvas-id="canvas-cursor" id="canvas-cursor">
- </canvas>
- </view>
- <br />
- <!-- <view class="info_div info_div_1">
- <view class="text_div">
- <text class="text" style="font-size: 20px;">{{cun}}</text>
- <text class="title3">{{$t('waistline_text2')}}</text>
- </view>
- </view> -->
- <view class="">
- <uv-picker ref="picker" :columns="columns" @change="change" keyName="label" :showToolbar="false" fontSize="25px"></uv-picker>
- </view>
- <view class="donext_div">
- <uv-button type="primary" :text="$t('next_step')" @click="donext" :customStyle="selectbutton2" :customTextStyle="selectbutton3"></uv-button>
- </view>
- </view>
- </template>
- <script>
- import {tohome,tostemlistnext} from "/common/js/common.js"
- import {subanswerbyuserid} from "/common/api/scale.js"
- import {drawruler,getCanvasConfig,getcursorvalue,setcursorvalue,getscrollleft} from "@/common/js/slider_ruler.js"
- export default{
- data(){
- return {
- userinfo:{},
- selectuser:{},
- scaleid:0,
- srid:0,
- sindex:0,
- value:80,
- minvalue:40,
- maxvalue:120,
- selectbutton2:{
- fontSize:'30px',
- width:'500rpx',
- background:'#3f73b3',
- border:"0px",
- },
- selectbutton3:{
- fontSize:"20px",
- fontWeight:"bold",
- letterSpacing: "0.5em",
- },
- canvasHeight:80,
- canvasWidth:1000,
- scroll_left:0,
- }
- },
- computed:{
- columns(){
- let list = []
- for (var i = this.minvalue; i <= this.maxvalue; i++) {
- let label =i;
- if(i==this.minvalue){
- label = this.$t('less_than')+i
- }
- if(i==this.maxvalue){
- label = this.$t('greater_than')+i
- }
- let item = {
- label:label,
- value:i
- }
- list.push(item)
- }
- return [list]
- },
- chi(){
- var chicun = Math.round(this.value*0.3)
- let value = parseInt(chicun/10)
- return value
- },
- cun(){
- // var chicun = Math.round(this.value*0.3)
- // let value = chicun%10
- var chicun = Math.round(this.value/2.5)
- let value = chicun
- return value
- },
- style(){
- let value ={
- canvasHeight:this.canvasHeight+"px",
- canvasWidth:this.canvasWidth+"px",
- screenWidth:this.screenWidth+"px"
- }
- return value
- },
- },
- methods:{
- init(){
- this.userinfo = uni.getStorageSync("userinfo")
- this.selectuser = uni.getStorageSync("selectuser")
- },
- change(e){
- let value = e.value[0].value
- this.value =value
- },
- donext(){
- let answer = {
- userid: this.userinfo.id,
- fmemberid:this.selectuser.fmemberid,
- stemid: 30,
- answertype: 0,
- answervalue: this.value,
- }
- let data={
- userid:this.userinfo.id,
- fmemberid:this.selectuser.fmemberid,
- srid: this.srid,
- scaleid: this.scaleid,
- }
- subanswerbyuserid(answer,data).then(res=>{
- res = res.data
- if(0==res.code){
- this.$refs.toast.show({
- type: 'error',
- message: res.errmsg
- })
- return false
- }
- if(200==res.code){
- uni.setStorage({
- key: 'srid',
- data: res.resultData,
- });
- tostemlistnext(this.sindex,1)
- }
- })
- },
- setvalue(){
- this.$refs.picker.open();
- let index = (this.value-this.minvalue)
- this.$refs.picker.setIndexs([index],true)
- },
- drawruler(){
- let param ={
- canvasid:'canvas_ruler',
- canvascursorid:'canvas-cursor',
- minvalue:this.minvalue,
- maxvalue:this.maxvalue,
- interval:1,
- defaultvalue:this.value,
- precision:0
- }
- drawruler(param)
- this.value=getcursorvalue()
- this.canvasHeight=getCanvasConfig().canvasHeight
- this.canvasWidth=getCanvasConfig().canvasWidth
- this.screenWidth = getCanvasConfig().screenWidth;
- this.scroll_left = getscrollleft()
- // this.scroll_left = this.canvasWidth/2-this.screenWidth/2
- },
- scroll(e){
- this.value = setcursorvalue(e.detail.scrollLeft);
- }
- },
- mounted() {
- uni.setNavigationBarTitle({
- title: this.$t('waistline')
- });
- this.init()
- },
- onLoad: function (option) {
- this.scaleid=option.scaleid
- this.srid=option.srid
- this.sindex = option.sindex
- },
- onBackPress:function(option){
- tohome()
- return true
- },
- onReady(){
- this.drawruler()
- }
- }
- </script>
- <style scop>
- .titlearea{
- /* height:400rpx; */
- display:flex;
- flex-direction:column;
- justify-content: center;
- align-items:center;
- }
- .title_2{
- margin-top:15rpx;
- font-size:36rpx;
- font-weight:400;
- color:#666666;
- padding-left: 0.5em;
- padding-right: 0.5em;
- }
- .title_member{
- margin-top:15rpx;
- font-size:36rpx;
- font-weight:400;
- color:#648EB8;
- }
- .title_desstr{
- width:700rpx;
- margin-left:25rpx;
- margin-top:15rpx;
- font-size:30rpx;
- font-weight:300;
- color:#9C9C9C;
- }
- .info_div{
- display: flex;
- flex-direction: column;
- align-items: center;
- margin-bottom: 20px;
- gap: 5px;
- }
- .info_div_2{
- margin-top: 20px;
- }
- .info_div_1{
- display: flex;
- flex-direction: row;
- justify-content: center;
- gap: 10px;
- }
- .info_div .text_div{
- text-align: center;
- letter-spacing: "0.5em";
- }
- .title1{
- color: #363636 ;
- font-size: 30px;
- }
- .text{
- color: #0000CD;
- font-size: 30px;
- }
- .title2{
- color: #363636;
- font-size: 15px;
- }
- .title3{
- color: #363636;
- font-size: 20px;
- }
- .mybtn{
- width: 50%;
- letter-spacing: 10px;
- }
- .canvasview{
- position:relative;
- }
- .showdiv{
- position: relative;
- width: 100%;
- }
- .showdiv #canvas_ruler{
- position: absolute;
- top: 0;
- left: 0;
- z-index: 0;
- }
- .showdiv #canvas-cursor{
- position: absolute;
- top: 0;
- left: 0;
- z-index: 100;
- pointer-events:none;
- }
- .app_content{
- margin-top: 5em;
- }
- </style>
|