全局登录调整
This commit is contained in:
13
app.js
13
app.js
@@ -2,20 +2,9 @@
|
||||
import api from './utils/api.js';
|
||||
App({
|
||||
onLaunch() {
|
||||
// 展示本地存储能力
|
||||
const logs = wx.getStorageSync('logs') || []
|
||||
logs.unshift(Date.now())
|
||||
wx.setStorageSync('logs', logs)
|
||||
|
||||
// 登录
|
||||
wx.login({
|
||||
success: res => {
|
||||
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
globalData: {
|
||||
userInfo: null
|
||||
},
|
||||
$api: api,
|
||||
})
|
||||
|
||||
3
app.json
3
app.json
@@ -2,10 +2,9 @@
|
||||
"pages": [
|
||||
"pages/task/index",
|
||||
"pages/task/taskView/index",
|
||||
"pages/logs/logs",
|
||||
"pages/myself/index",
|
||||
"pages/message/index",
|
||||
"pages/taskDetail/index",
|
||||
"pages/task/taskDetail/index",
|
||||
"pages/anniversary/index",
|
||||
"pages/anniversary/create/index",
|
||||
"pages/myself/notify/index",
|
||||
|
||||
@@ -168,9 +168,9 @@ Component({
|
||||
successTran: false,
|
||||
move: this.data.scrollHeight1
|
||||
});
|
||||
}, 350)
|
||||
}, 1500)
|
||||
}, 600)
|
||||
}, 100)
|
||||
}, 500)
|
||||
}, 200)
|
||||
} else {
|
||||
if (this.data.refreshStatus !== 3) {
|
||||
this.setData({
|
||||
|
||||
@@ -10,6 +10,18 @@ Component({
|
||||
}
|
||||
},
|
||||
|
||||
lifetimes: {
|
||||
created() {
|
||||
|
||||
},
|
||||
attached: function () {
|
||||
// 在组件实例进入页面节点树时执行
|
||||
},
|
||||
detached: function () {
|
||||
// 在组件实例被从页面节点树移除时执行
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
@@ -65,8 +77,8 @@ Component({
|
||||
checkLogin(){
|
||||
let userInfo = wx.getStorageSync('userInfo');
|
||||
let token = wx.getStorageSync('userToken');
|
||||
console.log('userInfo===' + userInfo);
|
||||
console.log('token===' + token);
|
||||
console.log('components userInfo===' + userInfo);
|
||||
console.log('components token===' + token);
|
||||
if (userInfo && token){
|
||||
return true;
|
||||
}else {
|
||||
|
||||
@@ -7,6 +7,9 @@ Page({
|
||||
code:''
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
wx.hideHomeButton();
|
||||
},
|
||||
// 输入框输入时
|
||||
inputChange(event) {
|
||||
let key = event.currentTarget.dataset.type;
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
// logs.js
|
||||
const util = require('../../utils/util.js')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
logs: []
|
||||
},
|
||||
onLoad() {
|
||||
this.setData({
|
||||
logs: (wx.getStorageSync('logs') || []).map(log => {
|
||||
return {
|
||||
date: util.formatTime(new Date(log)),
|
||||
timeStamp: log
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"navigationBarTitleText": "查看启动日志",
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
<!--logs.wxml-->
|
||||
<view class="container log-list">
|
||||
<block wx:for="{{logs}}" wx:key="timeStamp" wx:for-item="log">
|
||||
<text class="log-item">{{index + 1}}. {{log.date}}</text>
|
||||
</block>
|
||||
</view>
|
||||
@@ -1,8 +0,0 @@
|
||||
.log-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 40rpx;
|
||||
}
|
||||
.log-item {
|
||||
margin: 10rpx;
|
||||
}
|
||||
@@ -22,7 +22,7 @@ Page({
|
||||
|
||||
exitLogin(){
|
||||
wx.clearStorageSync();
|
||||
wx.redirectTo({url:"/pages/login/index"})
|
||||
wx.reLaunch({url:"/pages/login/index"})
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -47,7 +47,9 @@ Page({
|
||||
{"id":40,"userName":"浙A88FU7","checked":false}
|
||||
],
|
||||
},
|
||||
|
||||
onShow() {
|
||||
wx.hideHomeButton();
|
||||
},
|
||||
checkName() {
|
||||
this.closeDialog();
|
||||
wx.redirectTo({url:"/pages/register/password/index?name=" + this.data.checkedName})
|
||||
|
||||
@@ -7,6 +7,9 @@ Page({
|
||||
userName:options.name
|
||||
})
|
||||
},
|
||||
onShow() {
|
||||
wx.hideHomeButton();
|
||||
},
|
||||
toLongin(){
|
||||
wx.redirectTo({url:"/pages/login/index"});
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@ Page({
|
||||
userName:options.name
|
||||
})
|
||||
},
|
||||
|
||||
onShow() {
|
||||
wx.hideHomeButton();
|
||||
},
|
||||
toRegister(){
|
||||
wx.redirectTo({url:"/pages/register/ok/index?name=" + this.data.userName})
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ Page({
|
||||
{'taskId':'13','title':'我去哦额陪娃欧美大片请我们','note':'2022-11-11','complete':true,'notification':true},
|
||||
{'taskId':'14','title':'请问哦气雾剂群殴','note':'2022-11-11','complete':true,'notification':true}
|
||||
],
|
||||
duration: 300, // swiper-item 切换过渡时间
|
||||
duration: 100, // swiper-item 切换过渡时间
|
||||
categoryCur: 0, // 当前数据列索引
|
||||
categoryMenu: ['任务清单','收藏任务','延期任务'], // 分类菜单数据, 字符串数组格式
|
||||
categoryData: [], // 所有数据列
|
||||
@@ -86,7 +86,7 @@ Page({
|
||||
// 页面滑动切换事件
|
||||
animationFinish(e) {
|
||||
this.setData({
|
||||
duration: 300
|
||||
duration: 100
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.setData({
|
||||
@@ -178,6 +178,14 @@ Page({
|
||||
this.data.tapCheckHandle.close();
|
||||
},
|
||||
onLoad() {
|
||||
let userInfo = wx.getStorageSync('userInfo');
|
||||
let token = wx.getStorageSync('userToken');
|
||||
console.log('userInfo===' + userInfo);
|
||||
console.log('token===' + token);
|
||||
if (!userInfo || !token){
|
||||
wx.redirectTo({url:"/pages/login/index"});
|
||||
return;
|
||||
}
|
||||
let categoryData = [];
|
||||
this.data.categoryMenu.forEach(index =>{
|
||||
categoryData.push({
|
||||
@@ -195,12 +203,12 @@ Page({
|
||||
// 第一次加载延迟 350 毫秒 防止第一次动画效果不能完全体验
|
||||
setTimeout(() => {
|
||||
this.refresh();
|
||||
}, 350);
|
||||
}, 100);
|
||||
},
|
||||
|
||||
handleClick(){
|
||||
wx.navigateTo({
|
||||
url: '/pages/taskDetail/index'
|
||||
url: '/pages/task/taskDetail/index'
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
let taskId = '';
|
||||
Page({
|
||||
data: {
|
||||
mode: '',
|
||||
alertVisible: false,
|
||||
completeVisible: false,
|
||||
repeatVisible: false,
|
||||
repeatKey: [
|
||||
{ label: '每1天', value: '1' },
|
||||
{ label: '工作日', value: '2' },
|
||||
{ label: '每1周', value: '3' },
|
||||
{ label: '每1月', value: '4' },
|
||||
{ label: '每1年', value: '5' },
|
||||
],
|
||||
date: new Date('2021-12-23').getTime(), // 支持时间戳传入
|
||||
alertText: '',
|
||||
completeText: '',
|
||||
repeatText: '',
|
||||
repeatValue: '',
|
||||
// 指定选择区间起始值
|
||||
start: '2008-01-01 00:00:00',
|
||||
end: '2040-12-31 23:59:59',
|
||||
},
|
||||
onLoad: function (options) {
|
||||
taskId = options.id;
|
||||
},
|
||||
|
||||
showPicker(e) {
|
||||
const { mode } = e?.currentTarget?.dataset;
|
||||
this.setData({
|
||||
mode,
|
||||
[`${mode}Visible`]: true,
|
||||
});
|
||||
},
|
||||
hidePicker() {
|
||||
const { mode } = this.data;
|
||||
this.setData({
|
||||
[`${mode}Visible`]: false,
|
||||
});
|
||||
},
|
||||
onConfirm(e) {
|
||||
const { value } = e?.detail;
|
||||
const { mode } = this.data;
|
||||
|
||||
console.log('confim', value);
|
||||
|
||||
this.setData({
|
||||
[mode]: value,
|
||||
[`${mode}Text`]: value,
|
||||
});
|
||||
|
||||
this.hidePicker();
|
||||
},
|
||||
|
||||
onPickerConfirm(e) {
|
||||
const { label,value } = e?.detail;
|
||||
this.setData({
|
||||
repeatText : label,
|
||||
repeatValue: value
|
||||
});
|
||||
this.hidePicker();
|
||||
},
|
||||
|
||||
submitTask() {
|
||||
//TODO 新增或者修改
|
||||
console.log('保存成功')
|
||||
wx.redirectTo({
|
||||
url: '../task/index'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"t-date-time-picker": "/components/date-time-picker/date-time-picker",
|
||||
"t-picker": "/components/picker/picker",
|
||||
"t-picker-item": "/components/picker/picker-item",
|
||||
"t-switch": "/components/switch/switch",
|
||||
"t-button": "/components/button/button"
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
<t-input label="任务名" value="{{'任务的农安我i吗哇哦i对面'}}" placeholder="请输入任务名称" maxlength="{{10}}" clearable />
|
||||
<t-cell
|
||||
title="完成日期"
|
||||
hover
|
||||
note="{{completeText || '年 月 日'}}"
|
||||
arrow
|
||||
data-mode="complete"
|
||||
bindtap="showPicker"
|
||||
t-class="pannel-item"
|
||||
t-class-note="{{completeText ? 'sub-text' : 'empty'}}"
|
||||
/>
|
||||
<t-cell
|
||||
title="提醒日期"
|
||||
hover
|
||||
note="{{alertText || '年 月 日'}}"
|
||||
arrow
|
||||
data-mode="alert"
|
||||
bindtap="showPicker"
|
||||
t-class="pannel-item"
|
||||
t-class-note="{{alertText ? 'sub-text' : 'empty'}}"
|
||||
/>
|
||||
<t-cell
|
||||
title="任务重复"
|
||||
hover
|
||||
note="{{repeatText || '选择重复周期'}}"
|
||||
arrow
|
||||
data-mode="repeat"
|
||||
bindtap="showPicker"
|
||||
t-class="pannel-item"
|
||||
t-class-note="{{repeatText ? 'sub-text' : 'empty'}}"
|
||||
/>
|
||||
<t-textarea label="备注" placeholder="请输入任务备注..." maxcharacter="200" />
|
||||
<t-button t-class="external-class" theme="primary" block bind:tap="submitTask">保存</t-button>
|
||||
<input value="{{repeatValue}}" hidden/>
|
||||
<t-date-time-picker
|
||||
title="完成日期"
|
||||
visible="{{completeVisible}}"
|
||||
mode="date"
|
||||
defaultValue="{{date}}"
|
||||
format="YYYY-MM-DD"
|
||||
bindchange="onConfirm"
|
||||
bindpick="onColumnChange"
|
||||
bindcancel="hidePicker"
|
||||
start="{{start}}"
|
||||
end="{{end}}"
|
||||
></t-date-time-picker>
|
||||
<t-date-time-picker
|
||||
title="截止日期"
|
||||
visible="{{alertVisible}}"
|
||||
mode="date"
|
||||
defaultValue="{{date}}"
|
||||
format="YYYY-MM-DD"
|
||||
bindchange="onConfirm"
|
||||
bindpick="onColumnChange"
|
||||
bindcancel="hidePicker"
|
||||
start="{{start}}"
|
||||
end="{{end}}"
|
||||
></t-date-time-picker>
|
||||
<t-picker
|
||||
visible="{{repeatVisible}}"
|
||||
value="{{repeatText}}"
|
||||
data-key="repeatKey"
|
||||
title="请选择重复周期"
|
||||
cancelBtn="取消"
|
||||
confirmBtn="确认"
|
||||
bindchange="onPickerConfirm"
|
||||
bindpick="onColumnChange"
|
||||
>
|
||||
<t-picker-item options="{{repeatKey}}"></t-picker-item>
|
||||
</t-picker>
|
||||
@@ -1,17 +0,0 @@
|
||||
.pannel-item {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.pannel-item::after {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.sub-text {
|
||||
color: #000;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.empty {
|
||||
color: #000;
|
||||
opacity: 0.32;
|
||||
}
|
||||
@@ -1,51 +1,51 @@
|
||||
{
|
||||
"description": "项目配置文件",
|
||||
"packOptions": {
|
||||
"ignore": [],
|
||||
"include": []
|
||||
},
|
||||
"setting": {
|
||||
"bundle": false,
|
||||
"userConfirmedBundleSwitch": false,
|
||||
"urlCheck": true,
|
||||
"scopeDataCheck": false,
|
||||
"coverView": true,
|
||||
"es6": true,
|
||||
"postcss": true,
|
||||
"compileHotReLoad": false,
|
||||
"lazyloadPlaceholderEnable": false,
|
||||
"preloadBackgroundData": false,
|
||||
"minified": true,
|
||||
"autoAudits": false,
|
||||
"newFeature": false,
|
||||
"uglifyFileName": false,
|
||||
"uploadWithSourceMap": true,
|
||||
"useIsolateContext": true,
|
||||
"nodeModules": false,
|
||||
"enhance": true,
|
||||
"useMultiFrameRuntime": true,
|
||||
"useApiHook": true,
|
||||
"useApiHostProcess": true,
|
||||
"showShadowRootInWxmlPanel": true,
|
||||
"packNpmManually": false,
|
||||
"enableEngineNative": false,
|
||||
"packNpmRelationList": [],
|
||||
"minifyWXSS": true,
|
||||
"showES6CompileOption": false,
|
||||
"minifyWXML": true,
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
}
|
||||
},
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "2.19.4",
|
||||
"appid": "wxb1f499f0a173865b",
|
||||
"projectname": "quinn-task",
|
||||
"condition": {},
|
||||
"editorSetting": {
|
||||
"tabIndent": "insertSpaces",
|
||||
"tabSize": 4
|
||||
"description": "项目配置文件",
|
||||
"packOptions": {
|
||||
"ignore": [],
|
||||
"include": []
|
||||
},
|
||||
"setting": {
|
||||
"bundle": false,
|
||||
"userConfirmedBundleSwitch": false,
|
||||
"urlCheck": true,
|
||||
"scopeDataCheck": false,
|
||||
"coverView": true,
|
||||
"es6": true,
|
||||
"postcss": true,
|
||||
"compileHotReLoad": false,
|
||||
"lazyloadPlaceholderEnable": false,
|
||||
"preloadBackgroundData": false,
|
||||
"minified": true,
|
||||
"autoAudits": false,
|
||||
"newFeature": false,
|
||||
"uglifyFileName": false,
|
||||
"uploadWithSourceMap": true,
|
||||
"useIsolateContext": true,
|
||||
"nodeModules": false,
|
||||
"enhance": true,
|
||||
"useMultiFrameRuntime": true,
|
||||
"useApiHook": true,
|
||||
"useApiHostProcess": true,
|
||||
"showShadowRootInWxmlPanel": true,
|
||||
"packNpmManually": false,
|
||||
"enableEngineNative": false,
|
||||
"packNpmRelationList": [],
|
||||
"minifyWXSS": true,
|
||||
"showES6CompileOption": false,
|
||||
"minifyWXML": true,
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
}
|
||||
},
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "2.28.1",
|
||||
"appid": "wxb1f499f0a173865b",
|
||||
"projectname": "quinn-task",
|
||||
"editorSetting": {
|
||||
"tabIndent": "insertSpaces",
|
||||
"tabSize": 4
|
||||
},
|
||||
"condition": {}
|
||||
}
|
||||
Reference in New Issue
Block a user