selfInfo.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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. console.log(res.data.msg)
  95. }
  96. });
  97. },
  98. goMyAskPage(){
  99. uni.navigateTo({
  100. url: '../index/index',
  101. success: res => {},
  102. fail: () => {},
  103. complete: () => {}
  104. });
  105. },
  106. goRechargePage(){
  107. uni.navigateTo({
  108. url: './rechargeRecord/rechargeRecord',
  109. success: res => {},
  110. fail: () => {},
  111. complete: () => {}
  112. });
  113. },
  114. goPayPage(){
  115. uni.navigateTo({
  116. url: './payList/payList',
  117. success: res => {},
  118. fail: () => {},
  119. complete: () => {}
  120. });
  121. }
  122. }
  123. }
  124. </script>
  125. <style>
  126. .content {
  127. display: flex;
  128. flex-direction: column;
  129. align-items: center;
  130. justify-content: flex-start;
  131. background: #f4f5f7;
  132. }
  133. .self-title-box {
  134. height: 120upx;
  135. width: 100%;
  136. background: #27BCEF;
  137. display: flex;
  138. justify-content: flex-start;
  139. align-items: center;
  140. color: #fff;
  141. position: relative;
  142. }
  143. .login-button-pos{
  144. position: absolute;
  145. height: 120upx;
  146. line-height: 120upx;
  147. width: 100%;
  148. background:#27BCEF;
  149. color:#fff
  150. }
  151. .self-title-box image {
  152. width: 90rpx;
  153. height:90rpx;
  154. border-radius: 45rpx;
  155. margin-left: 7%;
  156. margin-right: 5%;
  157. }
  158. .self-search-box {
  159. height: 200upx;
  160. width: 85%;
  161. background: #fff;
  162. margin-top: 5%;
  163. display: flex;
  164. justify-content: space-around;
  165. align-items: center;
  166. }
  167. .line {
  168. height: 150rpx;
  169. width: 1rpx;
  170. background: #D9D9D9;
  171. }
  172. .search-content {
  173. height: 150upx;
  174. width: 45%;
  175. display: flex;
  176. flex-direction: column;
  177. justify-content: space-around;
  178. align-items: center;
  179. }
  180. .search-content-value {
  181. color: #27BCEF;
  182. font-weight: bold;
  183. font-size: 42rpx;
  184. }
  185. .search-content-text {
  186. color: #888;
  187. font-size: 26rpx;
  188. }
  189. .self-pay-box {
  190. height: 200upx;
  191. width: 85%;
  192. background: #fff;
  193. margin-top: 5%;
  194. display: flex;
  195. justify-content: space-between;
  196. align-items: center;
  197. }
  198. .search-content image {
  199. width: 120rpx;
  200. height:90rpx;
  201. }
  202. .search-content button {
  203. width: 120rpx;
  204. height:60rpx;
  205. line-height: 60rpx;
  206. font-size: 26rpx;
  207. color: #fff;
  208. background-color: #27BCEF!important;
  209. padding-left: 0;
  210. padding-right: 0;
  211. }
  212. .self-setting-box {
  213. height: 200upx;
  214. width: 90%;
  215. background: #fff;
  216. margin-top: 5%;
  217. }
  218. .setting-content-box {
  219. display: flex;
  220. justify-content: space-between;
  221. align-items: center;
  222. height: 100upx;
  223. }
  224. .setting-content-text {
  225. display: flex;
  226. align-items: center;
  227. width: 50%;
  228. }
  229. .setting-content-text image {
  230. width: 60upx;
  231. height:60upx;
  232. margin-left: 5%;
  233. margin-right: 3%;
  234. }
  235. .askIcon{
  236. width: 45rpx!important;
  237. height: 45rpx!important;
  238. margin-left: 8%!important;
  239. margin-right: 5%!important;
  240. }
  241. .setting-content-text text {
  242. font-size:30rpx;
  243. }
  244. </style>