remark_name.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <style>
  2. page{background: #ffffff;}
  3. .m-app{width:100vw}
  4. button.sub-btn{width:100%;height:40px;line-height: 40px; background:#2fbec0;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("chatGroupEditRemark",{
  56. groupId : this.groupId,
  57. name : formData.name
  58. })
  59. .then(res=>{
  60. if(res.code == 200) {
  61. this.utils.Tip("修改成功");
  62. uni.$emit('glRkName',{groupId:this.groupId,name:formData.name});
  63. setTimeout(function(){ uni.navigateBack();},1000);
  64. }else{
  65. that.utils.Tip(res.msg);
  66. }
  67. }).catch(function(){
  68. that.utils.Tip("网络错误,请稍后尝试");
  69. });
  70. }
  71. },
  72. }
  73. </script>