role.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <view class="tabPage" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='角色' :showback="false" bgColor='transparent'></cus-header>
  4. <template v-if="list.length">
  5. <div class="query adfacjb">
  6. <div class="ql adfac">
  7. <image src="http://106.54.209.120:8188/static/query_mini.png"></image>
  8. <input type="text" placeholder="搜索" placeholder-class="ph">
  9. </div>
  10. <div class="qr" @tap="addRole"> + 新增角色</div>
  11. </div>
  12. <div class="list" :style="{'height':'calc(100vh - '+(mt+156)+'px)'}">
  13. <u-swipe-action>
  14. <u-swipe-action-item v-for="(item, index) in list" :key="index"
  15. :options="options" @click="e=>deleteRole(item,e)" :ref="'swipeAction' + index" :threshold="5"
  16. >
  17. <view class="swipe-action u-border-top u-border-bottom">
  18. <view class="swipe-action__content">
  19. <div class="l_item adfacjb">
  20. <div class="li_l adfac">
  21. <image :src="'http://106.54.209.120:8188/static/role_avatar0.png'"></image>
  22. <div class="lil_info">
  23. <p>{{'词语接龙'}}</p>
  24. <div class="tip">
  25. <u--text :lines="2" :text="'擅长词语接龙,规范词汇,助你锻炼词汇量与反应能力'" size="24rpx" color="#A6A6A6" :bold="true" lineHeight="40rpx"></u--text>
  26. </div>
  27. </div>
  28. </div>
  29. <div class="li_r">配置到设备</div>
  30. </div>
  31. </view>
  32. </view>
  33. </u-swipe-action-item>
  34. </u-swipe-action>
  35. </div>
  36. </template>
  37. <template v-else>
  38. <div class="empty adffcacjc" :style="{'height':'calc(100vh - '+(mt+106)+'px)'}">
  39. <image src="http://106.54.209.120:8188/static/empty_device.png"></image>
  40. <p>请先绑定设备</p>
  41. <div class="zt_btn" @tap="addDevice"> + 添加新设备</div>
  42. </div>
  43. </template>
  44. <cus-tabbar :tabbarIndex="1"></cus-tabbar>
  45. <bind-device ref="bdRef"></bind-device>
  46. </view>
  47. </template>
  48. <script>
  49. import cusTabbar from '@/components/CusTabbar/index.vue'
  50. import bindDevice from '@/components/bindDevice/index.vue'
  51. export default {
  52. components:{
  53. cusTabbar,
  54. bindDevice
  55. },
  56. data(){
  57. return {
  58. list:[1,1],
  59. options: [{
  60. text: '删除',
  61. style: {
  62. backgroundColor: '#f56c6c'
  63. }
  64. }],
  65. }
  66. },
  67. methods:{
  68. addDevice(){
  69. this.$refs.bdRef.show = true;
  70. },
  71. addRole(){
  72. uni.navigateTo({
  73. url:'/pagesRole/addRole'
  74. })
  75. },
  76. deleteRole(item,e){
  77. console.log(e,item);
  78. uni.showModal({
  79. content:'删除角色设备将自动解绑需重新添加,您确定删除吗?',
  80. success: (res) => {
  81. if(res.confirm){
  82. this.list.forEach((d, i) => {
  83. this.$refs['swipeAction' + i][0].closeHandler();
  84. })
  85. }
  86. }
  87. })
  88. }
  89. }
  90. }
  91. </script>
  92. <style>
  93. .u-swipe-action-item__right__button__wrapper {
  94. background: #F55454 !important;
  95. font-size: 28rpx;
  96. font-weight: 400;
  97. color: #FFFFFF;
  98. letter-spacing: 2rpx;
  99. }
  100. .swipe-action {
  101. width: 100%;
  102. }
  103. .u-swipe-action {
  104. z-index: 100 !important;
  105. }
  106. </style>
  107. <style scoped lang="less">
  108. ::v-deep .list .u-swipe-action-item{
  109. margin-top: 60rpx;
  110. }
  111. ::v-deep .list .swipe-action{
  112. border: none !important;
  113. }
  114. .tabPage{
  115. background: #FFFFFF;
  116. padding-bottom: 192rpx;
  117. box-sizing: border-box;
  118. .query{
  119. margin-top: 20rpx;
  120. width: 100%;
  121. padding-left: 30rpx;
  122. box-sizing: border-box;
  123. .ql{
  124. width: calc(100% - 230rpx);
  125. height: 80rpx;
  126. background: #F6F6F8;
  127. border-radius: 40rpx;
  128. padding: 26rpx 36rpx;
  129. box-sizing: border-box;
  130. image{
  131. width: 28rpx;
  132. height: 28rpx;
  133. }
  134. input{
  135. font-family: PingFangSC, PingFang SC;
  136. font-weight: 400;
  137. font-size: 26rpx;
  138. color: #222222;
  139. line-height: 40rpx;
  140. padding-left: 20rpx;
  141. }
  142. }
  143. .qr{
  144. width: 204rpx;
  145. height: 80rpx;
  146. background: #D9F159;
  147. border-radius: 45rpx 0rpx 0rpx 45rpx;
  148. font-family: PingFang-SC, PingFang-SC;
  149. font-weight: bold;
  150. font-size: 28rpx;
  151. color: #111111;
  152. line-height: 80rpx;
  153. text-align: center;
  154. }
  155. }
  156. .list{
  157. padding: 0 30rpx;
  158. overflow-y: auto;
  159. .l_item{
  160. width: 100%;
  161. .li_l{
  162. width: calc(100% - 200rpx);
  163. image{
  164. width: 116rpx;
  165. height: 116rpx;
  166. }
  167. .lil_info{
  168. width: calc(100% - 116rpx);
  169. padding-left: 23rpx;
  170. p{
  171. font-family: PingFang-SC, PingFang-SC;
  172. font-weight: bold;
  173. font-size: 32rpx;
  174. color: #111111;
  175. line-height: 32rpx;
  176. margin-bottom: 16rpx;
  177. }
  178. }
  179. }
  180. .li_r{
  181. width: 160rpx;
  182. height: 64rpx;
  183. background: #D9F159;
  184. border-radius: 16rpx;
  185. font-family: PingFangSC, PingFang SC;
  186. font-weight: 400;
  187. font-size: 24rpx;
  188. color: #111111;
  189. line-height: 64rpx;
  190. text-align: center;
  191. letter-spacing: 2rpx;
  192. }
  193. }
  194. }
  195. .empty{
  196. image{
  197. width: 64rpx;
  198. height: 66rpx;
  199. }
  200. p{
  201. font-family: PingFangSC, PingFang SC;
  202. font-weight: 400;
  203. font-size: 30rpx;
  204. color: #A6A6A6;
  205. line-height: 42rpx;
  206. text-align: center;
  207. margin-top: 30rpx;
  208. }
  209. .zt_btn{
  210. width: calc(100% - 140rpx);
  211. margin: 230rpx 70rpx 0;
  212. }
  213. }
  214. .ph{
  215. color: #A6A6A6;
  216. }
  217. }
  218. </style>