receivingSet.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <!-- 接收设置 -->
  2. <template>
  3. <view class="container">
  4. <!-- 资产消息 -->
  5. <view class="setting_item_wrap" v-for="(item,index) in settingList" :key="index">
  6. <view class="setting_title">{{item.tplName}}</view>
  7. <view class="setting_item" v-for="(item2,index2) in item.memberTplList" :key="index2">
  8. <text>{{item2.tplName}}</text>
  9. <switch color="#FC2521" :checked="item2.isReceive==1?true:false" class="switch_btn" @change="modifySetting(item2.tplCode,item2.isReceive)"/>
  10. </view>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. import {
  16. mapState
  17. } from 'vuex';
  18. export default{
  19. data(){
  20. return{
  21. settingList:[] //接收设置列表
  22. }
  23. },
  24. computed:{
  25. ...mapState(['userInfo'])
  26. },
  27. onLoad(){
  28. this.loadData()
  29. },
  30. methods:{
  31. loadData(){
  32. let param = {}
  33. param.url = 'v3/msg/front/msg/setting/list'
  34. param.method = 'GET'
  35. this.$request(param).then(res=>{
  36. if(res.state == 200){
  37. this.settingList = res.data
  38. }else{
  39. this.$api.msg(res.msg)
  40. }
  41. })
  42. },
  43. // 接收设置开关
  44. modifySetting(tplCode,isReceive){
  45. let param = {}
  46. param.url = 'v3/msg/front/msg/setting/isReceive'
  47. param.method = 'POST'
  48. param.data = {
  49. tplCode,
  50. isReceive:isReceive == 0?1:0
  51. }
  52. this.$request(param).then(res=>{
  53. if(res.state == 200){
  54. this.loadData()
  55. }else{
  56. this.$api.msg(res.msg)
  57. }
  58. })
  59. }
  60. }
  61. }
  62. </script>
  63. <style lang="scss">
  64. page,
  65. .container{
  66. width: 750rpx;
  67. margin: 0 auto;
  68. // height:100%;
  69. background-color: #f5f5f5;
  70. }
  71. .setting_item_wrap{
  72. width:750rpx;
  73. box-sizing: border-box;
  74. padding-left:20rpx;
  75. background:#fff;
  76. margin-top:20rpx;
  77. .setting_title{
  78. width:100%;
  79. height:81rpx;
  80. font-size:32rpx;
  81. color:#333;
  82. font-weight: bold;
  83. display:flex;
  84. align-items: center;
  85. border-bottom:1rpx solid rgba(0,0,0,0.05);
  86. }
  87. .setting_item{
  88. display:flex;
  89. align-items: center;
  90. height:110rpx;
  91. justify-content: space-between;
  92. font-size:28rpx;
  93. color:#333;
  94. font-weight: 600;
  95. }
  96. }
  97. .switch_btn /deep/ .uni-switch-wrapper /deep/ .uni-switch-input{
  98. width:80rpx;
  99. height:40rpx;
  100. margin-right:30rpx;
  101. }
  102. .switch_btn /deep/ .uni-switch-wrapper /deep/ .uni-switch-input:after{
  103. width:36rpx;
  104. height:36rpx;
  105. }
  106. .switch_btn /deep/ .uni-switch-wrapper /deep/ .uni-switch-input:before{
  107. width:36rpx;
  108. height:36rpx;
  109. }
  110. </style>