selfInfo.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <view class="content" :style="{height:nowHeight}">
  3. <view class="self-title-box">
  4. <image :src='userHeadUrl' mode="aspectFit"></image>
  5. <text>{{userName}}</text>
  6. </view>
  7. <button class="login-button-pos" v-if="isShowAuthBtn" open-type="getUserInfo" @getuserinfo="getUserInfo">未登录,请点击授权</button>
  8. <view class="self-search-box">
  9. <view class="search-content">
  10. <view class="search-content-value">160</view>
  11. <view class="search-content-text">剩余查询次数(次)</view>
  12. </view>
  13. <view class="line"></view>
  14. <view class="search-content">
  15. <view class="search-content-value">300</view>
  16. <view class="search-content-text">总查询次数(次)</view>
  17. </view>
  18. </view>
  19. <view class="self-pay-box">
  20. <view class="search-content">
  21. <view class="search-content-value" style="color:#000;font-size: 38upx;margin-left: -11%;">查询套餐</view>
  22. <view class="search-content-text">限时优惠进行中</view>
  23. </view>
  24. <view class="search-content" style="width: 33%;height: 180rpx;" @click.stop="goPayPage()">
  25. <image src="../../static/payIcon.png" mode=""></image>
  26. <button type="primary">去购买</button>
  27. </view>
  28. </view>
  29. <view class="self-setting-box" @click.stop="goRechargePage()">
  30. <view class="setting-content-box" style="border-bottom: 1upx solid #d9d9d9">
  31. <view class="setting-content-text">
  32. <image src="../../static/icon/moneyIcon.png" mode=""></image>
  33. <text>充值记录</text>
  34. </view>
  35. <view style="margin-right: 2%;margin-top: 2%;">
  36. <image src="../../static/icon/arrowIcon.png" mode="" style="width: 32upx;height:32upx;"></image>
  37. </view>
  38. </view>
  39. <view class="setting-content-box" @click.stop="goMyAskPage()">
  40. <view class="setting-content-text">
  41. <image src="../../static/icon/askIcon.png" mode="" class="askIcon"></image>
  42. <text>我的咨询</text>
  43. </view>
  44. <view style="margin-right: 2%;margin-top: 2%;">
  45. <image src="../../static/icon/arrowIcon.png" mode="" style="width: 32upx;height:32upx;"></image>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. var md5 = require("../../common/md5.js");
  53. export default {
  54. data() {
  55. return {
  56. title: '个人中心页面',
  57. nowHeight:getApp().globalData.glbalHeight,
  58. isShowAuthBtn:getApp().globalData.isAuth,
  59. userName:getApp().globalData.user_name || '芝麻开发',
  60. userHeadUrl:getApp().globalData.user_headUrl || '../../static/logo.png',
  61. }
  62. },
  63. onLoad() {
  64. },
  65. methods: {
  66. // 获取用户信息
  67. getUserInfo(e) {
  68. if (e.detail.errMsg == "getUserInfo:ok") {
  69. this.userHeadUrl = e.detail.userInfo.avatarUrl;
  70. this.userName = e.detail.userInfo.nickName;
  71. this.isShowAuthBtn = false;
  72. this.loginUserInfo(e.detail.userInfo)
  73. } else {
  74. console.log("用户信息授权失败");
  75. this.isShowAuthBtn = true;
  76. }
  77. },
  78. loginUserInfo(info){
  79. uni.request({
  80. url:getApp().globalData.shareUrl, //需要设置为全局
  81. method: 'POST',
  82. header: {
  83. 'content-type': 'application/x-www-form-urlencoded'
  84. },
  85. data: {
  86. method: 'auth',
  87. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  88. uid:getApp().globalData.user_id,
  89. sign: md5('auth' + getApp().globalData.globalTimestamp),
  90. nickname:info.nickName,
  91. headimg:info.avatarUrl
  92. },
  93. success: res => {
  94. getApp().globalData.user_name = res.data.msg.name;
  95. getApp().globalData.user_headUrl = res.data.msg.headimg;
  96. }
  97. });
  98. },
  99. goMyAskPage(){
  100. uni.navigateTo({
  101. url: '../index/index',
  102. success: res => {},
  103. fail: () => {},
  104. complete: () => {}
  105. });
  106. },
  107. goRechargePage(){
  108. uni.navigateTo({
  109. url: './rechargeRecord/rechargeRecord',
  110. success: res => {},
  111. fail: () => {},
  112. complete: () => {}
  113. });
  114. },
  115. goPayPage(){
  116. uni.navigateTo({
  117. url: './payList/payList',
  118. success: res => {},
  119. fail: () => {},
  120. complete: () => {}
  121. });
  122. }
  123. }
  124. }
  125. </script>
  126. <style>
  127. .content {
  128. display: flex;
  129. flex-direction: column;
  130. align-items: center;
  131. justify-content: flex-start;
  132. background: #f4f5f7;
  133. }
  134. .self-title-box {
  135. height: 120upx;
  136. width: 100%;
  137. background: #27BCEF;
  138. display: flex;
  139. justify-content: flex-start;
  140. align-items: center;
  141. color: #fff;
  142. position: relative;
  143. }
  144. .login-button-pos{
  145. position: absolute;
  146. height: 120upx;
  147. line-height: 120upx;
  148. width: 100%;
  149. background:#27BCEF;
  150. color:#fff
  151. }
  152. .self-title-box image {
  153. width: 90rpx;
  154. height:90rpx;
  155. border-radius: 45rpx;
  156. margin-left: 7%;
  157. margin-right: 5%;
  158. }
  159. .self-search-box {
  160. height: 200upx;
  161. width: 85%;
  162. background: #fff;
  163. margin-top: 5%;
  164. display: flex;
  165. justify-content: space-around;
  166. align-items: center;
  167. }
  168. .line {
  169. height: 150rpx;
  170. width: 1rpx;
  171. background: #D9D9D9;
  172. }
  173. .search-content {
  174. height: 150upx;
  175. width: 45%;
  176. display: flex;
  177. flex-direction: column;
  178. justify-content: space-around;
  179. align-items: center;
  180. }
  181. .search-content-value {
  182. color: #27BCEF;
  183. font-weight: bold;
  184. font-size: 42rpx;
  185. }
  186. .search-content-text {
  187. color: #888;
  188. font-size: 26rpx;
  189. }
  190. .self-pay-box {
  191. height: 200upx;
  192. width: 85%;
  193. background: #fff;
  194. margin-top: 5%;
  195. display: flex;
  196. justify-content: space-between;
  197. align-items: center;
  198. }
  199. .search-content image {
  200. width: 120rpx;
  201. height:90rpx;
  202. }
  203. .search-content button {
  204. width: 120rpx;
  205. height:60rpx;
  206. line-height: 60rpx;
  207. font-size: 26rpx;
  208. color: #fff;
  209. background-color: #27BCEF!important;
  210. padding-left: 0;
  211. padding-right: 0;
  212. }
  213. .self-setting-box {
  214. height: 200upx;
  215. width: 90%;
  216. background: #fff;
  217. margin-top: 5%;
  218. }
  219. .setting-content-box {
  220. display: flex;
  221. justify-content: space-between;
  222. align-items: center;
  223. height: 100upx;
  224. }
  225. .setting-content-text {
  226. display: flex;
  227. align-items: center;
  228. width: 50%;
  229. }
  230. .setting-content-text image {
  231. width: 60upx;
  232. height:60upx;
  233. margin-left: 5%;
  234. margin-right: 3%;
  235. }
  236. .askIcon{
  237. width: 45rpx!important;
  238. height: 45rpx!important;
  239. margin-left: 8%!important;
  240. margin-right: 5%!important;
  241. }
  242. .setting-content-text text {
  243. font-size:30rpx;
  244. }
  245. </style>