my.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <view class="page">
  3. <view class="top">
  4. <view class="wd">
  5. <view class="qw"><image :src="user == '' ? '../../static/ls.jpg' : user.avatarUrl" class="head"></image></view>
  6. <view class="xs" @click="navigate('/pages/user/info')">
  7. <view v-if="user == ''">登录 / 注册</view>
  8. <view class="nickName" v-else>{{ user.nickName }}</view>
  9. <view class="nh">{{ user == '' ? '你还未登陆' : ' 你好,欢迎来到智慧旅游' }}</view>
  10. </view>
  11. </view>
  12. <image src="../../static/bj.jpg" mode="aspectFill"></image>
  13. </view>
  14. <view class="main">
  15. <view class="list">
  16. <view class="item hr" @click="navigate('/pages/order/my')">
  17. <text class="icon ic" style="background-color: #2979FF;">&#xe705;</text>
  18. <text>我的预约</text>
  19. <text class="icon arrow">&#xe62d;</text>
  20. </view>
  21. <view class="item hr" @click="navigate('/pages/shop/list')">
  22. <text class="icon ic" style="background-color:red">&#xe616;</text>
  23. <text>商家中心</text>
  24. <text class="icon arrow">&#xe62d;</text>
  25. </view>
  26. </view>
  27. <view class="list" style="margin-top: 13px;">
  28. <view class="item hr" @click="navigate('/pages/user/info')">
  29. <text class="icon ic" style="background-color:#606266">&#xe626;</text>
  30. <text>我的信息</text>
  31. <text class="icon arrow">&#xe62d;</text>
  32. </view>
  33. <view class="item hr" @click="call()">
  34. <text class="icon ic" style="background-color:#366092">&#xe634;</text>
  35. <text>求助电话</text>
  36. <text class="icon arrow">&#xe62d;</text>
  37. </view>
  38. <view class="item hr" @click="navigate('/pages/other/feedback')">
  39. <text class="icon ic" style="background-color:#FF554B">&#xe610;</text>
  40. <text>投诉建议</text>
  41. <text class="icon arrow">&#xe62d;</text>
  42. </view>
  43. <view class="item hr">
  44. <button open-type="share">
  45. <text class="icon ic" style="background-color:#18B566">&#xe607;</text>
  46. <text>分享朋友</text>
  47. <text class="icon arrow">&#xe62d;</text>
  48. </button>
  49. </view>
  50. <view class="item" @click="navigate('/pages/other/about')">
  51. <text class="icon ic" style="background-color:#606266">&#xe65f;</text>
  52. <text>关于我们</text>
  53. <text class="icon arrow">&#xe62d;</text>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. export default {
  61. data() {
  62. return {
  63. ip: this.$http.urls.ip,
  64. user: this.$getUser(),
  65. aboutUs: { showPictures: [] }
  66. };
  67. },
  68. onLoad() {
  69. this.aboutUs = uni.getStorageSync('aboutUs');
  70. },
  71. onShow() {
  72. this.user = this.$getUser();
  73. },
  74. methods: {
  75. navigate(url) {
  76. if (this.$hasLogin()) {
  77. uni.navigateTo({ url: url });
  78. } else {
  79. uni.navigateTo({ url: '/pages/user/login' });
  80. }
  81. },
  82. //拨打求助电话
  83. call() {
  84. if (!this.$hasLogin()) {
  85. uni.showModal({ content: '登陆才能使用该功能', showCancel: false });
  86. return;
  87. }
  88. //获取拨打人位置
  89. uni.authorize({
  90. scope: 'scope.userLocation',
  91. success: s => {
  92. uni.getLocation({
  93. type: 'wgs84',
  94. success: res => {
  95. uni.showModal({
  96. title: '提示',
  97. content: '是否拨打' + this.aboutUs.helpPhone + '求援电话?',
  98. success: c => {
  99. if (c.confirm) {
  100. //上传拨打救援记录
  101. this.$http.request({
  102. method: 'POST',
  103. url: this.$http.urls.pushHelp,
  104. data: {
  105. memberId: this.$getUser().memberId,
  106. lat: res.latitude,
  107. lng: res.longitude,
  108. phone: this.aboutUs.helpPhone,
  109. memberPhone: this.$getUser().mobile
  110. },
  111. success: r => {
  112. uni.makePhoneCall({
  113. phoneNumber: this.aboutUs.helpPhone
  114. });
  115. }
  116. });
  117. }
  118. }
  119. });
  120. }
  121. });
  122. },
  123. fail(res) {
  124. //1.2 拒绝授权
  125. console.log(JSON.stringify(res));
  126. }
  127. });
  128. }
  129. }
  130. };
  131. </script>
  132. <style lang="scss">
  133. .top {
  134. position: relative;
  135. height: 300px;
  136. color: white;
  137. .wd {
  138. position: absolute;
  139. top: 70px;
  140. left: 20px;
  141. z-index: 11;
  142. .head {
  143. width: 75px;
  144. height: 75px;
  145. border-radius: 50%;
  146. }
  147. .xs {
  148. margin-left: 90px;
  149. width: 100%;
  150. font-weight: bold;
  151. margin-top: 10px;
  152. .nickName {
  153. margin-top: 20px;
  154. }
  155. .nh {
  156. font-size: 12px;
  157. font-weight: normal;
  158. margin-top: 5px;
  159. }
  160. }
  161. }
  162. image {
  163. width: 100%;
  164. height: 300px;
  165. position: absolute;
  166. }
  167. }
  168. .main {
  169. padding: 15px 15px 50px 15px;
  170. width: 100%;
  171. overflow: hidden;
  172. position: absolute;
  173. margin-top: -100px;
  174. .list {
  175. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  176. width: 100%;
  177. background-color: white;
  178. border-radius: 5px;
  179. overflow: hidden;
  180. .item {
  181. padding: 16px;
  182. background-color: white;
  183. font-size: 16px;
  184. .ic {
  185. font-size: 20px;
  186. background-color: red;
  187. text-align: center;
  188. padding: 5px;
  189. border-radius: 5px;
  190. margin-right: 9px;
  191. color: white;
  192. }
  193. .arrow {
  194. font-size: 20px;
  195. }
  196. }
  197. }
  198. }
  199. button {
  200. text-align: left;
  201. background-color: white;
  202. color: #2e2e2e !important;
  203. font-size: 16px;
  204. padding-left: 0px;
  205. padding-right: 2px;
  206. line-height: 20px;
  207. overflow: initial;
  208. }
  209. </style>