123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350 |
- <template>
- <view>
- <view class="content">
- <view :style="{height:statusBarHeight + 'px'}"></view>
- <view class="navbar">
- <view class="left" @click="click_left()">
- <uni-icons type="arrowleft" color="#fff" size="18"></uni-icons>
- </view>
- <view class="right">
- <view class="input_box">
- <view class="input_icon"></view>
- <view class="input_text">
- <input type="text" v-model="search_text" placeholder="搜索" placeholder-style="color:#fff;" />
- </view>
- </view>
- </view>
- <view class="btn" @click="search()">搜索</view>
- </view>
- </view>
- <!-- 占位符 -->
- <view :style="{height: statusBarHeight + 'px'}"></view>
- <view style="height: 93rpx;"></view>
- <view class="tab">
- <view class="item" :class="active == 1?'active':''" @click="change_active(1)">文件</view>
- <view class="item" :class="active == 2?'active':''" @click="change_active(2)">人员</view>
- </view>
- <!-- 搜索列表 -->
- <view class="list" v-if="active == 1">
- <view class="item" v-for="(item,index) in list" :key="index" @click="go_record(item.id)">
- <view class="title">{{item.title}}</view>
- <view class="icon">
- <uni-icons type="arrowright"></uni-icons>
- </view>
- </view>
- </view>
-
- <!-- 搜索人员 -->
- <view class="people_list" v-if="active == 2">
- <view class="item" v-for="(item,index) in people_list" :key="index" @click="go_user_info(item.staff_num)">
- <view class="left">
- <view class="icon">{{item.name.charAt(0)}}</view>
- <view class="text">{{item.name}} {{item.dept_name}} {{item.duty_num}}</view>
- </view>
- <view class="right" @click.stop="phone(item.mobile)">
- <uni-icons type="phone"></uni-icons>
- </view>
- </view>
-
- <view v-if="people_list.length == 0" style="font-size: 32rpx;text-align: center;line-height: 400rpx;">暂无搜索结果
- </view>
- </view>
- </view>
- </template>
- <script>
- import {set_base_url} from '@/common/set_base_url.js'
- export default {
- data() {
- return {
- mine_code: "",
- statusBarHeight: 25,
- // 搜索关键词
- search_text: "",
- // 搜索结果列表
- list: [],
- people_list:[],
- active:1
- };
- },
- onLoad(option) {
- this.mine_code = option.mine_code
- // 获取手机系统信息
- const info = uni.getSystemInfoSync()
- // 设置状态栏高度
- this.statusBarHeight = info.statusBarHeight
- console.log(this.mine_code)
-
- // 根据矿编码切换首页接口不同的请求基础路径
- this.base_url = set_base_url(this.mine_code)
- },
- methods: {
- change_active(index){
- this.active = index
-
- this.search()
- },
- click_left() {
- uni.navigateBack();
- },
- search() {
- uni.showLoading()
-
- if(this.active == 1){
- uni.request({
- url: this.base_url + "/swagger/api/page/v1/getPageList",
- method: "GET",
- header:{
- 'accesskey': "b364b449a18af327867f7edc3431b541"
- },
- data: {
- title: this.search_text,
- departmentId: "",
- pageNumber: 0,
- pageSize: 0
- },
- success: (res) => {
- console.log(res)
- uni.hideLoading()
-
- this.list = res.data.data
- }
- })
- }else if(this.active == 2){
- uni.request({
- url: this.base_url + "/user/search",
- method: "POST",
- header:{
- 'Authorization' : uni.getStorageSync('token_type') +' '+uni.getStorageSync('Authorization'),
- 'accesskey': "b364b449a18af327867f7edc3431b541"
- },
- data: {
- content: this.search_text
- },
- success: (res) => {
- console.log(res)
- uni.hideLoading()
-
- this.people_list = res.data.data
- }
- })
- }
-
- },
- // 打开二维码页面
- go_record(id) {
- uni.navigateTo({
- url:"../../index/record/record?pageId=" + id + "&mine_code=" + this.mine_code,
- })
- },
-
- go_user_info(staff_num) {
- if(this.mine_code == 'ningmeijituan'){
- uni.navigateTo({
- url:"../../origanization/communication/origanization/personal_information/personal_information_peixun?staff_num=" + staff_num
- })
- }else{
- uni.navigateTo({
- url:"../../origanization/communication/origanization/personal_information/personal_information_info?staff_num=" + staff_num
- })
- }
-
- },
- phone(mobile) {
- if (mobile != null) {
- uni.makePhoneCall({
- phoneNumber: mobile
- });
- }else{
- uni.showToast({
- icon:"none",
- title:"未绑定手机号"
- })
- }
- },
- }
- }
- </script>
- <style lang="scss">
- .content {
- position: fixed;
- top: 0;
- left: 0;
- background-color: #009FE8;
- z-index: 999;
- }
- .navbar {
- width: 750rpx;
- box-sizing: border-box;
- padding-left: 31rpx;
- padding-right: 26rpx;
- padding-top: 14rpx;
- padding-bottom: 14rpx;
- display: flex;
- // justify-content: space-between;
- .left {
- width: 42rpx;
- line-height: 65rpx;
- margin-right: 15rpx;
- }
- .right {
- width: 500rpx;
- height: 65rpx;
- background: rgba(255, 255, 255, 0.2);
- border-radius: 33rpx;
- .input_box {
- display: flex;
- .input_icon {
- margin-left: 43rpx;
- margin-top: 16rpx;
- width: 34rpx;
- height: 34rpx;
- background-image: url(icon/search.png);
- background-size: cover;
- background-repeat: no-repeat;
- }
- .input_text {
- margin-left: 19rpx;
- font-size: 24rpx;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #FFFFFF;
- line-height: 65rpx;
- input {
- font-size: 24rpx;
- height: 65rpx;
- line-height: 65rpx;
- }
- }
- }
- }
- .btn {
- margin-left: 20rpx;
- width: 120rpx;
- text-align: center;
- height: 65rpx;
- line-height: 65rpx;
- background: rgba(255, 255, 255, 0.2);
- border-radius: 33rpx;
- font-size: 24rpx;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #FFFFFF;
- }
- }
- .tab{
- background-color: #FFFFFF;
- z-index: 999;
- position: fixed;
- top: 1;
- left: 0;
-
- width: 750rpx;
- box-sizing: border-box;
- padding: 20rpx 25rpx;
- display: flex;
-
- .item{
- box-sizing: border-box;
- padding: 10rpx 30rpx;
-
- border-radius: 10rpx;
- margin-right: 20rpx;
- font-size: 26rpx;
-
- border: 1rpx solid #009fe8;
- color: #009fe8;
- }
- .item.active{
- background-color: #009fe8;
- color: #FFFFFF;
- }
- }
- .list {
- margin-top: 60rpx;
- box-sizing: border-box;
- padding: 10rpx 25rpx;
- .item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- box-sizing: border-box;
- padding: 35rpx 0;
- border-bottom: 1rpx solid #F4F4F4;
- .title {
- font-size: 32rpx;
- }
- .icon {}
- }
- }
- .people_list {
- margin-top: 60rpx;
- box-sizing: border-box;
- padding: 10rpx 25rpx;
-
- .item {
- height: 110rpx;
-
- display: flex;
- justify-content: space-between;
- align-items: center;
-
- border-bottom: 1rpx solid #F3F8F7;
-
- .left {
- display: flex;
- align-items: center;
- .icon {
- width: 35rpx;
- height: 35rpx;
- text-align: center;
- line-height: 35rpx;
- border-radius: 50%;
- border: 1rpx solid #00A1E9;
-
- font-size: 24rpx;
- color: #00A1E9;
- }
-
- .text {
- margin-left: 18rpx;
- font-size: 30rpx;
-
- }
- }
-
- .right {}
- }
-
- }
- </style>
|