Browse Source

Initial Commit

liuYb 7 years ago
commit
f1b1412f9f
56 changed files with 730 additions and 0 deletions
  1. 14 0
      .gitignore
  2. 39 0
      app.js
  3. 39 0
      app.json
  4. 10 0
      app.wxss
  5. 54 0
      pages/index/index.js
  6. 94 0
      pages/index/index.wxml
  7. 218 0
      pages/index/index.wxss
  8. 15 0
      pages/logs/logs.js
  9. 3 0
      pages/logs/logs.json
  10. 6 0
      pages/logs/logs.wxml
  11. 8 0
      pages/logs/logs.wxss
  12. 66 0
      pages/my/my.js
  13. 4 0
      pages/my/my.json
  14. 5 0
      pages/my/my.wxml
  15. 1 0
      pages/my/my.wxss
  16. 66 0
      pages/predict/predict.js
  17. 3 0
      pages/predict/predict.json
  18. 10 0
      pages/predict/predict.wxml
  19. 1 0
      pages/predict/predict.wxss
  20. 48 0
      project.config.json
  21. 7 0
      sitemap.json
  22. BIN
      static/home-all.png
  23. BIN
      static/home_ic_college.png
  24. BIN
      static/home_ic_college@2x.png
  25. BIN
      static/home_ic_major.png
  26. BIN
      static/home_ic_major@2x.png
  27. BIN
      static/home_ic_test.png
  28. BIN
      static/home_ic_test@2x.png
  29. BIN
      static/home_icon_default_nor(1).png
  30. BIN
      static/home_icon_default_nor.png
  31. BIN
      static/home_icon_default_sel.png
  32. BIN
      static/home_icon_default_sel@2x.png
  33. BIN
      static/home_icon_my_nor.png
  34. BIN
      static/home_icon_my_nor@2x.png
  35. BIN
      static/home_icon_volunteer_nor.png
  36. BIN
      static/home_icon_volunteer_nor@2x.png
  37. BIN
      static/home_word_profession.png
  38. BIN
      static/home_word_profession@2x.png
  39. BIN
      static/home_word_university.png
  40. BIN
      static/home_word_university@2x.png
  41. BIN
      static/logo.png
  42. BIN
      static/search_icon_nor.png
  43. BIN
      static/search_icon_nor@2x.png
  44. BIN
      static/中南.png
  45. BIN
      static/中南@2x.png
  46. BIN
      static/中央财经.png
  47. BIN
      static/中央财经@2x.png
  48. BIN
      static/北大.png
  49. BIN
      static/北大@2x.png
  50. BIN
      static/四川.png
  51. BIN
      static/四川@2x.png
  52. BIN
      static/复旦.png
  53. BIN
      static/复旦@2x.png
  54. BIN
      static/清华.png
  55. BIN
      static/清华@2x.png
  56. 19 0
      utils/util.js

+ 14 - 0
.gitignore

@@ -0,0 +1,14 @@
+# Windows
+[Dd]esktop.ini
+Thumbs.db
+$RECYCLE.BIN/
+
+# macOS
+.DS_Store
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+
+# Node.js
+node_modules/

+ 39 - 0
app.js

@@ -0,0 +1,39 @@
+//app.js
+App({
+  onLaunch: function () {
+    // 展示本地存储能力
+    var logs = wx.getStorageSync('logs') || []
+    logs.unshift(Date.now())
+    wx.setStorageSync('logs', logs)
+
+    // 登录
+    wx.login({
+      success: res => {
+        // 发送 res.code 到后台换取 openId, sessionKey, unionId
+      }
+    })
+    // 获取用户信息
+    wx.getSetting({
+      success: res => {
+        if (res.authSetting['scope.userInfo']) {
+          // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
+          wx.getUserInfo({
+            success: res => {
+              // 可以将 res 发送给后台解码出 unionId
+              this.globalData.userInfo = res.userInfo
+
+              // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
+              // 所以此处加入 callback 以防止这种情况
+              if (this.userInfoReadyCallback) {
+                this.userInfoReadyCallback(res)
+              }
+            }
+          })
+        }
+      }
+    })
+  },
+  globalData: {
+    userInfo: null
+  }
+})

+ 39 - 0
app.json

@@ -0,0 +1,39 @@
+{
+    "pages": [
+        "pages/my/my",
+        "pages/index/index",
+        "pages/logs/logs",
+
+        "pages/predict/predict"
+    ],
+    "window": {
+        "backgroundTextStyle": "light",
+        "navigationBarBackgroundColor": "#fff",
+        "navigationBarTitleText": "首页",
+        "navigationBarTextStyle": "black"
+    },
+    "tabBar": {
+        "color": "#000",
+        "selectedColor": "f23030",
+        "list": [{
+                "pagePath": "pages/index/index",
+                "text": "首页",
+                "iconPath": "static/home_icon_volunteer_nor@2x.png",
+                "selectedIconPath": "static/home_icon_default_sel@2x.png"
+            },
+            {
+                "pagePath": "pages/predict/predict",
+                "text": "志愿预测",
+                "iconPath": "static/home_icon_volunteer_nor@2x.png",
+                "selectedIconPath": "static/home_icon_volunteer_nor@2x.png"
+            },
+            {
+                "pagePath": "pages/my/my",
+                "text": "我的",
+                "iconPath": "./static/home_icon_my_nor@2x.png",
+                "selectedIconPath": "./static/home_icon_volunteer_nor@2x.png"
+            }
+        ]
+    },
+    "sitemapLocation": "sitemap.json"
+}

+ 10 - 0
app.wxss

@@ -0,0 +1,10 @@
+/**app.wxss**/
+.container {
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: space-between;
+  padding: 200rpx 0;
+  box-sizing: border-box;
+} 

+ 54 - 0
pages/index/index.js

@@ -0,0 +1,54 @@
+//index.js
+//获取应用实例
+const app = getApp()
+
+Page({
+  data: {
+    motto: 'Hello World',
+    userInfo: {},
+    hasUserInfo: false,
+    canIUse: wx.canIUse('button.open-type.getUserInfo')
+  },
+  //事件处理函数
+  bindViewTap: function() {
+    wx.navigateTo({
+      url: '../logs/logs'
+    })
+  },
+  onLoad: function () {
+    if (app.globalData.userInfo) {
+      this.setData({
+        userInfo: app.globalData.userInfo,
+        hasUserInfo: true
+      })
+    } else if (this.data.canIUse){
+      // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
+      // 所以此处加入 callback 以防止这种情况
+      app.userInfoReadyCallback = res => {
+        this.setData({
+          userInfo: res.userInfo,
+          hasUserInfo: true
+        })
+      }
+    } else {
+      // 在没有 open-type=getUserInfo 版本的兼容处理
+      wx.getUserInfo({
+        success: res => {
+          app.globalData.userInfo = res.userInfo
+          this.setData({
+            userInfo: res.userInfo,
+            hasUserInfo: true
+          })
+        }
+      })
+    }
+  },
+  getUserInfo: function(e) {
+    console.log(e)
+    app.globalData.userInfo = e.detail.userInfo
+    this.setData({
+      userInfo: e.detail.userInfo,
+      hasUserInfo: true
+    })
+  }
+})

+ 94 - 0
pages/index/index.wxml

@@ -0,0 +1,94 @@
+<!-- index.wxml -->
+<!-- <view class="container">
+  <view class="userinfo">
+    <button wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
+    <block wx:else>
+      <image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image>
+      <text class="userinfo-nickname">{{userInfo.nickName}}</text>
+    </block>
+  </view>
+  <view class="usermotto">
+    <text class="user-motto">{{motto}}</text>
+  </view>
+</view> -->
+<view class="content">
+ 	<!-- <image class="logo" src="/static/logo.png"></image> -->
+ 	<div class="search-input-box">
+ 		<div>
+ 			<image class="search_icon_nor" src="../../static/search_icon_nor.png" mode=""></image>
+ 		</div>
+ 			<input type="text" placeholder="搜索专业、院校" value="" />
+ 	</div>
+ 	<!-- <image class="banner" src="/static/home-all.png" mode="widthFix"></image> -->
+ 	<div class="view-content">
+ 		<div>
+ 			<image src="../../static/home_ic_college@2x.png" mode="widthFix"></image>
+ 			<p>院校库</p>
+ 		</div>
+ 		<div>
+ 			<image src="../../static/home_ic_major@2x.png" mode="widthFix"></image>
+ 			<p>专业库</p>
+ 		</div>
+ 		<div>
+ 			<image src="../../static/home_ic_test@2x.png" mode="widthFix"></image>
+ 			<p>兴趣测评</p>
+ 		</div>
+ 	</div>
+ 	
+ 	<div class="school">
+ 		<image src="../../static/home_word_university@2x.png" mode="widthFix"></image>
+ 		<div class="school-content">
+ 				<div class="schol-icon">
+ 					<image src="../../static/清华@2x.png" mode="widthFix"></image>
+ 					<span>清华大学</span>
+ 				</div>
+ 				<div class="schol-icon">
+ 					<image src="../../static/清华@2x.png" mode="widthFix"></image>
+ 					<span>清华大学</span>
+ 				</div>	
+ 		</div>
+ 		<div class="school-content">
+ 			<!-- <div> -->
+ 				<div class="schol-icon">
+ 					<image src="../../static/清华@2x.png" mode="widthFix"></image>
+ 					<span>清华大学</span>
+ 				</div>
+ 				<div class="schol-icon">
+ 					<image src="../../static/清华@2x.png" mode="widthFix"></image>
+ 					<span>清华大学</span>
+ 				</div>
+ 		</div>
+ 		<div class="school-content">
+ 			<!-- <div> -->
+ 				<div class="schol-icon">
+ 					<image src="../../static/清华@2x.png" mode="widthFix"></image>
+ 					<span>清华大学</span>
+ 				</div>
+ 				<div class="schol-icon">
+ 					<image src="../../static/清华@2x.png" mode="widthFix"></image>
+ 					<span>清华大学</span>
+ 				</div>
+ 		</div>
+ 	</div>
+ 	
+ 	<div class="major">
+ 		<image src="../../static/home_word_profession@2x.png" mode="widthFix"></image>
+ 		<div class="major-content">
+ 			
+ 		</div>
+ 	</div>
+ 	<!-- <div class="footer">
+ 		<div>
+ 			<image src="../../static/home_icon_default_sel@2x.png" mode="widthFix"></image>
+ 			<p>首页</p>
+ 		</div>
+ 		<div>
+ 			<image src="../../static/home_icon_volunteer_nor@2x.png" mode="widthFix"></image>
+ 			<p>志愿预测</p>
+ 		</div>
+ 		<div>
+ 			<image src="../../static/home_icon_my_nor@2x.png" mode="widthFix"></image>
+ 			<p>我的</p>
+ 		</div>
+ 	</div> -->
+ </view>

+ 218 - 0
pages/index/index.wxss

@@ -0,0 +1,218 @@
+/**index.wxss**/
+/* .userinfo {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+
+.userinfo-avatar {
+  width: 128rpx;
+  height: 128rpx;
+  margin: 20rpx;
+  border-radius: 50%;
+}
+
+.userinfo-nickname {
+  color: #aaa;
+}
+
+.usermotto {
+  margin-top: 200px;
+}
+ */
+.search-input-box{
+		width:690rpx;
+		height:70rpx;
+		background:rgba(248,248,248,1);
+		border-radius:36rpx;
+		border:1rpx solid rgba(242,242,242,1); 
+		margin-top: 42rpx;
+	}
+	.search-input-box image{
+		width:70rpx;
+		height:70rpx;
+		margin-left: 20rpx;
+		float: left;
+	}
+	.search-input-box  uni-input {
+		overflow: visible;
+		float: left;
+	}
+	.search-input-box input{
+		 box-sizing: border-box;
+		 margin-bottom: 1rpx;
+		 outline: none;
+		 padding-left: 10rpx;
+		 border:0;
+		 margin-top: 10rpx;
+		 }
+	.search-input-box .uni-input-placeholder{
+		width:196rpx;
+		height:40rpx;
+		font-size:28rpx;
+		font-family:PingFangSC;
+		font-weight:400;
+		color:rgba(175,178,191,1);
+		line-height:40rpx;
+	}
+
+	.banner{
+		width:690rpx;
+		height:308rpx;
+		border-radius:20rpx;
+	}
+
+	.content {
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		justify-content: center;
+		/* background-color: #F8F8F8; */
+	}
+
+	.view-content{
+		display: flex;
+		flex-direction: row no-wrap;
+		height:210rpx;
+		background:rgba(255,255,255,1);
+	}
+	.view-content image{
+		width:128rpx;
+		height:128rpx;
+		overflow: visible;
+		vertical-align:middle;
+	}
+	.view-content p{
+		text-align:center;
+		width:96rpx;
+		height:33rpx;
+		font-size:24rpx;
+		font-family:PingFangSC;
+		font-weight:500;
+		color:rgba(117,119,128,1);
+		line-height:33rpx;
+		
+	}
+	.view-content div{
+		display: flex;
+		flex-direction: column;
+		width:80rpx;
+		height:28rpx;
+	}
+	.view-content div:first-child{
+		margin-left: 61rpx;
+		margin-right: 0rpx;
+	}
+	.view-content div:nth-child(2){
+		margin-left: 122rpx;
+		margin-right: 122rpx;
+	}
+	.view-content div:nth-child(3){
+		margin-right: 61rpx;
+	}
+	.view-content p{
+		align-self:center;
+	}
+	.view-content image{
+		align-self:center;
+	}
+
+	.school {
+		align-items:flex-start;
+		width:750rpx;
+		/* height:984rpx; */
+		background:rgba(255,255,255,1);
+	}
+	.school image{
+		width: 170rpx;
+		height: 54rpx;
+		    margin: 0 auto;
+		    /* text-align: center; */
+		    /* vertical-align: middle; */
+		    display: block;
+	}
+	.school-content{
+		display: flex;
+		flex-wrap: wrap;
+	}
+	.school-content div:first-child{
+		margin-left: 98rpx;
+		margin-right: 195rpx;
+	}
+	.schol-icon image{
+		width: 180rpx;
+		height: 180rpx;
+	}
+	.schol-icon span{
+		width:112rpx;
+		height:40rpx;
+		font-size:28rpx;
+		font-family:PingFangSC;
+		font-weight:500;
+		color:rgba(44,44,44,1);
+		line-height:40rpx;
+		margin-top: 24rpx;
+		margin-bottom: 40rpx;
+	}
+	.schol-icon{
+		    display: flex;
+		    flex-direction: column;
+		    align-items: flex-end;
+			text-align: -webkit-center;
+		}
+	
+
+	.major{
+		width:750rpx;
+		height:470rpx;
+		background:rgba(255,255,255,1);
+		margin-top: 20rpx;
+	}
+	.major image{
+		width: 170rpx;
+		height: 54rpx;
+		margin: 0 auto;
+		display: block;
+	}
+
+	.footer{
+		display: flex;
+		position: fixed;
+		bottom: 0;
+		width:750rpx;
+		height:99rpx;
+		background:rgba(255,255,255,1);
+		margin-top: 20rpx;
+	}
+	.footer div:first-child{
+		margin-left: 92rpx;
+		margin-right: 184rpx;
+	}
+	.footer div:nth-child(2){
+		margin-right: 183rpx;
+	}
+	.footer div:nth-child(3){
+		margin-right: 93rpx;
+	}
+	.footer image{
+		width:66rpx;
+		height:67rpx;
+		overflow: visible;
+	}
+	.footer div:first-child p{
+		margin-left: 15rpx;
+	}
+	.footer div:nth-child(3) p{
+		margin-left: 15rpx;
+	}
+	.footer div{
+		display: flex;
+		flex-direction: column;
+		width:80rpx;
+		height:28rpx;
+		font-size:20rpx;
+		font-family:PingFangSC;
+		font-weight:500;
+		color:rgba(175,178,191,1);
+		line-height:28rpx;
+	}

+ 15 - 0
pages/logs/logs.js

@@ -0,0 +1,15 @@
+//logs.js
+const util = require('../../utils/util.js')
+
+Page({
+  data: {
+    logs: []
+  },
+  onLoad: function () {
+    this.setData({
+      logs: (wx.getStorageSync('logs') || []).map(log => {
+        return util.formatTime(new Date(log))
+      })
+    })
+  }
+})

+ 3 - 0
pages/logs/logs.json

@@ -0,0 +1,3 @@
+{
+  "navigationBarTitleText": "志愿预测"
+}

+ 6 - 0
pages/logs/logs.wxml

@@ -0,0 +1,6 @@
+<!--logs.wxml-->
+<view class="container log-list">
+  <block wx:for="{{logs}}" wx:for-item="log">
+    <text class="log-item">{{index + 1}}. {{log}}</text>
+  </block>
+</view>

+ 8 - 0
pages/logs/logs.wxss

@@ -0,0 +1,8 @@
+.log-list {
+  display: flex;
+  flex-direction: column;
+  padding: 40rpx;
+}
+.log-item {
+  margin: 10rpx;
+}

+ 66 - 0
pages/my/my.js

@@ -0,0 +1,66 @@
+// pages/my/my.js
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        isChecked: true
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function(options) {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function() {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function() {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function() {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function() {
+
+    }
+})

+ 4 - 0
pages/my/my.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+   "navigationBarTitleText": "我的"
+}

+ 5 - 0
pages/my/my.wxml

@@ -0,0 +1,5 @@
+<view class="" hover-class="none" hover-stop-propagation="false">
+    <checkbox class="" value="" disabled="false" checked="{{isChecked?true:false}}" color="">
+        
+    </checkbox>
+</view>

+ 1 - 0
pages/my/my.wxss

@@ -0,0 +1 @@
+/* pages/my/my.wxss */

+ 66 - 0
pages/predict/predict.js

@@ -0,0 +1,66 @@
+// pages/predict/predict.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+      msg:"hello world 1"
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 3 - 0
pages/predict/predict.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 10 - 0
pages/predict/predict.wxml

@@ -0,0 +1,10 @@
+<!--pages/predict/predict.wxml-->
+<text>
+    hello world ||{{msg}}
+    pages/predict/predict.wxml
+</text>
+<view class="" hover-class="none" hover-stop-propagation="false">
+    <checkbox class="" value="" disabled="false" checked="{{true}}" color="">
+
+    </checkbox>
+</view>

+ 1 - 0
pages/predict/predict.wxss

@@ -0,0 +1 @@
+/* pages/predict/predict.wxss */

+ 48 - 0
project.config.json

@@ -0,0 +1,48 @@
+{
+	"description": "项目配置文件。",
+	"packOptions": {
+		"ignore": []
+	},
+	"setting": {
+		"urlCheck": true,
+		"es6": true,
+		"postcss": true,
+		"minified": true,
+		"newFeature": true,
+		"coverView": true,
+		"autoAudits": false,
+		"checkInvalidKey": true,
+		"checkSiteMap": true,
+		"uploadWithSourceMap": true,
+		"babelSetting": {
+			"ignore": [],
+			"disablePlugins": [],
+			"outputPath": ""
+		},
+		"enhance": true
+	},
+	"compileType": "miniprogram",
+	"libVersion": "2.0.8",
+	"appid": "touristappid",
+	"projectname": "aaaaaaaaa",
+	"simulatorType": "wechat",
+	"simulatorPluginLibVersion": {},
+	"condition": {
+		"search": {
+			"current": -1,
+			"list": []
+		},
+		"conversation": {
+			"current": -1,
+			"list": []
+		},
+		"game": {
+			"currentL": -1,
+			"list": []
+		},
+		"miniprogram": {
+			"current": -1,
+			"list": []
+		}
+	}
+}

+ 7 - 0
sitemap.json

@@ -0,0 +1,7 @@
+{
+  "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
+  "rules": [{
+  "action": "allow",
+  "page": "*"
+  }]
+}

BIN
static/home-all.png


BIN
static/home_ic_college.png


BIN
static/home_ic_college@2x.png


BIN
static/home_ic_major.png


BIN
static/home_ic_major@2x.png


BIN
static/home_ic_test.png


BIN
static/home_ic_test@2x.png


BIN
static/home_icon_default_nor(1).png


BIN
static/home_icon_default_nor.png


BIN
static/home_icon_default_sel.png


BIN
static/home_icon_default_sel@2x.png


BIN
static/home_icon_my_nor.png


BIN
static/home_icon_my_nor@2x.png


BIN
static/home_icon_volunteer_nor.png


BIN
static/home_icon_volunteer_nor@2x.png


BIN
static/home_word_profession.png


BIN
static/home_word_profession@2x.png


BIN
static/home_word_university.png


BIN
static/home_word_university@2x.png


BIN
static/logo.png


BIN
static/search_icon_nor.png


BIN
static/search_icon_nor@2x.png


BIN
static/中南.png


BIN
static/中南@2x.png


BIN
static/中央财经.png


BIN
static/中央财经@2x.png


BIN
static/北大.png


BIN
static/北大@2x.png


BIN
static/四川.png


BIN
static/四川@2x.png


BIN
static/复旦.png


BIN
static/复旦@2x.png


BIN
static/清华.png


BIN
static/清华@2x.png


+ 19 - 0
utils/util.js

@@ -0,0 +1,19 @@
+const formatTime = date => {
+  const year = date.getFullYear()
+  const month = date.getMonth() + 1
+  const day = date.getDate()
+  const hour = date.getHours()
+  const minute = date.getMinutes()
+  const second = date.getSeconds()
+
+  return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
+}
+
+const formatNumber = n => {
+  n = n.toString()
+  return n[1] ? n : '0' + n
+}
+
+module.exports = {
+  formatTime: formatTime
+}