| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319 |
- <template>
- <view class="content" :style="{height:nowHeight}">
-
- <view class="self-title-box">
- <image :src='userHeadUrl' mode="aspectFit"></image>
- <text>{{userName}}</text>
- </view>
- <button class="login-button-pos" v-if="isShowAuthBtn" open-type="getUserInfo" @getuserinfo="getUserInfo">
- <image src="/static/icon/power-head.png" class="power-head-img" />未授权,请点击获取信息
- </button>
- <view class="self-search-box">
- <view class="search-content">
- <view class="search-content-value">{{userTime}}</view>
- <view class="search-content-text">剩余查询次数(次)</view>
- </view>
- <view class="line"></view>
- <view class="search-content">
- <view class="search-content-value">{{userTotalTime}}</view>
- <view class="search-content-text">总查询次数(次)</view>
- </view>
- </view>
-
- <!-- <view class="self-pay-box" v-if='!isIos'>
- <view class="search-content">
- <view class="search-content-value" style="color:#000;font-size: 38upx;margin-left: -11%;">查询套餐</view>
- <view class="search-content-text">限时优惠进行中</view>
- </view>
- <view class="search-content" style="width: 33%;height: 180rpx;" @click.stop="goPayPage()">
- <image src="../../static/payIcon.png" mode=""></image>
- <button type="primary">去购买</button>
- </view>
- </view> -->
-
- <view class="self-setting-box">
- <!-- <view class="setting-content-box" style="border-bottom: 1upx solid #d9d9d9" v-if='!isIos' @click.stop="goRechargePage()">
- <view class="setting-content-text">
- <image src="../../static/icon/moneyIcon.png" mode=""></image>
- <text>充值记录</text>
- </view>
- <view style="margin-right: 2%;margin-top: 2%;">
- <image src="../../static/icon/arrowIcon.png" mode="" style="width: 32upx;height:32upx;"></image>
- </view>
- </view> -->
-
- <view class="setting-content-box" @click.stop="inviteFriend()">
- <view class="setting-content-text">
- <image src="../../static/icon/askIcon.png" mode="" class="askIcon"></image>
- <text>邀好友</text>
- </view>
- <view style="margin-right: 2%;margin-top:2%;display: flex;">
- <text style="font-size: 25upx;color:#999999;padding-right: 20rpx;">邀1人得10次查询机会</text>
- <image src="../../static/icon/arrowIcon.png" mode="" style="width: 32upx;height:32upx;"></image>
- </view>
- </view>
-
-
-
- <view class="setting-content-box" @click.stop="goMyAskPage()">
- <view class="setting-content-text">
- <image src="../../static/icon/askIcon.png" mode="" class="askIcon"></image>
- <text>我的咨询</text>
- </view>
- <view style="margin-right: 2%;margin-top: 2%;">
- <image src="../../static/icon/arrowIcon.png" mode="" style="width: 32upx;height:32upx;"></image>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- var md5 = require("../../common/md5.js");
- export default {
- data() {
- return {
- title: '个人中心页面',
- nowHeight:getApp().globalData.glbalHeight,
- isShowAuthBtn:true,
- userName:getApp().globalData.user_name,
- userHeadUrl:getApp().globalData.user_headUrl,
- userTime:getApp().globalData.times,
- userTotalTime:getApp().globalData.total_times,
- isIos:getApp().globalData.isIos
- }
- },
- onLoad() {
- },
- onShow(){
- this.getUserTimes();
- },
- methods: {
- // 获取用户信息
- getUserInfo(e) {
- console.log(e);
- if (e.detail.errMsg == "getUserInfo:ok") {
- this.userHeadUrl = e.detail.userInfo.avatarUrl;
- this.userName = e.detail.userInfo.nickName;
- getApp().globalData.user_name =e.detail.userInfo.nickName;
- getApp().globalData.user_headUrl = e.detail.userInfo.avatarUrl;
- this.isShowAuthBtn = false;
- this.loginUserInfo()
- } else {
- console.log("用户信息授权失败");
- this.isShowAuthBtn = true;
- }
- },
- getUserTimes(){
- let that = this;
- uni.request({
- url:getApp().globalData.shareUrl, //需要设置为全局
- method: 'POST',
- header: {
- 'content-type': 'application/x-www-form-urlencoded'
- },
- data: {
- method: 'getUserInfo',
- timestamp: getApp().globalData.globalTimestamp, //Date.now()
- uid:getApp().globalData.user_id,
- sign: md5('getUserInfo' + getApp().globalData.globalTimestamp),
- },
- success: res => {
- that.isShowAuthBtn = res.data.msg.isauth === '0';
- that.userTime = res.data.msg.times;
- that.userTotalTime = res.data.msg.total_times;
- getApp().globalData.times = res.data.msg.times;
- getApp().globalData.total_times = res.data.msg.total_times;
- }
- });
- },
- loginUserInfo(){
- let that = this;
- uni.request({
- url:getApp().globalData.shareUrl, //需要设置为全局
- method: 'POST',
- header: {
- 'content-type': 'application/x-www-form-urlencoded'
- },
- data: {
- method: 'auth',
- timestamp: getApp().globalData.globalTimestamp, //Date.now()
- uid:getApp().globalData.user_id,
- sign: md5('auth' + getApp().globalData.globalTimestamp),
- nickname:getApp().globalData.user_name,
- headimg:getApp().globalData.user_headUrl
- },
- success: res => {
- console.log('已授权')
- }
- });
- },
- goMyAskPage(){
- uni.navigateBack({
- delta:0
- })
- },
- inviteFriend(){
- uni.navigateTo({
- url: '../share/sharePage',
- success: res => {},
- fail: () => {},
- complete: () => {}
- });
- },
- goRechargePage(){
- uni.navigateTo({
- url: './rechargeRecord/rechargeRecord',
- success: res => {},
- fail: () => {},
- complete: () => {}
- });
- },
- goPayPage(){
- uni.navigateTo({
- url: './payList/payList',
- success: res => {},
- fail: () => {},
- complete: () => {}
- });
- }
- }
- }
- </script>
- <style>
- .content {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: flex-start;
- background: #f4f5f7;
- }
-
- .self-title-box {
- height: 120upx;
- width: 100%;
- background: #27BCEF;
- display: flex;
- justify-content: flex-start;
- align-items: center;
- color: #fff;
- position: relative;
- }
- .login-button-pos{
- position: absolute;
- height: 120upx;
- line-height: 120upx;
- width: 100%;
- background:#27BCEF;
- color:#fff;
- display: flex;
- align-items: center;
- font-size: 28upx;
- padding-left: 50upx;
- }
- .power-head-img {
- width: 85upx;
- height: 85upx;
- margin-right: 3%;
- }
- .self-title-box image {
- width: 90rpx;
- height:90rpx;
- border-radius: 45rpx;
- margin-left: 7%;
- margin-right: 5%;
- }
-
- .self-search-box {
- height: 200upx;
- width: 85%;
- background: #fff;
- margin-top: 5%;
- display: flex;
- justify-content: space-around;
- align-items: center;
- }
- .line {
- height: 150rpx;
- width: 1rpx;
- background: #D9D9D9;
- }
- .search-content {
- height: 150upx;
- width: 45%;
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- align-items: center;
- }
- .search-content-value {
- color: #27BCEF;
- font-weight: bold;
- font-size: 42rpx;
- }
- .search-content-text {
- color: #888;
- font-size: 26rpx;
- }
- .self-pay-box {
- height: 200upx;
- width: 85%;
- background: #fff;
- margin-top: 5%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .search-content image {
- width: 120rpx;
- height:90rpx;
- }
- .search-content button {
- width: 120rpx;
- height:60rpx;
- line-height: 60rpx;
- font-size: 26rpx;
- color: #fff;
- background-color: #27BCEF!important;
- padding-left: 0;
- padding-right: 0;
- }
-
- .self-setting-box {
- /* height: 200upx; */
- width: 90%;
- background: #fff;
- margin-top: 5%;
- }
- .setting-content-box {
- display: flex;
- justify-content: space-between;
- align-items: center;
- height: 100upx;
- }
- .setting-content-text {
- display: flex;
- align-items: center;
- width: 50%;
- }
- .setting-content-text image {
- width: 60upx;
- height:60upx;
- margin-left: 5%;
- margin-right: 3%;
- }
- .askIcon{
- width: 45rpx!important;
- height: 45rpx!important;
- margin-left: 8%!important;
- margin-right: 5%!important;
- }
- .setting-content-text text {
- font-size:30rpx;
- }
- </style>
|