Commit a07c74c6 authored by 罗超's avatar 罗超

1

parent 0c91ba88
......@@ -17,6 +17,7 @@
</view>
</view>
</view>
<van-toast id="van-toast" />
</div>
</template>
......
......@@ -49,6 +49,7 @@
</view>
</view>
</view>
<van-toast id="van-toast" />
</view>
</template>
......
......@@ -100,6 +100,7 @@
<Item :data="item" />
</view>
</view>
<van-toast id="van-toast" />
</view>
</template>
......
......@@ -30,6 +30,7 @@
</view>
</view>
</view>
<van-toast id="van-toast" />
</view>
</template>
......
......@@ -2,34 +2,41 @@
<view :style="{ 'padding-top': `${statusBarHeight}px` }">
<view style="height: 100rpx"></view>
<van-nav-bar fixed>
<template #left>
<van-icon name="cross" size="30rpx" @click="back" />
</template>
<template #left>
<van-icon name="cross" size="30rpx" @click="back" />
</template>
<template #title>
<view
class="flex"
style="justify-content: center"
@click="start"
>
<van-image
width="30rpx"
height="30rpx"
fit="cover"
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/clock.png"
style="margin-right: 10rpx"
<view class="flex" style="justify-content: center" @click="start">
<van-image
width="30rpx"
height="30rpx"
fit="cover"
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/clock.png"
style="margin-right: 10rpx"
/>
<van-count-down
:time="time"
: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
:time="time"
:auto-start="false"
class="flex flex_center_center"
ref="countdown"
<MultipleChoice
:paperData="item"
v-if="item.QuestionTypeKey === 'multiple'"
/>
</view>
</template>
</van-nav-bar>
<view class="exam-con">
<Sub1 />
<FillInTheBlanks />
</view>
<van-toast id="van-toast" />
</view>
</template>
......@@ -45,14 +52,19 @@ import {
onMounted,
} from "vue";
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 {
components: { Sub1 },
components: { SingleChoice, MultipleChoice, FillInTheBlanks },
setup(props, context) {
let { refs } = getCurrentInstance();
let data = reactive({
time: 2 * 60 * 60 * 1000,
statusBarHeight: 0,
msg: { PaperId: 30, Id: 11 },
peaperDetail: {},
});
let methods = {
jumpPage() {
......@@ -66,6 +78,13 @@ export default {
back() {
uni.navigateBack();
},
async getPaperDetail() {
let res = await getPaperDetail(data.msg);
console.log(74, res.Data);
if (res) {
data.peaperDetail = res.Data;
}
},
};
onMounted(() => {
getSystemInfo((res) => {
......@@ -77,7 +96,9 @@ export default {
...methods,
};
},
onLoad() {},
onLoad() {
this.getPaperDetail();
},
};
</script>
......
......@@ -50,6 +50,7 @@
<Loadmore :state="pageState" />
</scroll-view>
</view>
<van-toast id="van-toast" />
</view>
</template>
......
<template>
<view class="">
<van-nav-bar>
<van-icon slot="left" name="cross" size="50rpx" @click="back" />
</van-nav-bar>
<view class="top">
登录
<van-image width="193rpx" height="242rpx" fit="cover" class="yuqi"
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/yuqi.png" />
</view>
<view class="main">
<van-cell-group>
<van-field :value="Account" clearable placeholder="请输入用户名" clearable @input="usernameInput">
<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>
<view class="">
<van-nav-bar>
<van-icon slot="left" name="cross" size="50rpx" @click="back" />
</van-nav-bar>
<view class="top">
登录
<van-image
width="193rpx"
height="242rpx"
fit="cover"
class="yuqi"
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/yuqi.png"
/>
</view>
<view class="main">
<van-cell-group>
<van-field
:value="Account"
clearable
placeholder="请输入用户名"
clearable
@input="usernameInput"
>
<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>
<script>
import {
ref,
reactive,
toRefs,
toRef,
getCurrentInstance,
watch,
computed,
onMounted,
inject,
} from "vue";
// import Toast from "../../wxcomponents/vant/toast/toast";
import {
login
} from "../../api/index";
export default {
setup(props, context) {
let Toast = inject("$toast");
let msg = reactive({
Account: "18981921485",
Password: "123456",
});
let methods = {
usernameInput(val) {
msg.Account = val.detail;
},
passwordInput(val) {
msg.Password = val.detail;
},
back() {
uni.navigateBack();
},
jumpPage() {
uni.navigateTo({
url: "/pages/index/index",
});
clearTimeout();
},
authLogin() {
// that.getUserProfile();
},
// getUserProfile() {
// //新的获取用户资料
// wx.getUserProfile({
// desc: "用于完善资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
// success: (info) => {
// console.log(83, info);
// 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);
// that.getunionid(_res.code);
// },
// fail: () => {
// uni.showToast({
// title: "微信登录授权失败",
// icon: "none",
// });
// },
// });
// } else {
// uni.showToast({
// title: "请先安装微信或升级版本",
// icon: "none",
// });
// }
// },
// });
// },
async login() {
let res = await login(msg);
if (res) {
res.Data.Account = msg.Account;
uni.setStorageSync("userInfo", res.Data);
Toast.success("登录成功");
setTimeout(() => {
that.jumpPage();
}, 1000);
}
},
// getunionid(code) {
// let appid = "wxaa108410092fd276";
// let secret = "31cd99f321612f95b0006905032de7f0";
// uni.request({
// url: `https://api.weixin.qq.com/sns/jscode2session?appid=${appid}&secret=${secret}&js_code=${code}&grant_type=authorization_code`,
// success: (res) => {
// console.log(150, res);
// },
// fail: (err) => {
// console.log(154, err);
// },
// });
// },
};
onMounted(() => {});
let that = methods;
return {
...toRefs(msg),
...methods,
};
},
};
import {
ref,
reactive,
toRefs,
toRef,
getCurrentInstance,
watch,
computed,
onMounted,
inject,
} from "vue";
// import Toast from "../../wxcomponents/vant/toast/toast";
import { login } from "../../api/index";
export default {
setup(props, context) {
let Toast = inject("$toast");
let msg = reactive({
Account: "18981921485",
Password: "123456",
});
let methods = {
usernameInput(val) {
msg.Account = val.detail;
},
passwordInput(val) {
msg.Password = val.detail;
},
back() {
uni.navigateBack();
},
jumpPage() {
uni.navigateTo({
url: "/pages/index/index",
});
clearTimeout();
},
authLogin() {
// that.getUserProfile();
},
// getUserProfile() {
// //新的获取用户资料
// wx.getUserProfile({
// desc: "用于完善资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
// success: (info) => {
// console.log(83, info);
// 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);
// that.getunionid(_res.code);
// },
// fail: () => {
// uni.showToast({
// title: "微信登录授权失败",
// icon: "none",
// });
// },
// });
// } else {
// uni.showToast({
// title: "请先安装微信或升级版本",
// icon: "none",
// });
// }
// },
// });
// },
async login() {
let res = await login(msg);
if (res) {
res.Data.Account = msg.Account;
uni.setStorageSync("userInfo", res.Data);
Toast.success("登录成功");
setTimeout(() => {
that.jumpPage();
}, 1000);
}
},
// getunionid(code) {
// let appid = "wxaa108410092fd276";
// let secret = "31cd99f321612f95b0006905032de7f0";
// uni.request({
// url: `https://api.weixin.qq.com/sns/jscode2session?appid=${appid}&secret=${secret}&js_code=${code}&grant_type=authorization_code`,
// success: (res) => {
// console.log(150, res);
// },
// fail: (err) => {
// console.log(154, err);
// },
// });
// },
};
onMounted(() => {});
let that = methods;
return {
...toRefs(msg),
...methods,
};
},
};
</script>
<style scoped>
.top {
height: 242rpx;
box-sizing: border-box;
padding-left: 40rpx;
padding-top: 70rpx;
font-size: 50rpx;
font-family: PingFang SC;
font-weight: bold;
color: #0f1b35;
position: relative;
margin-bottom: 20rpx;
}
.top {
height: 242rpx;
box-sizing: border-box;
padding-left: 40rpx;
padding-top: 70rpx;
font-size: 50rpx;
font-family: PingFang SC;
font-weight: bold;
color: #0f1b35;
position: relative;
margin-bottom: 20rpx;
}
.yuqi {
position: absolute;
top: 0;
right: 1rpx;
}
.yuqi {
position: absolute;
top: 0;
right: 1rpx;
}
.main {
height: 250rpx;
box-sizing: border-box;
padding: 0 40rpx;
margin-bottom: 165rpx;
}
.main {
height: 250rpx;
box-sizing: border-box;
padding: 0 40rpx;
margin-bottom: 165rpx;
}
/deep/.van-cell {
height: 124rpx;
padding-top: 50rpx;
}
/deep/.van-cell {
height: 124rpx;
padding-top: 50rpx;
}
/deep/.loginBtn {
width: 600rpx;
height: 90rpx;
background-color: #00acf9;
border-radius: 12rpx;
margin: 0 auto;
font-size: 32rpx;
font-family: PingFang SC;
font-weight: 500;
color: #ffffff;
}
/deep/.loginBtn {
width: 600rpx;
height: 90rpx;
background-color: #00acf9;
border-radius: 12rpx;
margin: 0 auto;
font-size: 32rpx;
font-family: PingFang SC;
font-weight: 500;
color: #ffffff;
}
.auth {
text-align: center;
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 500;
color: #00acf9;
margin-top: 30rpx;
}
.auth {
text-align: center;
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 500;
color: #00acf9;
margin-top: 30rpx;
}
.left-iconfont {
margin-right: 20rpx;
font-size: 30rpx;
color: #111111;
}
.left-iconfont {
margin-right: 20rpx;
font-size: 30rpx;
color: #111111;
}
</style>
......@@ -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