Skip to content

Commit

Permalink
v3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Airmole committed Mar 10, 2021
0 parents commit 4ffe77b
Show file tree
Hide file tree
Showing 154 changed files with 16,618 additions and 0 deletions.
142 changes: 142 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
//app.js
App({
globalData: {
domain: 'https://dev.shellbox.airmole.cn/api',
_amap_key: '66a87160f8db2a9a76431c954b4f52a5',
openid: '',
userInfo: {},
edusysUserInfo: {},
hasEdusysStorage: false
},
onLaunch: function () {
let launchInfo = wx.getLaunchOptionsSync();
if(launchInfo.scene != 1145){
this.getUserOpenId();
this.appUpdate();
}
this.clearOldVersionStorage();
this.checkHasEdusysStorage();
this.getStorageEdusysUserInfo();
this.getUserInfoFromStorage()
this.getSystemStatusBarInfo();
},
clearOldVersionStorage: function () {
var newBetaInital = wx.getStorageSync('newBetaInital');
if (newBetaInital === 'true') {
// console.log('之前老版本的已经删干净了')
return true;
} else {
// console.log('老版本用户,第一次进入新版')
wx.clearStorage({
success: (res) => {
wx.setStorageSync('newBetaInital', 'true');
// console.log('老版本数据全部清空成功')
},
})
}
},
checkHasEdusysStorage: function () {
const edusysStorage = wx.getStorageSync('edusysUserInfo');
var self = this;
try {
if (edusysStorage.uid.length > 0) {
self.globalData.hasEdusysStorage = true
} else {
self.globalData.hasEdusysStorage = false
}
} catch (error) {
// console.log(error)
self.globalData.hasEdusysStorage = false
}
},
getUserInfoFromStorage: function () {
var self = this;
self.globalData.userInfo = wx.getStorageSync('userInfo');
},
getStorageEdusysUserInfo: function () {
var self = this;
self.globalData.edusysUserInfo = wx.getStorageSync('edusysUserInfo');
},
getSystemStatusBarInfo: function () {
// 获取系统状态栏信息
wx.getSystemInfo({
success: e => {
this.globalData.StatusBar = e.statusBarHeight;
let capsule = wx.getMenuButtonBoundingClientRect();
if (capsule) {
this.globalData.Custom = capsule;
this.globalData.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;
} else {
this.globalData.CustomBar = e.statusBarHeight + 50;
}
}
})
},
getUserOpenId: function (callback) {
var self = this
var storageOpenid = wx.getStorageSync('openid')
if (storageOpenid.openid) {
self.globalData.openid = storageOpenid.openid
return
}
if (self.globalData.openid) {
callback(null, self.globalData.openid)
} else {
wx.login({
success: function (data) {
wx.request({
url: self.globalData.domain + `/wechat/openid?jscode=${data.code}`,
success: function (res) {
// console.log('拉取openid成功', res.data)
wx.setStorage({
data: res.data,
key: 'openid',
})
self.globalData.openid = res.data.openid
},
fail: function (res) {
console.log('拉取用户openid失败,将无法正常使用开放接口等服务', res)
}
})
},
fail: function (err) {
console.log('wx.login 接口调用失败,将无法正常使用开放接口等服务', err)
}
})
}
},
appUpdate: function (where) {
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
// console.log(res)
if (where == 'userclick') {
wx.showToast({
title: '已是最新版',
icon: 'none'
})
}
})

updateManager.onUpdateReady(function () {
wx.showModal({
title: '小盒子求更新',
content: "小盒子有版本功能更新啦,建议各位小可爱重启应用体验新版本(●'◡'●)",
success: function (res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
})

updateManager.onUpdateFailed(function () {
// 新版本下载失败
wx.showToast({
title: '嘤嘤嘤更新失败了。可能网络不好',
duration: 1000
});
})
}
})
57 changes: 57 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"pages": [
"pages/index/index",
"pages/index/login",
"pages/index/feature",
"pages/course/my",
"pages/course/search",
"pages/course/content",
"pages/course/stulist/index",
"pages/course/stulist/content",
"pages/traffic/navi",
"pages/traffic/bus",
"pages/score/score",
"pages/school/calendar",
"pages/school/tel",
"pages/school/cert",
"pages/school/web",
"pages/school/aboutus",
"pages/school/xiaoai"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "贝壳小盒子",
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
},
"usingComponents": {
"cu-custom": "/colorui/components/cu-custom"
},
"tabBar": {
"selectedColor": "#84BD54",
"color": "#333",
"backgroundColor": "#fff",
"position": "bottom",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "images/index.png",
"selectedIconPath": "images/[email protected]"
},
{
"pagePath": "pages/index/feature",
"text": "更多",
"iconPath": "images/more.png",
"selectedIconPath": "images/holiday.png"
}
]
},
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于校园导航定位"
}
},
"sitemapLocation": "sitemap.json"
}
3 changes: 3 additions & 0 deletions app.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@import "colorui/main.wxss";
@import "colorui/icon.wxss";
@import "utils/iconfont.wxss";
184 changes: 184 additions & 0 deletions colorui/animation.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
/*
Animation 微动画
基于ColorUI组建库的动画模块 by 文晓港 2019年3月26日19:52:28
*/

/* css 滤镜 控制黑白底色gif的 */
.gif-black{
mix-blend-mode: screen;
}
.gif-white{
mix-blend-mode: multiply;
}


/* Animation css */
[class*=animation-] {
animation-duration: .5s;
animation-timing-function: ease-out;
animation-fill-mode: both
}

.animation-fade {
animation-name: fade;
animation-duration: .8s;
animation-timing-function: linear
}

.animation-scale-up {
animation-name: scale-up
}

.animation-scale-down {
animation-name: scale-down
}

.animation-slide-top {
animation-name: slide-top
}

.animation-slide-bottom {
animation-name: slide-bottom
}

.animation-slide-left {
animation-name: slide-left
}

.animation-slide-right {
animation-name: slide-right
}

.animation-shake {
animation-name: shake
}

.animation-reverse {
animation-direction: reverse
}

@keyframes fade {
0% {
opacity: 0
}

100% {
opacity: 1
}
}

@keyframes scale-up {
0% {
opacity: 0;
transform: scale(.2)
}

100% {
opacity: 1;
transform: scale(1)
}
}

@keyframes scale-down {
0% {
opacity: 0;
transform: scale(1.8)
}

100% {
opacity: 1;
transform: scale(1)
}
}

@keyframes slide-top {
0% {
opacity: 0;
transform: translateY(-100%)
}

100% {
opacity: 1;
transform: translateY(0)
}
}

@keyframes slide-bottom {
0% {
opacity: 0;
transform: translateY(100%)
}

100% {
opacity: 1;
transform: translateY(0)
}
}

@keyframes shake {

0%,
100% {
transform: translateX(0)
}

10% {
transform: translateX(-9px)
}

20% {
transform: translateX(8px)
}

30% {
transform: translateX(-7px)
}

40% {
transform: translateX(6px)
}

50% {
transform: translateX(-5px)
}

60% {
transform: translateX(4px)
}

70% {
transform: translateX(-3px)
}

80% {
transform: translateX(2px)
}

90% {
transform: translateX(-1px)
}
}

@keyframes slide-left {
0% {
opacity: 0;
transform: translateX(-100%)
}

100% {
opacity: 1;
transform: translateX(0)
}
}

@keyframes slide-right {
0% {
opacity: 0;
transform: translateX(100%)
}

100% {
opacity: 1;
transform: translateX(0)
}
}
Loading

0 comments on commit 4ffe77b

Please sign in to comment.