123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296 |
- <template>
- <view class="top">
- <view style="margin: 20px 15px 15px 15px; border: 1px solid #a4a4a4;border-radius: 10px;">
- <u--input v-model="text" placeholder="姓名 / 手机号" prefixIcon="search"
- prefixIconStyle="font-size: 22px;color: #909399" @focus="searchFocus" @blur="searchBlur"
- @input="doSearch()">
- </u--input>
- </view>
- <view v-if="showSearch">
- <u-row v-for="item in groupList" customStyle="margin: 5px 0" @click="toGroupAbPage(item.groupMember)">
- <u-col span="2">
- <view class="demo-layout bg-purple-light">
- <image src="../../static/img/msg/gzqz.png" style="margin-left: 10px;width: 50px;height: 50px;">
- </image>
- </view>
- </u-col>
- <u-col span="9">
- <view class="demo-layout bg-purple">
- <u-text :text="item.groupName" size="14"></u-text>
- </view>
- </u-col>
- </u-row>
- </view>
- <view v-if="showSearch">
- <view style="color: #a4a4a4;padding: 5px;background-color: #ffffff;">部门分类</view>
- <uni-list v-for="item in bmList">
- <uni-list-item :clickable="true" @click="toAbListPage(item.deptId)" :title="item.deptName" />
- </uni-list>
- </view>
- <view v-if="!showSearch" style="border-top: 1px solid #eeeeee;">
- <view class="row uni-flex uni-row" v-for="friend in result">
- <view style="padding: 5rpx 0 0 20rpx" @click="toVisitingCard(friend)">
- <u-text :text="friend.name+' '+friend.phone" size="18" color="#a5a5a5"></u-text>
- </view>
- </view>
- <view style="height: 40px;">
- </view>
- </view>
- <view style="height: 40px;">
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- text: '',
- result: [],
- data: [],
- showSearch: true,
- BaseUrl: this.$BASE_URL,
- list: [],
- qiyes: [{
- id: 1,
- name: '中山大学',
- src: '../../static/img/tab-icon/me-active.png'
- },
- {
- id: 2,
- name: '阿里巴巴',
- src: '../../static/img/tab-icon/me-active.png'
- }
- ],
- stars: [{
- id: 1,
- name: '1',
- src: '../../static/img/tab-icon/me-active.png'
- },
- {
- id: 2,
- name: '2',
- src: '../../static/img/tab-icon/me-active.png'
- }
- ],
- friends: [],
- bmList: [],
- groupList: [],
- isSearch: false,
- searchCount: 0
- }
- },
- onLoad() {
- this.getBmData()
- },
- onShow() {
- this.getBmData()
- this.getabData()
- this.getGcData()
- },
- methods: {
- toVisitingCard(friend) {
- console.log(this.result)
- uni.setStorageSync('data', friend)
- uni.navigateTo({
- url: '/pageA/msg/visitingCard'
- })
- },
- doSearch(value) {
- let that = this
- let count = this.searchCount++
- if (value) {
- this.result = []
- this.data.forEach(i => {
- if (that.isSearch) {
- // setTimeout(() => {
- i.children.forEach(t => {
- if (that.isSearch) {
- var tc = t
- if (that.isZhOrNumber(value) === 'ZH') {
- if (tc.name.indexOf(value) != -1) {
- that.result.push(tc)
- }
- } else if (that.isZhOrNumber(value) === 'NUM') {
- if (value.length >= 2) {
- let zzbds = new RegExp("^" + value + "[0-9]+")
- if (zzbds.test(tc.phone)) {
- that.result.push(tc)
- }
- } else {
- this.result = []
- }
- }
- }
- })
- // }, 10)
- }
- })
- }
- },
- isZhOrNumber(str) {
- //验证是否是汉字
- var pattern = new RegExp("[\u4E00-\u9FA5]+");
- if (pattern.test(str)) {
- return 'ZH'
- }
- //验证是否是数字
- var pattern3 = new RegExp("[0-9]+");
- if (pattern3.test(str)) {
- return 'NUM'
- }
- },
- searchFocus() {
- this.showSearch = false
- this.isSearch = true
- this.result = []
- },
- searchBlur() {
- this.isSearch = false
- this.text = null
- this.showSearch = true
- },
- toAbListPage(deptId) {
- uni.setStorageSync("deptId", deptId)
- this.$goto("abList")
- },
- toGroupAbPage(data) {
- uni.setStorageSync("groupUserCode", data)
- this.$goto("groupAb")
- },
- bindClick(e) {
- console.log('点击item,返回数据' + JSON.stringify(e))
- },
- async getGcData() {
- const {
- data: res
- } = await this.$httpRequest({
- url: '/api/ci/gl?un=' + uni.getStorageSync('userInfo').userName,
- method: 'get',
- })
- if (res.code == 200) {
- this.groupList = res.data
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg
- })
- }
- },
- async getBmData() {
- const {
- data: res
- } = await this.$httpRequest({
- url: '/api/ci/abDepts?un=' + uni.getStorageSync('userInfo').userName + "&oc=" + uni
- .getStorageSync("orgInfo").organizationCode,
- method: 'get',
- })
- if (res.code == 200) {
- this.bmList = res.data
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg
- })
- }
- },
- async getabData() {
- const {
- data: res
- } = await this.$httpRequest({
- url: '/api/ci/ab?un=all',
- method: 'get',
- })
- if (res.code == 200) {
- this.data = res.data
- }
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- page {
- background: #fefefe;
- }
- .row {
- background: white;
- display: flex;
- width: 100%;
- height: 80rpx;
- border-bottom: 1px solid #eeeeee;
- .row_logo {
- width: 20%;
- display: flex;
- align-items: center;
- image {
- width: 80px;
- height: 80px;
- margin: auto;
- border-radius: 5px;
- }
- }
- .row_left {
- height: 100%;
- width: 40%;
- display: flex;
- align-items: center;
- border: {
- bottom: 1px solid #DDDDDD;
- }
- text {
- font-size: 16px;
- font-family: 'syht';
- display: block;
- }
- }
- .row_right {
- height: 100%;
- width: 40%;
- display: flex;
- align-items: center;
- border: {
- bottom: 1px solid #DDDDDD;
- }
- text {
- font-size: 16px;
- font-family: 'syht';
- display: block;
- }
- }
- }
- .row:last-child {
- .row_right {
- border: 0;
- }
- }
- .qu {
- .tip {
- margin: 3px 0;
- font-size: 14px;
- font-family: 'syht';
- text {
- margin-left: 13px;
- }
- }
- }
- </style>
|