Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
点滴校园2020 基本逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
alexju committed Aug 21, 2020
1 parent b263693 commit 990175b
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 18 deletions.
3 changes: 2 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"pages/webview/webview",
"pages/aboutus/aboutus",
"pages/homework/homework",
"pages/school-life-2020/school-life-2020"
"pages/school-life-2020/school-life-2020",
"pages/school-life-2020-web/school-life-2020-web"
],
"window": {
"backgroundTextStyle": "light",
Expand Down
4 changes: 2 additions & 2 deletions pages/index/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
</swiper-item>

<!-- 常规banner -->
<block wx:for="{{indexBanner}}">
<!-- <block wx:for="{{indexBanner}}">
<swiper-item class='pic_item radius-shadow'>
<navigator hover-class="banner-hover" url="{{'../webview/webview?url='+item.msgurl}}">
<image src='{{item.imgurl}}' class="swiper_img" mode='scaleToFill' data-index='{{index}}' bindtap='swipclick'></image>
</navigator>
</swiper-item>
</block>
</block> -->
</swiper>
<view class="notice radius-shadow">
<view class='imgbox'>
Expand Down
68 changes: 68 additions & 0 deletions pages/school-life-2020-web/school-life-2020-web.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// pages/school-life-2020-web/school-life-2020-web.js
Page({

/**
* 页面的初始数据
*/
data: {

},

/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
url:"https://myncut.ncut.edu.cn/school-life?token=" + options.token
})
},

/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {

},

/**
* 生命周期函数--监听页面显示
*/
onShow: function () {

},

/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {

},

/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {

},

/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {

},

/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {

},

/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {

}
})
3 changes: 3 additions & 0 deletions pages/school-life-2020-web/school-life-2020-web.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"usingComponents": {}
}
2 changes: 2 additions & 0 deletions pages/school-life-2020-web/school-life-2020-web.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!--pages/school-life-2020-web/school-life-2020-web.wxml-->
<web-view src="{{url}}"></web-view>
1 change: 1 addition & 0 deletions pages/school-life-2020-web/school-life-2020-web.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* pages/school-life-2020-web/school-life-2020-web.wxss */
39 changes: 30 additions & 9 deletions pages/school-life-2020/school-life-2020.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
// pages/school-life-2020/school-life-2020.js
import {
Requests
} from "../../utils/Requests";

Page({

/**
* 页面的初始数据
*/
data: {
showAuth: true

},

/**
Expand All @@ -19,27 +23,33 @@ Page({
不允许不让过!!!
*/

let that = this;
wx.getUserInfo({
success: function (res) {
var userInfo = res.userInfo;
console.log(userInfo);
that.setData({
showAuth: false,
});
// 向服务器提交用户最新的数据
Requests.put({
url: "/user",
data: {
nickName: userInfo.nickName,
avatarUrl: userInfo.avatarUrl,
},
success(data) {
wx.navigateTo({
url: '../school-life-2020-web/school-life-2020-web?token=' + Requests.token,
})
}
});
},
fail: function (res) {
console.log("getUserInfo fail");
that.setData({
showAuth: true,
});
}
})
},

// 获取用户信息回调
tapGetUserInfo: function (e) {
let that = this;
if (e.detail.userInfo === undefined) {
console.log("user refused getUserInfo");
// 未同意
Expand All @@ -52,7 +62,18 @@ Page({
// 然后将页面切换成H5
console.log("user agreed getUserInfo");
console.log(e.detail.userInfo);

Requests.put({
url: "/user",
data: {
nickName: e.detail.userInfo.nickName,
avatarUrl: e.detail.userInfo.avatarUrl,
},
success(data) {
wx.navigateTo({
url: '../school-life-2020-web/school-life-2020-web?token=' + Requests.token,
})
}
});
}
},

Expand Down
5 changes: 1 addition & 4 deletions pages/school-life-2020/school-life-2020.wxml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<!--pages/school-life-2020/school-life-2020.wxml-->
<view wx:if="{{showAuth}}">
<view>
<button open-type="getUserInfo" bindgetuserinfo="tapGetUserInfo">立即认证</button>
</view>
<view wx:else>
内容
</view>
8 changes: 6 additions & 2 deletions project.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@
"minified": true,
"newFeature": true,
"autoAudits": false,
"scopeDataCheck": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"useCompilerModule": false
"useIsolateContext": true,
"useCompilerModule": false,
"userConfirmedUseCompilerModuleSwitch": false
},
"compileType": "miniprogram",
"libVersion": "2.10.1",
"libVersion": "2.12.1",
"appid": "wx12bef97a98001f0b",
"projectname": "myNCUT",
"debugOptions": {
Expand Down

0 comments on commit 990175b

Please sign in to comment.