123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- <template>
- <div class="chat-list">
- <div class="top-search">
- <a class="meechat-icon" href="https://www.mee.chat" target="_blank"></a>
- <!-- <input type="text" class="search-wrap" @input="searchUser($event, sessionList)" @blur="handleBlur" v-focus v-if="searchShow"> -->
- <!-- <input type="text" class="search-wrap" @focus="toSearch" @click="toSearch" v-if="searchShow"> -->
- <div class="search-tips search-wrap" @click="toSearch">
- <i class="el-icon-search"></i>{{$t('public.searchHotGroup')}}
- </div>
- <router-link class="add-icon" to="/invite/1"></router-link>
- </div>
- <div class="pwa-guide" id="btnPwa" style="display:none">
- <span>{{$t('public.installPwa')}}</span>
- <div class="btn-close">
- <i class="el-icon-close" @click.stop="closePwaGuide()"></i>
- </div>
- </div>
- <div class="chat-list pub-scroll-box">
- <template v-if="!isSearch">
- <session-item
- v-for="(item, index) in sessionList"
- :key="index"
- :item="item">
- </session-item>
- </template>
- <template v-else>
- <session-item
- v-for="(item, index) in searchList"
- :key="index"
- :item="item">
- </session-item>
- </template>
- </div>
- </div>
- </template>
- <script>
- import { mapState, mapMutations } from 'vuex'
- import sessionItem from '@/components/panel/sessionItem'
- import { searchUserMixin } from '@/mixins'
- export default {
- name: 'chatList',
- mixins: [searchUserMixin],
- components: {
- sessionItem
- },
- data () {
- return {
- searchShow: false
- }
- },
- computed: {
- ...mapState({
- sessionList: state => state.chat.sessionList,
- userInfo: state => state.userInfo
- })
- },
- methods: {
- ...mapMutations(['clearHash']),
- handleBlur (e) {
- let val = e.target.value
- if (!val) {
- this.searchShow = false
- }
- },
- toSearch () {
- this.$router.push({ path: `/search` })
- },
- closePwaGuide () {
- let btnPwa = document.getElementById('btnPwa')
- btnPwa.style.display = 'none'
- }
- },
- created () {
- this.$store.dispatch('getSessionList')
- if (this.userInfo && this.userInfo.user_id) this.$store.dispatch('getUserInfo')
- this.$store.commit('setUserId', localStorage.getItem('user_id'))
- },
- mounted () {
- this.clearHash()
- }
- }
- </script>
- <style lang="scss" scoped>
- .chat-list{
- background-color: #ffffff;
- overflow-x: hidden;
- }
- .top-search{
- height: px2rem(88);
- background-color: #f2f2f2;
- display: flex;
- align-items: center;
- > i{
- margin: 0 px2rem(20);
- }
- .search-wrap{
- flex: 1;
- background-color: #ffffff;
- border-radius: 4px;
- border: 1px solid #eeeeee;
- height: px2rem(60);
- line-height: px2rem(60);
- box-sizing: border-box;
- font-size: px2rem(28);
- }
- input{
- padding-left: px2rem(10);
- font-size: px2rem(28);
- color: #666666;
- }
- }
- .pwa-guide{
- position: relative;
- height: px2rem(81);
- line-height: px2rem(81);
- color: #438aff;
- font-size: px2rem(30);
- text-align: center;
- &::after{
- content: "";
- position: absolute;
- bottom: 0;
- left: 0;
- right: 0;
- border-bottom: 1px solid #d8d8d8;
- transform: scaleY(0.5);
- }
- .btn-close{
- position: absolute;
- top: 0;
- right: 0;
- width: px2rem(75);
- height: 100%;
- color: #999;
- }
- }
- .meechat-icon{
- display: inline-block;
- margin: 0 px2rem(20);
- background: url('../../../assets/h5/meechat-logo.png') 0 0 / 100% no-repeat;
- width: px2rem(42);
- height: px2rem(39);
- }
- .add-icon{
- background: url('../../../assets/more-icon.png');
- width: px2rem(42);
- height: px2rem(42);
- margin: 0 px2rem(20);
- background-size: 100%;
- }
- .search-tips{
- color: #8e8e93;
- i{
- display: inline-block;
- vertical-align: middle;
- margin: 0 px2rem(6) 0 px2rem(27);
- font-size: px2rem(26);
- }
- }
- </style>
|