123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <template>
- <view :style="{ minHeight: sys.windowHeight + 'px' }"
- :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
- <tm-menubars title="用户新增/切换" :shadow="0" :showback="true"></tm-menubars>
- <div class="zhuti">
- <!-- <tm-sheet class="kuang">
- <view class="mt-2 flex-between flex-center dingwei pt-20 pb-20">
- <view class="touxiang">
- <image class="ml-20" style="vertical-align: middle;" src="/static/img/53.png" mode="widthFix"></image>
- <text style="vertical-align: middle;" class="text-size-g text-white">Hahhhnxsm_</text>
- </view>
- <view >
- <text class="text-size-g you" style="vertical-align: middle;">(当前用户)</text>
- <tm-checkbox class="you" v-model="checked1" label=""></tm-checkbox>
- </view>
- </view>
- </tm-sheet> -->
- <tm-sheet class="kuang" v-for="(item,index) in userList">
- <view class="mt-2 flex-between flex-center dingwei pt-20 pb-20">
- <view class="touxiang" @click="bianji(item)">
- <image v-if="index==0" class="ml-20" style="vertical-align: middle;" src="/static/img/53.png" mode="widthFix"></image>
- <image v-else class="ml-20" style="vertical-align: middle;" src="/static/img/61.png" mode="widthFix"></image>
- <text style="vertical-align: middle;" class="text-size-g text-white">{{item.username}}</text>
- </view>
- <view @click="qiehuanFun(item,index)">
- <!-- <text class="text-size-g you" style="vertical-align: middle;">(家庭成员)</text> -->
- <tm-checkbox class="you" v-model="item.checked" label=""></tm-checkbox>
- </view>
- </view>
- </tm-sheet>
- <tm-sheet class="kuang">
- <view class="mt-2 flex-between flex-center dingwei pt-20 pb-20">
- <view class="touxiang" @click="tianjia">
- <image class="ml-20" style="vertical-align: middle;" src="/static/img/54.png" mode="widthFix"></image>
- <text style="vertical-align: middle;" class="text-size-g text-white">新增家庭成员</text>
- </view>
- </view>
- </tm-sheet>
- </div>
-
- </view>
- </template>
- <script>
- import{myRequest} from '@/api/request.js'
- export default {
- data() {
- return {
- indexsoyin:0,
- userList:[]
- };
- },
- onLoad() {
-
- },
- created() {
- this.sys = uni.getSystemInfoSync();
- if(uni.getStorageSync("itemuser")){
-
- console.log(uni.getStorageSync("itemuser"))
- }
- this.getDate()
- },
- methods: {
- bianji(item){
- console.log(item)
- uni.navigateTo({
- url: "/pages/chengyuan/index?username="+item.username+'&weight='+item.weight+'&height='+item.height+'&body_type='+item.body_type+'&id='+item.id,
- })
- },
- tianjia(){
- uni.navigateTo({
- url: "/pages/chengyuan/index",
- })
- },
- qiehuanFun(item){
- var that=this;
- myRequest({
- url: "/api/MemberInfo/switchRole",
- method:'post',
- data:{family_id:uni.getStorageSync("family_id"),id:item.id}
- }).then(res => {
- if (res.data.code == 200) {
- let pages = getCurrentPages(); // 当前页面
- let beforePage = pages[pages.length - 2]; // 前一个页面
- uni.navigateBack({
- delta: 1,
- success: function() {
- beforePage.$vm.initBtn()
- }
- });
- }else{
-
- }
- })
- },
- getDate(){
- var that=this;
- myRequest({
- url: "/api/MemberInfo/getFamilyMember",
- method:'post',
- data:{family_id:uni.getStorageSync("family_id")}
- }).then(res => {
- if (res.data.code == 200) {
- var data=res.data.data,panduan=0;
- for(let i=0;i<data.length;i++){
- if(data[i].checked!=0){
- panduan=1
- }
- data[i].checked=data[i].checked==0?false:true;
- }
- if(panduan==0){
- data[0].checked=true;
- }
- that.userList=res.data.data;
- console.log(that.userList)
- }else{
- that.userList=[];
- }
- })
- }
- },
- }
- </script>
- <style lang="scss">
- /deep/ .tm-menubars .body{
- background-color: #1b1b1b !important;
- }
- .dingwei{width: 100%;margin: 0 auto;margin-top: 10px;}
- .dingwei image{width: 55px;margin-right: 10px; }
- /deep/ .border-primary-a-1{border-color: #303440;background: #303440;}
- /deep/ .shuru .grey-darken-5{
- background-color: #0d0d0d!important;
- padding: 0px !important;
- }
- .you{text-align: right;}
- </style>
|