index2.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <view class="page">
  3. <view class="wd">
  4. <view class="qw">{{ weather.tem }}°</view>
  5. <view class="xs">
  6. <view>{{ weather.wea }} {{ weather.win }} {{ weather.win_speed }}</view>
  7. <view>风速 {{ weather.win_meter }}</view>
  8. </view>
  9. </view>
  10. <view class="ms">
  11. <text class="icon">&#xe64a;</text>
  12. <text>谢通门县欢迎您</text>
  13. <view class="sos" @click="call()">
  14. <text class="icon">&#xe94d;</text>
  15. 求助
  16. </view>
  17. </view>
  18. <view class="top"><image :src="ip + aboutUs.bgImg1" mode="aspectFill"></image></view>
  19. <view class="flex menu">
  20. <view class="f" @click="navigate('/pages/travel/detail?id=43')">
  21. <image src="../../static/icon3.png" mode="widthFix" class="icon1"></image>
  22. <view class="title">谢通门介绍</view>
  23. </view>
  24. <view class="f" @click="navigate('/pages/travel/list?type=3')">
  25. <image src="../../static/icon1.png" mode="widthFix" class="icon1"></image>
  26. <view class="title">旅游攻略</view>
  27. </view>
  28. <view class="f" @click="navigate('/pages/government/activity')">
  29. <image src="../../static/icon2.png" mode="widthFix" class="icon1"></image>
  30. <view class="title">热门活动</view>
  31. </view>
  32. <view class="f" @click="navigate('/pages/government/index')">
  33. <image src="../../static/icon4.png" mode="widthFix" class="icon1"></image>
  34. <view class="title">党政服务</view>
  35. </view>
  36. </view>
  37. <view class="flex" style="margin-top: 10px;">
  38. <view class="f" style="padding-right:8px;">
  39. <image @click="navigate(2)" :src="ip + aboutUs.bgImg2" style="height: 164px;width: 100%;border-radius: 5px;" mode="aspectFill"></image>
  40. </view>
  41. <view class="f">
  42. <image @click="navigate(3)" :src="ip + aboutUs.bgImg3" style="height: 77px;width: 100%;border-radius: 5px;" mode="aspectFill"></image>
  43. <image @click="navigate(4)" :src="ip + aboutUs.bgImg4" style="height: 77px;width: 100%;margin-top: 5px;border-radius: 5px;" mode="aspectFill"></image>
  44. </view>
  45. </view>
  46. <view class="it">
  47. <view class="v_title">
  48. <image src="../../static/lo.png" class="lo" mode="widthFix"></image>
  49. <view class="hd">热门景区</view>
  50. <view class="more" @click="tab('/pages/travel/index')">
  51. 更多
  52. <text class="arrow icon">&#xe62d;</text>
  53. </view>
  54. <view class="clear"></view>
  55. </view>
  56. <view class="jq_item" v-for="(item, index) in hot_list" :key="index" @click="detail(item)">
  57. <image :src="ip + item.showPictures" class="bmg" mode="aspectFill"></image>
  58. <view class="cons">
  59. <view class="tit omit">{{ item.title }}</view>
  60. <view class="desc omit">{{ item.briefContent }}</view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="it">
  65. <view class="v_title">
  66. <image src="../../static/lo.png" class="lo" mode="widthFix"></image>
  67. <view class="hd">攻略指南</view>
  68. <view class="more" @click="navigate('/pages/travel/introduction')">
  69. 更多
  70. <text class="arrow icon">&#xe62d;</text>
  71. </view>
  72. <view class="clear"></view>
  73. </view>
  74. <view class="jq_item flex" v-for="(item, index) in zn_list" :key="index" @click="detail(item)">
  75. <view class="f" style="height: 213px;border-radius: 5px 0px 0px 5px;"><image :src="ip + item.showPictures" mode="aspectFill"></image></view>
  76. <view class="f" style="padding: 10px;">
  77. <view class="cons">
  78. <view class="tit omit">{{ item.title }}</view>
  79. <view class="str-summery">{{ item.briefContent }}</view>
  80. <view class="lx">浏览</view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <u-back-top :scroll-top="scrollTop"></u-back-top>
  86. <help ref="help"></help>
  87. </view>
  88. </template>
  89. <script>
  90. import help from '../../components/help.vue';
  91. export default {
  92. components: {
  93. help
  94. },
  95. data() {
  96. return {
  97. ip: this.$http.urls.ip,
  98. scrollTop: 0,
  99. hot_list: [],
  100. zn_list: [],
  101. aboutUs: {},
  102. weather: { tem: '0', wea: '晴', win: '北风', win_speed: '0级', win_meter: '0km/h' }
  103. };
  104. },
  105. onPageScroll(e) {
  106. this.scrollTop = e.scrollTop;
  107. },
  108. onLoad(e) {
  109. this.getData();
  110. //this.getWeather();
  111. //uni.setStorageSync("user",{"searchValue":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null,"remark":null,"params":{},"memberId":27,"name":"wx_1011223213","mobile":"","email":null,"registerTime":"2021-11-23 21:39:27","lastLoginTime":"2021-11-23 21:53:20","lastLoginIp":"127.0.0.1","loginNum":2,"unionid":null,"openid":"ok3qt5FMehpGy6aOtqPd9pnPLC_Q","nickName":"西域男孩","avatarUrl":"https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTLeSLQBtiavUU0ByFbXtND7iaricbNU81HSdaV9bQLTfciaMV604u5TNIdjLiaarL7MIZQXIrWFZfNiaZIQ/132","gender":"0","province":"","city":"","country":"","language":"zh_CN","lastLat":null,"lastLng":null,"isShop":0,"apiToken":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIyNyIsImlhdCI6MTYzNzY3NTYwMCwiZXhwIjoxNjM4MjgwNDAwfQ.vRPuNnLrUH1T8_qOL6Ti4TT2Akw29Set18kiavbjJynol52cxHXqeRoStyF4afdcsiipELdVW9G8-zh52voOFg"})
  112. },
  113. methods: {
  114. getWeather() {
  115. //天气接口
  116. uni.request({
  117. url: this.$http.urls.weather,
  118. success: res => {
  119. if (!res.data.errcode) {
  120. this.weather = res.data;
  121. }
  122. }
  123. });
  124. },
  125. getData() {
  126. this.$http.request({
  127. url: this.$http.urls.home,
  128. success: res => {
  129. this.hot_list = res.data.data.hot_list;
  130. this.zn_list = res.data.data.zn_list;
  131. this.aboutUs = res.data.data.aboutUs;
  132. uni.setStorageSync('aboutUs', this.aboutUs);
  133. }
  134. });
  135. },
  136. tab(url) {
  137. uni.switchTab({
  138. url: url
  139. });
  140. },
  141. //详情
  142. detail(item) {
  143. uni.navigateTo({ url: '/pages/travel/detail?id=' + item.contentId });
  144. },
  145. //根据后台的选择跳转id跳转到指定文章
  146. navigate(index) {
  147. let id;
  148. if (index == 2) {
  149. id = this.$http.getParam(this.aboutUs.briefText1, '?');
  150. }
  151. if (index == 2) {
  152. id = this.$http.getParam(this.aboutUs.briefText2, '?');
  153. }
  154. if (index == 3) {
  155. id = this.$http.getParam(this.aboutUs.briefText3, '?');
  156. }
  157. if (index == 4) {
  158. id = this.$http.getParam(this.aboutUs.briefText4, '?');
  159. }
  160. uni.navigateTo({ url: '/pages/travel/detail?id=' + id });
  161. },
  162. //拨打求助电话
  163. call() {
  164. this.$refs.help.init();
  165. }
  166. },
  167. //下拉刷新
  168. onPullDownRefresh() {
  169. setTimeout(() => {
  170. uni.stopPullDownRefresh();
  171. this.getData();
  172. }, 1000);
  173. }
  174. };
  175. </script>
  176. <style lang="scss">
  177. .page {
  178. padding: 10px;
  179. overflow-x: hidden;
  180. }
  181. .wd {
  182. margin-top: 28px;
  183. z-index: 111111;
  184. .qw {
  185. font-size: 25px;
  186. float: left;
  187. font-weight: bold;
  188. }
  189. .xs {
  190. margin-left: 45px;
  191. width: 100%;
  192. font-size: 13px;
  193. line-height: 20px;
  194. }
  195. }
  196. .ms {
  197. font-size: 20px;
  198. font-weight: bold;
  199. margin-bottom: 15px;
  200. margin-top: 10px;
  201. .jb {
  202. float: right;
  203. font-size: 13px;
  204. font-weight: normal;
  205. margin-top: 6px;
  206. }
  207. }
  208. .top {
  209. image {
  210. width: 100%;
  211. height: 150px;
  212. border-radius: 5px;
  213. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  214. }
  215. }
  216. .a1 {
  217. border-radius: 3px;
  218. }
  219. .it {
  220. margin-top: 15px;
  221. }
  222. .v_title {
  223. .hd {
  224. left: 25px;
  225. }
  226. }
  227. </style>