index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <view class="page">
  3. <view class="qj" @click="call()">
  4. <view class="icon">&#xe6d1;</view>
  5. SOS
  6. </view>
  7. <view class="top">
  8. <view class="wz">
  9. <text class="icon">&#xe64a;</text>
  10. <text>谢通门县欢迎您!</text>
  11. </view>
  12. <view class="wd">
  13. <view class="qw">28°</view>
  14. <view class="xs">
  15. <view>中雨 东风2级</view>
  16. <view>空气优23</view>
  17. </view>
  18. </view>
  19. <view class="ms">城市后花园·温泉养生地·胜境谢通门</view>
  20. <image src="../../static/bg.jpg" mode="aspectFill"></image>
  21. </view>
  22. <view class="main">
  23. <view class="flex menu">
  24. <view class="f" @click="tab('/pages/travel/index')">
  25. <view class="icon" style="background-color: #0f0b51;">&#xe605;</view>
  26. <view class="title">景区介绍</view>
  27. </view>
  28. <view class="f" @click="tab('/pages/government/index')">
  29. <view class="icon" style="background-color: #e23e33;">&#xe695;</view>
  30. <view class="title">党政服务</view>
  31. </view>
  32. <view class="f">
  33. <view class="icon" style="background-color: #2cc937;">&#xe647;</view>
  34. <view class="title">旅游攻略</view>
  35. </view>
  36. <view class="f" @click="tab('/pages/government/index?type=4')">
  37. <view class="icon" style="background-color: #e23e33;">&#xe645;</view>
  38. <view class="title">热门活动</view>
  39. </view>
  40. </view>
  41. <view class="flex mt10">
  42. <view class="item" @click="tab('/pages/travel/index')">
  43. <view class="tag">景区介绍</view>
  44. <image src="../../static/img1.jpg" mode="aspectFill" class="gray"></image>
  45. <view class="more">点击显示更多</view>
  46. </view>
  47. <view class="item" @click="tab('/pages/government/index')">
  48. <view class="tag">党政服务信息</view>
  49. <image src="../../static/img1.jpg" mode="aspectFill" class="gray"></image>
  50. <view class="more">点击显示更多</view>
  51. </view>
  52. </view>
  53. <view class="flex">
  54. <view class="item">
  55. <view class="tag">旅游攻略</view>
  56. <image src="../../static/img2.jpg" mode="aspectFill" class="gray"></image>
  57. <view class="more">点击显示更多</view>
  58. </view>
  59. <view class="item" @click="navigate('/pages/government/activity')">
  60. <view class="tag">热门活动</view>
  61. <image src="../../static/img4.jpg" mode="aspectFill" class="gray"></image>
  62. <view class="more">点击显示更多</view>
  63. </view>
  64. </view>
  65. </view>
  66. <u-back-top :scroll-top="scrollTop"></u-back-top>
  67. </view>
  68. </template>
  69. <script>
  70. export default {
  71. data() {
  72. return {
  73. ip: this.$http.urls.ip,
  74. scrollTop: 0,
  75. item: {}
  76. };
  77. },
  78. onPageScroll(e) {
  79. this.scrollTop = e.scrollTop;
  80. },
  81. onLoad(e) {
  82. this.init();
  83. },
  84. methods: {
  85. init() {
  86. this.$http.request({
  87. url: this.$http.urls.getAboutUs,
  88. success: res => {
  89. this.item = res.data.data.aboutUs;
  90. }
  91. });
  92. },
  93. //拨打sos
  94. call() {
  95. if (!this.$hasLogin()) {
  96. uni.showModal({ content: '登陆才能使用该功能', showCancel: false });
  97. return;
  98. }
  99. //拨打电话获取位置
  100. uni.authorize({
  101. scope: 'scope.userLocation',
  102. success: s => {
  103. uni.getLocation({
  104. type: 'wgs84',
  105. success: res => {
  106. uni.showModal({
  107. title: '提示',
  108. content: '是否拨打' + this.item.helpPhone + '求援电话?',
  109. success: c => {
  110. if (c.confirm) {
  111. this.$http.request({
  112. method: 'POST',
  113. url: this.$http.urls.pushHelp,
  114. data: { memberId: this.$getUser().memberId, lat: res.latitude, lng: res.longitude, phone: '13097850971' },
  115. success: r => {
  116. uni.makePhoneCall({
  117. phoneNumber: this.item.helpPhone
  118. });
  119. }
  120. });
  121. }
  122. }
  123. });
  124. }
  125. });
  126. },
  127. fail(res) {
  128. //1.2 拒绝授权
  129. console.log(JSON.stringify(res));
  130. }
  131. });
  132. },
  133. tab(url) {
  134. uni.switchTab({
  135. url: url
  136. });
  137. },
  138. navigate(url) {
  139. uni.navigateTo({ url: url });
  140. }
  141. }
  142. };
  143. </script>
  144. <style lang="scss">
  145. .top {
  146. position: relative;
  147. height: 300px;
  148. color: white;
  149. .wz {
  150. position: absolute;
  151. top: 40px;
  152. left: 20px;
  153. z-index: 111111;
  154. .icon {
  155. padding-right: 5px;
  156. }
  157. }
  158. .wd {
  159. position: absolute;
  160. top: 70px;
  161. left: 20px;
  162. z-index: 111111;
  163. .qw {
  164. font-size: 40px;
  165. float: left;
  166. font-weight: bold;
  167. }
  168. .xs {
  169. margin-left: 75px;
  170. width: 100%;
  171. font-weight: bold;
  172. margin-top: 6px;
  173. }
  174. }
  175. .ms {
  176. position: absolute;
  177. top: 155px;
  178. left: 20px;
  179. z-index: 111111;
  180. font-size: 17px;
  181. font-weight: bold;
  182. }
  183. image {
  184. width: 100%;
  185. height: 300px;
  186. position: absolute;
  187. }
  188. }
  189. .main {
  190. padding: 15px 15px 50px 15px;
  191. width: 100%;
  192. margin-top: -50px;
  193. overflow: hidden;
  194. position: absolute;
  195. .menu {
  196. background-color: white;
  197. border-radius: 10px;
  198. padding: 15px;
  199. width: 100%;
  200. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  201. .icon {
  202. font-size: 30px;
  203. background-color: red;
  204. width: 38px;
  205. height: 38px;
  206. border-radius: 5px;
  207. margin: 0 auto;
  208. color: white;
  209. padding: 3px;
  210. }
  211. .title {
  212. padding-top: 4px;
  213. font-size: 13px;
  214. }
  215. }
  216. .item {
  217. flex: 1;
  218. overflow: hidden;
  219. padding: 5px;
  220. position: relative;
  221. image {
  222. border-radius: 5px;
  223. width: 100%;
  224. height: 180px;
  225. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  226. }
  227. .tag {
  228. position: absolute;
  229. left: 10px;
  230. top: 10px;
  231. z-index: 11111;
  232. font-weight: bold;
  233. color: white;
  234. font-size: 16px;
  235. }
  236. .more {
  237. position: absolute;
  238. width: 70%;
  239. background: #e23e33;
  240. opacity: 0.78;
  241. color: white;
  242. bottom: 20px;
  243. border-radius: 5px;
  244. left: 16%;
  245. padding: 5px 7px;
  246. font-size: 13px;
  247. }
  248. }
  249. }
  250. .gray {
  251. -webkit-filter: grayscale(30%);
  252. -moz-filter: grayscale(100%);
  253. -ms-filter: grayscale(100%);
  254. -o-filter: grayscale(100%);
  255. filter: grayscale(30%);
  256. filter: black;
  257. }
  258. .qj {
  259. position: fixed;
  260. top: 53%;
  261. right: 0px;
  262. width: 50px;
  263. background: red;
  264. z-index: 111;
  265. padding: 10px 10px 5px 10px;
  266. color: white;
  267. font-size: 15px;
  268. text-align: center;
  269. border-radius: 10px 0px 0px 10px;
  270. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.3);
  271. opacity: 0.8;
  272. .icon {
  273. font-size: 25px;
  274. padding-bottom: 3px;
  275. }
  276. }
  277. </style>