123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <template>
- <view class="app">
- <uni-nav-bar statusBar backgroundColor="#fff" fixed title="更多操作" left-icon="left" @clickLeft="utils.navigateBack()"/>
-
- <view class="btn" @tap="tapBlack" v-if="is_black == 0">加入黑名单</view>
- <view class="btn" @tap="tapBlackRmove" v-else>移除黑名单</view>
-
- <view class="btn color" @tap="tapDelete">删除好友</view>
- </view>
- </template>
- <style lang="scss">
- .btn{background: #fff;padding: 10px;text-align: center;font-size: 16px;margin-top: 10px;color: $ic-default-text;}
- .btn.color{color: red;font-weight: bold;}
- </style>
- <script>
- import {mapState,mapMutations } from 'vuex';
- export default {
- data() {
- return {
- usercode : "",
- is_black:0
- }
- },
-
- onLoad(option){
- this.usercode = option.usercode || "";
- this.is_black = option.is_black || 0;
- },
- methods: {
- tapBlack:function(){
- this.utils.showModal("加入黑名单,你将不会再收到对方的消息?",()=>{
- uni.showLoading({ title: '提交中..'});
- this
- .request
- .post("setBlack",{usercode:this.usercode,type:'black'})
- .then(res => {
- uni.hideLoading();
- if(res.code == 200) {
- this.utils.Tip("操作成功");
- uni.navigateBack();
- } else {
- uni.showModal({title: '系统提示',content: res.msg,showCancel: false});
- }
- })
- .catch(res=>{
- console.log(res);
- uni.hideLoading();
- uni.showModal({title: '系统提示',content: '加载失败,重新点击尝试!',showCancel: false});
- });
- });
- },
- /**
- * 移除黑名单
- */
- tapBlackRmove:function(){
- uni.showLoading({ title: '提交中..'});
- this
- .request
- .post("setBlack",{usercode:this.usercode,type:'remove'})
- .then(res => {
- uni.hideLoading();
- if(res.code == 200) {
- this.utils.Tip("操作成功");
- uni.navigateBack();
- } else {
- uni.showModal({title: '系统提示',content: res.msg,showCancel: false});
- }
- })
- .catch(res=>{
- console.log(res);
- uni.hideLoading();
- uni.showModal({title: '系统提示',content: '加载失败,重新点击尝试!',showCancel: false});
- });
- },
- /**
- * 删除好友
- */
- tapDelete:function(){
- this.utils.showModal("你确定要删除好友?",()=>{
- uni.showLoading({ title: '提交中..'});
- this
- .request
- .post("FriendDel",{usercode:this.usercode})
- .then(res => {
- uni.hideLoading();
- if(res.code == 200) {
- this.utils.Tip("操作成功");
- uni.navigateBack();
- } else {
- uni.showModal({title: '系统提示',content: res.msg,showCancel: false});
- }
- })
- .catch(res=>{
- console.log(res);
- uni.hideLoading();
- uni.showModal({title: '系统提示',content: '加载失败,重新点击尝试!',showCancel: false});
- });
- });
- }
- }
- }
- </script>
|