作者 乔蒙蒙

酒吧项目提交

@@ -24,6 +24,7 @@ App({ @@ -24,6 +24,7 @@ App({
24 let header = { 24 let header = {
25 'content-type': 'application/x-www-form-urlencoded' 25 'content-type': 'application/x-www-form-urlencoded'
26 } 26 }
  27 + // console.log(baseUrl/ + url)
27 header = Object.assign(header, headerParams) 28 header = Object.assign(header, headerParams)
28 wx.request({ 29 wx.request({
29 url: baseUrl + url, 30 url: baseUrl + url,
@@ -31,8 +32,9 @@ App({ @@ -31,8 +32,9 @@ App({
31 method: 'POST', 32 method: 'POST',
32 header: header, 33 header: header,
33 success: function (res) {//返回取得的数据 34 success: function (res) {//返回取得的数据
  35 + // console.log(res)
34 if (res.data.code == '20000') { 36 if (res.data.code == '20000') {
35 - resolve(res.data.data); 37 + resolve(res.data);
36 } else if (res.data.code == '10001') {//用户未 38 } else if (res.data.code == '10001') {//用户未
37 39
38 } else if (res.data.code == '40000') { 40 } else if (res.data.code == '40000') {
1 // pages/kaishi/kaishi.js 1 // pages/kaishi/kaishi.js
2 -const app=getApp(); 2 +const app = getApp();
3 Page({ 3 Page({
4 4
5 /** 5 /**
@@ -11,11 +11,11 @@ Page({ @@ -11,11 +11,11 @@ Page({
11 '../../imgs/lunbo2@3x.png', 11 '../../imgs/lunbo2@3x.png',
12 '../../imgs/lunbo3@3x.png' 12 '../../imgs/lunbo3@3x.png'
13 ], 13 ],
14 - indexs:0,  
15 - color:'#cccccc', 14 + indexs: 0,
  15 + color: '#cccccc',
16 indicatorDots: false, 16 indicatorDots: false,
17 autoplay: true, 17 autoplay: true,
18 - activecolor:'#ffffff', 18 + activecolor: '#ffffff',
19 interval: 5000, 19 interval: 5000,
20 duration: 1000 20 duration: 1000
21 }, 21 },
@@ -23,17 +23,18 @@ Page({ @@ -23,17 +23,18 @@ Page({
23 start(e) { 23 start(e) {
24 let that = this; 24 let that = this;
25 app.globalData.userInfo = e.detail.userInfo; 25 app.globalData.userInfo = e.detail.userInfo;
26 -  
27 wx.login({ 26 wx.login({
28 success: function (s) { 27 success: function (s) {
29 let url = 'wxapp/public/getSessionKey'; 28 let url = 'wxapp/public/getSessionKey';
30 if (s.code) { 29 if (s.code) {
31 var code = s.code; 30 var code = s.code;
32 var param = { 31 var param = {
33 - code: code 32 + code: s.code
34 } 33 }
35 app.post(url, param).then((res) => { 34 app.post(url, param).then((res) => {
36 - that.login(res.openid, res.session_key, e.detail.encryptedData, e.detail.iv); 35 + // console.log(res);
  36 + // console.log(e);
  37 + that.login(res.data.openid, res.data.session_key, e.detail.encryptedData, e.detail.iv, e.detail.rawData, e.detail.signature);
37 }).catch((errMsg) => { 38 }).catch((errMsg) => {
38 console.log(errMsg); 39 console.log(errMsg);
39 }) 40 })
@@ -41,28 +42,49 @@ Page({ @@ -41,28 +42,49 @@ Page({
41 } 42 }
42 }); 43 });
43 }, 44 },
44 - login(openid, session_key, encrypted_data, iv) { 45 + login(openid, session_key, encrypted_data, iv,r,s) {
45 let that = this; 46 let that = this;
46 let param = { 47 let param = {
47 openid: openid, 48 openid: openid,
48 session_key: session_key, 49 session_key: session_key,
49 encrypted_data: encrypted_data, 50 encrypted_data: encrypted_data,
50 - iv: iv 51 + iv: iv,
  52 + rawData: r,
  53 + signature: s
51 } 54 }
52 let url = 'wxapp/public/login'; 55 let url = 'wxapp/public/login';
  56 + // wx.navigateTo({
  57 + // url: '/pages/login/login',
  58 + // success: function (res) { },
  59 + // fail: function (res) { },
  60 + // complete: function (res) { },
  61 + // })
53 app.post(url, param).then((res) => { 62 app.post(url, param).then((res) => {
54 - wx.setStorageSync('token', res.token);  
55 - wx.navigateTo({  
56 - url: '/pages/login/login',  
57 - success: function (res) { },  
58 - fail: function (res) { },  
59 - complete: function (res) { }, 63 + console.log(res)
  64 + wx.setStorageSync('token', res.data.token);
  65 + let u = "wxapp/public/isMobile";
  66 + let header = {
  67 + "XX-Token": res.data.token
  68 + }
  69 + let data = {
  70 + type: 1
  71 + }
  72 + app.post(u, data, header).then((r) => {
  73 + console.log(r)
  74 + }).catch((err) => {
  75 +
60 }) 76 })
  77 + // wx.navigateTo({
  78 + // url: '/pages/login/login',
  79 + // success: function (res) { },
  80 + // fail: function (res) { },
  81 + // complete: function (res) { },
  82 + // })
61 }).catch((errMsg) => { 83 }).catch((errMsg) => {
62 console.log(errMsg); 84 console.log(errMsg);
63 }) 85 })
64 }, 86 },
65 - changeindexs(e){ 87 + changeindexs(e) {
66 this.setData({ 88 this.setData({
67 indexs: e.detail.current 89 indexs: e.detail.current
68 }) 90 })
@@ -20,10 +20,11 @@ @@ -20,10 +20,11 @@
20 </view> 20 </view>
21 <view class='start_btnbox'> 21 <view class='start_btnbox'>
22 <button class='start_btn' open-type='getUserInfo' bindgetuserinfo='start'> 22 <button class='start_btn' open-type='getUserInfo' bindgetuserinfo='start'>
23 - <text class='txt'>一起来吧</text> </button> 23 + <text class='txt'>一起来吧</text>
  24 + </button>
24 </view> 25 </view>
25 </swiper-item> 26 </swiper-item>
26 </swiper> 27 </swiper>
27 <view class='botsbox'> 28 <view class='botsbox'>
28 -<view class='bots {{index==indexs?"activecolor":""}}' wx:for='{{imgUrls.length+1}}' wx:key ></view> 29 + <view class='bots {{index==indexs?"activecolor":""}}' wx:for='{{imgUrls.length+1}}' wx:key></view>
29 </view> 30 </view>
  1 +//logs.js
  2 +const util = require('../../utils/util.js')
  3 +
  4 +Page({
  5 + data: {
  6 + logs: []
  7 + },
  8 + onLoad: function () {
  9 + this.setData({
  10 + logs: (wx.getStorageSync('logs') || []).map(log => {
  11 + return util.formatTime(new Date(log))
  12 + })
  13 + })
  14 + }
  15 +})
  1 +{
  2 + "navigationBarTitleText": "查看启动日志",
  3 + "usingComponents": {}
  4 +}
  1 +<!--logs.wxml-->
  2 +<view class="container log-list">
  3 + <block wx:for="{{logs}}" wx:for-item="log">
  4 + <text class="log-item">{{index + 1}}. {{log}}</text>
  5 + </block>
  6 +</view>
  1 +.log-list {
  2 + display: flex;
  3 + flex-direction: column;
  4 + padding: 40rpx;
  5 +}
  6 +.log-item {
  7 + margin: 10rpx;
  8 +}
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 }, 12 },
13 "compileType": "miniprogram", 13 "compileType": "miniprogram",
14 "libVersion": "2.4.1", 14 "libVersion": "2.4.1",
15 - "appid": "wx4ac44ac1779dc6a6", 15 + "appid": "wx6e9436f62c626fb7",
16 "projectname": "bar", 16 "projectname": "bar",
17 "debugOptions": { 17 "debugOptions": {
18 "hidedInDevtools": [] 18 "hidedInDevtools": []