修改小程序目录,删除示例小程序
This commit is contained in:
3
miniprogram/src/pages/index/index.config.js
Normal file
3
miniprogram/src/pages/index/index.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '首页'
|
||||
})
|
0
miniprogram/src/pages/index/index.css
Normal file
0
miniprogram/src/pages/index/index.css
Normal file
125
miniprogram/src/pages/index/index.vue
Normal file
125
miniprogram/src/pages/index/index.vue
Normal file
@@ -0,0 +1,125 @@
|
||||
<template>
|
||||
<view style="background-color: #F6F6F6;height: 100%;">
|
||||
<image src="../../image/home.jpg" style="width: 100%;height: 130px;"></image>
|
||||
<view style="display: block; padding-left: 30px; padding-top: 12px;">
|
||||
<text>欢迎你,{{ displayUsername }}!</text>
|
||||
</view>
|
||||
<view style="display: block;" v-if="isUser">
|
||||
<view style="display: flex;text-align: center;margin-top: 20px;">
|
||||
<view style="width: 25%;">
|
||||
<image src="../../image/icon/code.png" style="width: 40px;height: 40px;" @tap='goCode'></image>
|
||||
<view>进出码</view>
|
||||
</view>
|
||||
<view style="width: 25%;">
|
||||
<image src="../../image/icon/feedback.png" style="width: 40px;height: 40px;" bindtap='goFeedback'></image>
|
||||
<view>反馈查看</view>
|
||||
</view>
|
||||
<view style="width: 25%;">
|
||||
<image src="../../image/icon/apply.png" style="width: 40px;height: 40px;" bindtap='goApply'></image>
|
||||
<view>申请记录</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="display: flex;text-align: center;margin-top: 20px;">
|
||||
<view style="width: 25%;">
|
||||
<image src="../../image/icon/yq.png" style="width: 40px;height: 40px;" data-web="xgPage" bindtap='goWebPage'>
|
||||
</image>
|
||||
<view>疫情追踪</view>
|
||||
</view>
|
||||
<view style="width: 25%;">
|
||||
<image src="../../image/icon/report.png" style="width: 40px;height: 40px;" bindtap='goReport'></image>
|
||||
<view>今日日报</view>
|
||||
</view>
|
||||
<view style="width: 25%;">
|
||||
<image src="../../image/icon/updPwd.png" style="width: 40px;height: 40px;" bindtap='goUpdPwd'></image>
|
||||
<view>密码修改</view>
|
||||
</view>
|
||||
<view style="width: 25%;">
|
||||
<image src="../../image/icon/fk.png" style="width: 40px;height: 40px;" bindtap='goKf'></image>
|
||||
<view>提交反馈</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="display: block;" v-if="isAdmin">
|
||||
<view style="display: flex;text-align: center;margin-top: 20px;">
|
||||
<view style="width: 25%;">
|
||||
<image src="../../image/icon/danger.png" style="width: 40px;height: 40px;" bindtap='goCode'></image>
|
||||
<view>不健康人员</view>
|
||||
</view>
|
||||
<view style="width: 25%;">
|
||||
<image src="../../image/icon/feedback.png" style="width: 40px;height: 40px;" bindtap='goFeedbackReplay'>
|
||||
</image>
|
||||
<view>反馈回复</view>
|
||||
</view>
|
||||
<view style="width: 25%;">
|
||||
<image src="../../image/icon/apply.png" style="width: 40px;height: 40px;" bindtap='goApplyReplay'></image>
|
||||
<view>申请审批</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="display: flex;text-align: center;margin-top: 20px;">
|
||||
<view style="width: 25%;">
|
||||
<image src="../../image/icon/gg.png" style="width: 40px;height: 40px;" data-web="xgPage" bindtap='goNotice'>
|
||||
</image>
|
||||
<view>公告发布</view>
|
||||
</view>
|
||||
<view style="width: 25%;">
|
||||
<image src="../../image/icon/visitor.png" style="width: 40px;height: 40px;" bindtap="goVisitor"></image>
|
||||
<view>访客审批</view>
|
||||
</view>
|
||||
<view style="width: 25%;">
|
||||
<image src="../../image/icon/count.png" style="width: 40px;height: 40px;" bindtap='goCount'></image>
|
||||
<view>分配账号</view>
|
||||
</view>
|
||||
<view style="width: 25%;">
|
||||
<image src="../../image/icon/_report.png" style="width: 40px;height: 40px;" bindtap='toRedList'></image>
|
||||
<view>今日未填</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Taro from '@tarojs/taro'
|
||||
import { eventCenter, getCurrentInstance } from '@tarojs/taro'
|
||||
|
||||
import './index.css'
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
userInfo: null,
|
||||
displayUsername: "",
|
||||
isUser: false,
|
||||
isAdmin: false,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
eventCenter.once(getCurrentInstance().router.onShow, () => {
|
||||
console.log('onShow')
|
||||
this.userInfo = Taro.getStorageSync("userInfo");
|
||||
this.displayUsername = this.userInfo?.username ?? "请登录";
|
||||
if (!this.userInfo) {
|
||||
console.log("用户未登录")
|
||||
Taro.redirectTo({
|
||||
url: '/pages/index/login'
|
||||
})
|
||||
} else {
|
||||
this.isUser = this.userInfo.userType == "user";
|
||||
this.isAdmin = this.userInfo.userType == "admin";
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
goCode() {
|
||||
// Taro.navigateTo({
|
||||
// url: '/pages/residents/code'
|
||||
// })
|
||||
Taro.switchTab({
|
||||
url: '/pages/residents/code'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
3
miniprogram/src/pages/index/login.config.js
Normal file
3
miniprogram/src/pages/index/login.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '登录'
|
||||
})
|
28
miniprogram/src/pages/index/login.css
Normal file
28
miniprogram/src/pages/index/login.css
Normal file
@@ -0,0 +1,28 @@
|
||||
.container {
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
.login-icon {
|
||||
text-align: center;
|
||||
height: 35vh;
|
||||
}
|
||||
|
||||
.login-img {
|
||||
width: 50vw;
|
||||
}
|
||||
|
||||
.login-from {
|
||||
padding: 0 20vw;
|
||||
}
|
||||
|
||||
.inputText {
|
||||
border-bottom: solid 1px;
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
.loginBtnView {
|
||||
margin-top: 70px;
|
||||
}
|
||||
.loginBtn {
|
||||
margin-bottom: 25px;
|
||||
}
|
85
miniprogram/src/pages/index/login.vue
Normal file
85
miniprogram/src/pages/index/login.vue
Normal file
@@ -0,0 +1,85 @@
|
||||
<template>
|
||||
<!--pages/login/login.wxml-->
|
||||
<view class="container">
|
||||
<view class="login-icon">
|
||||
<image class="login-img" src="../../image/icon/login-background.svg"></image>
|
||||
</view>
|
||||
<view class="login-from">
|
||||
<view class="inputView">
|
||||
<!--账号-->
|
||||
<input v-model="username" class="inputText" placeholder="账号" />
|
||||
<!--密码-->
|
||||
<input v-model="password" class="inputText" placeholder="密码" password="true" />
|
||||
</view>
|
||||
<view class="loginBtnView">
|
||||
<!--按钮-->
|
||||
<button class="loginBtn" type="primary" @tap="login">登录</button>
|
||||
<button class="loginBtn" type="secondary" bindtap="visitor">访客申请</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Taro from '@tarojs/taro'
|
||||
|
||||
import './login.css'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
...Taro.getApp().globalData,
|
||||
username: '',
|
||||
password: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
login() {
|
||||
if (this.username == '' || this.password == '') {
|
||||
Taro.showToast({
|
||||
title: "请完善登录信息",
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
} else {
|
||||
Taro.request({
|
||||
url: `${this.baseUrl}/user/login`,
|
||||
data: {
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
},
|
||||
success: function (d) {
|
||||
let data = d.data;
|
||||
if (data.code == 200) {
|
||||
if (data.status == "success") {
|
||||
Taro.setStorageSync("userInfo", data.userInfo);
|
||||
console.log("userInfo", Taro.getStorageSync("userInfo"))
|
||||
Taro.showToast({
|
||||
title: "登录成功",
|
||||
icon: 'success',
|
||||
success: function () {
|
||||
Taro.redirectTo({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: data.msg,
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: data.msg,
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
4
miniprogram/src/pages/residents/code.config.js
Normal file
4
miniprogram/src/pages/residents/code.config.js
Normal file
@@ -0,0 +1,4 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '身份码'
|
||||
})
|
||||
|
8
miniprogram/src/pages/residents/code.css
Normal file
8
miniprogram/src/pages/residents/code.css
Normal file
@@ -0,0 +1,8 @@
|
||||
.time-text {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#qrcode {
|
||||
width: 70vw;
|
||||
height: 70vw;
|
||||
}
|
21
miniprogram/src/pages/residents/code.vue
Normal file
21
miniprogram/src/pages/residents/code.vue
Normal file
@@ -0,0 +1,21 @@
|
||||
<template>
|
||||
<view style="background-color: #F6F6F6;height: 100%;">
|
||||
<image src="../../image/home.jpg" style="width: 100%;height: 130px;"></image>
|
||||
</view>
|
||||
<view style="text-align: center; margin-top: 100px;">
|
||||
<view><text>{{ stuId }} {{ name }}</text></view>
|
||||
<image id="qrcode" src="{{imgUrl}}"></image>
|
||||
<view><text class="time-text">{{ time }}</text></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import './code.css'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
Reference in New Issue
Block a user