作者 lihongjuan

4.1号修改登录流程

@@ -24,12 +24,12 @@ @@ -24,12 +24,12 @@
24 </picker> 24 </picker>
25 <view class="list_textarea"> 25 <view class="list_textarea">
26 <view class="list_left">详细地址</view> 26 <view class="list_left">详细地址</view>
27 - <view class="list_right">  
28 - <textarea placeholder="道路、门牌号、小区、楼栋号等" value="{{address}}" placeholder-class="inut_plclass" bindinput="getAddressFun"></textarea> 27 + <view class="list_right areabox">
  28 + <textarea placeholder="道路、门牌号、小区、楼栋号等" value="{{address}}" placeholder-class="inut_plclass" bindinput="getAddressFun" maxlength='-1'></textarea>
29 </view> 29 </view>
30 </view> 30 </view>
31 <view class="list"> 31 <view class="list">
32 - <view class="list_left">设为默认地址</view> 32 + <view class="list_left shezhimo">设为默认地址</view>
33 <view class="list_right"> 33 <view class="list_right">
34 <switch checked="{{mo}}" type="switch" color="rgba(242, 0, 0, 1)" bindchange="switchChange"/> 34 <switch checked="{{mo}}" type="switch" color="rgba(242, 0, 0, 1)" bindchange="switchChange"/>
35 </view> 35 </view>
@@ -30,7 +30,8 @@ page { @@ -30,7 +30,8 @@ page {
30 } 30 }
31 31
32 .list_left { 32 .list_left {
33 - min-width: 166rpx; 33 + width: 166rpx;
  34 + font-size: 30rpx
34 } 35 }
35 36
36 37
@@ -98,8 +99,12 @@ page { @@ -98,8 +99,12 @@ page {
98 font-size: 30rpx; 99 font-size: 30rpx;
99 color: rgba(255, 255, 255, 1); 100 color: rgba(255, 255, 255, 1);
100 } 101 }
101 -  
102 - 102 +.areabox{
  103 + margin-top:2rpx;
  104 +}
  105 +.shezhimo{
  106 + width:175rpx;
  107 +}
103 108
104 109
105 110
@@ -67,7 +67,7 @@ Page({ @@ -67,7 +67,7 @@ Page({
67 67
68 }else{ 68 }else{
69 wx.navigateTo({ 69 wx.navigateTo({
70 - url: '/pages/xianshi/xianshi', 70 + url: '/pages/xianshi/xianshi?title2='+this.data.title2,
71 }) 71 })
72 } 72 }
73 73
@@ -100,7 +100,7 @@ Page({ @@ -100,7 +100,7 @@ Page({
100 let url = '/special/get_all'; 100 let url = '/special/get_all';
101 let data = { 101 let data = {
102 page: 1, 102 page: 1,
103 - pageNum: 4 103 + pageNum: 6
104 104
105 } 105 }
106 app.post(url, data, "POST").then((r) => { 106 app.post(url, data, "POST").then((r) => {
@@ -456,12 +456,12 @@ image { @@ -456,12 +456,12 @@ image {
456 .miaoshalist { 456 .miaoshalist {
457 display: flex; 457 display: flex;
458 align-items: center; 458 align-items: center;
459 - flex-wrap: wrap; 459 + justify-content: space-between;
460 margin-top: 24rpx; 460 margin-top: 24rpx;
461 } 461 }
462 462
463 .miaoshalistitem { 463 .miaoshalistitem {
464 - width: 140rpx; 464 + width: 82rpx;
465 display: flex; 465 display: flex;
466 flex-direction: column; 466 flex-direction: column;
467 justify-content: center; 467 justify-content: center;
@@ -469,6 +469,9 @@ image { @@ -469,6 +469,9 @@ image {
469 margin-right: 32rpx; 469 margin-right: 32rpx;
470 box-sizing: border-box; 470 box-sizing: border-box;
471 } 471 }
  472 +.miaoshalistitem:last-child{
  473 + margin-right:0;
  474 +}
472 475
473 .goodimg { 476 .goodimg {
474 width:75rpx; 477 width:75rpx;
1 // pages/startindex/startindex.js 1 // pages/startindex/startindex.js
2 -const app = getApp() 2 +const a = getApp()
3 Page({ 3 Page({
4 4
5 /** 5 /**
@@ -8,7 +8,10 @@ Page({ @@ -8,7 +8,10 @@ Page({
8 data: { 8 data: {
9 thumbnail: '', 9 thumbnail: '',
10 sec:'', 10 sec:'',
11 - endTime:'' 11 + endTime:'',
  12 + code: '',
  13 + iv: '',
  14 + encryptedData: ''
12 }, 15 },
13 16
14 /** 17 /**
@@ -17,6 +20,87 @@ Page({ @@ -17,6 +20,87 @@ Page({
17 onLoad: function (options) { 20 onLoad: function (options) {
18 21
19 }, 22 },
  23 + // 进入页面获取code
  24 + getCodeFun() {
  25 + let that = this;
  26 + wx.login({
  27 + success: function(r) {
  28 + that.setData({
  29 + code: r.code
  30 + })
  31 + wx.getSetting({
  32 + success: res => {
  33 + console.log(res)
  34 + if (res.authSetting['scope.userInfo'] === true) {
  35 + wx.getUserInfo({
  36 + success: reg => {
  37 + that.setData({
  38 + iv: reg.iv,
  39 + encryptedData: reg.encryptedData
  40 + })
  41 + if(that.data.iv){
  42 + that.get_token()
  43 + }
  44 + }
  45 + })
  46 + }else{
  47 + // console.log(347878347)
  48 + wx.navigateTo({
  49 + url: '/pages/register/register',
  50 + })
  51 + }
  52 + }
  53 + })
  54 + }
  55 + })
  56 + },
  57 +
  58 + // 获取登录注册信息
  59 + get_token(){
  60 + // wx.showLoading({
  61 + // title: '加载中',
  62 + // })
  63 + let that = this
  64 + wx.checkSession({
  65 + success(res) {
  66 + let u = a.interface.openid;
  67 + let d = {
  68 + code: that.data.code,
  69 + iv: that.data.iv,
  70 + encryptedData: that.data.encryptedData
  71 + }
  72 + a.post(u, d).then((r) => {
  73 + console.log('778899',r)
  74 + wx.hideLoading()
  75 + if (r.code == 200) {
  76 + wx.setStorageSync('token', r.token);
  77 + wx.setStorageSync('login', r.new_login);
  78 + wx.setStorageSync('tel', r.tel);
  79 + // wx.reLaunch({
  80 + // url: '/pages/index/index'
  81 + // })
  82 + if (r.new_login == 0) {
  83 + // 未绑定手机号
  84 + wx.redirectTo({
  85 + url: '/pages/login/login'
  86 + })
  87 + } else if (r.new_login == 1) {
  88 + wx.reLaunch({
  89 + url: '/pages/index/index'
  90 + })
  91 + }
  92 + }
  93 + }).catch((er) => { })
  94 + }
  95 + ,
  96 + fail(err) {
  97 + wx.hideLoading();
  98 + that.getCodeFun()
  99 + }
  100 + })
  101 +
  102 +
  103 + },
20 104
21 getpic() { 105 getpic() {
22 let that = this; 106 let that = this;
@@ -24,7 +108,7 @@ Page({ @@ -24,7 +108,7 @@ Page({
24 var params = { 108 var params = {
25 109
26 } 110 }
27 - app.post(url, params).then((res) => { 111 + a.post(url, params).then((res) => {
28 console.log(res); 112 console.log(res);
29 that.setData({ 113 that.setData({
30 thumbnail: res.msg.image, 114 thumbnail: res.msg.image,
@@ -38,10 +122,11 @@ Page({ @@ -38,10 +122,11 @@ Page({
38 122
39 }, 123 },
40 jump(){ 124 jump(){
41 - wx.switchTab({ 125 + this.getCodeFun()
  126 + // wx.switchTab({
42 127
43 - url: '/pages/index/index',  
44 - }) 128 + // url: '/pages/index/index',
  129 + // })
45 }, 130 },
46 131
47 // 倒计时 132 // 倒计时
@@ -56,21 +141,35 @@ Page({ @@ -56,21 +141,35 @@ Page({
56 let hou = parseInt(time % (60 * 60 * 24) / 3600); 141 let hou = parseInt(time % (60 * 60 * 24) / 3600);
57 let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); 142 let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
58 let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); 143 let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
  144 + console.log(sec)
59 145
60 that.setData({ 146 that.setData({
61 // day: that.timeFormat(day), 147 // day: that.timeFormat(day),
62 // hou: that.timeFormat(hou), 148 // hou: that.timeFormat(hou),
63 // min: that.timeFormat(min), 149 // min: that.timeFormat(min),
64 - sec: sec 150 + sec: sec+'s'
65 }) 151 })
66 152
67 time--; 153 time--;
68 - if (time <= 0) { 154 + if (time ==1) {
  155 + console.log(34643)
  156 + that.getCodeFun()
  157 + // let token=wx.getStorageSync('token')
  158 + // wx.navigateTo({
  159 + // url: '/pages/register/register',
  160 + // })
  161 + // if(token==""){
  162 + // wx.navigateTo({
  163 + // url: '/pages/register/register',
  164 + // })
  165 + // }else{
  166 + //  wx.navigateTo({
  167 + // url: '/pages/index/index'
  168 + //  })
  169 + // }
  170 +
  171 + }else if (time<=0){
69 clearInterval(interval); 172 clearInterval(interval);
70 - wx.switchTab({  
71 - url: '/pages/index/index',  
72 - })  
73 -  
74 } 173 }
75 }.bind(this), 1000); 174 }.bind(this), 1000);
76 }, 175 },
@@ -92,12 +191,16 @@ Page({ @@ -92,12 +191,16 @@ Page({
92 onShow: function () { 191 onShow: function () {
93 let that = this; 192 let that = this;
94 that.getpic() 193 that.getpic()
95 - setTimeout(function () {  
96 - wx.navigateTo({ 194 + // setTimeout(function () {
  195 + // wx.navigateTo({
97 196
98 - url: '/pages/homepage/homepage',  
99 - })  
100 - }, 2500) 197 + // url: '/pages/homepage/homepage',
  198 + // })
  199 + // }, 2500)
  200 +
  201 + // this.getCodeFun()
  202 +
  203 +
101 }, 204 },
102 205
103 /** 206 /**
@@ -21,9 +21,13 @@ Page({ @@ -21,9 +21,13 @@ Page({
21 * 生命周期函数--监听页面加载 21 * 生命周期函数--监听页面加载
22 */ 22 */
23 onLoad: function (options) { 23 onLoad: function (options) {
  24 + console.log(options)
24 let that=this; 25 let that=this;
25 this.getxianshi(); 26 this.getxianshi();
26 this.getxianshik() 27 this.getxianshik()
  28 + wx.setNavigationBarTitle({
  29 + title: options.title2
  30 + })
27 31
28 setTimeout(function(){ 32 setTimeout(function(){
29 that.setData({ 33 that.setData({
@@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
18 </template> 18 </template>
19 19
20 <template name="wxParseImg"> 20 <template name="wxParseImg">
21 - <image class="{{item.classStr}} wxParse-{{item.tag}}" data-from="{{item.from}}" data-src="{{item.attr.src}}" data-idx="{{item.imgIndex}}" src="https://binhai.w.broing.cn/{{item.attr.src}}" mode="aspectFit" bindload="wxParseImgLoad" mode="widthFix" style="width:{{item.width}}px;" 21 + <image class="{{item.classStr}} wxParse-{{item.tag}}" data-from="{{item.from}}" data-src="{{item.attr.src}}" data-idx="{{item.imgIndex}}" src="{{item.attr.src}}" mode="aspectFit" bindload="wxParseImgLoad" mode="widthFix" style="width:{{item.width}}px;"
22 /> 22 />
23 </template> 23 </template>
24 24