Browse Source

功能优化

guessPrice
sui 5 years ago
parent
commit
b4eafd38b7
14 changed files with 93 additions and 42 deletions
  1. +30
    -1
      496_dongfengqichen/app.js
  2. +6
    -4
      496_dongfengqichen/pages/address/address.js
  3. +16
    -2
      496_dongfengqichen/pages/index/index.js
  4. +3
    -1
      496_dongfengqichen/pages/index/index.wxml
  5. +9
    -0
      496_dongfengqichen/pages/index/index.wxss
  6. +2
    -11
      496_dongfengqichen/pages/luckyStar/luckyStar.js
  7. +1
    -1
      496_dongfengqichen/pages/mobileVerification/mobileVerification.js
  8. +1
    -9
      496_dongfengqichen/pages/myCenter/myCenter.js
  9. +3
    -1
      496_dongfengqichen/pages/myCenter/myCenter.wxml
  10. +1
    -0
      496_dongfengqichen/pages/myCenter/myCenter.wxss
  11. +1
    -8
      496_dongfengqichen/pages/scout/scout.js
  12. +2
    -2
      496_dongfengqichen/pages/scout/scout.wxml
  13. +11
    -1
      496_dongfengqichen/pages/scout/scout.wxss
  14. +7
    -1
      496_dongfengqichen/project.config.json

+ 30
- 1
496_dongfengqichen/app.js View File

this.globalData.userInfoData = {}; this.globalData.userInfoData = {};
this.globalData.userInfoData.avatarUrl = userInfoData.avatarUrl; this.globalData.userInfoData.avatarUrl = userInfoData.avatarUrl;
this.globalData.userInfoData.nickName = userInfoData.nickName; this.globalData.userInfoData.nickName = userInfoData.nickName;
}else{
this.getUserInfo();
} }
var userPhoneType = wx.getStorageSync('userPhoneType'); var userPhoneType = wx.getStorageSync('userPhoneType');
if (userPhoneType) { if (userPhoneType) {
} }
}, },
submitUserMsg: function (avatarUrl, nickName) {//提交用户信息 submitUserMsg: function (avatarUrl, nickName) {//提交用户信息
this.wxRequest(this.globalData.urlRoot + "userInfo/updateUserInfo", { avatarUrl: avatarUrl, nickName: nickName }, res => { }, this, "POST")
this.wxRequest(this.globalData.urlRoot + "userInfo/updateUserInfo", { avatarUrl: avatarUrl, nickName: nickName }, res => {
if (res.code == 200) {
this.globalData.userInfoData = {};
this.globalData.userInfoData.avatarUrl = avatarUrl;
this.globalData.userInfoData.nickName = nickName;
wx.setStorageSync('userInfoData', {
avatarUrl: avatarUrl,
nickName: nickName
})
}
}, this, "POST")
}, },
codeVerify: function (card) {//身份证号码验证 codeVerify: function (card) {//身份证号码验证
let rule = /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}[0-9Xx]$)/; let rule = /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}[0-9Xx]$)/;
}, this, "POST"); }, this, "POST");
}, },
getMobile: function (encryptedData, iv, callback, thisArg) {//检查登录态是否过期 getMobile: function (encryptedData, iv, callback, thisArg) {//检查登录态是否过期
console.log(encryptedData);
console.log(iv);
wx.checkSession({ wx.checkSession({
success: res => { success: res => {
this.getMobile2(encryptedData,iv,callback,thisArg); this.getMobile2(encryptedData,iv,callback,thisArg);
callback.call(thisArg, res); callback.call(thisArg, res);
} }
}, this, "POST"); }, this, "POST");
},
getUserInfo: function () {//获取个人信息
this.wxRequest(this.globalData.urlRoot +"userInfo/getUserInfo",{},res=>{
if(res.code==200){
if (res.data && res.data.avatarUrl) {
this.globalData.userInfoData = {};
this.globalData.userInfoData.avatarUrl = res.data.avatarUrl;
this.globalData.userInfoData.nickName = res.data.nickName;
wx.setStorageSync('userInfoData', {
avatarUrl: res.data.avatarUrl,
nickName: res.data.nickName
})
}
}
},this)
} }
}) })

+ 6
- 4
496_dongfengqichen/pages/address/address.js View File

if (e.detail.errMsg == 'getPhoneNumber:ok') { if (e.detail.errMsg == 'getPhoneNumber:ok') {
app.getMobile(e.detail.encryptedData, e.detail.iv, res => { app.getMobile(e.detail.encryptedData, e.detail.iv, res => {
if (res.code == 200) { if (res.code == 200) {
this.data.submitData.mobile = res.data.decodeData.phoneNumber;
this.setData({
submitData: this.data.submitData
})
if (res.data && res.data.decodeData) {
this.data.submitData.mobile = res.data.decodeData.phoneNumber;
this.setData({
submitData: this.data.submitData
})
}
} else { } else {
wx.showToast({ wx.showToast({
title: res.msg, title: res.msg,

+ 16
- 2
496_dongfengqichen/pages/index/index.js View File

videoList:[],//视频列表 videoList:[],//视频列表
videoVideoControls:false,//是否显示视频控件 videoVideoControls:false,//是否显示视频控件
mainShow:false, mainShow:false,
isOnce:false
isOnce:false,
userData:null,
}, },
onLoad: function () { onLoad: function () {
app.globalData.nowPage = 1; app.globalData.nowPage = 1;
} }
}, },
loadFun: function () { loadFun: function () {
if (app.globalData.userInfoData) {
this.setData({
userData: app.globalData.userInfoData
})
}
if (app.globalData.userMobile) { if (app.globalData.userMobile) {
this.data.subscribeData.mobile = app.globalData.userMobile; this.data.subscribeData.mobile = app.globalData.userMobile;
this.setData({ this.setData({
if (e.detail.errMsg=='getPhoneNumber:ok'){ if (e.detail.errMsg=='getPhoneNumber:ok'){
app.getMobile(e.detail.encryptedData, e.detail.iv,res=>{ app.getMobile(e.detail.encryptedData, e.detail.iv,res=>{
if (res.code == 200) { if (res.code == 200) {
if(res.data){
if (res.data && res.data.decodeData){
this.data.subscribeData.mobile = res.data.decodeData.phoneNumber; this.data.subscribeData.mobile = res.data.decodeData.phoneNumber;
this.setData({ this.setData({
subscribeData: this.data.subscribeData subscribeData: this.data.subscribeData
*/ */
onShareAppMessage: function () { onShareAppMessage: function () {
return app.sharePack(); return app.sharePack();
},
getUserWxMsg:function(e){
if (e.detail.errMsg == "getUserInfo:ok") {
this.setData({
userData: e.detail.userInfo
})
app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName);
}
} }
}) })

+ 3
- 1
496_dongfengqichen/pages/index/index.wxml View File

</view> </view>
</picker> </picker>
</view> </view>
<view class="subscribeBtn" bindtap="subscribeFun">预约鉴赏</view>
<view class="subscribeBtn" bindtap="subscribeFun">预约鉴赏
<button wx:if="{{!userData}}" class="getUserMsgBtn" open-type="getUserInfo" lang="zh_CN" bindgetuserinfo="getUserWxMsg" style="width:100%;height:100%;min-height:0;"></button>
</view>
</view> </view>
<service></service> <service></service>
</view> </view>

+ 9
- 0
496_dongfengqichen/pages/index/index.wxss View File

height: 15rpx; height: 15rpx;
} }
.subscribeBtn{ .subscribeBtn{
position: relative;
width:672rpx; width:672rpx;
height:54rpx; height:54rpx;
line-height: 54rpx; line-height: 54rpx;
bottom: 25rpx; bottom: 25rpx;
width: 188rpx; width: 188rpx;
height: 40rpx; height: 40rpx;
}
.getUserMsgBtn{
position: absolute;
top: 0;
left: 0;
padding: 0;
margin: 0;
opacity: 0;
} }

+ 2
- 11
496_dongfengqichen/pages/luckyStar/luckyStar.js View File

}, },
loadFun: function () { loadFun: function () {
if (app.globalData.userInfoData) { if (app.globalData.userInfoData) {
this.data.userData = app.globalData.userInfoData;
this.setData({ this.setData({
userData: this.data.userData
userData: app.globalData.userInfoData
}) })
} }
this.getAddress(); this.getAddress();
getUserWxMsg: function (e) {//通过微信获取用户信息 getUserWxMsg: function (e) {//通过微信获取用户信息
if (e.detail.errMsg == "getUserInfo:ok") { if (e.detail.errMsg == "getUserInfo:ok") {
this.gameStart(); this.gameStart();
app.globalData.userInfoData = {};
app.globalData.userInfoData.avatarUrl = e.detail.userInfo.avatarUrl;
app.globalData.userInfoData.nickName = e.detail.userInfo.nickName;
this.data.userData = app.globalData.userInfoData;
this.setData({ this.setData({
userData:this.data.userData
})
wx.setStorageSync('userInfoData', {
avatarUrl: e.detail.userInfo.avatarUrl,
nickName: e.detail.userInfo.nickName
userData: e.detail.userInfo
}) })
app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName); app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName);
}else{ }else{

+ 1
- 1
496_dongfengqichen/pages/mobileVerification/mobileVerification.js View File

if (e.detail.errMsg == 'getPhoneNumber:ok') { if (e.detail.errMsg == 'getPhoneNumber:ok') {
app.getMobile(e.detail.encryptedData, e.detail.iv, res => { app.getMobile(e.detail.encryptedData, e.detail.iv, res => {
if (res.code == 200) { if (res.code == 200) {
if (res.data.result == 0) {
if (res.data && res.data.decodeData) {
this.setData({ this.setData({
mobileText: res.data.decodeData.phoneNumber mobileText: res.data.decodeData.phoneNumber
}) })

+ 1
- 9
496_dongfengqichen/pages/myCenter/myCenter.js View File

if (e.detail.errMsg == "getUserInfo:ok") { if (e.detail.errMsg == "getUserInfo:ok") {
this.data.userData.avatarUrl = e.detail.userInfo.avatarUrl; this.data.userData.avatarUrl = e.detail.userInfo.avatarUrl;
this.data.userData.nickName = e.detail.userInfo.nickName; this.data.userData.nickName = e.detail.userInfo.nickName;
this.data.userData.userLevel = 0;
this.setData({ this.setData({
userData: this.data.userData, userData: this.data.userData,
isLogin: true isLogin: true
}) })
app.globalData.userInfoData = {};
app.globalData.userInfoData.avatarUrl = e.detail.userInfo.avatarUrl;
app.globalData.userInfoData.nickName = e.detail.userInfo.nickName;
wx.setStorageSync('userInfoData', {
avatarUrl: e.detail.userInfo.avatarUrl,
nickName: e.detail.userInfo.nickName
})
app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName); app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName);
} }
}, },
if (e.detail.errMsg == 'getPhoneNumber:ok') { if (e.detail.errMsg == 'getPhoneNumber:ok') {
app.getMobile(e.detail.encryptedData, e.detail.iv, res => { app.getMobile(e.detail.encryptedData, e.detail.iv, res => {
if (res.code == 200) { if (res.code == 200) {
if(res.data){
if (res.data && res.data.decodeData){
this.data.subscribeData.mobile = res.data.decodeData.phoneNumber; this.data.subscribeData.mobile = res.data.decodeData.phoneNumber;
this.setData({ this.setData({
subscribeData: this.data.subscribeData subscribeData: this.data.subscribeData

+ 3
- 1
496_dongfengqichen/pages/myCenter/myCenter.wxml View File

<image class="agreeIcon" bindtap="agreementState" src="{{imgUrl+(isAgreement?'/images/agreeIcon.png':'/images/disagreeIcon.png')}}"></image> <image class="agreeIcon" bindtap="agreementState" src="{{imgUrl+(isAgreement?'/images/agreeIcon.png':'/images/disagreeIcon.png')}}"></image>
<view class="agreementText"><view>我仔细阅读并接受所附的</view><view bindtap="agreementControl">《用户协议与隐私政策》</view></view> <view class="agreementText"><view>我仔细阅读并接受所附的</view><view bindtap="agreementControl">《用户协议与隐私政策》</view></view>
</view> </view>
<view class="subscribeBtn" bindtap="subscribeFun">登录/注册</view>
<view class="subscribeBtn" bindtap="subscribeFun">登录/注册
<button wx:if="{{userData}}" class="getUserMsgBtn" open-type="getUserInfo" lang="zh_CN" bindgetuserinfo="getUserWxMsg" style="width:100%;height:100%;min-height:0;"></button>
</view>
<view class="subscribeBtn">查看更多车型</view> <view class="subscribeBtn">查看更多车型</view>
</view> </view>
<!-- <view class="subscribeGroup" wx:if="{{selectNow==4 && isRegister}}"> <!-- <view class="subscribeGroup" wx:if="{{selectNow==4 && isRegister}}">

+ 1
- 0
496_dongfengqichen/pages/myCenter/myCenter.wxss View File

height: 15rpx; height: 15rpx;
} }
.subscribeBtn{ .subscribeBtn{
position: relative;
margin: 0 auto; margin: 0 auto;
width:652rpx; width:652rpx;
height:65rpx; height:65rpx;

+ 1
- 8
496_dongfengqichen/pages/scout/scout.js View File

this.data.userData.nickName = e.detail.userInfo.nickName; this.data.userData.nickName = e.detail.userInfo.nickName;
this.data.userData.userLevel = 0; this.data.userData.userLevel = 0;
this.setData({ this.setData({
userData: this.data.userData,
isLogin: true
userData: this.data.userData
}) })
app.globalData.userInfoData = {};
app.globalData.userInfoData.avatarUrl = e.detail.userInfo.avatarUrl;
app.globalData.userInfoData.nickName = e.detail.userInfo.nickName;
app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName); app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName);
wx.navigateTo({ wx.navigateTo({
url:'../poster/poster' url:'../poster/poster'
this.setData({ this.setData({
userData: this.data.userData userData: this.data.userData
}) })
app.globalData.userInfoData = {};
app.globalData.userInfoData.avatarUrl = res.data.avatarUrl;
app.globalData.userInfoData.nickName = res.data.nickName;
wx.navigateTo({ wx.navigateTo({
url:'../poster/poster' url:'../poster/poster'
}) })

+ 2
- 2
496_dongfengqichen/pages/scout/scout.wxml View File

<view class="content"> <view class="content">
<image class="bg" src="{{imgUrl+'/star/scout/bg.jpg'}}"></image> <image class="bg" src="{{imgUrl+'/star/scout/bg.jpg'}}"></image>
<image class="reward" wx:if="{{maskid<4}}" src="{{imgUrl+'/star/scout/reward.png'}}"></image> <image class="reward" wx:if="{{maskid<4}}" src="{{imgUrl+'/star/scout/reward.png'}}"></image>
<image class="reward" wx:if="{{maskid>3}}" src="{{imgUrl+'/star/tu1.png'}}"></image>
<view class="btn" bindtap="getPoster">立即分享,赚取奖励</view>
<image class="reward" wx:if="{{maskid>3}}" src="{{imgUrl+'/star/tu1.png?v=002'}}"></image>
<view class="btn" bindtap="getPoster">{{maskid<4?"立即分享,赚取奖励":"立即分享"}}</view>
<button class="btn2" wx:if="{{iconShow}}" open-type="getUserInfo" bindgetuserinfo="getUserWxMsg"></button> <button class="btn2" wx:if="{{iconShow}}" open-type="getUserInfo" bindgetuserinfo="getUserWxMsg"></button>
</view> </view>
<view class="mask" wx:if="{{maskShow}}"> <view class="mask" wx:if="{{maskShow}}">

+ 11
- 1
496_dongfengqichen/pages/scout/scout.wxss View File

margin: 43rpx auto 0 auto; margin: 43rpx auto 0 auto;
} }
.btn{ .btn{
position: relative;
text-align: center; text-align: center;
width: 654rpx; width: 654rpx;
height: 58rpx; height: 58rpx;
/* .closeBtn::before { /* .closeBtn::before {
content: "\2716"; content: "\2716";
} */
} */
.getUserMsgBtn{
position: absolute;
left: 0;
top: 0;
opacity: 0;
margin: 0;
padding: 0;
}

+ 7
- 1
496_dongfengqichen/project.config.json View File

"name": "用户协议与隐私政策", "name": "用户协议与隐私政策",
"pathName": "pages/agreement/agreement", "pathName": "pages/agreement/agreement",
"query": "" "query": ""
}
},
{
"id": -1,
"name": "星探任务",
"pathName": "pages/scout/scout",
"query": ""
}
] ]
} }
} }

Loading…
Cancel
Save