nationalregionalCountryInformaions.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <template>
  2. <view class="nationalregionalCountryInformaions">
  3. <!-- 头部 -->
  4. <u-navbar back-icon-color="#fff" :height="50" :is-back="true" :background="{background:'#1777FE'}"
  5. :back-text-style="{color:'#fff'}" :border-bottom="true" title-color="#fff" :custom-back="back">
  6. <view class="slot-wrap">
  7. <u-search :placeholder="placeholder" v-model="keyword" :show-action="false" bg-color="#fff"
  8. @change="getKeyWord" @search="searchData"></u-search>
  9. <image class="icon" src="../../../static/checkbig.png" mode="widthFix" @click="showDialog"></image>
  10. </view>
  11. </u-navbar>
  12. <!-- 字母选择 -->
  13. <view class="tabABC">
  14. <view class="abcitem" v-for="(abcitem,abcindex) in ABCList" :key="abcindex" @click="selectBy('abc',abcitem)"
  15. :class="{active:abcIndex==abcitem}">{{abcitem}}</view>
  16. </view>
  17. <view class="dataList">
  18. <view class="listitem" v-for="(listitem,listindex) in countryList" :key="listindex">
  19. <view class="listTitle">{{listitem.letter}}</view>
  20. <view class="listDataList">
  21. <view class="sonlistitem" v-for="(sonlistitem,sonslistindex) in listitem.data"
  22. @click="showDetail(sonlistitem)">
  23. <view class="sonlistitem">
  24. <view class="thumb">
  25. <image class="flag" :src="websiteUrl+sonlistitem.nationalFlag" mode="widthFix"></image>
  26. </view>
  27. <!-- <view class="thumb"><image :src="'/api/file/pub/' + sonlistitem.nationalFlag" mode="widthFix"></image></view> -->
  28. <view class="title">{{sonlistitem.committeeName}}</view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="nodata" v-if="countryList.length==0" style="text-align: center;margin-top: 120upx;">
  34. <view class="imgBox" style="height:600upx;margin-bottom:60upx">
  35. <image src="../../../static/img/public/7.png" style="width: 80%;margin:0 10%" mode="widthFix">
  36. </image>
  37. </view>
  38. <text style="font-size: 30upx;color:#ccc">{{$t('common.Nodata')}}</text>
  39. </view>
  40. <u-toast ref="uToast" />
  41. </view>
  42. <!-- 区域选择 -->
  43. <u-popup v-model="showDia" mode="right" border-radius="20" height="50%" width="80%">
  44. <view class="contentDom">
  45. <view class="selecttitle">{{$t('common.Screening')}}</view>
  46. <view class="zone">{{$t('common.Region')}}</view>
  47. <view class="zoneList">
  48. <view class="zoneitem" v-for="(zoneitem,zoneindex) in zoneList" :key="zoneitem.id"
  49. :class="{active:zoneIndex==zoneitem.id}" @click="setZone(zoneitem,zoneindex)">{{zoneitem.label}}
  50. </view>
  51. </view>
  52. <view class="btn">
  53. <view class="reset" :class="{active:btnIndex==0}" @click="selectOpt(0)">{{$t('common.reset')}}
  54. </view>
  55. <view class="submi" :class="{active:btnIndex==1}" @click="selectOpt(1)">{{$t('common.submit')}}
  56. </view>
  57. </view>
  58. </view>
  59. </u-popup>
  60. <!-- 返回顶部 -->
  61. <rf-back-top :scrollTop="scrollTop"></rf-back-top>
  62. </view>
  63. </template>
  64. <script>
  65. import rfSearchBar from '@/components/rf-search-bar/index';
  66. export default {
  67. data() {
  68. return {
  69. scrollTop: 0,
  70. showDia: false,
  71. keyword: '',
  72. abcIndex: null,
  73. zoneIndex: null,
  74. region: null,
  75. btnIndex: 1,
  76. pageNo: 1,
  77. pageSize: 40,
  78. countryList: [],
  79. zoneList: [],
  80. placeholder: '',
  81. ABCList: ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S",
  82. "T", "U", "V", "W", "X", "Y", "Z", "#"
  83. ]
  84. }
  85. },
  86. onShow() {
  87. this.placeholder = this.$i18n.locale.toUpperCase() == 'EN' ? 'Please input National Committee' : '输入国家委员会名称'
  88. },
  89. mounted() {
  90. this.getDataList();
  91. },
  92. onPageScroll(e) {
  93. this.scrollTop = e.scrollTop;
  94. },
  95. computed: {
  96. },
  97. onReachBottom() {
  98. },
  99. methods: {
  100. //路由后退一步
  101. back() {
  102. // #ifdef H5
  103. history.back()
  104. // #endif
  105. // #ifndef H5
  106. uni.navigateBack()
  107. // #endif
  108. },
  109. //调转至国家委员会详情
  110. showDetail(item) {
  111. uni.setStorageSync('committeeData', item)
  112. uni.navigateTo({
  113. url: '/pages/nationalregionalCommissions/nationalregionalInformaions/committeeLayout'
  114. })
  115. },
  116. //打开区域筛选框
  117. showDialog() {
  118. this.showDia = true;
  119. this.getZoneList();
  120. },
  121. //监听搜索关键字变化
  122. getKeyWord(keyword) {
  123. this.keyword = keyword;
  124. },
  125. // 关键字搜索
  126. searchData() {
  127. if (!this.keyword) {
  128. return;
  129. }
  130. this.getDataList()
  131. this.keyword = '';
  132. },
  133. // 提交数据
  134. selectBy(type, item) {
  135. this.abcIndex = item;
  136. this.getDataList();
  137. },
  138. //选择区域
  139. setZone(item, index) {
  140. this.zoneIndex = item.id;
  141. this.region = index + 1;
  142. },
  143. //表单操作
  144. selectOpt(index) {
  145. this.btnIndex = index;
  146. if (index == 0) {
  147. this.zoneIndex = -1;
  148. } else {
  149. this.getDataList();
  150. this.showDia = false;
  151. this.zoneIndex = -1;
  152. this.region = null;
  153. }
  154. },
  155. //获取弹窗-区域列表
  156. async getZoneList() {
  157. let res = await this.$myRequest({
  158. url: '/sys/sysDicts',
  159. data: {
  160. type: `COMMITTEE_REGIONAL_DICT,COMMITTEE_REGIONAL_DICT_EN`
  161. }
  162. })
  163. if (res.status == 200) {
  164. let data = res.data
  165. this.zoneList = this.$i18n.locale == 'zh' ? data[0] : data[1];
  166. } else {
  167. this.zoneList = []
  168. }
  169. },
  170. // 获取数据--根据字母/区域筛选
  171. async getDataList() {
  172. let temp = {
  173. name: this.keyword,
  174. region: this.region,
  175. order: this.abcIndex,
  176. language: this.$i18n.locale.toUpperCase(),
  177. pageNo: this.pageNo,
  178. pageSize: this.pageSize
  179. }
  180. let data = await this.formatObject(temp)
  181. let res = await this.$myRequest({
  182. url: '/project/committeeBasisInfos/getCommitteeCountryInfosForApp',
  183. data: data
  184. })
  185. if (res.status == 200) {
  186. let data = res.data;
  187. if (data.length > 0) {
  188. this.countryList = data
  189. } else this.countryList = []
  190. } else {
  191. this.countryList = []
  192. }
  193. },
  194. //对象配置处理
  195. formatObject(obj) {
  196. let object = {}
  197. for (let i in obj) {
  198. if (obj[i] && obj[i] != '#') object[i] = decodeURIComponent(obj[i])
  199. }
  200. return object;
  201. }
  202. }
  203. }
  204. </script>
  205. <style lang="scss" scoped>
  206. .nationalregionalCountryInformaions {
  207. // background-color:#E4E5E6;
  208. }
  209. page {
  210. // background-color:#E4E5E6;
  211. }
  212. /deep/ .uni-scroll-view-content {
  213. padding: 60upx 10upx 60upx 20upx;
  214. }
  215. /deep/ .anchor-text {
  216. padding: 0.5rem 0;
  217. }
  218. .text {
  219. width: 100%;
  220. text-align: left;
  221. margin: 0;
  222. }
  223. /deep/ .slot-wrap {
  224. flex: 1;
  225. display: flex;
  226. align-items: center;
  227. justify-content: space-between;
  228. .icon {
  229. width: 36upx;
  230. height: 36upx;
  231. display: block;
  232. position: relative;
  233. overflow: hidden;
  234. margin: 0 26upx;
  235. display: block;
  236. }
  237. }
  238. .tabABC {
  239. position: fixed;
  240. right: 0;
  241. top: 16%;
  242. width: 80upx;
  243. height: 76%;
  244. bottom: 8%;
  245. // background:#fff;
  246. padding-top: 20upx;
  247. .abcitem {
  248. width: 36upx;
  249. height: 36upx;
  250. line-height: 36upx;
  251. text-align: center;
  252. cursor: pointer;
  253. border-radius: 50%;
  254. margin: 0 auto;
  255. font-size: 20upx;
  256. &.active {
  257. color: #fff;
  258. background: #1677FF;
  259. }
  260. }
  261. }
  262. .dataList {
  263. display: flex;
  264. flex-direction: column;
  265. .listTitle {
  266. height: 60upx;
  267. line-height: 60upx;
  268. width: 90%;
  269. padding: 0 1rem;
  270. border-bottom: 1px solid #eee;
  271. }
  272. .listDataList {
  273. display: flex;
  274. flex-direction: column;
  275. background: #fff;
  276. .sonlistitem {
  277. flex: 1;
  278. display: flex;
  279. width: 89%;
  280. padding: 16upx 0;
  281. border-bottom: 1px solid #eee;
  282. &:last-of-type {
  283. border: none
  284. }
  285. .thumb {
  286. width: 240upx;
  287. // height:160upx;
  288. background: transparent;
  289. position: relative;
  290. overflow: hidden;
  291. margin-right: 28upx;
  292. margin-left: 28upx;
  293. border: 1px solid #eee;
  294. .flag {
  295. display: block;
  296. width: 100%;
  297. }
  298. }
  299. .title {
  300. flex: 1;
  301. overflow: hidden;
  302. text-overflow: ellipsis;
  303. white-space: nowrap;
  304. }
  305. }
  306. }
  307. }
  308. .contentDom {
  309. position: fixed;
  310. height: 80%;
  311. .selecttitle {
  312. font-size: 30upx;
  313. font-weight: 700;
  314. margin-bottom: 30upx;
  315. padding: 0 10upx;
  316. }
  317. .zone {
  318. margin-bottom: 10upx;
  319. padding: 0 10upx;
  320. }
  321. .zoneList {
  322. display: flex;
  323. flex-wrap: wrap;
  324. .zoneitem {
  325. padding: 8upx 20upx;
  326. // width:180upx;
  327. background-color: #F6F6F6;
  328. color: #7A7A7A;
  329. margin: 20upx 20upx 0 0;
  330. text-align: center;
  331. cursor: pointer;
  332. &.active {
  333. color: #09a0f2;
  334. background-color: #def;
  335. }
  336. }
  337. }
  338. .btn {
  339. position: fixed;
  340. bottom: 0;
  341. left: 0;
  342. display: flex;
  343. justify-content: space-between;
  344. width: 100%;
  345. .reset,
  346. .submi {
  347. width: 50%;
  348. height: 80upx;
  349. line-height: 80upx;
  350. text-align: center;
  351. color: #7A7A7A;
  352. &.active {
  353. background: #1677FF;
  354. color: #fff;
  355. }
  356. }
  357. }
  358. }
  359. </style>