index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <view :style="{ minHeight: sys.windowHeight + 'px' }"
  3. :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
  4. <tm-menubars title="用户新增/切换" :shadow="0" :showback="true"></tm-menubars>
  5. <div class="zhuti">
  6. <!-- <tm-sheet class="kuang">
  7. <view class="mt-2 flex-between flex-center dingwei pt-20 pb-20">
  8. <view class="touxiang">
  9. <image class="ml-20" style="vertical-align: middle;" src="/static/img/53.png" mode="widthFix"></image>
  10. <text style="vertical-align: middle;" class="text-size-g text-white">Hahhhnxsm_</text>
  11. </view>
  12. <view >
  13. <text class="text-size-g you" style="vertical-align: middle;">(当前用户)</text>
  14. <tm-checkbox class="you" v-model="checked1" label=""></tm-checkbox>
  15. </view>
  16. </view>
  17. </tm-sheet> -->
  18. <tm-sheet class="kuang" v-for="(item,index) in userList">
  19. <view class="mt-2 flex-between flex-center dingwei pt-20 pb-20">
  20. <view class="touxiang" @click="bianji(item)">
  21. <image v-if="index==0" class="ml-20" style="vertical-align: middle;" src="/static/img/53.png" mode="widthFix"></image>
  22. <image v-else class="ml-20" style="vertical-align: middle;" src="/static/img/61.png" mode="widthFix"></image>
  23. <text style="vertical-align: middle;" class="text-size-g text-white">{{item.username}}</text>
  24. </view>
  25. <view @click="qiehuanFun(item)">
  26. <text v-if="item.checked==1" class="text-size-g you" style="vertical-align: middle;">(当前用户)</text>
  27. <tm-checkbox class="you" v-model="item.checked" label=""></tm-checkbox>
  28. </view>
  29. </view>
  30. </tm-sheet>
  31. <tm-sheet class="kuang">
  32. <view class="mt-2 flex-between flex-center dingwei pt-20 pb-20">
  33. <view class="touxiang" @click="tianjia">
  34. <image class="ml-20" style="vertical-align: middle;" src="/static/img/54.png" mode="widthFix"></image>
  35. <text style="vertical-align: middle;" class="text-size-g text-white">新增家庭成员</text>
  36. </view>
  37. </view>
  38. </tm-sheet>
  39. </div>
  40. </view>
  41. </template>
  42. <script>
  43. import{myRequest} from '@/api/request.js'
  44. export default {
  45. data() {
  46. return {
  47. indexsoyin:0,
  48. userList:[]
  49. };
  50. },
  51. onLoad() {
  52. },
  53. onShow() {
  54. this.sys = uni.getSystemInfoSync();
  55. if(uni.getStorageSync("itemuser")){
  56. console.log(uni.getStorageSync("itemuser"))
  57. }
  58. this.getDate()
  59. },
  60. methods: {
  61. bianji(item){
  62. console.log(item)
  63. uni.navigateTo({
  64. url: "/pages/chengyuan/index?username="+item.username+'&weight='+item.weight+'&height='+item.height+'&body_type='+item.body_type+'&id='+item.id,
  65. })
  66. },
  67. tianjia(){
  68. uni.navigateTo({
  69. url: "/pages/chengyuan/index",
  70. })
  71. },
  72. qiehuanFun(item){
  73. var that=this;
  74. myRequest({
  75. url: "/api/MemberInfo/switchRole",
  76. method:'post',
  77. data:{family_id:uni.getStorageSync("family_id"),id:item.id}
  78. }).then(res => {
  79. if (res.data.code == 200) {
  80. uni.navigateBack();
  81. }else{
  82. uni.navigateBack();
  83. }
  84. })
  85. },
  86. getDate(){
  87. var that=this;
  88. myRequest({
  89. url: "/api/MemberInfo/getFamilyMember",
  90. method:'post',
  91. data:{family_id:uni.getStorageSync("family_id")}
  92. }).then(res => {
  93. if (res.data.code == 200) {
  94. var data=res.data.data,panduan=0;
  95. for(let i=0;i<data.length;i++){
  96. if(data[i].checked!=0){
  97. panduan=1
  98. }
  99. data[i].checked=data[i].checked==0?false:true;
  100. }
  101. if(panduan==0){
  102. data[0].checked=true;
  103. }
  104. that.userList=res.data.data;
  105. }else{
  106. that.userList=[];
  107. }
  108. })
  109. }
  110. },
  111. }
  112. </script>
  113. <style lang="scss">
  114. /deep/ .tm-menubars .body{
  115. background-color: #1b1b1b !important;
  116. }
  117. .dingwei{width: 100%;margin: 0 auto;margin-top: 10px;}
  118. .dingwei image{width: 55px;margin-right: 10px; }
  119. /deep/ .border-primary-a-1{border-color: #303440;background: #303440;}
  120. /deep/ .shuru .grey-darken-5{
  121. background-color: #0d0d0d!important;
  122. padding: 0px !important;
  123. }
  124. .you{text-align: right;}
  125. </style>