index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. <template>
  2. <view class="container">
  3. <view class="banner">
  4. <u-swiper v-if="bannerList.length != 0" :list="bannerList" height="356" mode="none" img-mode="widthFix" border-radius="0"></u-swiper>
  5. <u-empty v-else text="banner图为空" mode="list" style="margin: 50rpx"></u-empty>
  6. </view>
  7. <view class="mim-view">
  8. <text class="mim-h">时政要闻</text>
  9. <view class="mim-flex-wrap-space-between news">
  10. <view
  11. class="news_child"
  12. style="background-image: url('http://api.jczl.site.xmnk.cn//storage/default/ERhLcsxuXDi6yJE1CbIClJrMSMaWc389.png')"
  13. @click="goPage('gnwyw')"
  14. >
  15. <!-- <u-image src="../../../static/images/index/gwyw.png" mode="widthFix"></u-image> -->
  16. <view class="mim-flex-vertical" style="width: 100%; position: absolute; top: 32rpx; left: 32rpx">
  17. <text class="news_child_h">国内外要闻</text>
  18. <text class="news_child_p">新闻资讯一键查阅</text>
  19. </view>
  20. </view>
  21. <view
  22. class="news_child"
  23. style="margin-left: 24rpx; background-image: url('http://api.jczl.site.xmnk.cn//storage/default/BMq5AUUsErPs4hvGOp86A8t5D7dnhzzJ.png')"
  24. @click="goPage('lsxw')"
  25. >
  26. <!-- <u-image src=" ../../../static/images/index/lsxw.png" mode="widthFix"></u-image> -->
  27. <view class="mim-flex-vertical" style="width: 100%; position: absolute; top: 32rpx; left: 32rpx">
  28. <text class="news_child_h">罗山新闻</text>
  29. <text class="news_child_p">家乡大事这里都有</text>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <view
  35. class="mim-view kjb"
  36. @click="goPage('info_quick_action')"
  37. style="background-image: url('http://api.jczl.site.xmnk.cn//storage/default/TKbSo6rl3muivIj5UkmHuLIkdbY2bdMo.png'); padding: 0; height: 200rpx"
  38. >
  39. <!-- <u-image src="../../../static/images/index/banner2.png" mode="widthFix"></u-image> -->
  40. <view class="mim-flex-vertical-center" style="position: absolute; top: 46rpx; left: 32rpx">
  41. <text class="kjb_h">政务服务快捷办</text>
  42. <text class="kjb_p">罗山政务服务网</text>
  43. </view>
  44. </view>
  45. <view class="mim-view">
  46. <text class="mim-h">社情民意直通车</text>
  47. <view class="train" style="background-image: url('http://api.jczl.site.xmnk.cn//storage/default/KfzvL3DdyQg435FtEKabUQDn3DRyt9IW.png')">
  48. <view class="mim-flex-wrap-space-between">
  49. <view class="mim-flex-wrap-left">
  50. <view class="mim_img_div mim-flex-wrap">
  51. <u-image src="../../../static/icon/index/file.png" width="40rpx" height="44rpx"></u-image>
  52. </view>
  53. <view class="mim-flex-vertical" style="margin-left: 24rpx">
  54. <view class="h">市民吹哨</view>
  55. <view class="p">党群连心有呼必应</view>
  56. </view>
  57. </view>
  58. <view v-if="mobile" class="whew mim-button" @click="goPage('wantComplaint')">我要吹哨</view>
  59. <button v-else class="whew_2 mim-button" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">我要吹哨</button>
  60. </view>
  61. <u-divider border-color="rgba(255, 255, 255, 0.6)" margin-top="24" margin-bottom="24" use-slot></u-divider>
  62. <view class="mim-flex-wrap-space-between">
  63. <view class="left mim-flex-wrap-space-between" @click="goPage('myComplaint')">
  64. <text>反馈列表</text>
  65. <u-image src="../../../static/icon/icon_right.png" width="32rpx" height="32rpx"></u-image>
  66. </view>
  67. <view class="long-string"></view>
  68. <view class="right mim-flex-wrap-space-between" @click="goPage('myComplaintEnd')">
  69. <text>满意度评价</text>
  70. <u-image src="../../../static/icon/icon_right.png" width="32rpx" height="32rpx"></u-image>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. <view class="mim-view">
  76. <text class="mim-h">品质引领在罗山</text>
  77. <view class="mim-flex-wrap-space-between list">
  78. <view class="storm mim-flex-vertical-center" @click="goPage('lsxq')">
  79. <u-image src="../../../static/icon/index/ls_1.png" width="56rpx" height="56rpx"></u-image>
  80. <text>罗山县情</text>
  81. </view>
  82. <view class="storm mim-flex-vertical-center" @click="goPage('fzdt')">
  83. <u-image src="../../../static/icon/index/ls_2.png" width="56rpx" height="56rpx"></u-image>
  84. <text>发展动态</text>
  85. </view>
  86. <view class="storm mim-flex-vertical-center" @click="goPage('yshj')">
  87. <u-image src="../../../static/icon/index/ls_3.png" width="56rpx" height="56rpx"></u-image>
  88. <text>营商环境</text>
  89. </view>
  90. <view class="storm mim-flex-vertical-center" @click="goPage('qyly')">
  91. <u-image src="../../../static/icon/index/ls_4.png" width="56rpx" height="56rpx"></u-image>
  92. <text>全域旅游</text>
  93. </view>
  94. </view>
  95. </view>
  96. <view class="mim-view">
  97. <view class="mim-flex-wrap-space-between" style="width: 100%">
  98. <text class="mim-h">公告板</text>
  99. <view class="mim-flex-wrap-right" @click="goPage('announcementAll')">
  100. <text class="look-text">查看全部</text>
  101. <u-image src="../../../static/icon/icon_right.png" width="32rpx" height="32rpx"></u-image>
  102. </view>
  103. </view>
  104. <view class="message_list">
  105. <view class="storm mim-flex-wrap-space-between" v-for="item in callBoard" :key="item.id">
  106. <view class="mim-flex-vertical" style="max-width: 60%">
  107. <text class="mim-multi-line msg_p">{{ item.title }}</text>
  108. <text class="msg_time">{{ item.created_at }}</text>
  109. </view>
  110. <view class="mim-button details" @click="goDetails(item.id)">查看详情</view>
  111. </view>
  112. </view>
  113. </view>
  114. <u-divider bg-color="#f7f7f7" fontSize="24">我是有底线的</u-divider>
  115. <view class="mim-view-list"></view>
  116. <UserPrivacy ref="privacy"></UserPrivacy>
  117. </view>
  118. </template>
  119. <script>
  120. import { wechatAppId } from '@/common/settings.js';
  121. import UserPrivacy from '@/components/userPrivacy/userPrivacy.vue';
  122. export default {
  123. components: {
  124. UserPrivacy
  125. },
  126. data() {
  127. return {
  128. statusBarHeight: '',
  129. navHeight: '',
  130. bannerList: [],
  131. callBoard: [],
  132. mobile: ''
  133. };
  134. },
  135. onShow() {
  136. wx.onNeedPrivacyAuthorization((resolve, eventInfo) => {
  137. console.log('触发本次事件的接口是:' + eventInfo.referrer);
  138. this.$refs.privacy.getPrivacySettingFn();
  139. resolve({ event: 'disagree' });
  140. });
  141. const that = this.$u;
  142. const _this = this;
  143. const token = uni.getStorageSync('token');
  144. if (!token) {
  145. wx.login({
  146. success(res) {
  147. if (res.code) {
  148. that.post('/base/auth/mini-program-login', {
  149. code: res.code,
  150. appid: wechatAppId
  151. }).then((res) => {
  152. console.log(res);
  153. if (res.status === 'success') {
  154. uni.setStorageSync('token', res.data.token);
  155. _this.homeDataFn();
  156. _this.getUserInfoFn();
  157. }
  158. });
  159. }
  160. }
  161. });
  162. } else {
  163. this.homeDataFn();
  164. this.getUserInfoFn();
  165. }
  166. },
  167. methods: {
  168. goPage(e) {
  169. switch (e) {
  170. case 'wantComplaint': //我要投诉页面
  171. this.$u.route('/pages/tabbar/user/myComplaint/wantComplaint', {
  172. phone: this.mobile
  173. });
  174. break;
  175. case 'myComplaint': //投诉列表
  176. this.$u.route('/pages/tabbar/user/myComplaint/myComplaint');
  177. break;
  178. case 'myComplaintEnd': //投诉列表(满意度评价,待评价)
  179. this.$u.route('/pages/tabbar/user/myComplaint/myComplaint', {
  180. current: '3'
  181. });
  182. break;
  183. case 'lsxw': //罗山新闻
  184. this.$u.route('/pages/tabbar/index/announcementAll', {
  185. type: '2'
  186. });
  187. break;
  188. case 'lsxq': //罗山县情
  189. this.$u.route('/pages/tabbar/index/announcementAll', {
  190. type: '3'
  191. });
  192. break;
  193. case 'fzdt': //发展动态
  194. this.$u.route('/pages/tabbar/index/announcementAll', {
  195. type: '4'
  196. });
  197. break;
  198. case 'yshj': //营商环境
  199. this.$u.route('/pages/tabbar/index/announcementAll', {
  200. type: '5'
  201. });
  202. break;
  203. case 'qyly': //全域旅游
  204. this.$u.route('/pages/tabbar/index/announcementAll', {
  205. type: '6'
  206. });
  207. break;
  208. case 'announcementAll': //全部公告
  209. this.$u.route('/pages/tabbar/index/announcementAll', {
  210. type: '7'
  211. });
  212. break;
  213. case 'info_quick_action': //跳转快捷办
  214. // wx.navigateToMiniProgram({
  215. // appId: 'wxf5cb6ba192bc783f'
  216. // // path: 'page/index/index',
  217. // // envVersion: 'develop',
  218. // // success(res) {
  219. // // // 打开成功
  220. // // }
  221. // })
  222. uni.navigateTo({
  223. url: '/pages/tabbar/index/webview'
  224. });
  225. break;
  226. case 'gnwyw': //国内外要闻
  227. this.$u.route('/pages/tabbar/index/announcementAll', {
  228. type: '1'
  229. });
  230. break;
  231. default:
  232. console.log('Unknown fruit');
  233. break;
  234. }
  235. },
  236. //查看详情
  237. goDetails(e) {
  238. this.$u.route('/pages/detailPage/detailPage', {
  239. id: e,
  240. type: 7
  241. });
  242. },
  243. //获取用户手机号
  244. getPhoneNumber(res) {
  245. const encryptedData = res.detail.encryptedData;
  246. const iv = res.detail.iv;
  247. if (iv && encryptedData) {
  248. this.$u
  249. .post('/base/auth/mini-bind-mobile', {
  250. encryptedData: encryptedData,
  251. iv: iv
  252. })
  253. .then((res) => {
  254. console.log(res);
  255. this.getUserInfoAgainFn();
  256. });
  257. }
  258. },
  259. //获取主页信息
  260. async homeDataFn() {
  261. const res = await this.$u.api.homeData();
  262. if (res.status === 'success') {
  263. const data = res.data;
  264. this.bannerList = data.bannersS;
  265. this.callBoard = data.informationsS;
  266. }
  267. },
  268. //获取用户信息
  269. async getUserInfoFn() {
  270. const res = await this.$u.api.getUserInfo();
  271. this.mobile = res.data.mobile;
  272. },
  273. //绑定完成手机号调用
  274. async getUserInfoAgainFn() {
  275. const res = await this.$u.api.getUserInfo();
  276. this.mobile = res.data.mobile;
  277. if (this.mobile) {
  278. this.$u.route('/pages/tabbar/user/myComplaint/wantComplaint', {
  279. phone: this.mobile
  280. });
  281. }
  282. }
  283. }
  284. };
  285. </script>
  286. <style lang="scss">
  287. page {
  288. background-color: #f7f7f7;
  289. .container {
  290. .banner {
  291. width: 100%;
  292. }
  293. .mim-view {
  294. .mim-h {
  295. font-size: 32rpx;
  296. font-weight: bold;
  297. letter-spacing: 0em;
  298. color: #333333;
  299. }
  300. .news {
  301. margin-top: 24rpx;
  302. view {
  303. width: 50%;
  304. position: relative;
  305. }
  306. &_child {
  307. background-position: center;
  308. background-repeat: no-repeat;
  309. background-size: 100% 100%;
  310. box-sizing: border-box;
  311. height: 144rpx;
  312. &_h {
  313. font-size: 32rpx;
  314. font-weight: bold;
  315. line-height: 32rpx;
  316. letter-spacing: 0em;
  317. color: #ffffff;
  318. }
  319. &_p {
  320. font-size: 20rpx;
  321. font-weight: normal;
  322. line-height: 20rpx;
  323. letter-spacing: 0em;
  324. margin-top: 20rpx;
  325. color: #ffffff;
  326. }
  327. }
  328. }
  329. .mim-h-p {
  330. font-size: 32rpx;
  331. font-weight: normal;
  332. letter-spacing: 0em;
  333. color: #333333;
  334. }
  335. .bg-image {
  336. width: 100%;
  337. height: 100%;
  338. position: absolute;
  339. z-index: -1;
  340. top: 0;
  341. left: 0;
  342. }
  343. .train {
  344. margin-top: 24rpx;
  345. padding: 24rpx;
  346. height: 212rpx;
  347. border-radius: 16px;
  348. background-position: center;
  349. background-repeat: no-repeat;
  350. background-size: 100% 100%;
  351. // background-color: #999999;
  352. }
  353. .mim_img_div {
  354. width: 84rpx;
  355. height: 84rpx;
  356. opacity: 1;
  357. background: #ffffff;
  358. border-radius: 50%;
  359. }
  360. .h {
  361. font-size: 28rpx;
  362. font-weight: bold;
  363. letter-spacing: 0em;
  364. color: #3d3d3d;
  365. }
  366. .p {
  367. font-size: 24rpx;
  368. font-weight: normal;
  369. letter-spacing: 0em;
  370. color: #999999;
  371. }
  372. .whew {
  373. width: 144rpx;
  374. height: 48rpx;
  375. border-radius: 24rpx;
  376. opacity: 1;
  377. background: #ffffff;
  378. box-sizing: border-box;
  379. border: 2rpx solid #de2e27;
  380. font-size: 24rpx;
  381. font-weight: normal;
  382. letter-spacing: 0em;
  383. color: #de2e27;
  384. }
  385. .whew_2 {
  386. width: 144rpx;
  387. height: 48rpx;
  388. border-radius: 24rpx;
  389. opacity: 1;
  390. background: #ffffff;
  391. box-sizing: border-box;
  392. border: 2rpx solid #de2e27;
  393. font-size: 24rpx;
  394. font-weight: normal;
  395. letter-spacing: 0em;
  396. color: #de2e27;
  397. padding: 0;
  398. margin-right: 0;
  399. }
  400. .left,
  401. .right {
  402. position: relative;
  403. width: 50%;
  404. text {
  405. font-size: 24rpx;
  406. font-weight: normal;
  407. line-height: 24rpx;
  408. letter-spacing: 0em;
  409. color: #333333;
  410. }
  411. }
  412. .long-string {
  413. width: 2rpx;
  414. height: 24rpx;
  415. background-color: rgba(255, 255, 255, 0.6);
  416. margin: 0 12rpx;
  417. }
  418. .kjb {
  419. &_h {
  420. font-size: 16px;
  421. font-weight: bold;
  422. letter-spacing: 0em;
  423. color: #333333;
  424. }
  425. &_p {
  426. display: inline-block;
  427. font-size: 12px;
  428. font-weight: normal;
  429. letter-spacing: 0.08em;
  430. color: #de2e27;
  431. background: #ffffff;
  432. box-sizing: border-box;
  433. border: 1px solid #de2e27;
  434. padding: 3px 10px;
  435. border-radius: 12px;
  436. margin-top: 20rpx;
  437. }
  438. }
  439. .list {
  440. .storm {
  441. margin-top: 44rpx;
  442. padding: 0 16rpx;
  443. text {
  444. font-size: 24rpx;
  445. font-weight: normal;
  446. letter-spacing: 0em;
  447. margin-top: 12rpx;
  448. color: #333333;
  449. }
  450. }
  451. }
  452. .look-text {
  453. font-size: 24rpx;
  454. font-weight: normal;
  455. letter-spacing: 0em;
  456. color: #999999;
  457. margin-right: 4rpx;
  458. }
  459. .message_list {
  460. .storm {
  461. padding: 24rpx 0;
  462. border-bottom: 2rpx solid #eee;
  463. .msg_p {
  464. font-size: 30rpx;
  465. font-weight: normal;
  466. line-height: 36rpx;
  467. letter-spacing: 0em;
  468. color: #333333;
  469. }
  470. .msg_time {
  471. font-size: 24rpx;
  472. font-weight: normal;
  473. line-height: 24rpx;
  474. letter-spacing: 0em;
  475. color: #999999;
  476. margin-top: 32rpx;
  477. }
  478. &:last-child {
  479. border-bottom: none;
  480. padding-bottom: 0;
  481. }
  482. }
  483. .details {
  484. width: 176rpx;
  485. height: 64rpx;
  486. margin-left: 30rpx;
  487. }
  488. }
  489. }
  490. }
  491. }
  492. </style>