note.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <view class="page">
  3. <view class="cell-wrapper">
  4. <view class="cell" style="font-size: 14px;height: 35px;line-height: 35px;color: #666;">
  5. 群组通知
  6. </view>
  7. <view class="cell" >
  8. <view class="cell-hd">声音</view>
  9. <switch @change="noteChanage(1)" :checked="shownote(user.note1)" />
  10. </view>
  11. <view class="cell" >
  12. <view class="cell-hd">震动</view>
  13. <switch @change="noteChanage(2)" :checked="shownote(user.note2)" />
  14. </view>
  15. <view class="cell" style="font-size: 14px;height: 35px;line-height: 35px;color: #666;">
  16. 私信通知
  17. </view>
  18. <view class="cell" >
  19. <view class="cell-hd">声音</view>
  20. <switch @change="noteChanage(3)" :checked="shownote(user.note3)" />
  21. </view>
  22. <view class="cell" >
  23. <view class="cell-hd">震动</view>
  24. <switch @change="noteChanage(4)" :checked="shownote(user.note4)" />
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import http from "../../library/http.js"
  31. export default {
  32. data() {
  33. return {
  34. user: uni.getStorageSync('userInfo'),
  35. note1:true,
  36. note2:true
  37. }
  38. },
  39. methods: {
  40. shownote(note){
  41. if(note==1) return true;
  42. else return false;
  43. },
  44. noteChanage(num){
  45. if(num==1){
  46. var note=this.user.note1==1?0:1;
  47. var data={id:this.user.id,note1: note};
  48. }
  49. if(num==2){
  50. var note=this.user.note2==1?0:1;
  51. var data={id:this.user.id,note2: note};
  52. }
  53. if(num==3){
  54. var note=this.user.note3==1?0:1;
  55. var data={id:this.user.id,note3: note};
  56. }
  57. if(num==4){
  58. var note=!this.user.note4==1?0:1;
  59. var data={id:this.user.id,note4: note};
  60. }
  61. http.setWait(false).post('user.php?act=profile',data).then(res=>{
  62. this.user=res.data;
  63. uni.setStorageSync('userInfo',this.user)
  64. })
  65. },
  66. },
  67. onLoad() {
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. .cell-wrapper {
  73. margin-top: 0;
  74. }
  75. .avatar {
  76. line-height: 1;
  77. padding-top: $uni-spacing-col-base;
  78. padding-bottom: $uni-spacing-col-base;
  79. .cell-hb {
  80. display: flex;
  81. flex-direction: column;
  82. }
  83. image {
  84. width: 140upx;
  85. height: 140upx;
  86. border-radius: $uni-border-radius-base;
  87. background-color: #eee;
  88. }
  89. }
  90. .fromInput {
  91. text-align: right;
  92. font-size: 32upx;
  93. color: #777;
  94. border: 1px sold #eee !important;padding: 0px 5px;;
  95. }
  96. .uploadBtn{
  97. width: 90%;
  98. margin-top: 100upx;
  99. }
  100. </style>