123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- <template>
- <view class="page">
- <uni-status-bar></uni-status-bar>
- <view class="header">
- <view class="input-view">
- <image style="width: 16px;height: 16px;" src="/static/img/search.png" mode="widthFix"></image>
- <input class="input" type="text" placeholder="搜索" @input="handleInput" :focus="true" />
- </view>
- <view class="" @click="toBack">
- <text>取消</text>
- </view>
- </view>
- <view class="search-main" v-if="keyword">
- <view class="search-main-errtitle" v-if="hasNoData" >无搜索结果</view>
- <view class="uni-list">
- <view class="uni-list-cell" hover-class="none" v-for="(item,index) of list" @tap="handleClick(item)"
- :key="index">
- <view class="uni-media-list">
- <view class="uni-media-list-logo">
- <image :src="staticPhoto + item.photo" :lazy-load="true"></image>
- </view>
- <view class="uni-media-list-body">
- <view class="uni-list-cell-navigate">{{item.name}}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import uniIcon from '../../components/uni-ui/uni-icon/uni-icon.vue';
- import _get from '../../common/_get';
- import _hook from '../../common/_hook';
- import _data from '../../common/_data';
- import uniStatusBar from '@/components/uni-ui/uni-status-bar/uni-status-bar.vue'
- export default {
- components: {
- uniIcon,
- uniStatusBar
- },
- data() {
- return {
- is_type: 0,
- keyword: '',
- list: [],
- timer: null,
- my_data: {}
- }
- },
- onShow() {
- _hook.routeSonHook();
- this.my_data = _data.data('user_info');
- console.log(this.my_data,'this.my_data');
- },
- computed: {
- hasNoData() {
- return !this.list.length;
- },
- staticPhoto() {
- return _data.staticPhoto();
- },
- },
- watch: {
- keyword(new_val, old_val) {
- let _this = this;
- if (_this.timer) {
- clearTimeout(_this.timer);
- }
- if (!new_val) {
- _this.list = [];
- return
- }
- _this.timer = setTimeout(() => {
- _this.$httpSend({
- path: '/im/get/searchGroup',
- data: {
- group_id: new_val
- },
- success(res) {
- console.log(res,'res');
- _this.list = res.map(item => {
- item.photo = '/group_photo/36F21FB48146249A044B7547C255A412/90.jpg'
- return item
- });
- // _this.is_type = data.is_type;
- }
- });
- }, 100);
- }
- },
- methods: {
- toBack() {
- uni.navigateBack({
- })
- },
- handleInput(e) {
- this.keyword = e.detail.value
- },
- handleClick(item) {
- // uni.navigateTo({
- // url: ('../details/index?user_id=' + id + '&is_type=' + this.is_type),
- // });
- let _this = this
- console.log(item,'qun');
- uni.showModal({
- title:'提示',
- content: '是否立即申请加入群聊?',
- complete(res) {
- if(res.confirm) {
-
- let arr = [0]
- arr[0] =_this.my_data.id
- console.log(item.main_id,item.list_id,arr);
- let req = {
- main_id: item.main_id,
- list_id: item.list_id,
- users: arr,
- }
- console.log(req,'req');
- _this.$httpSend({
- path: '/im/Message/addChats',
- data: req,
- success(res) {
- uni.showModal({
- content: '已经申请加入群聊,请耐心等待群管理审核',
- showCancel: false,
- });
- },
- });
- // let params = {
- // // user_id: _this.my_data.id,
- // action: 'group_add',
- // list_id: item.list_id,
- // type: 1,
- // // add_type: "scan"
- // };
- // _get.groupAdd(params,function (res) {
- // uni.showModal({
- // content: '已经申请加入群聊,请耐心等待群管理审核',
- // showCancel: false,
- // });
- // },function (ret) {
- // uni.showToast({
- // title:ret.msg,
- // duration:2000,
- // icon:'none'
- // })
- // })
- }
- }
- })
- }
- }
- }
- </script>
- <style>
- page {
- background: #fff;
- }
- .search-main {
- height: 100%;
- padding-bottom: 20upx;
- background-color: #fff;
- overflow: hidden;
- }
- .search-main-errtitle {
- width: 100%;
- height: 92upx;
- line-height: 92upx;
- font-size: 32upx;
- padding: 0 20upx;
- border-bottom: 1px solid #e5e5e5;
- }
- .header {
- display: flex;
- flex-direction: row;
- padding: 10px 15px;
- align-items: center;
- }
- .input-view {
- display: flex;
- align-items: center;
- flex-direction: row;
- background-color: #f7f7f7;
- height: 36px;
- border-radius: 18px;
- padding: 0 10px;
- flex: 1;
- margin-right: 10rpx;
- }
- .input {
- flex: 1;
- padding: 0 5px;
- height: 24px;
- line-height: 24px;
- font-size: 14px;
- }
- </style>
|