index.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. <template>
  2. <view class="container">
  3. <!-- <view class="box-bg" style="padding-top: 25px;background: #FFF;">
  4. <uni-nav-bar left-icon="left" @clickLeft="closePage" title="辖区概况" />
  5. </view> -->
  6. <view class="fl">
  7. <view class="fl1">
  8. <view class="item">
  9. <view class="title fw">
  10. <image style="" :src="fw_icon"></image>
  11. <view>房屋总数</view>
  12. </view>
  13. <view class="num"><view></view> <view>{{formatNumberWithComma(datas.fwzs)}}</view></view>
  14. </view>
  15. <view class="item">
  16. <view class="title dw">
  17. <image style="" :src="dw_icon"></image>
  18. 实有单位总数</view>
  19. <view class="num"><view></view>{{formatNumberWithComma(datas.sydwzs)}}</view>
  20. </view>
  21. </view>
  22. <view class="fl2">
  23. <view class="item">
  24. <view class="title syrk">
  25. <image style="" :src="syrk_icon"></image>
  26. 实有人口总数 <view class="num"><view></view>{{formatNumberWithComma(datas.syrkzs)}}</view>
  27. </view>
  28. <view class="item_box">
  29. <view class="item">
  30. <view class="title fw">
  31. 常住人口数</view>
  32. <view class="num">{{formatNumberWithComma(datas.czrk)}}</view>
  33. </view>
  34. <view class="item">
  35. <view class="title fw">
  36. 寄住人口数</view>
  37. <view class="num">{{formatNumberWithComma(datas.jzrk)}}</view>
  38. </view>
  39. <view class="item">
  40. <view class="title fw">
  41. 暂住人口数</view>
  42. <view class="num">{{formatNumberWithComma(datas.zzrk)}}</view>
  43. </view>
  44. <view class="item">
  45. <view class="title fw">
  46. 境外人口数</view>
  47. <view class="num">{{formatNumberWithComma(datas.jwrk)}}</view>
  48. </view>
  49. <view class="item">
  50. <view class="title fw">
  51. 未落常人口数</view>
  52. <view class="num">{{formatNumberWithComma(datas.wlrk)}}</view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="fl3">
  58. <view class="item">
  59. <view class="title zdrk">
  60. <image style="" :src="zdrk_icon"></image>
  61. 重点人口总数</view>
  62. <view class="num"><view></view>{{formatNumberWithComma(datas.zdrkzs)}}</view>
  63. </view>
  64. <view class="item">
  65. <view class="title swzdr">
  66. <image style="" :src="swzdr_icon"></image>
  67. 涉稳重点人总数</view>
  68. <view class="num"><view></view>{{formatNumberWithComma(datas.swzdrzs)}}</view>
  69. </view>
  70. <view class="item">
  71. <view class="title tddx">
  72. <image style="" :src="tddx_icon"></image>
  73. 特定对象总数</view>
  74. <view class="num"><view></view>{{formatNumberWithComma(datas.tddxzs)}}</view>
  75. </view>
  76. <view class="item">
  77. <view class="title mdjf">
  78. <image style="" :src="mdjf_icon"></image>
  79. 矛盾纠纷总数</view>
  80. <view class="num"><view></view>{{formatNumberWithComma(datas.mdjfzs)}}</view>
  81. </view>
  82. <view class="item">
  83. <view class="title jxcs">
  84. <image style="" :src="jxcs_icon"></image>
  85. 九小场所总数</view>
  86. <view class="num"><view></view>{{formatNumberWithComma(datas.jxcszs)}}</view>
  87. </view>
  88. </view>
  89. </view>
  90. <!-- {{isSzApp.extraData}}
  91. <button type="primary" @click="loginFun" style="margin-top: 30px;">手动触发方法</button> -->
  92. </view>
  93. </template>
  94. <script>
  95. //https://nativesupport.dcloud.net.cn/UniMPDocs/Sample/android-v2.html
  96. import {getXqgk,getrequest} from '../../api/xqgk.js'
  97. export default {
  98. data(){
  99. return{
  100. loading:true,
  101. contentprovider:'',
  102. nativeMsg:'',
  103. isSzApp: '88',
  104. SzApp:'',
  105. isInternet:'',
  106. referrerInfo:'',
  107. datas:{},
  108. fw_icon:require('../../static/icon/icon_statistics_house_20.png'),
  109. dw_icon:require('../../static/icon/icon_statistics_unit_20.png'),
  110. syrk_icon:require('../../static/icon/icon_statistics_people_20.png'),
  111. zdrk_icon:require('../../static/icon/icon_statistics_point_20.png'),
  112. swzdr_icon:require('../../static/icon/icon_statistics_stabilize_20.png'),
  113. tddx_icon:require('../../static/icon/icon_statistics_special_20.png'),
  114. mdjf_icon:require('../../static/icon/icon_statistics_dispute_20.png'),
  115. jxcs_icon:require('../../static/icon/icon_statistics_site_20.png'),
  116. }
  117. },
  118. onLoad(options) {
  119. this.loginFun()
  120. },
  121. onReady() {
  122. console.group('onReady 状态===============》');
  123. },
  124. onShow() {
  125. this.SzApp = uni.getStorageSync('SzApp');
  126. this.isSzApp = uni.getStorageSync('isSzApp');
  127. this.loginFun()
  128. },
  129. mounted(){
  130. console.log('开启调试mounted');
  131. },
  132. // 监听按钮点击事件
  133. onNavigationBarButtonTap(e) {
  134. plus.runtime.quit()
  135. },
  136. //下拉后触发的事件
  137. onPullDownRefresh() {
  138. this.initData()
  139. },
  140. methods: {
  141. loginFun(){
  142. uni.showLoading({
  143. title:''
  144. })
  145. getrequest('bladeTokenEndPoint','token3').then(res=>{
  146. let userInfo = JSON.parse(res.data.dataList[0].fieldValues[0].value)
  147. this.$u.vuex('userInfo', userInfo)
  148. this.$u.vuex('accessToken', userInfo.access_token)
  149. this.$u.vuex('refreshToken', userInfo.refresh_token)
  150. //console.log(JSON.parse(res.data.dataList[0].fieldValues[0].value),'data')
  151. this.initData()
  152. }).catch(r=>{
  153. console.log(r)
  154. }).finally(r=>{
  155. uni.hideLoading()
  156. })
  157. },
  158. initData(){
  159. getrequest('userController','getXqgk').then(res=>{
  160. let xqtjData = JSON.parse(res.data.dataList[0].fieldValues[0].value)
  161. this.datas= xqtjData.data
  162. }).finally(r=>{
  163. // 隐藏导航栏加载动画
  164. uni.stopPullDownRefresh();
  165. })
  166. uni.stopPullDownRefresh();
  167. },
  168. download(){
  169. window.open('../../static/source/__UNI__0308C60.wgt')
  170. },
  171. getDataFromContentProvider() {
  172. const main = plus.android.runtimeMainActivity();
  173. const context = main.getApplicationContext();
  174. const uri = Uri.parse("content://com.example.mycontentprovider");
  175. const cursor = context.getContentResolver().query(uri, null, null, null, null);
  176. if (cursor != null) {
  177. while (cursor.moveToNext()) {
  178. // 获取数据
  179. const data = cursor.getString(cursor.getColumnIndexOrThrow("column_name"));
  180. // 处理数据
  181. this.contentprovider = data
  182. }
  183. cursor.close();
  184. }
  185. },
  186. closePage(){
  187. plus.runtime.quit()
  188. },
  189. snedMessage(){
  190. // 向宿主App发送事件
  191. uni.sendNativeEvent('unimp-event', {
  192. msg: 'unimp message!!!'
  193. }, ret => {
  194. this.nativeMsg = '宿主App回传的数据:' + ret;
  195. })
  196. },
  197. formatNumberWithComma(number) {
  198. if(number){
  199. return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
  200. }else{
  201. return 0
  202. }
  203. }
  204. }
  205. }
  206. </script>
  207. <style lang="scss">
  208. @font-face {
  209. font-family: 'dinpro';
  210. src: url('../../static/font/DINPro-Bold.otf');
  211. }
  212. @font-face {
  213. font-family: 'sy_Medium';
  214. src: url('../../static/font/sy/Medium/VYsJ5mVGs4xO.woff');
  215. }
  216. @font-face {
  217. font-family: 'sy_Regular';
  218. src: url('../../static/font/sy/Regular/86cVqZlTJTV1.woff');
  219. }
  220. .container{
  221. padding: 0;
  222. box-sizing: border-box;
  223. .fl{
  224. padding: 18px 12px;
  225. box-sizing: border-box;
  226. background: #F7F7F7;
  227. .fl1,.fl3{
  228. display: grid;
  229. grid-template-columns: calc((100% - 15px)/2) calc((100% - 15px)/2);
  230. grid-template-rows: auto;
  231. gap: 15px;
  232. .item{
  233. background: #FFFFFF;
  234. border-radius: 8px;
  235. text-align: center;
  236. padding: 15px;
  237. box-sizing: border-box;
  238. .title{
  239. font-weight: 500;
  240. font-size: 14px;
  241. font-family: 'sy_Regular';
  242. position: relative;
  243. text-align: left;
  244. margin: auto;
  245. display: grid;
  246. grid-template-columns:26px auto;
  247. image{
  248. width: 20px;
  249. height: 20px;
  250. vertical-align: bottom;
  251. margin-top: 1px;
  252. }
  253. }
  254. .fw{
  255. color: #477FFF;
  256. }
  257. .dw{
  258. color: #00ABE6;
  259. }
  260. .num{
  261. display: grid;
  262. grid-template-columns:26px auto;
  263. font-weight: bold;
  264. font-size: 20px;
  265. color: #111111;
  266. font-family: 'dinpro';
  267. padding-top: 3px;
  268. text-align: left;
  269. }
  270. }
  271. }
  272. .fl2{
  273. margin-top: 15px;
  274. .item{
  275. background: #FFFFFF;
  276. border-radius: 8px;
  277. text-align: left;
  278. padding: 15px;
  279. box-sizing: border-box;
  280. .title{
  281. font-weight: 500;
  282. font-size: 14px;
  283. font-family: 'sy_Regular';
  284. position: relative;
  285. margin: auto;
  286. image{
  287. width: 20px;
  288. height: 20px;
  289. vertical-align: bottom;
  290. margin-right: 6px;
  291. }
  292. }
  293. .syrk{
  294. color: #22C450;
  295. .num{
  296. display: inline-block;
  297. font-weight: bold;
  298. font-size: 20px;
  299. color: #111111;
  300. font-family: 'dinpro';
  301. float: right;
  302. }
  303. }
  304. }
  305. .item_box{
  306. display: grid;
  307. grid-template-columns: calc((100% - 15px)/2) calc((100% - 15px)/2);
  308. grid-template-rows: auto auto auto;
  309. gap: 15px;
  310. margin-top: 15px;
  311. .item{
  312. background: #FAFAFA;
  313. border-radius: 8px;
  314. text-align: left;
  315. padding: 15px;
  316. box-sizing: border-box;
  317. .title{
  318. font-weight: 500;
  319. font-size: 14px;
  320. font-family: 'sy_Regular';
  321. box-sizing: border-box;
  322. margin: auto;
  323. width: 100%;
  324. }
  325. .fw{
  326. color: #666666;
  327. }
  328. .dw{
  329. color: #666666;
  330. }
  331. .num{
  332. font-weight: bold;
  333. font-size: 20px;
  334. color: #111111;
  335. font-family: 'dinpro';
  336. padding-top: 3px;
  337. }
  338. }
  339. }
  340. }
  341. .fl3{
  342. margin-top: 15px;
  343. .item{
  344. .title{
  345. }
  346. .zdrk{
  347. color: #F73838 !important;
  348. }
  349. .swzdr{
  350. color: #FF2D7B;
  351. }
  352. .tddx{
  353. color:#8656FF
  354. }
  355. .mdjf{
  356. color:#F5A218
  357. }
  358. .jxcs{
  359. color:#00ABE6
  360. }
  361. }
  362. }
  363. }
  364. }
  365. /deep/ .uni-navbar--border{
  366. border-bottom: none !important;
  367. }
  368. </style>