topic.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <view>
  3. <view class="btnContain">
  4. <button
  5. v-for="(item,idx) in userType"
  6. @click="onclick(item,idx)"
  7. :class="idx == currentIdx ? 'highlight' : 'not-highlight'"
  8. :style="idx == 0 ? 'text-align:left' : 'text-align:right'"
  9. >
  10. {{item.dictLabel}}
  11. </button>
  12. </view>
  13. <view>
  14. <uni-grid :column="2" :square="false" :highlight="false" >
  15. <uni-grid-item v-for="(item, index) in dataList" :index="index" :key="index" >
  16. <view class="grid-item-box" @click="onMatters(item)">
  17. <text class="text" >{{ item.deptName }}</text>
  18. </view>
  19. </uni-grid-item>
  20. </uni-grid>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import {
  26. getDicts
  27. } from "@/api/system/dict/data.js"
  28. import {
  29. listAll
  30. } from "@/api/handleAffairs/topicType.js"
  31. export default {
  32. data() {
  33. return {
  34. userType: [], // 初始化用户类型为空
  35. dataList: [],
  36. currentIdx:0,
  37. }
  38. },
  39. created() {
  40. this.getdictData()//初始化字典按钮
  41. this.getdataList()//初始化数据
  42. },
  43. methods: {
  44. onMatters(data){
  45. uni.setStorageSync('data', {type:data.deptName,examine:1})
  46. uni.navigateTo({
  47. url: '/pages/handleAffairs/matterAll/matterAll',
  48. });
  49. },
  50. getdataList(data){
  51. let _that = this
  52. if (!data) {
  53. data = {
  54. objectOfHandling: 0,
  55. yesOrNoShow: "0"
  56. }
  57. }
  58. listAll(data).then(res => {
  59. _that.dataList = res.data
  60. })
  61. console.log(_that.dataList)
  62. },
  63. onclick(row,idx) {
  64. this.currentIdx = idx
  65. let data = {
  66. objectOfHandling: row.dictValue,
  67. yesOrNoShow: "0"
  68. }
  69. this.getdataList(data)
  70. },
  71. getdictData() {
  72. let _that = this
  73. getDicts("object_application").then(res => {
  74. _that.userType = res.data
  75. })
  76. },
  77. changeUserType(type) {
  78. this.userType = type
  79. }
  80. },
  81. }
  82. </script>
  83. <style>
  84. /* view {
  85. display: flex;
  86. flex-direction: column;
  87. align-items: center;
  88. justify-content: center;
  89. height: 100vh;
  90. } */
  91. html,body{
  92. background-color: #fff;
  93. }
  94. .btnContain button:nth-child(1){
  95. text-indent: 20%;
  96. text-align:left;
  97. }
  98. .btnContain button:nth-child(2){
  99. text-align:left;
  100. }
  101. .btnContain button:nth-child(1)::after{
  102. content:'';
  103. width: 40%;
  104. height: 94%;
  105. position: absolute;
  106. top: 25%;
  107. left: -2%;
  108. background: url('@/static/images/more/accounter.png') 0 0 no-repeat;
  109. background-size: 100% 100%;
  110. }
  111. .btnContain button:nth-child(2)::after{
  112. content:'';
  113. width: 40%;
  114. height: 94%;
  115. position: absolute;
  116. top: 25%;
  117. left: 20%;
  118. background: url('@/static/images/more/personLegal.png') 0 0 no-repeat;
  119. background-size: 100% 100%;
  120. }
  121. .not-highlight{
  122. color:#000;
  123. }
  124. .highlight{
  125. color:#FF673D;
  126. }
  127. .uni-grid{
  128. flex-wrap:wrap
  129. }
  130. .uni-grid uni-grid-item{
  131. width: 28%;
  132. margin-top: 3%;
  133. margin-left: 4%;
  134. background-color: #fff;
  135. box-shadow: 0px 0px 2px 0px gray;
  136. }
  137. .uni-grid .uni-grid-item{
  138. width: 100% !important;
  139. }
  140. .btnContain{
  141. position: relative;
  142. width: 92%;
  143. display: flex;
  144. height: 20%;
  145. background-color: #fff;
  146. justify-content: space-between;
  147. margin:2% auto auto auto;
  148. padding: 1%;
  149. box-shadow: 0px 0px 2px 0px gray;
  150. }
  151. .btnContain::after{
  152. content: '';
  153. position: absolute;
  154. width: 4rpx;
  155. height: 40%;
  156. left: 50%;
  157. top: 30%;
  158. z-index: 10;
  159. margin: auto;
  160. background-color: #E1E1E1;
  161. }
  162. button {
  163. width: 35%;
  164. border: none;
  165. background-color: #fff;
  166. }
  167. button:after{
  168. border: none;
  169. }
  170. .selected {
  171. background-color: #007bff;
  172. color: #fff;
  173. }
  174. .grid-item-box {
  175. flex: 1;
  176. // position: relative;
  177. /* #ifndef APP-NVUE */
  178. display: flex;
  179. /* #endif */
  180. flex-direction: column;
  181. align-items: center;
  182. justify-content: center;
  183. padding: 15px 0;
  184. }
  185. .grid-item-box-row {
  186. flex: 1;
  187. // position: relative;
  188. /* #ifndef APP-NVUE */
  189. display: flex;
  190. /* #endif */
  191. flex-direction: row;
  192. align-items: center;
  193. justify-content: center;
  194. padding: 15px 0;
  195. }
  196. </style>