recommend.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <view>
  3. <navbar :config="config" backColor="#999999"></navbar>
  4. <view class="box">
  5. <view>关闭推荐</view>
  6. <view><u-switch active-color="rgb(60,189,209)" size="32" v-model="messageConfig" ></u-switch></view>
  7. </view>
  8. <view class="tig">*开启后,所有应用将不给您推荐内容</view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. data() {
  14. return {
  15. config: {
  16. back: true, //false是tolbar页面 是则不写
  17. title: '消息设置',
  18. color: '#000',
  19. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  20. // backgroundColor: [0, '#2cba28'],
  21. },
  22. messageConfig: false
  23. }
  24. },
  25. onLoad(options) {
  26. },
  27. methods:{
  28. getUserData() {
  29. myUserInfo().then(res => {
  30. this.messageConfig = res.data.messageConfig
  31. })
  32. },
  33. // 修改消息免打扰配置
  34. updateMessageConfig(){
  35. uni.showLoading({
  36. title: '修改中',
  37. mask: true
  38. });
  39. this.$yghttp.post('/user/updateMessageConfig',{messageConfig:this.messageConfig}).then(res=>{
  40. uni.showToast({
  41. title: '修改成功!',
  42. icon: 'success',
  43. duration: 1000
  44. })
  45. this.getUserData()
  46. })
  47. }
  48. }
  49. }
  50. </script>
  51. <style>
  52. page {
  53. background-color: #F8F8F8;
  54. }
  55. </style>
  56. <style lang="scss" scoped>
  57. .box {
  58. padding: 40rpx 30rpx;
  59. background: #fff;
  60. border-radius: 20rpx;
  61. display: flex;
  62. justify-content: space-between;
  63. margin: 20rpx 30rpx;
  64. >view {
  65. font-size: 30rpx;
  66. }
  67. }
  68. .tig{
  69. font-size: 24rpx;
  70. color: #999999;
  71. margin: 20rpx 30rpx;
  72. }
  73. </style>