index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <template>
  2. <div class="container">
  3. <div class="box-item">
  4. <div class="item-title">
  5. <div class="text-lf">群聊成员</div>
  6. <div class="text-ri" @click="checkMember">查看8名群成员<svg-icon class="item-icon" name="right1"/></div>
  7. </div>
  8. <div class="member-box">
  9. <div class="member-li" v-for="item in 8">
  10. <van-image class="member-img" round src="https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg"/>
  11. <div>希希子</div>
  12. </div>
  13. <div class="member-li" @click="addMember">
  14. <div class="add">
  15. <svg-icon class="add-icon" name="add3" />
  16. </div>
  17. <div>邀请</div>
  18. </div>
  19. </div>
  20. </div>
  21. <van-cell-group class="user-bar-list">
  22. <van-cell
  23. title="群聊名称"
  24. :value="information.name"
  25. is-link @click="changeUpdateName(1)"
  26. ></van-cell>
  27. <van-cell title="群二维码" :value="information.qrCode" is-link @click="goQrcode">
  28. <template #value>
  29. <svg-icon class="qrcode-icon" name="qrcode"/>
  30. </template>
  31. </van-cell>
  32. <van-cell
  33. title="群公告"
  34. :value="information.notice" @click="showNotice = true"
  35. is-link
  36. ></van-cell>
  37. <van-cell
  38. title="我在群里的昵称" class="user-bar-list-last" @click="changeUpdateName(2)"
  39. :value="information.nickname"
  40. is-link
  41. ></van-cell>
  42. </van-cell-group>
  43. <van-cell-group class="user-bar-list">
  44. <van-cell center title="消息免打扰">
  45. <template #right-icon>
  46. <van-switch v-model="disturb" active-color="#4765DD" inactive-color="#D9D9D9"/>
  47. </template>
  48. </van-cell>
  49. <van-cell center title="置顶聊天" class="user-bar-list-last">
  50. <template #right-icon>
  51. <van-switch v-model="topStory" active-color="#4765DD " inactive-color="#D9D9D9 "/>
  52. </template>
  53. </van-cell>
  54. </van-cell-group>
  55. <van-cell-group class="user-bar-list">
  56. <van-cell class="user-bar-list-last" title="查看聊天记录" is-link @click="goChatDetail"></van-cell>
  57. </van-cell-group>
  58. <div class="exit" @click="showExit = true">退出群聊</div>
  59. <!-- 修改信息弹框 -->
  60. <van-popup v-model:show="showUpdateName" :style="{ borderRadius:'25px' }">
  61. <div class="pop-content-password">
  62. <div class="pop-title-password">{{type == 1?'修改群聊名称':'修改昵称'}}</div>
  63. <van-field v-model="newName" class="pop-input" placeholder="请输入名称" />
  64. <div class="pop-btn-password">
  65. <van-button type="default" class="btn-password cancel" @click="cancel">{{ $t('wallet.Cancel') }}</van-button>
  66. <van-button type="default" class="btn-password confirm" @click="popConfirm" :disabled="isDisabledConfirm">{{ $t('wallet.Sure') }}</van-button>
  67. </div>
  68. </div>
  69. </van-popup>
  70. <!-- 公告弹框 -->
  71. <van-popup v-model:show="showNotice" position="bottom" round style="height:280px">
  72. <div class="pop-content">
  73. <div class="pop-title">
  74. <div @click="showNotice = false">取消</div>
  75. <div class="save" @click="changeUpdateNotice">保存</div>
  76. </div>
  77. <van-field class="textarea-item"
  78. v-model="newNotice"
  79. rows="2"
  80. autosize
  81. type="textarea"
  82. placeholder="请输入公告内容..."
  83. show-word-limit
  84. />
  85. </div>
  86. </van-popup>
  87. <!-- 退出群聊弹框 -->
  88. <van-popup v-model:show="showExit" :style="{ borderRadius:'25px' }">
  89. <div class="pop-content-password">
  90. <div class="pop-title-password">确定要退出群聊吗?</div>
  91. <div class="pop-btn-password" style="margin-top: 50px;">
  92. <van-button type="default" class="btn-password cancel" @click="showExit = false">{{ $t('wallet.Cancel') }}</van-button>
  93. <van-button type="default" class="btn-password confirm" @click="popConfirm">{{ $t('wallet.Sure') }}</van-button>
  94. </div>
  95. </div>
  96. </van-popup>
  97. </div>
  98. </template>
  99. <script setup>
  100. import { useRouter,useRoute } from 'vue-router'
  101. import { reactive } from 'vue'
  102. import { showNotify } from 'vant';
  103. const router = useRouter();
  104. const information = reactive({
  105. name:'群聊',
  106. qrCode:'',
  107. notice:'367657',
  108. nickname:'vs大放送'
  109. })
  110. const type = ref(1);//1:修改群聊名称 2:修改我的群昵称
  111. const disturb = ref(true);
  112. const topStory = ref(false);
  113. const showUpdateName = ref(false);
  114. const isDisabledConfirm = ref(false);
  115. const showNotice = ref(false);
  116. const showExit = ref(false);
  117. const newName = ref('');
  118. const newNotice = ref('');
  119. const changeUpdateName = (val) => {
  120. type.value = val;
  121. newName.value = val == 1?information.name:information.nickname
  122. showUpdateName.value = true;
  123. }
  124. // 群聊名称取消
  125. const cancel = () => {
  126. showUpdateName.value = false;
  127. }
  128. // 群聊名称确定
  129. const popConfirm = () => {
  130. if(!newName.value){
  131. showNotify({ type: 'warning', message: '请输入名称' });
  132. return;
  133. }
  134. isDisabledConfirm.value = true;
  135. setTimeout(() => {
  136. isDisabledConfirm.value = false;
  137. showUpdateName.value = false;
  138. if(type.value == 1){
  139. information.name = newName.value;
  140. }else{
  141. information.nickname = newName.value;
  142. }
  143. }, 1000);
  144. }
  145. // 群公告
  146. const changeUpdateNotice = () => {
  147. if(!newNotice.value){
  148. showNotify({ type: 'warning', message: '请输入公告内容' });
  149. return;
  150. }
  151. setTimeout(() => {
  152. showNotice.value = false;
  153. information.notice = newNotice.value;
  154. }, 500);
  155. }
  156. // 跳转群二维码页面
  157. const goQrcode = () => {
  158. router.push('qrcode')
  159. }
  160. // 跳转聊天记录
  161. const goChatDetail = () => {
  162. router.push('chatLog')
  163. }
  164. // 跳转添加成员页面
  165. const addMember = () => {
  166. router.push('addMember')
  167. }
  168. // 跳转查看成员页面
  169. const checkMember = () => {
  170. router.push('checkMember')
  171. }
  172. </script>
  173. <style lang="less" scoped>
  174. .container{
  175. margin: 16px;
  176. .box-item{
  177. background-color: #fff;
  178. border-radius: 12px;
  179. padding: 12px 16px 0;
  180. margin-bottom: 16px;
  181. .item-title{
  182. display: flex;
  183. align-items: center;
  184. justify-content: space-between;
  185. font-family: PingFang SC, PingFang SC;
  186. font-weight: 400;
  187. font-size: 12px;
  188. color: #8D8D8D;
  189. .text-lf{
  190. font-weight: 500;
  191. font-size: 15px;
  192. color: #000000;
  193. }
  194. .text-ri{
  195. display: flex;
  196. align-items: center;
  197. .item-icon{
  198. width: 20px;
  199. height: 20px;
  200. color: #969799;
  201. }
  202. }
  203. }
  204. .member-box{
  205. margin-top: 12px;
  206. flex-wrap: wrap;
  207. display: flex;
  208. .member-li{
  209. width: calc(100% / 5);
  210. display: flex;
  211. flex-direction: column;
  212. font-family: PingFang SC, PingFang SC;
  213. font-weight: 400;
  214. font-size: 10px;
  215. color: #000000;
  216. padding-bottom: 17px;
  217. align-items: center;
  218. .member-img{
  219. width: 44px;
  220. height: 44px;
  221. margin-bottom: 4px;
  222. flex-shrink: 0;
  223. }
  224. .add{
  225. width: 44px;
  226. height: 44px;
  227. margin-bottom: 4px;
  228. border-radius: 22px;
  229. background: #F2F2F2;
  230. position: relative;
  231. .add-icon{
  232. width: 20px;
  233. height: 20px;
  234. position: absolute;
  235. top:50%;
  236. left: 50%;
  237. transform: translate(-50%,-50%);
  238. }
  239. }
  240. }
  241. }
  242. }
  243. .user-bar-list{
  244. background-color: #fff;
  245. border-radius: 12px;
  246. overflow: hidden;
  247. margin-bottom: 16px;
  248. .van-cell {
  249. // height: 44px;
  250. background: @bg-color1;
  251. border-bottom: 1px solid @bg-color1;
  252. font-size: 15px;
  253. &::after {
  254. border-bottom: 1px solid #f2f2f2;
  255. }
  256. }
  257. :deep(.van-cell__title){
  258. font-family: PingFang SC, PingFang SC;
  259. font-weight: 500 ;
  260. font-size: 15px;
  261. color: #000000;
  262. }
  263. :deep(.van-cell__value){
  264. font-family: PingFang SC, PingFang SC;
  265. font-weight: 400;
  266. font-size: 15px;
  267. color: #8D8D8D;
  268. }
  269. .user-bar-list-last::after {
  270. border-bottom: 0;
  271. }
  272. .qrcode-icon{
  273. width: 24px;
  274. height: 24px;
  275. }
  276. }
  277. .exit{
  278. height: 44px;
  279. background-color: #fff;
  280. border-radius: 12px;
  281. font-family: PingFang SC, PingFang SC;
  282. font-weight: 500;
  283. font-size: 15px;
  284. color: #FF0000;
  285. text-align: center;
  286. line-height: 44px;
  287. }
  288. .pop-content-password{
  289. padding: 27px 35px 25px 34px;
  290. .pop-title-password{
  291. font-family: PingFang SC, PingFang SC;
  292. font-weight: 500;
  293. font-size: 17px;
  294. color: #000000;
  295. text-align: center;
  296. }
  297. .pop-input{
  298. background: #F2F2F2;
  299. border-radius: 8px;
  300. height: 40px;
  301. margin: 21px 0 31px;
  302. }
  303. .pop-btn-password{
  304. display: flex;
  305. justify-content: center;
  306. .btn-password{
  307. width: 83px;
  308. height: 29px;
  309. line-height: 29px;
  310. padding: 5px 0 !important;
  311. border-radius: 6px;
  312. font-family: PingFang SC, PingFang SC;
  313. font-weight: 400;
  314. font-size: 15px;
  315. box-sizing:border-box;
  316. }
  317. .cancel{
  318. margin-right: 17px !important;
  319. border: 1px solid #D8D8D8;
  320. color: #000 !important;
  321. }
  322. .confirm{
  323. background: @theme-color1;
  324. color: #FFF;
  325. font-weight: 500;
  326. border: none !important;
  327. }
  328. }
  329. }
  330. :deep(.van-popup--center) {
  331. margin: 0 40px !important;
  332. width: auto !important;
  333. }
  334. .pop-content{
  335. background: #F7F8FA;
  336. height: 280px;
  337. .pop-title{
  338. background: #fff;
  339. padding: 0 20px;
  340. height: 48px;
  341. display: flex;
  342. align-items: center;
  343. justify-content: space-between;
  344. box-sizing: border-box;
  345. font-family: PingFang SC, PingFang SC;
  346. font-weight: 400;
  347. font-size: 15px;
  348. color: #4F4F4F;
  349. .save{
  350. font-weight: 500;
  351. color: #4765DD;
  352. }
  353. }
  354. .textarea-item{
  355. background: #F7F8FA !important;
  356. :deep(.van-cell__value){
  357. font-weight: 400 !important;
  358. font-size: 15px !important;
  359. }
  360. }
  361. .textarea-item :deep(textarea::placeholder) {
  362. font-family: PingFang SC, PingFang SC;
  363. font-weight: 400;
  364. font-size: 15px;
  365. color: #8D8D8D;
  366. }
  367. }
  368. }
  369. </style>