Commit a07c74c6 authored by 罗超's avatar 罗超

1

parent 0c91ba88
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
</view> </view>
</view> </view>
</view> </view>
<van-toast id="van-toast" />
</div> </div>
</template> </template>
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
</view> </view>
</view> </view>
</view> </view>
<van-toast id="van-toast" />
</view> </view>
</template> </template>
......
...@@ -100,6 +100,7 @@ ...@@ -100,6 +100,7 @@
<Item :data="item" /> <Item :data="item" />
</view> </view>
</view> </view>
<van-toast id="van-toast" />
</view> </view>
</template> </template>
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
</view> </view>
</view> </view>
</view> </view>
<van-toast id="van-toast" />
</view> </view>
</template> </template>
......
...@@ -2,34 +2,41 @@ ...@@ -2,34 +2,41 @@
<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>
<template #left> <template #left>
<van-icon name="cross" size="30rpx" @click="back" /> <van-icon name="cross" size="30rpx" @click="back" />
</template> </template>
<template #title> <template #title>
<view <view class="flex" style="justify-content: center" @click="start">
class="flex" <van-image
style="justify-content: center" width="30rpx"
@click="start" height="30rpx"
> fit="cover"
<van-image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/clock.png"
width="30rpx" style="margin-right: 10rpx"
height="30rpx" />
fit="cover" <van-count-down
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/clock.png" :time="time"
style="margin-right: 10rpx" :auto-start="false"
class="flex flex_center_center"
ref="countdown"
/>
</view>
</template>
</van-nav-bar>
<view class="exam-con">
<view v-for="(item, index) in peaperDetail.Paper.GroupList" :key="index">
<SingleChoice
:paperData="item"
v-if="item.QuestionTypeKey === 'single'"
/> />
<van-count-down <MultipleChoice
:time="time" :paperData="item"
:auto-start="false" v-if="item.QuestionTypeKey === 'multiple'"
class="flex flex_center_center"
ref="countdown"
/> />
</view> </view>
</template> <FillInTheBlanks />
</van-nav-bar>
<view class="exam-con">
<Sub1 />
</view> </view>
<van-toast id="van-toast" />
</view> </view>
</template> </template>
...@@ -45,14 +52,19 @@ import { ...@@ -45,14 +52,19 @@ import {
onMounted, onMounted,
} from "vue"; } from "vue";
import { getSystemInfo } from "../../utils/index"; import { getSystemInfo } from "../../utils/index";
import Sub1 from "./subject1"; import { getPaperDetail } from "../../api/exam";
import SingleChoice from "../../components/subject/SingleChoice.vue";
import MultipleChoice from "../../components/subject/MultipleChoice.vue";
import FillInTheBlanks from "../../components/subject/FillInTheBlanks.vue";
export default { export default {
components: { Sub1 }, components: { SingleChoice, MultipleChoice, FillInTheBlanks },
setup(props, context) { setup(props, context) {
let { refs } = getCurrentInstance(); let { refs } = getCurrentInstance();
let data = reactive({ let data = reactive({
time: 2 * 60 * 60 * 1000, time: 2 * 60 * 60 * 1000,
statusBarHeight: 0, statusBarHeight: 0,
msg: { PaperId: 30, Id: 11 },
peaperDetail: {},
}); });
let methods = { let methods = {
jumpPage() { jumpPage() {
...@@ -66,6 +78,13 @@ export default { ...@@ -66,6 +78,13 @@ export default {
back() { back() {
uni.navigateBack(); uni.navigateBack();
}, },
async getPaperDetail() {
let res = await getPaperDetail(data.msg);
console.log(74, res.Data);
if (res) {
data.peaperDetail = res.Data;
}
},
}; };
onMounted(() => { onMounted(() => {
getSystemInfo((res) => { getSystemInfo((res) => {
...@@ -77,7 +96,9 @@ export default { ...@@ -77,7 +96,9 @@ export default {
...methods, ...methods,
}; };
}, },
onLoad() {}, onLoad() {
this.getPaperDetail();
},
}; };
</script> </script>
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
<Loadmore :state="pageState" /> <Loadmore :state="pageState" />
</scroll-view> </scroll-view>
</view> </view>
<van-toast id="van-toast" />
</view> </view>
</template> </template>
......
<template> <template>
<view class=""> <view class="">
<van-nav-bar> <van-nav-bar>
<van-icon slot="left" name="cross" size="50rpx" @click="back" /> <van-icon slot="left" name="cross" size="50rpx" @click="back" />
</van-nav-bar> </van-nav-bar>
<view class="top"> <view class="top">
登录 登录
<van-image width="193rpx" height="242rpx" fit="cover" class="yuqi" <van-image
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/yuqi.png" /> width="193rpx"
</view> height="242rpx"
<view class="main"> fit="cover"
<van-cell-group> class="yuqi"
<van-field :value="Account" clearable placeholder="请输入用户名" clearable @input="usernameInput"> src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/yuqi.png"
<i class="iconfont icon-user2 left-iconfont" slot="left-icon"></i> />
</van-field> </view>
<van-field :value="Password" password placeholder="请输入密码" clearable @input="passwordInput"> <view class="main">
<i class="iconfont icon-password left-iconfont" slot="left-icon"></i> <van-cell-group>
</van-field> <van-field
</van-cell-group> :value="Account"
</view> clearable
<van-button block custom-class="loginBtn" @click="login">登录</van-button> placeholder="请输入用户名"
<view class="auth" @click="authLogin"> 授权手机号一键登录 </view> clearable
<van-toast id="van-toast" /> @input="usernameInput"
</view> >
<i class="iconfont icon-user2 left-iconfont" slot="left-icon"></i>
</van-field>
<van-field
:value="Password"
password
placeholder="请输入密码"
clearable
@input="passwordInput"
>
<i class="iconfont icon-password left-iconfont" slot="left-icon"></i>
</van-field>
</van-cell-group>
</view>
<van-button block custom-class="loginBtn" @click="login">登录</van-button>
<view class="auth" @click="authLogin"> 授权手机号一键登录 </view>
<van-toast id="van-toast" />
</view>
</template> </template>
<script> <script>
import { import {
ref, ref,
reactive, reactive,
toRefs, toRefs,
toRef, toRef,
getCurrentInstance, getCurrentInstance,
watch, watch,
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 { import { login } from "../../api/index";
login export default {
} from "../../api/index"; setup(props, context) {
export default { let Toast = inject("$toast");
setup(props, context) { let msg = reactive({
let Toast = inject("$toast"); Account: "18981921485",
let msg = reactive({ Password: "123456",
Account: "18981921485", });
Password: "123456", let methods = {
}); usernameInput(val) {
let methods = { msg.Account = val.detail;
usernameInput(val) { },
msg.Account = val.detail; passwordInput(val) {
}, msg.Password = val.detail;
passwordInput(val) { },
msg.Password = val.detail; back() {
}, uni.navigateBack();
back() { },
uni.navigateBack(); jumpPage() {
}, uni.navigateTo({
jumpPage() { url: "/pages/index/index",
uni.navigateTo({ });
url: "/pages/index/index", clearTimeout();
}); },
clearTimeout(); authLogin() {
}, // that.getUserProfile();
authLogin() { },
// that.getUserProfile(); // getUserProfile() {
}, // //新的获取用户资料
// getUserProfile() { // wx.getUserProfile({
// //新的获取用户资料 // desc: "用于完善资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
// wx.getUserProfile({ // success: (info) => {
// desc: "用于完善资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 // console.log(83, info);
// success: (info) => { // that.getUserInfo(info);
// console.log(83, info); // },
// that.getUserInfo(info); // fail: () => {
// }, // uni.showToast({
// fail: () => { // title: "微信登录授权失败",
// uni.showToast({ // icon: "none",
// title: "微信登录授权失败", // });
// icon: "none", // },
// }); // });
// }, // },
// }); // getUserInfo(info) {
// }, // uni.getProvider({
// getUserInfo(info) { // service: "oauth",
// uni.getProvider({ // success: function (res) {
// service: "oauth", // if (~res.provider.indexOf("weixin")) {
// success: function (res) { // uni.login({
// if (~res.provider.indexOf("weixin")) { // provider: "weixin",
// uni.login({ // success: (_res) => {
// provider: "weixin", // console.log(107, _res);
// success: (_res) => { // that.getunionid(_res.code);
// console.log(107, _res); // },
// that.getunionid(_res.code); // fail: () => {
// }, // uni.showToast({
// fail: () => { // title: "微信登录授权失败",
// uni.showToast({ // icon: "none",
// title: "微信登录授权失败", // });
// icon: "none", // },
// }); // });
// }, // } else {
// }); // uni.showToast({
// } else { // title: "请先安装微信或升级版本",
// uni.showToast({ // icon: "none",
// title: "请先安装微信或升级版本", // });
// icon: "none", // }
// }); // },
// } // });
// }, // },
// }); async login() {
// }, let res = await login(msg);
async login() { if (res) {
let res = await login(msg); res.Data.Account = msg.Account;
if (res) { uni.setStorageSync("userInfo", res.Data);
res.Data.Account = msg.Account; Toast.success("登录成功");
uni.setStorageSync("userInfo", res.Data); setTimeout(() => {
Toast.success("登录成功"); that.jumpPage();
setTimeout(() => { }, 1000);
that.jumpPage(); }
}, 1000); },
} // getunionid(code) {
}, // let appid = "wxaa108410092fd276";
// getunionid(code) { // let secret = "31cd99f321612f95b0006905032de7f0";
// let appid = "wxaa108410092fd276"; // uni.request({
// let secret = "31cd99f321612f95b0006905032de7f0"; // url: `https://api.weixin.qq.com/sns/jscode2session?appid=${appid}&secret=${secret}&js_code=${code}&grant_type=authorization_code`,
// uni.request({ // success: (res) => {
// url: `https://api.weixin.qq.com/sns/jscode2session?appid=${appid}&secret=${secret}&js_code=${code}&grant_type=authorization_code`, // console.log(150, res);
// success: (res) => { // },
// console.log(150, res); // fail: (err) => {
// }, // console.log(154, err);
// fail: (err) => { // },
// console.log(154, err); // });
// }, // },
// }); };
// }, onMounted(() => {});
}; let that = methods;
onMounted(() => {}); return {
let that = methods; ...toRefs(msg),
return { ...methods,
...toRefs(msg), };
...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;
padding-top: 70rpx; padding-top: 70rpx;
font-size: 50rpx; font-size: 50rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: bold; font-weight: bold;
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;
border-radius: 12rpx; border-radius: 12rpx;
margin: 0 auto; margin: 0 auto;
font-size: 32rpx; font-size: 32rpx;
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>
...@@ -174,3 +174,35 @@ export function UploadFileToTencent(uploadConfig, fileFullPath, fileObj, success ...@@ -174,3 +174,35 @@ export function UploadFileToTencent(uploadConfig, fileFullPath, fileObj, success
// } // }
// }); // });
} }
// 数字转汉字
export let changeNumToHan = (num) => {
var arr1 = new Array('零', '一', '二', '三', '四', '五', '六', '七', '八', '九');
var arr2 = new Array('', '十', '百', '千', '万', '十', '百', '千', '亿', '十', '百', '千', '万', '十', '百', '千', '亿');//可继续追加更高位转换值
if (!num || isNaN(num)) {
return "零";
}
var english = num.toString().split("")
var result = "";
for (var i = 0; i < english.length; i++) {
var des_i = english.length - 1 - i;//倒序排列设值
result = arr2[i] + result;
var arr1_index = english[des_i];
result = arr1[arr1_index] + result;
}
//将【零千、零百】换成【零】 【十零】换成【十】
result = result.replace(/零(千|百|十)/g, '零').replace(/十零/g, '十');
//合并中间多个零为一个零
result = result.replace(/零+/g, '零');
//将【零亿】换成【亿】【零万】换成【万】
result = result.replace(/零亿/g, '亿').replace(/零万/g, '万');
//将【亿万】换成【亿】
result = result.replace(/亿万/g, '亿');
//移除末尾的零
result = result.replace(/零+$/, '')
//将【零一十】换成【零十】
//result = result.replace(/零一十/g, '零十');//貌似正规读法是零一十
//将【一十】换成【十】
result = result.replace(/^一十/g, '十')
return result;
}
\ 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