rkname.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <style lang="scss">
  2. page{background: #ffffff;}
  3. .m-app{width:100vw}
  4. button.sub-btn{width:100%;height:40px;line-height: 40px; background:$ic-appcolor;border-radius:20px;font-size:15px;font-weight:500;color:#ffffff;margin-top: 30px;}
  5. .form-body{width:calc(100% - 24px);background: #ffffff;padding: 0px 12px;}
  6. .form-title{width:100%;text-align: left;font-size: 14px;color:#333333;height:38px;line-height: 38px;}
  7. .form-content{width:100%;border-bottom: 1px solid #f0f0f0;padding-bottom: 10px;}
  8. .form-content image{width: 40px;height: 40px;}
  9. input.form-input{height:38px;width:calc(100% - 50px);margin-left:8px;text-align: left;color:#333333;font-size: 14px;}
  10. .form-msg{font-size: 12px;text-align: left;width:100%;height:30px;line-height: 30px;color:#303033}
  11. </style>
  12. <template>
  13. <view class="m-app">
  14. <form report-submit="true" @submit="formSubmit">
  15. <view class='form-body'>
  16. <view class="form-title">
  17. 修改群聊名称后,将在群内通知其他成员。
  18. </view>
  19. <view class="form-content fx-r">
  20. <image :src="img == '' ? '/static/chat/group_chat.png' : img" mode="aspectFill"></image>
  21. <input class="form-input" type="text" name="name" :value="name"/>
  22. </view>
  23. <view class="form-msg">限4-16个字符,一个汉字为两个字符</view>
  24. <button class="nt sub-btn" formType="submit">确认保存</button>
  25. </view>
  26. </form>
  27. </view>
  28. </template>
  29. <script>
  30. import {mapState,mapMutations} from 'vuex'
  31. export default {
  32. computed: mapState(['user']),
  33. data() {
  34. return {
  35. name : "",
  36. img : "",
  37. groupId : 0
  38. }
  39. },
  40. onLoad(options) {
  41. this.name = options.name || "";
  42. this.img = options.img || "";
  43. this.groupId = options.groupId || 0;
  44. },
  45. methods: {
  46. formSubmit:function(e){
  47. var that = this , formData = e.detail.value;
  48. if(!this.utils.isDefine(formData.name)){
  49. this.utils.Tip("请输入群聊名称");
  50. return;
  51. }
  52. this.utils.loadIng("提交中..")
  53. this
  54. .request
  55. .post("chatGroupEditName",{
  56. groupId : this.groupId,
  57. name : formData.name
  58. })
  59. .then(res=>{
  60. if(res.code == 200) {
  61. this.utils.Tip("修改成功");
  62. setTimeout(function(){ uni.navigateBack();},1000);
  63. }else{
  64. that.utils.Tip(res.msg);
  65. }
  66. }).catch(function(){
  67. that.utils.Tip("网络错误,请稍后尝试");
  68. });
  69. }
  70. },
  71. }
  72. </script>