123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <template>
- <view class="site-wrapper">
- <!-- 筛选框start -->
- <view style="height:90rpx"></view>
- <view class="ding">
- <view class="cu-bar search bg-gray filter-section">
- <view class="search-form round bg-white">
- <text class="cuIcon-search"></text>
- <input class="" @focus="InputFocus" @blur="InputBlur" :adjust-position="false" type="text" confirm-type="search"
- v-model="phoneNumber"></input>
- </view>
- <view class="action">
- <button class="cu-btn bg-blue round" @click="searchAuthList">查询</button>
- </view>
- </view>
- </view>
- <!-- 筛选框end -->
- <!-- 权限管理start -->
- <view class="site-items" style="margin-top:0;height: calc(100vh - 286rpx);">
- <view class="cu-list menu-avatar">
- <view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''" v-for="(item,index) in authList" :key="index"
- @touchstart="ListTouchStart" @touchmove="ListTouchMove" @touchend="ListTouchEnd" :data-target="'move-box-' + index">
- <view class="cu-avatar round lg" style="background-image: url(../../static/auth-icon.jpg);"></view>
- <view class="content">
- <view class="text-grey site-tit">{{item.phone}}</view>
- </view>
- <view class="move">
- <view class="bg-grey" @click.stop="EditItem(item)">编辑</view>
- <view class="bg-red" @click.stop="deleteItem(item)">删除</view>
- </view>
- </view>
- </view>
- <view v-if="!authList.length&&authListRes==1" class="text-center margin-top"> 暂无数据</view>
- </view>
- <!-- 权限管理end-->
- <!-- 新增按钮start -->
- <view class="plus">
- <image src="../../static/plus.png" style="width:100rpx;height:100rpx" @tap="goAddPage(type)"></image>
- </view>
- <!-- 新增按钮end -->
- </view>
- </template>
- <script>
- import json from '../../data/json.js';
- export default {
- data() {
- return {
- phoneNumber: '',
- authListRes: 0,
- authList: [],
- type: '0',
- siteListData: json.siteListData,
- modalName: null,
- listTouchStart: 0,
- listTouchDirection: null,
- CustomBar: this.CustomBar,
- csListArrl: [],
- //左滑默认宽度
- delBtnWidth: 160,
- flag: false
- };
- },
- onLoad: function(option) {
- this.getAuthData()
- },
- methods: {
-
- EditItem(item){
- uni.navigateTo({
- url: '/pages/authAdd/authAdd?phone='+item.phone+'',
-
- });
- },
- deleteItem(item) {
- let deleteT=0;
- uni.showModal({
- title: '确认删除吗?',
- content: '',
- success: function (result) {
- if (result.confirm) {
- this.deleteAuth({
- "phone": item.phone
- });
- } else if (result.cancel) {
- console.log('用户点击取消');
- }
- }.bind(this)
- });
- },
- // 删除请求接口
- async deleteAuth(ming = {}) {
- let res = await this.$myRequest({
- url: 'AuthorityManagement/setDelAuthority',
- data: ming
- })
- if (!res.data.flag) {
- alert('删除失败');
- return;
- }
- this.getAuthData()
-
- return res;
- },
- async getAuthData(ming = {}) {
- const res = await this.$myRequest({
- url: 'AuthorityManagement/getAuthorityList',
- showLoading: true,
- data: ming
- })
- this.authListRes = 1;
- this.authList = res.data.data
- console.log(res.data.data);
- },
- searchAuthList() {
- this.getAuthData({
- "phone": this.phoneNumber
- })
- },
- // 页面跳转
- goAddPage(type) {
- uni.navigateTo({
- url: '/pages/authAdd/authAdd',
- success: res => {},
- fail: () => {},
- complete: () => {}
- });
- },
- InputFocus(e) {
- this.InputBottom = e.detail.height
- },
- InputBlur(e) {
- this.InputBottom = 0
- },
- // ListTouch触摸开始
- ListTouchStart(e) {
- this.listTouchStart = e.touches[0].pageX
- },
- // ListTouch计算方向
- ListTouchMove(e) {
- this.listTouchDirection = e.touches[0].pageX - this.listTouchStart < -60 ? 'left' : 'right'
- },
- // ListTouch计算滚动
- ListTouchEnd(e) {
- if (this.listTouchDirection == 'left') {
- this.modalName = e.currentTarget.dataset.target
- } else {
- this.modalName = null
- }
- this.listTouchDirection = null
- }
- }
- }
- </script>
|