Commit 0c91ba88 authored by 罗超's avatar 罗超

1

parent c2d9530e
...@@ -3,8 +3,12 @@ import { ...@@ -3,8 +3,12 @@ import {
} from 'vue' } from 'vue'
import App from './App.vue' import App from './App.vue'
import Toast from "./wxcomponents/vant/toast/toast"; import Toast from "./wxcomponents/vant/toast/toast";
import Dialog from "./wxcomponents/vant/dialog/dialog";
import plugin from './utils/plugin'
let app = createApp(App) let app = createApp(App)
app.provide("$toast", Toast) app.provide("$toast", Toast)
app.provide("$dialog", Dialog)
app.use(plugin)
// app.config.globalProperties.$toast = Toast;//全局挂载方法 // app.config.globalProperties.$toast = Toast;//全局挂载方法
// app.component('v-MessageBox',MessageBox);//全局注册组件 // app.component('v-MessageBox',MessageBox);//全局注册组件
app.mount() app.mount()
...@@ -90,7 +90,6 @@ import { ...@@ -90,7 +90,6 @@ import {
} from "vue"; } from "vue";
import { getStudentLeaveList, invalidReceiptInfo } from "../../api/index"; import { getStudentLeaveList, invalidReceiptInfo } from "../../api/index";
import Loadmore from "../../components/loadmore.vue"; import Loadmore from "../../components/loadmore.vue";
import Dialog from "../../wxcomponents/vant/dialog/dialog";
export default { export default {
components: { components: {
Loadmore, Loadmore,
...@@ -98,6 +97,7 @@ export default { ...@@ -98,6 +97,7 @@ export default {
setup() { setup() {
let userInfo = uni.getStorageSync("userInfo"); let userInfo = uni.getStorageSync("userInfo");
let Toast = inject("$toast"); let Toast = inject("$toast");
let Dialog = inject("$dialog");
let data = reactive({ let data = reactive({
data: [], data: [],
pageState: "more", pageState: "more",
......
...@@ -2,9 +2,11 @@ ...@@ -2,9 +2,11 @@
<view :style="{ 'padding-top': `${statusBarHeight}px` }"> <view :style="{ 'padding-top': `${statusBarHeight}px` }">
<view style="height: 100rpx"></view> <view style="height: 100rpx"></view>
<van-nav-bar fixed> <van-nav-bar fixed>
<van-icon name="cross" slot="left" size="30rpx" @click="back" /> <template #left>
<van-icon name="cross" size="30rpx" @click="back" />
</template>
<template #title>
<view <view
slot="title"
class="flex" class="flex"
style="justify-content: center" style="justify-content: center"
@click="start" @click="start"
...@@ -23,6 +25,7 @@ ...@@ -23,6 +25,7 @@
ref="countdown" ref="countdown"
/> />
</view> </view>
</template>
</van-nav-bar> </van-nav-bar>
<view class="exam-con"> <view class="exam-con">
<Sub1 /> <Sub1 />
......
...@@ -131,6 +131,7 @@ import { ...@@ -131,6 +131,7 @@ import {
} from "vue"; } from "vue";
import { getIndexInfo } from "../../api/index"; import { getIndexInfo } from "../../api/index";
import { getSystemInfo, desensitization } from "../../utils/index"; import { getSystemInfo, desensitization } from "../../utils/index";
import request from "../../utils/request.js";
export default { export default {
name: "", name: "",
props: {}, props: {},
...@@ -203,7 +204,6 @@ export default { ...@@ -203,7 +204,6 @@ export default {
}, },
], ],
}); });
let methods = { let methods = {
jumpPage(url) { jumpPage(url) {
uni.navigateTo({ uni.navigateTo({
...@@ -232,6 +232,7 @@ export default { ...@@ -232,6 +232,7 @@ export default {
}; };
onMounted(() => { onMounted(() => {
console.log(process.env);
getSystemInfo((res) => { getSystemInfo((res) => {
data.statusBarHeight = res.statusBarHeight; data.statusBarHeight = res.statusBarHeight;
}); });
...@@ -250,7 +251,10 @@ export default { ...@@ -250,7 +251,10 @@ export default {
}; };
}, },
onLoad() { onLoad() {
console.log("index load"); // let { ctx } = getCurrentInstance();
// ctx.$test("首页");
// this.$test("首页");
// console.log(256, this);
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: "首页", title: "首页",
}); });
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
如果需要解构 prop,可以通过使用 setup 函数中的 toRefs 来完成此操作 如果需要解构 prop,可以通过使用 setup 函数中的 toRefs 来完成此操作
* // ref和reactive的区别: ref()传入的是js的基本数据类型; reactive()中传入的是object普通对象,------------reactive对象不能直接赋值-------------- * // ref和reactive的区别: ref()传入的是js的基本数据类型; reactive()中传入的是object普通对象,------------reactive对象不能直接赋值--------------
*@reactive:处理的是对象的双向绑定, 对象不能被***解构或展开***,一旦被解构或者展开,返回的值将失去响应式,需用...toRef() *@reactive:处理的是对象的双向绑定, 对象不能被***解构或展开***,一旦被解构或者展开,返回的值将失去响应式,需用...toRef()
* 没有this 通过 @getCurrentInstance,获取当前页面实例,使用const { ctx,proxy } = getCurrentInstance(); ctx或proxy.$挂载的方法 * 没有this 通过 @getCurrentInstance,获取当前页面实例,使用const { ctx,proxy,refs } = getCurrentInstance(); ctx或proxy.$挂载的方法
*/ */
import { import {
ref, ref,
...@@ -37,11 +37,19 @@ export default { ...@@ -37,11 +37,19 @@ export default {
watch(name, (newVal, oldVal) => { watch(name, (newVal, oldVal) => {
console.log(51, newVal); console.log(51, newVal);
}); });
//监听对象的某一项
watch(
() => msg.Account,
(val) => {
console.log(val);
}
);
// computed 计算属性 : 适合计算一个属性, 并且绑定. // computed 计算属性 : 适合计算一个属性, 并且绑定.
// computed将监听它里面所有的变量, 里面变量发生变化就会触发结果重新计算 // computed将监听它里面所有的变量, 里面变量发生变化就会触发结果重新计算
// 计算出来的结果是只读的, 所以fullName是不能被改变的 // 计算出来的结果是只读的, 所以fullName是不能被改变的
const fullName = computed(() => name.firstname + name.lastname); const fullName = computed(() => name.firstname + name.lastname);
// const fullName = computed(() => { return name.firstname + name.lastname});
// 高级用法: 可以修改值 // 高级用法: 可以修改值
const fullName2 = computed({ const fullName2 = computed({
get: () => name.firstname + name.lastname, get: () => name.firstname + name.lastname,
...@@ -57,5 +65,15 @@ export default { ...@@ -57,5 +65,15 @@ export default {
fullName2, fullName2,
}; };
}, },
onLoad() {
//这里有this
let { ctx } = getCurrentInstance();
ctx.$test("首页");
this.$test("首页");
console.log(69, this);
uni.setNavigationBarTitle({
title: "首页",
});
},
}; };
</script> </script>
...@@ -5,32 +5,15 @@ ...@@ -5,32 +5,15 @@
</van-nav-bar> </van-nav-bar>
<view class="top"> <view class="top">
登录 登录
<van-image <van-image width="193rpx" height="242rpx" fit="cover" class="yuqi"
width="193rpx" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/yuqi.png" />
height="242rpx"
fit="cover"
class="yuqi"
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/yuqi.png"
/>
</view> </view>
<view class="main"> <view class="main">
<van-cell-group> <van-cell-group>
<van-field <van-field :value="Account" clearable placeholder="请输入用户名" clearable @input="usernameInput">
:value="Account"
clearable
placeholder="请输入用户名"
clearable
@input="usernameInput"
>
<i class="iconfont icon-user2 left-iconfont" slot="left-icon"></i> <i class="iconfont icon-user2 left-iconfont" slot="left-icon"></i>
</van-field> </van-field>
<van-field <van-field :value="Password" password placeholder="请输入密码" clearable @input="passwordInput">
:value="Password"
password
placeholder="请输入密码"
clearable
@input="passwordInput"
>
<i class="iconfont icon-password left-iconfont" slot="left-icon"></i> <i class="iconfont icon-password left-iconfont" slot="left-icon"></i>
</van-field> </van-field>
</van-cell-group> </van-cell-group>
...@@ -42,7 +25,7 @@ ...@@ -42,7 +25,7 @@
</template> </template>
<script> <script>
import { import {
ref, ref,
reactive, reactive,
toRefs, toRefs,
...@@ -52,10 +35,12 @@ import { ...@@ -52,10 +35,12 @@ import {
computed, computed,
onMounted, onMounted,
inject, inject,
} from "vue"; } from "vue";
// import Toast from "../../wxcomponents/vant/toast/toast"; // import Toast from "../../wxcomponents/vant/toast/toast";
import { login } from "../../api/index"; import {
export default { login
} from "../../api/index";
export default {
setup(props, context) { setup(props, context) {
let Toast = inject("$toast"); let Toast = inject("$toast");
let msg = reactive({ let msg = reactive({
...@@ -65,7 +50,6 @@ export default { ...@@ -65,7 +50,6 @@ export default {
let methods = { let methods = {
usernameInput(val) { usernameInput(val) {
msg.Account = val.detail; msg.Account = val.detail;
console.log(74, msg);
}, },
passwordInput(val) { passwordInput(val) {
msg.Password = val.detail; msg.Password = val.detail;
...@@ -157,11 +141,11 @@ export default { ...@@ -157,11 +141,11 @@ export default {
...methods, ...methods,
}; };
}, },
}; };
</script> </script>
<style scoped> <style scoped>
.top { .top {
height: 242rpx; height: 242rpx;
box-sizing: border-box; box-sizing: border-box;
padding-left: 40rpx; padding-left: 40rpx;
...@@ -172,23 +156,27 @@ export default { ...@@ -172,23 +156,27 @@ export default {
color: #0f1b35; color: #0f1b35;
position: relative; position: relative;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.yuqi {
.yuqi {
position: absolute; position: absolute;
top: 0; top: 0;
right: 1rpx; right: 1rpx;
} }
.main {
.main {
height: 250rpx; height: 250rpx;
box-sizing: border-box; box-sizing: border-box;
padding: 0 40rpx; padding: 0 40rpx;
margin-bottom: 165rpx; margin-bottom: 165rpx;
} }
/deep/.van-cell {
/deep/.van-cell {
height: 124rpx; height: 124rpx;
padding-top: 50rpx; padding-top: 50rpx;
} }
/deep/.loginBtn {
/deep/.loginBtn {
width: 600rpx; width: 600rpx;
height: 90rpx; height: 90rpx;
background-color: #00acf9; background-color: #00acf9;
...@@ -198,18 +186,20 @@ export default { ...@@ -198,18 +186,20 @@ export default {
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 500; font-weight: 500;
color: #ffffff; color: #ffffff;
} }
.auth {
.auth {
text-align: center; text-align: center;
font-size: 26rpx; font-size: 26rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 500; font-weight: 500;
color: #00acf9; color: #00acf9;
margin-top: 30rpx; margin-top: 30rpx;
} }
.left-iconfont {
.left-iconfont {
margin-right: 20rpx; margin-right: 20rpx;
font-size: 30rpx; font-size: 30rpx;
color: #111111; color: #111111;
} }
</style> </style>
*{ /* *{
font-family: PingFang SC;
box-sizing: border-box;
} */
:global(*) {
font-family: PingFang SC; font-family: PingFang SC;
box-sizing: border-box; box-sizing: border-box;
} }
......
let host = 'http://192.168.20.17:8017/api' let host = 'http://192.168.20.17:8017/api'
if (process.env.NODE_ENV === "development") {
host = 'http://192.168.20.17:8017/api'
} else {
host = 'http://192.168.20.17:8017/api'
}
import Toast from '../wxcomponents/vant/toast/toast'; import Toast from '../wxcomponents/vant/toast/toast';
let token = uni.getStorageSync('userInfo').Token; let token = uni.getStorageSync('userInfo').Token;
let request = (param) => { let request = (param) => {
...@@ -28,7 +33,5 @@ let request = (param) => { ...@@ -28,7 +33,5 @@ let request = (param) => {
} }
}); });
}) })
} }
export default request export default request
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment