123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- <template>
- <view class="user-setting-box">
- <!-- #ifndef MP-TOUTIAO -->
- <Navbar background-color="#fff" color="#333" title="成员信息"></Navbar>
- <!-- #endif -->
- <view class="content">
- <view class="info-box top-border-radius top10">
- <view class="label">昵称</view>
- <view class="right">
- <!-- {{}} -->
- </view>
- </view>
- <view class="info-box">
- <view class="label">体重/kg</view>
- <view class="right">
- <input v-model="form.weight" type="text" class="input" placeholder="此处输入体重"/>
- </view>
- </view>
- <view class="info-box bottom-border-radius">
- <view class="label">时间</view>
- <view class="right">
- <!-- <uni-datetime-picker v-model="form.feedTime" :border="false" type="date" class="date"/> -->
- <uni-datetime-picker v-model="form.feedTime" :border="false" type="datetime" class="date-box">
- <view class="date">
- {{form.feedTime || '请选择时间'}}
- <IconText :code="`\ue88e`" class="icon" size="12" color="#C6C5CB"></IconText>
- </view>
- </uni-datetime-picker>
- </view>
- </view>
- </view>
- <view class="fixed-bottom" >
- <view class="btn" @click="deleteBabyWeightModal" v-if="id">删除</view>
- <view class="solid-btn" @click="handleConfirm">保存</view>
- </view>
- <ShowModal ref="deletePopup" title="提示" @submit="deleteBabyWeight" leftBtnText="取消" content="是否确认删除?" btnText="确认" />
- </view>
- </template>
- <script lang="ts">
- import {
- Component,
- Mixins
- } from 'vue-property-decorator';
- import loginMixin from '@/common/mixins/loginMixin.ts';
- // import {
- // namespace
- // } from 'vuex-class';
- // const baseModule = namespace('base');
- @Component({})
- export default class UserSetting extends Mixins(loginMixin) {
- // @baseModule.Getter('_userInfo') _userInfo: any;
- form: any = {
- weight: null,
- height: null,
- feedTime: '',
- };
- bid: any = null;
- id: any = null;
-
- onShow() {
-
- }
-
- onLoad(){
- this.bid = +this.$Route.query.bid;
- if (this.$Route.query.id) {
- this.id = +this.$Route.query.id;
- this.getBabyWeightInfo();
- }
- }
-
- getBabyWeightInfo(){
- uni.showLoading({
- title: '加载中',
- });
- this.$http.get({
- url: this.$api.getBabyGrowthInfo,
- data: {
- id: this.id
- }
- }).then((res: any) => {
- for(let key in this.form){
- this.form[key] = res[key];
- }
- uni.hideLoading();
- })
- }
-
- deleteBabyWeightModal(){
- (this.$refs.deletePopup as any).open();
- }
-
- deleteBabyWeight(){
- uni.showLoading({
- title: '加载中',
- });
- this.$http.delete({
- url: this.$api.deleteBabyGrowth,
- data: {
- id: this.id
- }
- }).then((res: any) => {
- this.$Router.back(1);
- uni.hideLoading();
- })
- }
-
- handleConfirm(){
- console.log(this.form);
- uni.showLoading({
- title: '加载中',
- });
- let url : string = 'addBabyGrowth';
- let method : string = 'post';
- let data: any = {
- ...this.form,
- bid: this.bid,
- weight: +this.form.weight,
- height: +this.form.height,
- };
- if (this.id) {
- url = 'updateBabyGrowth';
- method = 'put';
- data.id = this.id;
- }
- this.$http[method]({
- url: this.$api[url],
- data: data
- }).then((res: any) => {
- this.$Router.back(1);
- uni.hideLoading();
- })
- }
- }
- </script>
- <style lang="scss" scoped>
- page{
- background: #f5f5f5;
- }
- .user-setting-box {
- // background: #F5F5F5;
- height: 100vh;
- @include flex-y(flex-start);
- .content {
- width: 100%;
- flex: 1;
- // padding: 0 vw(10);
- box-sizing: border-box;
- @include flex-y(flex-start);
- .info-box{
- width: vw(355);
- height: vw(56);
- background: #fff;
- @include flex-x();
- padding-left: vw(20);
- padding-right: vw(10);
- box-sizing: border-box;
- @include word-vw(14, #333);
- margin-top: vw(1);
- &.top10{
- margin-top: vw(10);
- }
- &.top-border-radius{
- border-top-right-radius: vw(10);
- border-top-left-radius: vw(10);
- }
- &.bottom-border-radius{
- border-bottom-right-radius: vw(10);
- border-bottom-left-radius: vw(10);
- }
- .right{
- width: vw(210);
- @include flex-x(flex-end);
- .input{
- width: 100%;
- height: vw(40);
- border-radius: vw(5);
- background: #F6F6F6;
- text-align: center;
- font-size: vw(14);
- }
- /deep/.uni-date{
- @include flex-x(flex-end);
- }
- .date{
- // width: vw(100);
- @include flex-x(flex-end);
- .icon{
- margin-left: vw(3);
- }
- }
- }
- }
- }
- .fixed-bottom {
- height: vw(60);
- width: 100%;
- // background: #fff;
- @include flex-x(center);
- padding: 0 vw(15);
- box-sizing: border-box;
-
- .btn{
- @include solid-btn(125, 50, #787878);
- border-radius: vw(25);
- margin-right: vw(15);
- background: #fff;
- }
-
- .solid-btn {
- background: $bk-color;
- @include solid-btn(345, 50, #333);
- border-radius: vw(25);
- @include word-vw(14, #fff);
- flex: 1;
- }
- }
- }
- </style>
|