init project
This commit is contained in:
6
miniprogram/pages/index/index.json
Normal file
6
miniprogram/pages/index/index.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"t-button": "tdesign-miniprogram/button/button",
|
||||
"t-input": "tdesign-miniprogram/input/input"
|
||||
}
|
||||
}
|
||||
60
miniprogram/pages/index/index.less
Normal file
60
miniprogram/pages/index/index.less
Normal file
@ -0,0 +1,60 @@
|
||||
/**index.wxss**/
|
||||
page {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.index {
|
||||
flex: 1;
|
||||
overflow-y: hidden;
|
||||
|
||||
.container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
padding: 200rpx 0;
|
||||
box-sizing: border-box;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
.logo {
|
||||
width: 128px;
|
||||
height: 128px;
|
||||
display: block;
|
||||
border-radius: 4px;
|
||||
box-shadow: 2px 2px 8px rgba(0, 0, 0, .2);
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.name {
|
||||
margin: 0 .5rem;
|
||||
display: inline-block;
|
||||
|
||||
&.gao {
|
||||
color: #FF7A9B;
|
||||
}
|
||||
|
||||
&.yeyu {
|
||||
color: #7A9BFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.password {
|
||||
width: 20rem;
|
||||
border-top: 1px solid rgba(0, 0, 0, .1);
|
||||
border-bottom: 1px solid rgba(0, 0, 0, .1);
|
||||
}
|
||||
|
||||
.enter {
|
||||
width: 10rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
46
miniprogram/pages/index/index.ts
Normal file
46
miniprogram/pages/index/index.ts
Normal file
@ -0,0 +1,46 @@
|
||||
// index.ts
|
||||
|
||||
import config from "../../config/index"
|
||||
|
||||
interface IndexData {
|
||||
key: string;
|
||||
}
|
||||
|
||||
Page({
|
||||
data: <IndexData>{
|
||||
key: ""
|
||||
},
|
||||
onShow() {
|
||||
const key = wx.getStorageSync("key");
|
||||
if (key) {
|
||||
this.setData({
|
||||
key
|
||||
});
|
||||
}
|
||||
},
|
||||
navigateToMain() {
|
||||
wx.request({
|
||||
url: `${config.url}/journal/list`,
|
||||
method: "POST",
|
||||
header: {
|
||||
Key: this.data.key
|
||||
},
|
||||
data: {
|
||||
index: 0,
|
||||
size: 1
|
||||
},
|
||||
success: (resp) => {
|
||||
const data = resp.data as any;
|
||||
if (data.code === 20000) {
|
||||
wx.setStorageSync("key", this.data.key);
|
||||
wx.switchTab({
|
||||
url: "/pages/main/journal/index",
|
||||
})
|
||||
} else {
|
||||
wx.showToast({ title: "密码错误", icon: "error" });
|
||||
}
|
||||
},
|
||||
fail: () => wx.showToast({ title: "验证失败", icon: "error" })
|
||||
});
|
||||
}
|
||||
})
|
||||
18
miniprogram/pages/index/index.wxml
Normal file
18
miniprogram/pages/index/index.wxml
Normal file
@ -0,0 +1,18 @@
|
||||
<!--index.wxml-->
|
||||
<scroll-view class="index" scroll-y type="list">
|
||||
<view class="container">
|
||||
<view class="header">
|
||||
<image class="logo" src="/assets/image/logo.png"></image>
|
||||
<text>
|
||||
<text class="name gao">小糕</text>
|
||||
<text>和</text>
|
||||
<text class="name yeyu">夜雨</text>
|
||||
<text>的美好记录</text>
|
||||
</text>
|
||||
</view>
|
||||
<view class="password">
|
||||
<t-input placeholder="请输入访问密码" model:value="{{key}}" borderless clearable />
|
||||
</view>
|
||||
<t-button class="enter" theme="primary" bind:tap="navigateToMain">进入</t-button>
|
||||
</view>
|
||||
</scroll-view>
|
||||
Reference in New Issue
Block a user