index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <view class="page">
  3. <view class="sos" @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="item.showPictures[0] ? ip + item.showPictures[0] : '../../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="item.bgImg1 ? ip + item.bgImg1 : '../../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="item.bgImg2 ? ip + item.bgImg2 : '../../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="item.bgImg3 ? ip + item.bgImg3 : '../../static/img3.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="item.bgImg4 ? ip + item.bgImg4 : '../../static/img3.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: { showPictures: [] }
  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.home,
  88. success: res => {
  89. this.item = res.data.data.aboutUs;
  90. if (this.item.showPictures) {
  91. this.item.showPictures = this.item.showPictures.split(',');
  92. }
  93. uni.setStorageSync('aboutUs', this.item);
  94. }
  95. });
  96. },
  97. //拨打sos
  98. call() {
  99. if (!this.$hasLogin()) {
  100. uni.showModal({ content: '登陆才能使用该功能', showCancel: false });
  101. return;
  102. }
  103. //获取拨打人位置
  104. uni.authorize({
  105. scope: 'scope.userLocation',
  106. success: s => {
  107. uni.getLocation({
  108. type: 'wgs84',
  109. success: res => {
  110. uni.showModal({
  111. title: '提示',
  112. content: '是否拨打' + this.item.helpPhone + '求援电话?',
  113. success: c => {
  114. if (c.confirm) {
  115. //上传拨打救援记录
  116. this.$http.request({
  117. method: 'POST',
  118. url: this.$http.urls.pushHelp,
  119. data: {
  120. memberId: this.$getUser().memberId,
  121. lat: res.latitude,
  122. lng: res.longitude,
  123. phone: this.item.helpPhone,
  124. memberPhone: this.$getUser().mobile
  125. },
  126. success: r => {
  127. uni.makePhoneCall({
  128. phoneNumber: this.item.helpPhone
  129. });
  130. }
  131. });
  132. }
  133. }
  134. });
  135. }
  136. });
  137. },
  138. fail(res) {
  139. //1.2 拒绝授权
  140. console.log(JSON.stringify(res));
  141. }
  142. });
  143. },
  144. tab(url) {
  145. uni.switchTab({
  146. url: url
  147. });
  148. },
  149. navigate(url) {
  150. uni.navigateTo({ url: url });
  151. }
  152. }
  153. };
  154. </script>
  155. <style lang="scss">
  156. .top {
  157. position: relative;
  158. height: 300px;
  159. color: white;
  160. .wz {
  161. position: absolute;
  162. top: 45px;
  163. left: 20px;
  164. z-index: 111;
  165. .icon {
  166. padding-right: 5px;
  167. }
  168. }
  169. .wd {
  170. position: absolute;
  171. top: 80px;
  172. left: 20px;
  173. z-index: 111111;
  174. .qw {
  175. font-size: 40px;
  176. float: left;
  177. font-weight: bold;
  178. }
  179. .xs {
  180. margin-left: 75px;
  181. width: 100%;
  182. font-weight: bold;
  183. margin-top: 6px;
  184. }
  185. }
  186. .ms {
  187. position: absolute;
  188. top: 155px;
  189. left: 20px;
  190. z-index: 111111;
  191. font-size: 17px;
  192. font-weight: bold;
  193. }
  194. image {
  195. width: 100%;
  196. height: 300px;
  197. position: absolute;
  198. }
  199. }
  200. .main {
  201. padding: 15px 15px 50px 15px;
  202. width: 100%;
  203. margin-top: -50px;
  204. overflow: hidden;
  205. position: absolute;
  206. .menu {
  207. background-color: white;
  208. border-radius: 10px;
  209. padding: 15px;
  210. width: 100%;
  211. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  212. .icon {
  213. font-size: 30px;
  214. background-color: #48a5ff;
  215. width: 38px;
  216. height: 38px;
  217. border-radius: 5px;
  218. margin: 0 auto;
  219. color: white;
  220. padding: 3px;
  221. }
  222. .title {
  223. padding-top: 4px;
  224. font-size: 13px;
  225. }
  226. }
  227. .item {
  228. flex: 1;
  229. overflow: hidden;
  230. padding: 5px;
  231. position: relative;
  232. image {
  233. border-radius: 5px;
  234. width: 100%;
  235. height: 180px;
  236. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  237. }
  238. .tag {
  239. position: absolute;
  240. left: 10px;
  241. top: 10px;
  242. z-index: 11111;
  243. font-weight: bold;
  244. color: white;
  245. font-size: 16px;
  246. }
  247. .more {
  248. position: absolute;
  249. width: 70%;
  250. background: #e23e33;
  251. opacity: 0.78;
  252. color: white;
  253. bottom: 20px;
  254. border-radius: 5px;
  255. left: 16%;
  256. padding: 5px 7px;
  257. font-size: 13px;
  258. }
  259. }
  260. }
  261. .gray {
  262. -webkit-filter: grayscale(30%);
  263. -moz-filter: grayscale(100%);
  264. -ms-filter: grayscale(100%);
  265. -o-filter: grayscale(100%);
  266. filter: grayscale(30%);
  267. filter: black;
  268. }
  269. </style>