index2.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <view>
  3. <view class="welcome" :style="{ marginTop: top + 'px' }">
  4. <image src="../../static/dw.png" mode="widthFix" class="dw"></image>
  5. <image src="../../static/index.png" mode="widthFix" class="bq"></image>
  6. <view class="clear"></view>
  7. </view>
  8. <view class="top">
  9. <view class="wd">
  10. <view class="qw">{{ weather.tem }}°</view>
  11. <view class="xs">
  12. <view>{{ weather.wea }} {{ weather.win }} {{ weather.win_speed }}</view>
  13. <view>风速 {{ weather.win_meter }}</view>
  14. </view>
  15. </view>
  16. <view class="sos" @click="call()">
  17. <image src="../../static/qz.png" mode="widthFix"></image>
  18. <view class="title">求助</view>
  19. </view>
  20. <image :src="ip + aboutUs.bgImg1" mode="scaleToFill"></image>
  21. </view>
  22. <view class="page">
  23. <view class="flex menu">
  24. <view class="f" @click="navigate('/pages/travel/detail?id=43')">
  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/travel/introduction')">
  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/activity')">
  33. <image src="../../static/icon3.png" mode="widthFix" class="icon1"></image>
  34. <view class="title">热门活动</view>
  35. </view>
  36. <view class="f" @click="navigate('/pages/government/index')">
  37. <image src="../../static/icon4.png" mode="widthFix" class="icon1"></image>
  38. <view class="title">党政服务</view>
  39. </view>
  40. </view>
  41. <view class="flex mt15">
  42. <view class="f" style="padding-right:8px;">
  43. <image @click="detail(3)" :src="ip + aboutUs.bgImg3" style="height: 77px;width: 100%;border-radius: 10px;" mode="widthFix"></image>
  44. </view>
  45. <view class="f"><image @click="detail(4)" :src="ip + aboutUs.bgImg4" style="height: 77px;width: 100%;border-radius: 10px;" mode="widthFix"></image></view>
  46. </view>
  47. <view style="margin-top: 10px;"><image @click="detail(2)" :src="ip + aboutUs.bgImg2" style="border-radius: 5px;width: 100%;" mode="widthFix"></image></view>
  48. <!--热门景区-->
  49. <view class="item">
  50. <view class="lable">
  51. <view class="title">热门景区</view>
  52. <image src="../../static/lo2.png" mode="widthFix"></image>
  53. <view class="look" @click="tab('/pages/travel/index')">
  54. <text>更多</text>
  55. <text class="icon">&#xe62d;</text>
  56. </view>
  57. <view class="clear"></view>
  58. </view>
  59. <view class="rows">
  60. <view class="row" v-for="(item, index) in hot_list" :key="index" @click="detail(item)">
  61. <view class="out">
  62. <view class="int">
  63. <image :src="ip + item.showPictures" mode="scaleToFill"></image>
  64. <view class="title omit">{{ item.title }}</view>
  65. </view>
  66. </view>
  67. </view>
  68. <view class="clear"></view>
  69. </view>
  70. </view>
  71. <!--攻略指南-->
  72. <view class="item" style="margin-top: 15px;">
  73. <view class="lable">
  74. <view class="title">攻略指南</view>
  75. <view class="look" @click="navigate('/pages/travel/introduction')">
  76. <text>更多</text>
  77. <text class="icon">&#xe62d;</text>
  78. </view>
  79. <view class="clear"></view>
  80. </view>
  81. <view class="card" v-for="(item, index) in zn_list" :key="index" @click="detail(item)">
  82. <image :src="ip + item.showPictures" mode="aspectFill"></image>
  83. <view class="cons">
  84. <view class="title omit">{{ item.title }}</view>
  85. <view class="desc omit">{{ item.briefContent }}</view>
  86. </view>
  87. </view>
  88. </view>
  89. <u-back-top :scroll-top="scrollTop"></u-back-top>
  90. <help ref="help"></help>
  91. </view>
  92. </view>
  93. </template>
  94. <script>
  95. import help from "../../components/help.vue";
  96. export default {
  97. components: {
  98. help
  99. },
  100. data() {
  101. return {
  102. ip: this.$http.urls.ip,
  103. top: 20,
  104. scrollTop: 0,
  105. hot_list: [],
  106. zn_list: [],
  107. aboutUs: {},
  108. weather: { tem: "0", wea: "晴", win: "北风", win_speed: "0级", win_meter: "0km/h" }
  109. };
  110. },
  111. onPageScroll(e) {
  112. this.scrollTop = e.scrollTop;
  113. },
  114. onLoad(e) {
  115. this.getData();
  116. this.getWeather();
  117. //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"})
  118. uni.getSystemInfo({
  119. success: res => {
  120. console.log("assd:" + JSON.stringify(res.safeArea));
  121. this.top = parseInt(res.safeArea.top) + 5;
  122. },
  123. fail(err) {
  124. console.error(err);
  125. }
  126. });
  127. },
  128. onReady() {
  129. uni.setNavigationBarColor({
  130. frontColor: "#000000",
  131. backgroundColor: "#f8f8f8",
  132. fail(e) {
  133. console.log("aaa:" + JSON.stringify(e));
  134. }
  135. });
  136. },
  137. methods: {
  138. getWeather() {
  139. //天气接口
  140. uni.request({
  141. url: this.$http.urls.weather,
  142. success: res => {
  143. if (!res.data.errcode) {
  144. this.weather = res.data;
  145. }
  146. }
  147. });
  148. },
  149. getData() {
  150. this.$http.request({
  151. url: this.$http.urls.home,
  152. success: res => {
  153. this.hot_list = res.data.data.hot_list;
  154. this.zn_list = res.data.data.zn_list;
  155. this.aboutUs = res.data.data.aboutUs;
  156. uni.setStorageSync("aboutUs", this.aboutUs);
  157. }
  158. });
  159. },
  160. tab(url) {
  161. uni.switchTab({
  162. url: url
  163. });
  164. },
  165. //详情
  166. detail(item) {
  167. if (item.contentId) {
  168. uni.navigateTo({ url: "/pages/travel/detail?id=" + item.contentId });
  169. } else {
  170. //根据后台的选择跳转id跳转到指定文章
  171. let id;
  172. if (item == 1) {
  173. id = this.$http.getParam(this.aboutUs.briefText1, "?");
  174. }
  175. if (item == 2) {
  176. id = this.$http.getParam(this.aboutUs.briefText2, "?");
  177. }
  178. if (item == 3) {
  179. id = this.$http.getParam(this.aboutUs.briefText3, "?");
  180. }
  181. if (item == 4) {
  182. id = this.$http.getParam(this.aboutUs.briefText4, "?");
  183. }
  184. uni.navigateTo({ url: "/pages/travel/detail?id=" + id });
  185. }
  186. },
  187. navigate(url) {
  188. uni.navigateTo({ url: url });
  189. },
  190. //拨打求助电话
  191. call() {
  192. this.$refs.help.init();
  193. }
  194. },
  195. //下拉刷新
  196. onPullDownRefresh() {
  197. setTimeout(() => {
  198. uni.stopPullDownRefresh();
  199. this.getData();
  200. }, 1000);
  201. }
  202. };
  203. </script>
  204. <style lang="scss">
  205. page {
  206. background-color: #f8f8f8;
  207. }
  208. .welcome {
  209. margin-top: 38px;
  210. padding-bottom: 5px;
  211. .icon {
  212. float: left;
  213. font-size: 27px;
  214. }
  215. .dw {
  216. float: left;
  217. width: 6.5%;
  218. margin: 3px 7px 0px 7px;
  219. }
  220. .bq {
  221. width: 45%;
  222. float: left;
  223. }
  224. }
  225. .page {
  226. padding: 10px;
  227. overflow-x: hidden;
  228. margin-top: -50px;
  229. position: relative;
  230. }
  231. .top {
  232. overflow: hidden;
  233. position: relative;
  234. .wd {
  235. position: absolute;
  236. top: 0px;
  237. left: 0px;
  238. width: 100%;
  239. padding-top: 10px;
  240. padding-left: 10px;
  241. z-index: 111111;
  242. color: #666666;
  243. background: linear-gradient(180deg, #ffffff 0%, rgba(255, 255, 255, 0.1) 100%);
  244. .qw {
  245. font-size: 25px;
  246. float: left;
  247. font-weight: bold;
  248. }
  249. .xs {
  250. margin-left: 45px;
  251. width: 100%;
  252. font-size: 13px;
  253. line-height: 20px;
  254. }
  255. }
  256. .sos {
  257. position: absolute;
  258. right: 10px;
  259. top: 10px;
  260. background: linear-gradient(180deg, #ffffff 0%, rgba(255, 255, 255, 0.3) 100%);
  261. padding: 10px 10px 15px 10px;
  262. color: white;
  263. font-size: 15px;
  264. text-align: center;
  265. font-weight: normal;
  266. border-radius: 30px;
  267. z-index: 111112;
  268. image {
  269. width: 115%;
  270. }
  271. .title {
  272. color: #333333;
  273. }
  274. }
  275. image {
  276. width: 100%;
  277. height: 200px;
  278. }
  279. }
  280. .item {
  281. margin-top: 15px;
  282. .lable {
  283. margin-bottom: 13px;
  284. .title {
  285. float: left;
  286. font-size: 20px;
  287. font-weight: bold;
  288. color: #333;
  289. }
  290. image {
  291. float: left;
  292. width: 25%;
  293. margin-top: -3px;
  294. }
  295. .look {
  296. color: #999999;
  297. float: right;
  298. font-size: 15px;
  299. }
  300. }
  301. .rows {
  302. margin-left: -5px;
  303. margin-right: -5px;
  304. .row {
  305. float: left;
  306. width: 33.333%;
  307. overflow: hidden;
  308. height: 150px;
  309. .out {
  310. padding: 0px 3px 0px 3px;
  311. .int {
  312. position: relative;
  313. image {
  314. border-radius: 10px;
  315. height: 150px;
  316. width: 100%;
  317. background-color: white;
  318. }
  319. .title {
  320. position: absolute;
  321. bottom: 13px;
  322. left: 10px;
  323. width: 85%;
  324. color: white;
  325. font-size: 15px;
  326. font-weight: 400;
  327. }
  328. }
  329. }
  330. }
  331. }
  332. .card {
  333. background-color: white;
  334. overflow: hidden;
  335. border-radius: 10px;
  336. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.03);
  337. image {
  338. width: 100%;
  339. height: 150px;
  340. }
  341. .cons {
  342. padding: 12px;
  343. .title {
  344. color: #333333;
  345. font-weight: bold;
  346. font-size: 17px;
  347. }
  348. .desc {
  349. font-size: 14px;
  350. color: #999999;
  351. margin-top: 8px;
  352. }
  353. }
  354. }
  355. }
  356. </style>