index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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" @click="navigate('/pages/travel/introduction')">
  33. <view class="icon" style="background-color: #2cc937;">&#xe647;</view>
  34. <view class="title">旅游攻略</view>
  35. </view>
  36. <view class="f" @click="navigate('/pages/government/activity')">
  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/img77.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/img3.jpg" mode="aspectFill" class="gray"></image>
  50. <view class="more">点击显示更多</view>
  51. </view>
  52. </view>
  53. <view class="flex">
  54. <view class="item" @click="navigate('/pages/travel/introduction')">
  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. //上传拨打救援记录
  112. this.$http.request({
  113. method: 'POST',
  114. url: this.$http.urls.pushHelp,
  115. data: { memberId: this.$getUser().memberId, lat: res.latitude, lng: res.longitude, phone: this.$getUser().mobile },
  116. success: r => {
  117. uni.makePhoneCall({
  118. phoneNumber: this.item.helpPhone
  119. });
  120. }
  121. });
  122. }
  123. }
  124. });
  125. }
  126. });
  127. },
  128. fail(res) {
  129. //1.2 拒绝授权
  130. console.log(JSON.stringify(res));
  131. }
  132. });
  133. },
  134. tab(url) {
  135. uni.switchTab({
  136. url: url
  137. });
  138. },
  139. navigate(url) {
  140. uni.navigateTo({ url: url });
  141. }
  142. }
  143. };
  144. </script>
  145. <style lang="scss">
  146. .top {
  147. position: relative;
  148. height: 300px;
  149. color: white;
  150. .wz {
  151. position: absolute;
  152. top: 45px;
  153. left: 20px;
  154. z-index: 111111;
  155. .icon {
  156. padding-right: 5px;
  157. }
  158. }
  159. .wd {
  160. position: absolute;
  161. top: 80px;
  162. left: 20px;
  163. z-index: 111111;
  164. .qw {
  165. font-size: 40px;
  166. float: left;
  167. font-weight: bold;
  168. }
  169. .xs {
  170. margin-left: 75px;
  171. width: 100%;
  172. font-weight: bold;
  173. margin-top: 6px;
  174. }
  175. }
  176. .ms {
  177. position: absolute;
  178. top: 155px;
  179. left: 20px;
  180. z-index: 111111;
  181. font-size: 17px;
  182. font-weight: bold;
  183. }
  184. image {
  185. width: 100%;
  186. height: 300px;
  187. position: absolute;
  188. }
  189. }
  190. .main {
  191. padding: 15px 15px 50px 15px;
  192. width: 100%;
  193. margin-top: -50px;
  194. overflow: hidden;
  195. position: absolute;
  196. .menu {
  197. background-color: white;
  198. border-radius: 10px;
  199. padding: 15px;
  200. width: 100%;
  201. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  202. .icon {
  203. font-size: 30px;
  204. background-color: red;
  205. width: 38px;
  206. height: 38px;
  207. border-radius: 5px;
  208. margin: 0 auto;
  209. color: white;
  210. padding: 3px;
  211. }
  212. .title {
  213. padding-top: 4px;
  214. font-size: 13px;
  215. }
  216. }
  217. .item {
  218. flex: 1;
  219. overflow: hidden;
  220. padding: 5px;
  221. position: relative;
  222. image {
  223. border-radius: 5px;
  224. width: 100%;
  225. height: 180px;
  226. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  227. }
  228. .tag {
  229. position: absolute;
  230. left: 10px;
  231. top: 10px;
  232. z-index: 11111;
  233. font-weight: bold;
  234. color: white;
  235. font-size: 16px;
  236. }
  237. .more {
  238. position: absolute;
  239. width: 70%;
  240. background: #e23e33;
  241. opacity: 0.78;
  242. color: white;
  243. bottom: 20px;
  244. border-radius: 5px;
  245. left: 16%;
  246. padding: 5px 7px;
  247. font-size: 13px;
  248. }
  249. }
  250. }
  251. .gray {
  252. -webkit-filter: grayscale(30%);
  253. -moz-filter: grayscale(100%);
  254. -ms-filter: grayscale(100%);
  255. -o-filter: grayscale(100%);
  256. filter: grayscale(30%);
  257. filter: black;
  258. }
  259. .qj {
  260. position: fixed;
  261. top: 53%;
  262. right: 0px;
  263. width: 50px;
  264. background: red;
  265. z-index: 111;
  266. padding: 10px 10px 5px 10px;
  267. color: white;
  268. font-size: 15px;
  269. text-align: center;
  270. border-radius: 10px 0px 0px 10px;
  271. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.3);
  272. opacity: 0.8;
  273. .icon {
  274. font-size: 25px;
  275. padding-bottom: 3px;
  276. }
  277. }
  278. </style>