Commit 62156b8e authored by 罗超's avatar 罗超

1

parent cbccd6de
<script> <script>
export default { export default {
onLaunch() { onLaunch() {
// console.log('App Launch') // console.log('App Launch')
}, },
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
}, },
onHide() { onHide() {
// console.log('App Hide') // console.log('App Hide')
} },
} };
</script> </script>
<style> <style>
/*每个页面公共css */ /*每个页面公共css */
@import "wxcomponents/vant/common/index.wxss"; @import "wxcomponents/vant/common/index.wxss";
@import "static/css/common.css"; @import "static/css/common.css";
@import "static/font/iconfont.css";
</style> </style>
...@@ -45,8 +45,8 @@ import { ...@@ -45,8 +45,8 @@ import {
} from "vue"; } from "vue";
export default { export default {
setup() { setup() {
let data = ref([]); let data = reactive({
data.value = [ data: [
{ {
name: "电子合同的名称", name: "电子合同的名称",
con: "一点小内容吧,放在这里,一点小内容吧", con: "一点小内容吧,放在这里,一点小内容吧",
...@@ -59,9 +59,12 @@ export default { ...@@ -59,9 +59,12 @@ export default {
name: "电子合同的名称", name: "电子合同的名称",
con: "一点小内容吧,放在这里,一点小内容吧", con: "一点小内容吧,放在这里,一点小内容吧",
}, },
]; ],
});
let methods = {};
return { return {
data, ...toRefs(data),
...methods,
}; };
}, },
onLoad() { onLoad() {
......
...@@ -80,15 +80,9 @@ import { ...@@ -80,15 +80,9 @@ import {
} from "vue"; } from "vue";
export default { export default {
setup() { setup() {
let showLayer = ref(false); let data = reactive({
let openLayer = () => { showLayer: false,
showLayer.value = true; data: [
};
let closeLayer = () => {
showLayer.value = false;
};
let data = ref([]);
data.value = [
{ {
name: "第一次课", name: "第一次课",
coursetime: "4课时", coursetime: "4课时",
...@@ -101,12 +95,19 @@ export default { ...@@ -101,12 +95,19 @@ export default {
}, },
], ],
}, },
]; ],
});
let methods = {
openLayer() {
data.showLayer = true;
},
closeLayer() {
data.showLayer = false;
},
};
return { return {
showLayer, ...toRefs(data),
openLayer, ...methods,
closeLayer,
data,
}; };
}, },
onLoad() { onLoad() {
......
...@@ -46,13 +46,18 @@ export default { ...@@ -46,13 +46,18 @@ export default {
props: {}, props: {},
components: {}, components: {},
setup(props) { setup(props) {
let jumpPage = (url) => { let data = reactive({});
let methods = {
jumpPage(url) {
uni.navigateTo({ uni.navigateTo({
url: url, url: url,
}); });
},
}; };
return { return {
jumpPage, ...toRefs(data),
...methods,
}; };
}, },
}; };
......
...@@ -46,12 +46,8 @@ import { ...@@ -46,12 +46,8 @@ import {
} from "vue"; } from "vue";
export default { export default {
setup() { setup() {
let jumpPage = () => { let data = reactive({
uni.navigateTo({ questionList: [
url: "/pages/exam/examPaper",
});
};
let questionList = ref([
{ {
name: "一、单选题", name: "一、单选题",
type: 1, type: 1,
...@@ -94,15 +90,22 @@ export default { ...@@ -94,15 +90,22 @@ export default {
}, },
], ],
}, },
]); ],
});
let methods = {
jumpPage() {
uni.navigateTo({
url: "/pages/exam/examPaper",
});
},
//选题 //选题
let change = (type, index, index1, index2) => { change(type, index, index1, index2) {
if (type === 1) { if (type === 1) {
questionList.value[index].children[index1].choose = data.questionList[index].children[index1].choose =
questionList.value[index].children[index1].children[index2]; data.questionList[index].children[index1].children[index2];
} else if (type === 2) { } else if (type === 2) {
let choose = questionList.value[index].children[index1].choose; let choose = data.questionList[index].children[index1].choose;
let res = questionList.value[index].children[index1].children[index2]; let res = data.questionList[index].children[index1].children[index2];
let find = choose.indexOf(res); let find = choose.indexOf(res);
if (find == -1) { if (find == -1) {
choose.push(res); choose.push(res);
...@@ -110,11 +113,11 @@ export default { ...@@ -110,11 +113,11 @@ export default {
choose.splice(find, 1); choose.splice(find, 1);
} }
} }
},
}; };
return { return {
questionList, ...toRefs(data),
jumpPage, ...methods,
change,
}; };
}, },
onLoad() { onLoad() {
......
...@@ -45,26 +45,26 @@ export default { ...@@ -45,26 +45,26 @@ export default {
components: { Sub1 }, components: { Sub1 },
setup(props, context) { setup(props, context) {
let { refs } = getCurrentInstance(); let { refs } = getCurrentInstance();
let time = ref(0); let data = reactive({
// let countdown = ref(null); time: 2 * 60 * 60 * 1000,
time.value = 2 * 60 * 60 * 1000; });
let jumpPage = () => { let methods = {
jumpPage() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/exam/examPaper", url: "/pages/exam/examPaper",
}); });
}; },
let start = () => { start() {
refs.countdown.start(); refs.countdown.start();
}; },
let back = () => { back() {
uni.navigateBack(); uni.navigateBack();
},
}; };
onMounted(() => {}); onMounted(() => {});
return { return {
jumpPage, ...toRefs(data),
time, ...methods,
start,
back,
}; };
}, },
onLoad() {}, onLoad() {},
......
...@@ -13,6 +13,12 @@ ...@@ -13,6 +13,12 @@
<van-tab title="已完成" name="d"></van-tab> <van-tab title="已完成" name="d"></van-tab>
</van-tabs> </van-tabs>
<view class="exampaper-con"> <view class="exampaper-con">
<scroll-view
:scroll-top="0"
scroll-y="true"
class="scroll-box"
@scrolltolower="lower"
>
<view <view
v-for="(item, index) in examList" v-for="(item, index) in examList"
:key="index" :key="index"
...@@ -41,6 +47,8 @@ ...@@ -41,6 +47,8 @@
</view> </view>
</view> </view>
</view> </view>
<Loadmore :state="pageState" />
</scroll-view>
</view> </view>
</view> </view>
</template> </template>
...@@ -56,18 +64,15 @@ import { ...@@ -56,18 +64,15 @@ import {
computed, computed,
onMounted, onMounted,
} from "vue"; } from "vue";
import Loadmore from "../../components/loadmore.vue";
export default { export default {
components: {
Loadmore,
},
setup() { setup() {
let curtab = ref("b"); let data = reactive({
let changeTab = (e) => { pageState: "more",
// console.log(62, e); examList: [
};
let jumpPage = () => {
uni.navigateTo({
url: "/pages/exam/examPaper",
});
};
let examList = ref([
{ {
testName: "あぃお试卷名称", testName: "あぃお试卷名称",
testTime: "2021-07-29 14:00", testTime: "2021-07-29 14:00",
...@@ -84,12 +89,61 @@ export default { ...@@ -84,12 +89,61 @@ export default {
teacherImg: "", teacherImg: "",
status: "未开始", status: "未开始",
}, },
]); {
testName: "あぃお试卷名称",
testTime: "2021-07-29 14:00",
bgimg: "",
teacherName: "纳豆",
teacherImg: "",
status: "未开始",
},
{
testName: "あぃお试卷名称",
testTime: "2021-07-29 14:00",
bgimg: "",
teacherName: "纳豆",
teacherImg: "",
status: "未开始",
},
{
testName: "あぃお试卷名称",
testTime: "2021-07-29 14:00",
bgimg: "",
teacherName: "纳豆",
teacherImg: "",
status: "未开始",
},
{
testName: "あぃお试卷名称",
testTime: "2021-07-29 14:00",
bgimg: "",
teacherName: "纳豆",
teacherImg: "",
status: "未开始",
},
],
curtab: "b",
});
let methods = {
changeTab(e) {
console.log(123, e);
},
jumpPage() {
uni.navigateTo({
url: "/pages/exam/examPaper",
});
},
lower(e) {
data.pageState = "loading";
console.log(131, e);
},
};
onMounted(() => {
console.log(135, data);
});
return { return {
curtab, ...toRefs(data),
changeTab, ...methods,
examList,
jumpPage,
}; };
}, },
onLoad() { onLoad() {
...@@ -111,9 +165,9 @@ export default { ...@@ -111,9 +165,9 @@ export default {
font-weight: bold !important; font-weight: bold !important;
} }
.exampaper-con { .exampaper-con {
height: calc(100vh - 100rpx);
box-sizing: border-box; box-sizing: border-box;
margin-top: 10rpx; margin-top: 10rpx;
padding: 0 30rpx;
} }
.exam-item { .exam-item {
height: 250rpx; height: 250rpx;
...@@ -177,4 +231,10 @@ export default { ...@@ -177,4 +231,10 @@ export default {
font-weight: bold; font-weight: bold;
color: #00acf9; color: #00acf9;
} }
.scroll-box {
height: 100%;
width: 100%;
box-sizing: border-box;
padding: 0 30rpx 40rpx;
}
</style> </style>
...@@ -56,16 +56,8 @@ import { ...@@ -56,16 +56,8 @@ import {
export default { export default {
setup(props, context) { setup(props, context) {
// let { refs } = getCurrentInstance(); // let { refs } = getCurrentInstance();
let jumpPage = () => { let data = reactive({
uni.navigateTo({ questionList: [
url: "/pages/exam/examPaper",
});
};
let back = () => {
uni.navigateBack();
};
let questionList = ref([
{ {
name: "一、单选题", name: "一、单选题",
type: 1, type: 1,
...@@ -210,17 +202,29 @@ export default { ...@@ -210,17 +202,29 @@ export default {
}, },
], ],
}, },
]); ],
});
let methods = {
jumpPage() {
uni.navigateTo({
url: "/pages/exam/examPaper",
});
},
back() {
uni.navigateBack();
},
//选题 //选题
let change = (type, index, index1, index2) => { change(type, index, index1, index2) {
console.log(158, type);
if (type === 1) { if (type === 1) {
questionList.value[index].children[index1].choose = data.questionList[index].children[index1].choose =
questionList.value[index].children[index1].children[index2].chooseNum; data.questionList[index].children[index1].children[
index2
].chooseNum;
} else if (type === 2) { } else if (type === 2) {
let choose = questionList.value[index].children[index1].choose; let choose = data.questionList[index].children[index1].choose;
let res = let res =
questionList.value[index].children[index1].children[index2].chooseNum; data.questionList[index].children[index1].children[index2]
.chooseNum;
let find = choose.indexOf(res); let find = choose.indexOf(res);
if (find == -1) { if (find == -1) {
choose.push(res); choose.push(res);
...@@ -229,13 +233,16 @@ export default { ...@@ -229,13 +233,16 @@ export default {
} }
console.log(230, choose); console.log(230, choose);
} }
},
};
let change = (type, index, index1, index2) => {
console.log(158, type);
}; };
onMounted(() => {}); onMounted(() => {});
return { return {
jumpPage, ...toRefs(data),
back, ...methods,
questionList,
change,
}; };
}, },
onLoad() {}, onLoad() {},
......
...@@ -115,7 +115,8 @@ export default { ...@@ -115,7 +115,8 @@ export default {
props: {}, props: {},
components: {}, components: {},
setup(props) { setup(props) {
let baseInfo = ref([ let data = reactive({
baseInfo: [
{ {
name: "学区", name: "学区",
desc: "锦江校区", desc: "锦江校区",
...@@ -158,8 +159,8 @@ export default { ...@@ -158,8 +159,8 @@ export default {
bgcolor: "#FFE7E6", bgcolor: "#FFE7E6",
jumpUrl: "", jumpUrl: "",
}, },
]); ],
let testList = ref([ testList: [
{ {
testName: "あぃお试卷名称", testName: "あぃお试卷名称",
testTime: "2021-07-29 14:00", testTime: "2021-07-29 14:00",
...@@ -176,17 +177,20 @@ export default { ...@@ -176,17 +177,20 @@ export default {
teacherImg: "", teacherImg: "",
status: "未开始", status: "未开始",
}, },
]); ],
let jumpPage = (url) => { });
let methods = {
jumpPage(url) {
uni.navigateTo({ uni.navigateTo({
url: url, url: url,
}); });
},
}; };
onMounted(() => {}); onMounted(() => {});
return { return {
baseInfo, ...toRefs(data),
testList, ...methods,
jumpPage,
}; };
}, },
onLoad() { onLoad() {
......
<template>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<view>
<van-button type="warning" size="mini" @click="add">{{title}}</van-button>
<van-icon name="location-o" info="9" size="200rpx" />
</view>
<van-cell-group>
<van-field v-model="yzm" center clearable label="短信验证码" placeholder="请输入短信验证码" use-button-slot>
<van-button slot="button" size="small" type="primary">
发送验证码
</van-button>
</van-field>
<view class="">
<!-- {{count}}{{name.firstname}} -->
</view>
<view class="">
{{firstname}}
</view>
</van-cell-group>
<!-- <van-radio-group v-model="radio" >
<van-radio name='1'>单选框 1</van-radio>
<van-radio name='2'>单选框 2</van-radio>
</van-radio-group> -->
</view>
</template>
<script> <script>
/** /**
* 因为 props 是响应式的,你不能使用 ES6 解构,因为它会消除 prop 的响应性。 * 因为 props 是响应式的,你不能使用 ES6 解构,因为它会消除 prop 的响应性。
如果需要解构 prop,可以通过使用 setup 函数中的 toRefs 来完成此操作 如果需要解构 prop,可以通过使用 setup 函数中的 toRefs 来完成此操作
* // ref和reactive的区别: ref()传入的是js的基本数据类型; reactive()中传入的是object普通对象 * // ref和reactive的区别: ref()传入的是js的基本数据类型; reactive()中传入的是object普通对象
*@reactive:处理的是对象的双向绑定, 对象不能被***解构或展开***,一旦被解构或者展开,返回的值将失去响应式 *@reactive:处理的是对象的双向绑定, 对象不能被***解构或展开***,一旦被解构或者展开,返回的值将失去响应式
* @getCurrentInstance,获取当前页面实例,使用const { ctx,proxy } = getCurrentInstance(); ctx或proxy.$挂载的方法 * @getCurrentInstance,获取当前页面实例,使用const { ctx,proxy } = getCurrentInstance(); ctx或proxy.$挂载的方法
*/ */
import { import {
ref, ref,
reactive, reactive,
toRefs, toRefs,
...@@ -41,57 +16,52 @@ ...@@ -41,57 +16,52 @@
getCurrentInstance, getCurrentInstance,
watch, watch,
computed, computed,
onMounted onMounted,
} from "vue" } from "vue";
export default { export default {
name: '', name: "",
props: {}, props: {},
components: {}, components: {},
setup(props) { setup(props) {
let { let { titles } = toRefs(props);
titles let { ctx } = getCurrentInstance();
} = toRefs(props) let title = ref("hello");
let { let count = ref(0);
ctx let yzm = ref(1234);
} = getCurrentInstance()
let title = ref("hello")
let count = ref(0)
let yzm = ref(1234)
let add = () => { let add = () => {
count.value++ count.value++;
name.firstname += "x" name.firstname += "x";
console.log(58, titles) console.log(58, titles);
} };
let name = reactive({ let name = reactive({
firstname: "x", firstname: "x",
lastname: "w" lastname: "w",
}) });
// 第一个参数: 要监听的响应式对象 // 第一个参数: 要监听的响应式对象
// 第二个参数: 回调函数 // 第二个参数: 回调函数
// watch(count,(newVal,oldVal)=>{ // watch(count,(newVal,oldVal)=>{
// console.log(51,newVal) // console.log(51,newVal)
// }) // })
watch(name, (newVal, oldVal) => { watch(name, (newVal, oldVal) => {
console.log(51, newVal) console.log(51, newVal);
}) });
// computed 计算属性 : 适合计算一个属性, 并且绑定. // computed 计算属性 : 适合计算一个属性, 并且绑定.
// computed将监听它里面所有的变量, 里面变量发生变化就会触发结果重新计算 // computed将监听它里面所有的变量, 里面变量发生变化就会触发结果重新计算
// 计算出来的结果是只读的, 所以fullName是不能被改变的 // 计算出来的结果是只读的, 所以fullName是不能被改变的
const fullName = computed(() => name.firstname + name.lastname) const fullName = computed(() => name.firstname + name.lastname);
// 高级用法: 可以修改值 // 高级用法: 可以修改值
const fullName2 = computed({ const fullName2 = computed({
get: () => name.firstname + name.lastname, get: () => name.firstname + name.lastname,
set: (val) => { set: (val) => {
title.value = val title.value = val;
},
} });
}) fullName2.value = 7;
fullName2.value = 7 console.log(76, fullName2);
console.log(76, fullName2)
onMounted(() => { onMounted(() => {
console.log(84, "onmounted") console.log(84, "onmounted");
}) });
return { return {
title, title,
count, count,
...@@ -100,32 +70,14 @@ ...@@ -100,32 +70,14 @@
// name, // name,
...toRefs(name), ...toRefs(name),
fullName, fullName,
fullName2 fullName2,
} };
}, },
onLoad() { onLoad() {
console.log('index load') console.log("index load");
}, },
onShow() { onShow() {
console.log('index Show') console.log("index Show");
}, },
} };
</script> </script>
<style>
.content {
text-align: center;
height: 400rpx;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>
...@@ -16,25 +16,27 @@ ...@@ -16,25 +16,27 @@
<view class="main"> <view class="main">
<van-cell-group> <van-cell-group>
<van-field <van-field
v-model="msg.username" :value="username"
clearable clearable
placeholder="请输入用户名" placeholder="请输入用户名"
clearable clearable
left-icon="manager-o"
@input="usernameInput" @input="usernameInput"
/> >
<i class="iconfont icon-user2 left-iconfont" slot="left-icon"></i>
</van-field>
<van-field <van-field
:value="msg.password" :value="password"
password password
placeholder="请输入密码" placeholder="请输入密码"
clearable clearable
left-icon="manager-o"
@input="passwordInput" @input="passwordInput"
/> >
<i class="iconfont icon-password left-iconfont" slot="left-icon"></i>
</van-field>
</van-cell-group> </van-cell-group>
</view> </view>
<van-button block custom-class="loginBtn">登录</van-button> <van-button block custom-class="loginBtn">登录</van-button>
<view class="auth"> 授权手机号一键登录 </view> <view class="auth" @click="authLogin"> 授权手机号一键登录 </view>
</view> </view>
</template> </template>
...@@ -52,27 +54,92 @@ import { ...@@ -52,27 +54,92 @@ import {
export default { export default {
setup(props, context) { setup(props, context) {
let msg = { let msg = reactive({
username: "123", username: "123123123",
password: "", password: "",
}; });
let usernameInput = (val) => { let methods = {
usernameInput(val) {
msg.username = val.detail; msg.username = val.detail;
}; console.log(74, msg);
let passwordInput = (val) => { },
passwordInput(val) {
msg.password = val.detail; msg.password = val.detail;
}; },
let back = () => { back() {
uni.navigateBack(); uni.navigateBack();
},
authLogin() {
let that = methods;
that.getUserProfile();
},
getUserProfile() {
//新的获取用户资料
var that = methods;
wx.getUserProfile({
desc: "用于完善资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (info) => {
console.log(info);
// this.msg = {
// Id: 0,
// AliasName: info.userInfo.nickName,
// Photo: info.userInfo.avatarUrl,
// };
that.getUserInfo(info);
},
fail: () => {
uni.showToast({
title: "微信登录授权失败",
icon: "none",
});
},
});
},
getUserInfo(info) {
uni.getProvider({
service: "oauth",
success: function (res) {
if (~res.provider.indexOf("weixin")) {
uni.login({
provider: "weixin",
success: (_res) => {
console.log(107, _res);
// //这里请求接口
// let obj = {
// Source: 1,
// OpenId: "",
// Name: info.userInfo.nickName,
// Photo: info.userInfo.avatarUrl,
// Gender: info.userInfo.gender,
// Moblie: "",
// SuperiorId: 0,
// code: res.code,
// };
// that.getCode(obj);
},
fail: () => {
uni.showToast({
title: "微信登录授权失败",
icon: "none",
});
},
});
} else {
uni.showToast({
title: "请先安装微信或升级版本",
icon: "none",
});
}
},
});
},
}; };
onMounted(() => {});
return { return {
msg, ...toRefs(msg),
usernameInput, ...methods,
passwordInput,
back,
}; };
}, },
onLoad() {},
}; };
</script> </script>
...@@ -123,4 +190,9 @@ export default { ...@@ -123,4 +190,9 @@ export default {
color: #00acf9; color: #00acf9;
margin-top: 30rpx; margin-top: 30rpx;
} }
.left-iconfont {
margin-right: 20rpx;
font-size: 30rpx;
color: #111111;
}
</style> </style>
...@@ -80,15 +80,9 @@ import { ...@@ -80,15 +80,9 @@ import {
} from "vue"; } from "vue";
export default { export default {
setup() { setup() {
let showLayer = ref(false); let data = reactive({
let openLayer = () => { showLayer: false,
showLayer.value = true; data: [
};
let closeLayer = () => {
showLayer.value = false;
};
let data = ref([]);
data.value = [
{ {
name: "第一次课", name: "第一次课",
coursetime: "4课时", coursetime: "4课时",
...@@ -101,12 +95,19 @@ export default { ...@@ -101,12 +95,19 @@ export default {
}, },
], ],
}, },
]; ],
});
let methods = {
openLayer() {
data.showLayer = true;
},
closeLayer() {
data.showLayer = false;
},
};
return { return {
showLayer, ...toRefs(data),
openLayer, ...methods,
closeLayer,
data,
}; };
}, },
onLoad() { onLoad() {
......
...@@ -75,15 +75,9 @@ import { ...@@ -75,15 +75,9 @@ import {
} from "vue"; } from "vue";
export default { export default {
setup() { setup() {
let showLayer = ref(false); let data = reactive({
let openLayer = () => { showLayer: false,
showLayer.value = true; data: [
};
let closeLayer = () => {
showLayer.value = false;
};
let data = ref([]);
data.value = [
{ {
classroom: "奈良", classroom: "奈良",
teacherName: "李琴", teacherName: "李琴",
...@@ -97,12 +91,19 @@ export default { ...@@ -97,12 +91,19 @@ export default {
}, },
], ],
}, },
]; ],
});
let methods = {
openLayer() {
data.showLayer = true;
},
closeLayer() {
data.showLayer = false;
},
};
return { return {
showLayer, ...toRefs(data),
openLayer, ...methods,
closeLayer,
data,
}; };
}, },
onLoad() { onLoad() {
......
...@@ -70,6 +70,10 @@ ...@@ -70,6 +70,10 @@
flex-wrap: wrap; flex-wrap: wrap;
} }
.between{
justify-content: space-between;
}
.grow { .grow {
flex-grow: 1; flex-grow: 1;
} }
...@@ -88,3 +92,10 @@ ...@@ -88,3 +92,10 @@
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
overflow: hidden; overflow: hidden;
} }
.fixed_center{
display: fixed;
top: 50vh;
left: 50vw;
transform: translate(-50%,-50%);
z-index: 999;
}
\ No newline at end of file
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