first commit

This commit is contained in:
2025-03-07 22:27:18 +08:00
commit 912da26042
4457 changed files with 306818 additions and 0 deletions

243
pages/my/my.js Normal file
View File

@@ -0,0 +1,243 @@
var Token = require('../../utils/util.js');
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName'),
phone: wx.getStorageSync('uid'),
uidFlag: wx.getStorageSync('uidFlag'),
status: '',
code: '',
height: '',
userInfo: null,
isUser: false,
userInfo: {},
hasUserInfo: false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var statusBarHeight = wx.getSystemInfoSync().statusBarHeight;
app.console(statusBarHeight + "=================xxxxxxxxxxxxxxxxxxxxxxxx")
this.setData({
statusBarHeight: statusBarHeight,
height: 46 + statusBarHeight,
});
app.console(this.data.height + "=================xxxxxxxxxxxxxxxxxxxxxxxx")
//调试参数
// wx.setStorageSync('phone', 18133922183);
// wx.setStorageSync('uid', 'adfdffb45a364fc23162f1ebfe9dd66f');
// wx.setStorageSync('token', '797d4q7XT8/PM9bU+T+CNpEpNfsWeVb5j+eXnrRXW0yq+wKXY9fBNSvb7qPiCRMlzZmwG3u1ods8R8Rh3gITxCkyiZGUtLZf');
// wx.setStorageSync('uidFlag', true);
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getLogin()
console.log("code==" + this.data.code)
// if (wx.getStorageSync('phone') != '') {
// this.getUserBaseInfo()
// }
},
// 登录
getLogin() {
var that = this;
wx.login({
success: res => {
console.log(res)
app.globalData.code = res.code
that.setData({
code: res.code
})
wx.getUserInfo({
success: (data) => {
const encryptedData = data.encryptedData;
const iv = data.iv;
app.globalData.encryptedData = encryptedData
app.globalData.iv = iv
// 将code、encryptedData、iv发送到后端接口
console.log("encryptedData==" + app.globalData.encryptedData)
console.log("iv==" + app.globalData.iv)
console.log("wxcode==" + app.globalData.code)
}
})
}
})
},
// 获取电话号码
getPhoneNumber(e) {
// console.log("encryptedData==" + app.globalData.encryptedData)
// console.log("iv==" + app.globalData.iv)
// console.log("wxcode==" + app.globalData.code)
var _this = this;
wx.request({
url: app.globalData.url + 'app/Ghdwechat/wechatLogin',
data: {
code: app.globalData.code,
encryptedData: app.globalData.encryptedData,
iv: app.globalData.iv
},
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded'
},
success(res) {
if (res.data.erro == 0) {
app.globalData.uid = res.data.uid;
wx.setStorageSync('phone', res.data.uid);
wx.setStorageSync('uid', res.data.uid);
wx.setStorageSync('token', res.data.uid);
wx.setStorageSync('uidFlag', true);
_this.setData({
uidFlag: true,
phone: res.data.uid
})
app.globalData.uid = res.data.uid;
wx.switchTab({
url: '/pages/home/home'
})
// _this.getToken()
// _this.ceshi()
wx.showToast({
title: res.data.msg,
icon: 'none'
});
} else {
wx.showToast({
title: res.data.msg,
icon: 'none'
});
}
}
})
},
//上传测试数据
ceshi() {
wx.request({
url: app.buildUrltwo("/member/logintwo"),
header: app.getRequestHeader(),
method: "POST",
data: {
name: wx.getStorageSync('uid'),
phone: wx.getStorageSync('phone'),
storename: wx.getStorageSync('token')
},
success: function (res) {
var resp = res.data;
if (resp.code != 200) {
app.alert({
"content": resp.msg
});
return;
}
// 跳转
wx.navigateBack({});
}
})
},
//获取token
getUserBaseInfo: function () {
var that = this;
//假数据
// if (this.data.resp.erro == 0) {
// that.setData({
// infor: this.data.resp.infor
// });
// }
wx.request({
url: app.globalData.url + '/getUserToken',
header: app.getRequestHeader(),
method: 'GET',
data: {
phonenumber: '18133922183'
},
success: function (res) {
var resp = res.data;
console.log(resp + "=======dddddddddddddddddd")
console.log(resp.erro + "======ddddddddddddddddddd")
if (resp.erro == 0) {
that.setData({
infor: resp.infor
});
}
}
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
shoucang() {
wx.navigateTo({
url: '/pages/myshoucang/myshoucang_index?' + "type=" + "1",
})
},
pintuan() {
wx.navigateTo({
// url: '/pages/myshoucang/myshoucang_index?'+"type="+"2",
url: '/pages/order/order',
})
},
qianbao() {
wx.navigateTo({
url: '/pages/wodeqianbao/qianbao'
})
},
guanyu() {
wx.navigateTo({
url: '/pages/guanyu/guanyu'
})
},
})

7
pages/my/my.json Normal file
View File

@@ -0,0 +1,7 @@
{
"usingComponents": {
"van-nav-bar":"/miniprogram/miniprogram_npm/@vant/weapp/nav-bar/index",
"van-icon": "/miniprogram/miniprogram_npm/@vant/weapp/icon/index"
},
"navigationBarTitleText": "我的"
}

53
pages/my/my.wxml Normal file
View File

@@ -0,0 +1,53 @@
<van-nav-bar
title="个人中心"
left-text=""
right-text=""
bind:click-left="onClickLeft"
bind:click-right="onClickRight"
style=" position: fixed;left: 0;top: 0;width: 100%;z-index: 2;"
/>
<view style="margin-top: {{height}}px;">
<view wx:if="{{uidFlag}}">
<view class="content">
<view class="userinfo-avatar" bindtap="bindViewTap">
<open-data type="userAvatarUrl"></open-data>
</view>
<view class="content_right">
<navigator>
<open-data type="userNickName"></open-data>
</navigator>
<!-- <view>{{phone}}</view> -->
</view>
</view>
<view class="substance" bindtap="pintuan">
<view style="display:flex">
<image src="/pages/image/Collage.png" style="width:34rpx;height:34rpx;"></image>
<view class="price">报告历史记录</view>
</view>
<view>
<image src="/pages/image/right1.png" style="width:15rpx;height:28rpx"></image>
</view>
</view>
<view class="substance" bindtap="guanyu">
<view style="display:flex">
<van-icon style="width:34rpx;height:34rpx;" name="info-o" />
<view class="price">关于</view>
</view>
<view>
<image src="/pages/image/right1.png" style="width:15rpx;height:28rpx"></image>
</view>
</view>
</view>
<view class="content" wx:else>
<image class="userinfo-avatar" src="../image/userimg.png" mode="widthFix"></image>
<view class="content_right">
<!-- <navigator url="/pages/login/login">点击登录</navigator> -->
<button class="phone" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">点击登录</button>
<view>登录获取更多信息~</view>
</view>
</view>
</view>

95
pages/my/my.wxss Normal file
View File

@@ -0,0 +1,95 @@
.content {
display: flex;
flex-direction: row;
padding: 80rpx;
padding-bottom: 48rpx;
align-items: center;
}
.content image {
width: 120rpx;
margin-right: 20rpx;
}
.content_right view:last-child {
color: #A0A5B5;
font-size: 24rpx;
margin-top: 10rpx;
}
.userinfo-avatar {
overflow: hidden;
width: 128rpx;
height: 128rpx;
margin: 20rpx;
border-radius: 50%;
}
.content_right button {
text-align: left;
padding: 0;
background: none;
color: #333333;
font-size: 34rpx;
font-weight: 800;
}
.balance {
width: 688rpx;
height: 149rpx;
margin: 0 31rpx;
display: flex;
justify-content: space-between;
}
.balance .money {
margin: 28rpx;
}
.money view:nth-child(1) {
font-size: 22rpx;
font-family: PingFang SC;
font-weight: 400;
line-height: 36rpx;
color: #929292;
}
.money view:nth-child(2) {
font-size: 40rpx;
font-weight: 400;
line-height: 36rpx;
color: #333333;
margin-top: 15rpx;
}
.balance .btn {
width: 131rpx;
height: 58rpx;
background: #FF4C00;
opacity: 1;
border-radius: 85rpx;
font-size: 26rpx;
text-align: center;
font-family: PingFang SC;
line-height: 58rpx;
color: #FFFFFF;
margin: 46rpx 24rpx;
}
.substance {
display: flex;
/* margin-top: 53rpx; */
justify-content: space-between;
margin: 53rpx 24rpx 57rpx 31rpx;
border-bottom: 1px solid #eee;
line-height: 50rpx;
}
.price {
font-size: 26rpx;
font-family: PingFang SC;
line-height: 34rpx;
color: #333333;
opacity: 1;
margin-left: 20rpx;
}