作者 吴孟雨

首页静态页,启动页

... ... @@ -2,22 +2,21 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="75f2dbf1-3658-44f1-8934-8f4aa7a66688" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/科学队长.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/app.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/app.json" afterDir="false" />
<change afterPath="$PROJECT_DIR$/app.wxss" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pages/index/index.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pages/index/index.wxml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pages/index/index.wxss" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pages/logs/logs.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pages/logs/logs.json" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pages/logs/logs.wxml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pages/logs/logs.wxss" afterDir="false" />
<change afterPath="$PROJECT_DIR$/project.config.json" afterDir="false" />
<change afterPath="$PROJECT_DIR$/utils/util.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/images/start-logo.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pages/start/start.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pages/start/start.json" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pages/start/start.wxml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pages/start/start.wxss" afterDir="false" />
<change afterPath="$PROJECT_DIR$/templates/templates.wxml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/templates/templates.wxss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app.js" beforeDir="false" afterPath="$PROJECT_DIR$/app.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app.json" beforeDir="false" afterPath="$PROJECT_DIR$/app.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/app.wxss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pages/index/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/pages/index/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pages/index/index.wxml" beforeDir="false" afterPath="$PROJECT_DIR$/pages/index/index.wxml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pages/index/index.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/pages/index/index.wxss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/project.config.json" beforeDir="false" afterPath="$PROJECT_DIR$/project.config.json" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/.tmp/" />
<ignored path="$PROJECT_DIR$/temp/" />
... ... @@ -38,32 +37,158 @@
</usages-collector>
<usages-collector id="statistics.file.extensions.open">
<counts>
<entry key="wxml" value="1" />
<entry key="js" value="4" />
<entry key="json" value="7" />
<entry key="wxml" value="6" />
<entry key="wxss" value="7" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.open">
<counts>
<entry key="HTML" value="1" />
<entry key="CSS" value="7" />
<entry key="HTML" value="6" />
<entry key="JSON" value="7" />
<entry key="JavaScript" value="4" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.edit">
<counts>
<entry key="js" value="197" />
<entry key="json" value="79" />
<entry key="txt" value="12" />
<entry key="wxml" value="405" />
<entry key="wxss" value="567" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.edit">
<counts>
<entry key="CSS" value="567" />
<entry key="HTML" value="405" />
<entry key="JSON" value="79" />
<entry key="JavaScript" value="197" />
<entry key="PLAIN_TEXT" value="12" />
</counts>
</usages-collector>
</session>
</component>
<component name="FileEditorManager">
<leaf>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/pages/start/start.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="506">
<caret line="32" column="37" lean-forward="true" selection-start-line="32" selection-start-column="37" selection-end-line="32" selection-end-column="37" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/app.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="396">
<caret line="18" column="30" lean-forward="true" selection-start-line="18" selection-start-column="30" selection-end-line="18" selection-end-column="30" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/templates/templates.wxml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="220">
<caret line="10" column="58" selection-start-line="10" selection-start-column="51" selection-end-line="10" selection-end-column="58" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/templates/templates.wxss">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="740">
<caret line="66" column="25" selection-start-line="66" selection-start-column="25" selection-end-line="66" selection-end-column="25" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app.wxss">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="418">
<caret line="19" column="16" selection-start-line="19" selection-start-column="16" selection-end-line="19" selection-end-column="16" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/pages/start/start.wxml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="242">
<caret line="11" lean-forward="true" selection-start-line="11" selection-end-line="11" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/pages/index/index.wxml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="286">
<caret line="13" lean-forward="true" selection-start-line="13" selection-end-line="13" />
<state relative-caret-position="352">
<caret line="16" column="23" lean-forward="true" selection-start-line="16" selection-start-column="23" selection-end-line="16" selection-end-column="23" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/pages/index/index.wxss">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="426">
<caret line="51" column="18" lean-forward="true" selection-start-line="51" selection-start-column="18" selection-end-line="51" selection-end-column="18" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/pages/index/index.json">
<provider selected="true" editor-type-id="text-editor" />
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/pages/index/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="333">
<caret line="16" column="25" lean-forward="true" selection-start-line="16" selection-start-column="25" selection-end-line="16" selection-end-column="25" />
<folding>
<element signature="n#!!doc" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>getUserInfo</find>
</findStrings>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/project.config.json" />
<option value="$PROJECT_DIR$/app.js" />
<option value="$PROJECT_DIR$/pages/start/start.wxml" />
<option value="$PROJECT_DIR$/pages/start/start.js" />
<option value="$PROJECT_DIR$/app.wxss" />
<option value="$PROJECT_DIR$/pages/index/index.wxss" />
<option value="$PROJECT_DIR$/pages/index/index.wxml" />
<option value="$PROJECT_DIR$/pages/index/index.js" />
<option value="$PROJECT_DIR$/templates/templates.wxml" />
<option value="$PROJECT_DIR$/templates/templates.wxss" />
<option value="$PROJECT_DIR$/app.json" />
</list>
</option>
</component>
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsGulpfileManager">
... ... @@ -71,9 +196,10 @@
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="-8" />
<option name="width" value="1936" />
<option name="height" value="1047" />
<option name="x" value="437" />
<option name="y" value="57" />
<option name="width" value="1400" />
<option name="height" value="1000" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView">
... ... @@ -99,6 +225,11 @@
<item name="pages" type="462c0819:PsiDirectoryNode" />
<item name="index" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="科学队长" type="b2602c69:ProjectViewProjectNode" />
<item name="科学队长" type="462c0819:PsiDirectoryNode" />
<item name="templates" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
... ... @@ -108,10 +239,17 @@
</component>
<component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="last_opened_file_path" value="D:/info" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="D:\小程序\科学队长" />
<recent name="D:\小程序\科学队长\images" />
<recent name="D:\小程序\科学队长\pages" />
</key>
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
... ... @@ -134,22 +272,30 @@
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1541813457161</updated>
<workItem from="1541813458425" duration="326000" />
<workItem from="1541813458425" duration="8400000" />
</task>
<task id="LOCAL-00001" summary="first commit">
<created>1541813802326</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1541813802326</updated>
</task>
<option name="localTasksCounter" value="2" />
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="326000" />
<option name="totallyTimeSpent" value="8400000" />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Favorites" side_tool="true" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.12170706" />
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.12170706" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Docker" show_stripe_button="false" />
<window_info active="true" anchor="bottom" id="Version Control" visible="true" weight="0.329718" />
<window_info anchor="bottom" id="Version Control" weight="0.329718" />
<window_info anchor="bottom" id="Terminal" />
<window_info anchor="bottom" id="Event Log" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
... ... @@ -196,11 +342,117 @@
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="first commit" />
<option name="LAST_COMMIT_MESSAGE" value="first commit" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/pages/start/start.json">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/pages/logs/logs.wxss">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="176">
<caret line="8" lean-forward="true" selection-start-line="8" selection-end-line="8" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pages/logs/logs.wxml">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/pages/logs/logs.json">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/pages/logs/logs.js">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/pages/start/start.wxss">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="660">
<caret line="30" column="25" lean-forward="true" selection-start-line="30" selection-start-column="25" selection-end-line="30" selection-end-column="25" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="410">
<caret line="141" column="21" lean-forward="true" selection-start-line="141" selection-start-column="21" selection-end-line="141" selection-end-column="21" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/project.config.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="484">
<caret line="22" column="4" selection-start-line="22" selection-start-column="4" selection-end-line="22" selection-end-column="4" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pages/start/start.wxml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="242">
<caret line="11" lean-forward="true" selection-start-line="11" selection-end-line="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pages/start/start.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="506">
<caret line="32" column="37" lean-forward="true" selection-start-line="32" selection-start-column="37" selection-end-line="32" selection-end-column="37" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app.wxss">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="418">
<caret line="19" column="16" selection-start-line="19" selection-start-column="16" selection-end-line="19" selection-end-column="16" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pages/index/index.json">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/pages/index/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="333">
<caret line="16" column="25" lean-forward="true" selection-start-line="16" selection-start-column="25" selection-end-line="16" selection-end-column="25" />
<folding>
<element signature="n#!!doc" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pages/index/index.wxml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="286">
<caret line="13" lean-forward="true" selection-start-line="13" selection-end-line="13" />
<state relative-caret-position="352">
<caret line="16" column="23" lean-forward="true" selection-start-line="16" selection-start-column="23" selection-end-line="16" selection-end-column="23" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pages/index/index.wxss">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="426">
<caret line="51" column="18" lean-forward="true" selection-start-line="51" selection-start-column="18" selection-end-line="51" selection-end-column="18" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/templates.wxml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="220">
<caret line="10" column="58" selection-start-line="10" selection-start-column="51" selection-end-line="10" selection-end-column="58" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/templates.wxss">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="740">
<caret line="66" column="25" selection-start-line="66" selection-start-column="25" selection-end-line="66" selection-end-column="25" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="396">
<caret line="18" column="30" lean-forward="true" selection-start-line="18" selection-start-column="30" selection-end-line="18" selection-end-column="30" />
</state>
</provider>
</entry>
... ...
//app.js
// import md5 from 'utils/md5.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.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)
// }
// }
// })
// }
// }
// })
},
post: function (url,data,headerParams) {
/**
* 自定义post函数,返回Promise
* +-------------------
* @param {String} url 接口网址
* @param {arrayObject} data 要传的数组对象 like: {name: 'name', age: 32}
* +-------------------
* @return {Promise} promise 返回promise供后续操作
*/
// wx.showLoading({
// title: '加载中',
// })
wx.showNavigationBarLoading()
// wx.showToast({
// title: '加载中',
// icon:'none',
// })
var promise = new Promise((resolve, reject) => {
//init
let that = this;
let postData = data;
let baseUrl = 'http://informationxcx.w.bronet.cn/api';
//网络请求
let header = {
'content-type': 'application/x-www-form-urlencoded'
}
header = Object.assign(header, headerParams)
wx.request({
url: baseUrl + url,
data: postData,
method: 'POST',
header: header,
success: function (res) {//返回取得的数据
if (res.data.code == '20000') {
resolve(res.data.data);
} else if (res.data.code == '40001') {//返回错误提示信息
wx.showModal({
title: '提示',
content: '登录已过期请重新登录!',
showCancel: false,
success: function (res) {
if (res.confirm) {
wx.removeStorageSync('token');
wx.navigateTo({
url: '/pages/start/start',
})
// 获取用户信息
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)
}
}
})
} else if (res.data.code == '40000') {
wx.showModal({
title: '提示',
content: res.data.msg,
showCancel: false,
success: function (res) { }
})
} else {
wx.showModal({
title: '提示',
content: res.data.msg,
showCancel: false,
})
reject(res.data)
}
setTimeout(function () {
// wx.hideLoading()
// wx.hideToast()
wx.hideNavigationBarLoading()
}, 500)
},
error: function (e) {
reject('网络出错');
// wx.hideLoading()
wx.hideNavigationBarLoading()
}
})
});
return promise;
},
formCollect(id){
let url = '/sign/formid'
let params = {
formid: id,
openid: wx.getStorageSync('openId')
}
this.post(url,params).then((res)=>{
console.log(res)
}).catch((errMsg)=>{
})
},
nowDate() {
let date = new Date();
let month = date.getMonth() + 1;
let day = date.getDate();
let hours = date.getHours();
let minutes = date.getMinutes();
let Y = date.getFullYear() + '/' + (month > 9 ? month : ('0' + month)) + '/' + (day > 9 ? day : ('0' + day));
let H = (hours>9?hours:('0'+hours)) + ':' +(minutes>9?minutes:('0'+minutes));
let time = [];
time.push(Y,H);
let new_time = time.join(' ');
return new_time;
},
initDate(a){
let date1 = new Date();
let time1 = date1.getFullYear() + "-" + (date1.getMonth() + 1) + "-" + date1.getDate();
let date2 = new Date(date1);
date2.setDate(date1.getDate() + a);
let time2 = date2.getFullYear() + "-" + (date2.getMonth() + 1) + "-" + date2.getDate();
return time2;
},
// 数组移除指定元素
arryRemove(arr, item){
return arr.filter(function (ele) {
return ele != item;
})
},
strTime(strtime){
let str = 'bronet' + strtime + 'beijing'
return md5(md5(str))
},
globalData: {
userInfo: null
userInfo: null,
baseUrl:'https://beijing.wx.broteam.cn'
}
})
\ No newline at end of file
... ...
{
"pages":[
"pages": [
"pages/index/index",
"pages/logs/logs"
"pages/start/start",
"pages/logs/logs",
"pages/clock/clock",
"pages/my/my"
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "WeChat",
"navigationBarTextStyle":"black"
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#3FA9F5",
"navigationBarTitleText": "科学队长实验室",
"navigationBarTextStyle": "white"
},
"tabBar": {
"color": "#6F6F6F",
"selectedColor": "#5AB7F9",
"borderStyle": "black",
"backgroundColor": "#fff",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "/images/home0.png",
"selectedIconPath": "/images/home1.png"
},
{
"pagePath": "pages/clock/clock",
"text": "打卡",
"iconPath": "/images/clock0.png",
"selectedIconPath": "/images/clock1.png"
},
{
"pagePath": "pages/my/my",
"text": "我的",
"iconPath": "/images/my0.png",
"selectedIconPath": "/images/my1.png"
}
]
}
}
\ No newline at end of file
... ...
/**app.wxss**/
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
/*.container {*/
/*height: 100%;*/
/*display: flex;*/
/*flex-direction: column;*/
/*align-items: center;*/
/*justify-content: space-between;*/
/*padding: 200rpx 0;*/
/*box-sizing: border-box;*/
/*}*/
@font-face {
font-family: 'iconfont'; /* project id 912375 */
src: url('//at.alicdn.com/t/font_912375_rrnjo8y2a0b.eot');
src: url('//at.alicdn.com/t/font_912375_rrnjo8y2a0b.eot?#iefix') format('embedded-opentype'),
url('//at.alicdn.com/t/font_912375_rrnjo8y2a0b.woff') format('woff'),
url('//at.alicdn.com/t/font_912375_rrnjo8y2a0b.ttf') format('truetype'),
url('//at.alicdn.com/t/font_912375_rrnjo8y2a0b.svg#iconfont') format('svg');
}
.iconfont {
font-family:"iconfont" !important;
font-size:16px;
font-style:normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-wode:before { content: "\e67b"; }
.icon-shouye:before { content: "\e6a5"; }
.icon-dianji:before { content: "\e600"; }
\ No newline at end of file
... ...
// pages/clock/clock.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/clock/clock.wxml-->
<text>pages/clock/clock.wxml</text>
... ...
/* pages/clock/clock.wxss */
\ No newline at end of file
... ...
... ... @@ -4,15 +4,23 @@ const app = getApp()
Page({
data: {
motto: 'Hello World',
userInfo: {},
hasUserInfo: false,
canIUse: wx.canIUse('button.open-type.getUserInfo')
imgUrls:[
{'url': '../../images/banner.jpg'},
{'url': '../../images/banner.jpg'},
{'url': '../../images/banner.jpg'},],
autoplay: true, //是否自动轮播
interval: 2000, //间隔时间
duration: 500, //滑动时间
test_info: {
is_this_week: true,
url: [{url:'../../images/test_img.jpg'}],
ordered: false,
time: '10月08号-10月14号'
},
//事件处理函数
bindViewTap: function() {
wx.navigateTo({
url: '../logs/logs'
},
swiperChange: function (e) { //切换轮播图
this.setData({
currentSwiper: e.detail.current
})
},
onLoad: function () {
... ...
{}
\ No newline at end of file
... ...
<!--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>
<!--轮播图-->
<view class="wrap">
<swiper autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" circular="true"
bindchange="swiperChange">
<block wx:for="{{imgUrls}}" wx:key="index">
<swiper-item>
<navigator url="{{item.url}}" hover-class="navigator-hover">
<view class="index_top">
<image src="{{item.url}}" class="slide-image" mode="aspectFill"/>
</view>
</navigator>
</swiper-item>
</block>
</swiper>
<view class="dots">
<block wx:for="{{ imgUrls}}" wx:key>
<view class="dot{{index == currentSwiper ? ' active' : ''}}"></view>
</block>
</view>
<view class="usermotto">
<text class="user-motto">{{motto}}</text>
</view>
<view class="btn-box">
<view class="buy-btn">
<text>点击图片可跳转到购买页</text>
</view>
</view>
<import src="/templates/templates.wxml" />
<template is="experiment" data="{{...test_info}}"></template>
</view>
... ...
/**index.wxss**/
.userinfo {
@import "../../templates/templates.wxss";
.wrap {
height: auto;
position: relative;
}
swiper {
display: block;
height: 376rpx;
}
/*用来包裹所有的小圆点 */
.dots {
width: 156rpx;
height: 36rpx;
display: flex;
flex-direction: column;
align-items: center;
flex-direction: row;
position: absolute;
left: 320rpx;
bottom: 20rpx;
z-index: 10;
}
.userinfo-avatar {
width: 128rpx;
height: 128rpx;
margin: 20rpx;
/*未选中时的小圆点样式 */
.dot {
width: 16rpx;
height: 16rpx;
border-radius: 50%;
margin-right: 26rpx;
background-color: white;
opacity: 0.6;
}
/*选中以后的小圆点样式 */
.active {
width: 30rpx;
height: 16rpx;
border-radius: 8rpx;
opacity: 1;
}
.userinfo-nickname {
color: #aaa;
.index_top {
width: 100%;
overflow: hidden;
}
.usermotto {
margin-top: 200px;
.index_top image {
width: 100%;
height: 376rpx;
}
.btn-box {
padding: 22rpx 20rpx;
box-sizing: border-box;
}
.buy-btn {
width: 100%;
height: 150rpx;
/*padding: 22rpx 20rpx;*/
/*margin-top: 22rpx;*/
/*margin-bottom: 22rpx;*/
/*margin-left: 20rpx;*/
/*margin-right: 20rpx;*/
box-sizing: border-box;
background: #5AB7F9;
border-radius: 20rpx;
display: flex;
align-items: center;
justify-content: center;
}
.buy-btn text {
color: #ffffff;
font-size: 24rpx;
}
\ No newline at end of file
... ...
// pages/my/my.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/my/my.wxml-->
<text>pages/my/my.wxml</text>
... ...
/* pages/my/my.wxss */
\ No newline at end of file
... ...
// var appjs = require("../../app.js");
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
openid: '',
session_key: '',
},
// 获取用户信息
start(e) {
let that = this;
console.log('点击');
// wx.redirectTo({
// url: '/pages/index/index',
// })
let url = '/wxapp/public/login';
// console.log(that.data.openid)
let params = {
encrypted_data: e.detail.encryptedData,
iv: e.detail.iv,
raw_data: e.detail.rawData,
signature: e.detail.signature,
openid: that.data.openid,
session_key: that.data.session_key,
}
app.post(url, params).then((ret) => {
wx.setStorageSync('token', ret.token)
app.globalData.userInfo = ret.user_type
// console.log('userInfo',app.globalData.userInfo,ret);
if (ret.user_type == 2) {
wx.switchTab({
url: '/pages/index/index',
})
}
})
},
example() {
app.post(url, {
id: 1
}, {}).then((res) => {
this.setData({
code: res
})
}).catch((err) => {
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let that = this
let url = '/wxapp/public/getSessionKey'
wx.login({
success: function (res) {
// console.log(res)
app.post(url, {
code: res.code
}, {}).then((ret) => {
// console.log('res',ret);
that.setData({
openid: ret.openid,
session_key: ret.session_key
})
})
},
fail: function (res) {
},
complete: function (res) {
},
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/start/start.wxml-->
<view class= 'ic_img'>
<image src='../../images/start-logo.png'></image>
</view>
<text class='tit'>
科学队长
</text>
<button class='go_btn' open-type="getUserInfo" lang="zh_CN" bindgetuserinfo="start">立即开启</button>
<!--<view class='go_btn'bindtap="start">立即开启</view>-->
... ...
/* pages/start/start.wxss */
.ic_img {
width: 320rpx;
height: 320rpx;
margin: 147rpx auto 0rpx;
}
.ic_img image {
width: 100%;
height: 100%;
}
.tit {
font-size: 30rpx;
color: #5493FB;
text-align: center;
display: block;
line-height: 40rpx;
}
.go_btn {
width: 360rpx;
height: 80rpx;
color: #fff;
position: absolute;
bottom: 182rpx;
left: 0;
right: 0;
margin: 0 auto;
background: #5493FB;
/*background: linear-gradient(to bottom right, #ffc536, #ffab2e); !* 标准的语法 *!*/
border-radius: 40rpx;
line-height: 80rpx;
}
.go_btn::after {
border: none;
}
... ...
... ... @@ -4,7 +4,7 @@
"ignore": []
},
"setting": {
"urlCheck": true,
"urlCheck": false,
"es6": true,
"postcss": true,
"minified": true,
... ... @@ -12,7 +12,7 @@
},
"compileType": "miniprogram",
"libVersion": "2.4.0",
"appid": "wxaab44bbcfc0e5bc5",
"appid": "wx48319d952ea4e37f",
"projectname": "%E7%A7%91%E5%AD%A6%E9%98%9F%E9%95%BF",
"debugOptions": {
"hidedInDevtools": []
... ...
<template name="experiment">
<view class='experiment_box'>
<view class="title_box">
<view class="line"></view>
<text wx:if="{{is_this_week}}">本周实验</text>
<text wx:if="{{!is_this_week}}">往期实验</text>
</view>
<view class="test_box">
<view class="time">{{time}}</view>
<view wx:for="{{url}}" wx:key="index" class="img_box">
<image src="{{item.url}}"></image>
</view>
</view>
<view class="order_box">
<text wx:if="{{!ordered}}">前往预约</text>
<text wx:if="{{ordered}}">查看</text>
</view>
</view>
</template>
\ No newline at end of file
... ...
/* pages/template/template.wxss */
.experiment_box {
width: 100%;
background-color: #fff;
padding: 20rpx;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.title_box {
width: 100%;
display: flex;
align-items: center;
justify-content: flex-start;
}
.title_box .line {
width: 6rpx;
height: 32rpx;
background-color: #3FA9F5;
margin-right: 18rpx;
}
.title_box text {
color: #464646;
font-size: 32rpx;
}
.test_box {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.test_box .time {
font-size: 28rpx;
color: #3FA9F5;
margin-bottom: 20rpx;
}
.test_box .img_box {
width: 100%;
height: 300rpx;
}
.img_box image {
width: 100%;
height: 100%;
border-radius: 20rpx;
}
.order_box {
display: flex;
align-items: center;
justify-content: flex-end;
margin-top: 10rpx;
}
.order_box text {
width: 150rpx;
height: 40rpx;
line-height: 40rpx;
color: #ffffff;
background-color: #3FA9F5;
font-size: 28rpx;
text-align: center;
border-radius: 10rpx;
}
\ No newline at end of file
... ...