123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <template>
- <view class="content">
- <view class="es-pt-20 es-pb-20 es-pl-20 es-fs-26 es-c-99 es-bc-f7">你希望收到</view>
- <view class="set-box" >
- <view class="item">
- <view class="left">
- <view class="title">消息通知</view>
- <view class="text">关闭后,可能会错过点赞、评论、关注等消息通知</view>
- </view>
- <switch :checked="user.isPush" color="#FF5C03" @change="switch1Change" style="transform:scale(0.7)"/>
- </view>
- <!-- <view class="line"></view> -->
- <view class="item">
- <view class="left">
- <view class="title">个性化推送</view>
- <view class="text">依据您的喜好和习惯向您推荐相关信息</view>
- </view>
- <switch :checked="user.isIndividuationPush" color="#FF5C03" @change="switch2Change" style="transform:scale(0.7)"/>
- </view>
- </view>
-
- </view>
- </template>
- <script>
- import { editUserPushSetting,getUserPushSetting} from '@/api/user'
- export default {
- data() {
- return {
- user:{
- "isPush": 0,
- "isIndividuationPush": 0
- }
- }
- },
- onLoad() {
- this.getUserPushSetting();
- },
- onNavigationBarButtonTap(e) {
- this.editUserPushSetting();
- },
- methods: {
- getUserPushSetting(){
- let that=this;
- getUserPushSetting().then(res => {
- if(res.code==200){
- if(res.data!=null){
- this.user = res.data;
- }
- else{
- uni.showToast({
- icon:'none',
- title: res.msg,
- });
- }
- }
- },
- rej => {}
- );
- },
- editUserPushSetting(){
- let that=this;
- uni.showLoading({title:""});
- console.log("qxj isPush:"+this.user.isPush);
- let data={"isPush":this.user.isPush?1:0,"isIndividuationPush":this.user.isIndividuationPush?1:0};
- editUserPushSetting(data).then(res => {
- uni.hideLoading();
- if(res.code==200){
- uni.showToast({icon:'none',title: "操作成功"});
- }
- else{
- uni.showToast({
- icon:'none',
- title: res.msg
- });
- }
- },
- rej => {}
- );
- },
-
- loginNavTo(url){
- if(!this.$isLogin()){
- this.$showLoginPage();
- return;
- }
- uni.navigateTo({
- url: url
- });
- },
- switch1Change(e){
- console.log('switch1 发生 change 事件,携带值为', e.detail.value);
- this.user.isPush=e.detail.value;
- },
- switch2Change(e){
- console.log('switch2 发生 change 事件,携带值为', e.detail.value);
- this.user.isIndividuationPush=e.detail.value;
- },
-
- }
- }
-
-
- </script>
- <style scoped lang="scss">
- page{
- height: 100%;
- }
- .content{
- height: 100%;
- background-color: #ffffff;
- }
- .line{
- height: 1px;background-color: #F7F7F7;
- }
- .logo{
- padding-top: 15%;
- text-align: center;
- image{
- width: 120rpx;
- height: 120rpx;
- border-radius: 10rpx;
- box-shadow:0px 0px 20rpx rgba(0,0,0,0.2);
- }
- p{
- margin: 10px 0px;
- font-size: 14px;
- }
- }
- .set-box{
- margin-top: 20upx;
- background: #fff;
- padding: 0 30upx;
- .item{
- position: relative;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 25upx 0;
- .left{
- display: flex;
- flex-direction: column;
- .title{
- font-size: 32upx;
- font-weight: bold;
- color: #333;
- margin-bottom: 10rpx;
- }
- .text{
- font-size: 22upx;
- color: #999;
- }
-
- }
- .right{
- width: 10upx;
- height: 20upx;
-
- }
- .right-text{
-
- }
- }
- }
- .contact-btn {
- position: absolute;
- width: 100%;
- display: flex;
- opacity: 0;
- }
- </style>
|