index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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,index)">
  26. <!-- <text 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. created() {
  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. let pages = getCurrentPages(); // 当前页面
  81. let beforePage = pages[pages.length - 2]; // 前一个页面
  82. uni.navigateBack({
  83. delta: 1,
  84. success: function() {
  85. beforePage.$vm.initBtn()
  86. }
  87. });
  88. }else{
  89. }
  90. })
  91. },
  92. getDate(){
  93. var that=this;
  94. myRequest({
  95. url: "/api/MemberInfo/getFamilyMember",
  96. method:'post',
  97. data:{family_id:uni.getStorageSync("family_id")}
  98. }).then(res => {
  99. if (res.data.code == 200) {
  100. var data=res.data.data,panduan=0;
  101. for(let i=0;i<data.length;i++){
  102. if(data[i].checked!=0){
  103. panduan=1
  104. }
  105. data[i].checked=data[i].checked==0?false:true;
  106. }
  107. if(panduan==0){
  108. data[0].checked=true;
  109. }
  110. that.userList=res.data.data;
  111. console.log(that.userList)
  112. }else{
  113. that.userList=[];
  114. }
  115. })
  116. }
  117. },
  118. }
  119. </script>
  120. <style lang="scss">
  121. /deep/ .tm-menubars .body{
  122. background-color: #1b1b1b !important;
  123. }
  124. .dingwei{width: 100%;margin: 0 auto;margin-top: 10px;}
  125. .dingwei image{width: 55px;margin-right: 10px; }
  126. /deep/ .border-primary-a-1{border-color: #303440;background: #303440;}
  127. /deep/ .shuru .grey-darken-5{
  128. background-color: #0d0d0d!important;
  129. padding: 0px !important;
  130. }
  131. .you{text-align: right;}
  132. </style>