提交 4036d1a6 编写于 作者: 闲敲棋子丶's avatar 闲敲棋子丶

初步整理一下流程

上级 95c67a80
<script>
import store from './store/index.js';
import {plus_async} from './common/common.js'
export default {
onLaunch: function() {
uni.getSystemInfo({
//获取手机屏幕高度信息,让swiper的高度和手机屏幕一样高
success: function(res) {
store.dispatch('device/set_systemInfo', res);
}
});
// console.log('App Launch')
},
onShow: function() {
// console.log('App Show')
},
onHide: function() {
// console.log('App Hide')
}
};
import store from './store/index.js';
import {
plus_async
} from './common/common.js'
export default {
onLaunch: function() {
uni.getSystemInfo({
//获取手机屏幕高度信息,让swiper的高度和手机屏幕一样高
success: function(res) {
store.dispatch('device/set_systemInfo', res);
}
});
// console.log('App Launch')
},
onShow: function() {
// console.log('App Show')
},
onHide: function() {
// console.log('App Hide')
}
};
</script>
<style lang="scss">
@import 'colorui/main.css';
@import 'colorui/icon.css';
@import 'colorui/animation.css';
page {
background-color: #ebeee8;
}
@import 'colorui/main.css';
@import 'colorui/icon.css';
@import 'colorui/animation.css';
@import 'colorui/mobile_theme.scss';
page {
height: 100%;
background-color: #ebeee8;
}
image {
will-change: transform
}
/*每个页面公共css */
/*每个页面公共css */
</style>
import {request} from 'examination.js'
// export const
\ No newline at end of file
@mixin setBox($type, $suffix, $param, $isBar: 'default', $unit: !important) {
$m: (
'margin': 'default',
'margin-top': 't',
'margin-right': 'r',
'margin-bottom': 'b',
'margin-left': 'l'
);
$p: (
'padding': 'default',
'padding-top': 't',
'padding-right': 'r',
'padding-bottom': 'b',
'padding-left': 'l'
);
$border: (
'border': 'default',
'border-top': 't',
'border-right': 'r',
'border-bottom': 'b',
'border-left': 'l'
);
@if $type == 'm' {
@include changeStyle($m, $type, $suffix, $param, $isBar, $unit);
}
@if $type == 'p' {
@include changeStyle($p, $type, $suffix, $param, $isBar, $unit);
}
@if $type == 'border' {
@include changeStyle($border, $type, $suffix, $param, $isBar, $unit);
}
}
@mixin changeStyle($items, $type, $suffix, $param, $isBar, $unit) {
@each $key, $value in $items {
@if $value == 'default' {
.#{$type}-#{$suffix} {
#{$key}: $param #{$unit};
}
} @else {
@if $isBar == 'default' {
.#{$type}#{$value}-#{$suffix} {
#{$key}: $param #{$unit};
}
} @else {
.#{$type}-#{$value}-#{$suffix} {
#{$key}: $param #{$unit};
}
}
}
}
}
//第二种
::-webkit-scrollbar {
width: 0 !important;
height: 0 !important;
background: transparent;
display: none !important;
}
.height-fit {
height: fit-content;
}
.min-height-page {
min-height: 100vh;
}
.page-w {
width: 100vw;
}
.page-h {
height: 100vh;
}
.page-c-w {
width: 100%;
}
.page-c-h {
height: 100%;
}
.bs-border {
box-sizing: border-box;
}
// flex
.f-shrink {
flex-shrink: 0 !important;
}
.flex-1 {
flex: 1 !important;
}
.flex-2 {
flex: 2 !important;
}
.row {
display: flex !important;
flex-direction: row !important;
}
.row-r {
display: flex !important;
flex-direction: row-reverse !important;
}
.column {
display: flex !important;
flex-direction: column !important;
}
.column-r {
display: flex !important;
flex-direction: column-reverse !important;
}
.ai-c {
align-items: center !important;
}
.ai-e {
align-items: flex-end !important;
}
.ai-s {
align-items: flex-start !important;
}
.as-stretch {
align-self: stretch;
}
.as-c {
align-self: center !important;
}
.as-e {
align-self: flex-end !important;
}
.as-s {
align-self: flex-start !important;
}
.jc-c {
justify-content: center !important;
}
.jc-e {
justify-content: flex-end !important;
}
.jc-s {
justify-content: flex-start !important;
}
.jc-sb {
justify-content: space-between !important;
}
.jc-sa {
justify-content: space-around !important;
}
.wrap {
flex-wrap: wrap !important;
}
.nowrap {
flex-wrap: nowrap !important;
}
.wrap-r {
flex-wrap: wrap-reverse !important;
}
// 文本
.ta-l {
text-align: left !important;
}
.ta-c {
text-align: center !important;
}
.ta-r {
text-align: right !important;
}
.wb-all {
word-break: break-all !important;
}
// over
.over-a {
overflow: auto !important;
}
.over-h {
overflow: hidden !important;
}
.over-x-a {
overflow-x: auto !important;
}
.over-x-h {
overflow-x: hidden !important;
}
.over-y-a {
overflow-y: auto !important;
}
.over-y-h {
overflow-y: hidden !important;
}
// margin
@include setBox('m', 10, 10rpx);
@include setBox('m', 16, 16rpx);
@include setBox('m', 20, 20rpx);
@include setBox('m', 24, 24rpx);
@include setBox('m', 32, 32rpx);
@include setBox('m', 40, 40rpx);
// padding
@include setBox('p', 10, 10rpx);
@include setBox('p', 16, 16rpx);
@include setBox('p', 20, 20rpx);
@include setBox('p', 24, 24rpx);
@include setBox('p', 32, 32rpx);
@include setBox('p', 40, 40rpx);
// 文字
.fs-0 {
font-size: 0 !important;
}
.fs-1 {
font-size: $uni-font-size-sm !important;
}
.fs-2 {
font-size: $uni-font-size-base !important;
}
.fs-3 {
font-size: $uni-font-size-lg !important;
}
// 颜色
.fc-w {
color: #ffffff !important;
}
.fc-b {
color: #000 !important;
}
.fc-text {
color: $uni-text-color !important;
}
.fc-d {
color: $uni-text-color-disable !important;
}
.fc-p {
color: $uni-text-color-placeholder !important;
}
.fc-g {
color: $uni-text-color-grey !important;
}
.fc-sub {
color: #dbdbdb !important;
}
// 字体粗细
.fw-400 {
font-weight: 400 !important;
}
.fw-500 {
font-weight: 500 !important;
}
.fw-700 {
font-weight: 700 !important;
}
.fw-b {
font-weight: bolder !important;
}
.f-nowrap {
white-space: nowrap !important;
}
.f-ellipsis {
text-overflow: ellipsis;
}
// 背景颜色
.bg-trans {
background-color: transparent !important;
}
.bg-w {
background-color: #ffffff !important;
}
.bg-h {
background-color: #cbe2e4 !important;
}
.bg-g {
background-color: $uni-bg-color-grey !important;
}
.bg-sub {
background-color: #dbdbdb !important;
}
.bg-b {
background-color: #f7f7f7 !important;
}
.bg-yb {
background-color: #daf3ef !important;
}
// 状态颜色
.status-i {
color: $uni-color-primary !important;
}
.status-s {
color: $uni-color-success !important;
}
.status-w {
color: $uni-color-warning !important;
}
.status-e {
color: $uni-color-error !important;
}
.status-g-trans {
background-color: transparent !important;
}
.status-g-i {
background-color: $uni-color-primary !important;
}
.status-g-s {
background-color: $uni-color-success !important;
}
.status-g-w {
background-color: $uni-color-warning !important;
}
.status-g-e {
background-color: $uni-color-error !important;
}
// 边框
.border-c-w {
border-color: #ffffff !important;
}
.border-c-b {
border-color: #000000 !important;
}
.border-c-sub {
border-color: #dbdbdb !important;
}
@include setBox('border', 0, 0 solid $uni-border-color, 'false', '');
@include setBox('border', 1, 2rpx solid $uni-border-color, 'false', '');
@include setBox('border', 2, 4rpx solid $uni-border-color, 'false', '');
@include setBox('border', 3, 6rpx solid $uni-border-color, 'false', '');
.border-radius-circle {
border-radius: $uni-border-radius-circle;
}
.border-radius-0 {
border-radius: 0;
}
.border-radius-1 {
border-radius: $uni-border-radius-sm;
}
.border-radius-2 {
border-radius: $uni-border-radius-base;
}
.border-radius-3 {
border-radius: $uni-border-radius-lg;
}
// 禁用
.disabled {
opacity: $uni-opacity-disabled !important;
cursor: no-drop;
}
// 行高
.line-0 {
line-height: inherit !important;
}
.line-1 {
line-height: $uni-font-size-paragraph !important;
}
.line-2 {
line-height: $uni-font-size-subtitle !important;
}
.line-3 {
line-height: $uni-font-size-title !important;
}
// 鼠标
.cs-d {
cursor: default !important;
}
.cs-p {
cursor: pointer !important;
}
// 定位
.pos-r {
position: relative !important;
}
.pos-a {
position: absolute !important;
}
.pos-f {
position: fixed !important;
}
.t-red {
color: red!important;
}
.t-yellow {
color: rgb(255, 187, 91);
}
.t-main {
color: rgb(21, 131, 255);
}
.t-green {
color: rgb(4, 157, 0);
}
.t-orange {
color: rgb(234, 103, 23);
}
.t-blue {
color: rgb(21, 131, 255);
}
import {
HTTP_BASE_URL
DEFAULT_AUTH,
} from './setting.js'
import store from '../store/index.js'
uni.addInterceptor('request', {
invoke(args) {
// request 触发前拼接 url
args.url = HTTP_BASE_URL + args.url
args.url = store.getters.baseUrl + args.url
if (!args.data.hasOwnProperty('token')) {
args.data['token'] = DEFAULT_AUTH
}
},
success(args) {
// 请求成功后,修改code值为1
......@@ -22,3 +27,19 @@ uni.addInterceptor('request', {
// console.log('interceptor-complete', res)
}
})
/**
* 简单封装请求方式
*/
export const request = (options)=>{
return new Promise((resolve, reject) => {
uni.request({
...options,
success(res) {
resolve(res.data)
},
fail(err) {
reject(err)
}
})
})
}
/**
* 部分页面通用 获取原生方法传参
*/
export const initNativeCall = {
data() {
return {
ryid: '',
baseUrl: '',
}
},
async onLoad(e) {
if (e.ryid) {
this.ryid = e.ryid;
this.$store.dispatch('user/set_ryid', e.ryid)
}
if (e.baseUrl) {
this.baseUrl = e.baseUrl
this.$store.dispatch('user/set_base_url', e.baseUrl)
}
this.$nextTick(() => {
this._init()
})
},
methods: {
initHook() {
console.warn('--- 初始化 --- ');
}
},
}
import { format_time } from "./common"
// 请求接口基础路径
export const HTTP_BASE_URL = 'http://47.96.143.14:91'
// 默认token
export const DEFAULT_AUTH = format_time(Date.now(), 'yMd')
<template>
<view class="base-empty column page-c-w ai-c jc-c">
<image :src="require('../../static/empty.png')" v-bind="$attrs"></image>
<view class="bs-border pt-10 row ai-c jc-c">
<slot>
<view class="error_title">
{{text}}
</view>
</slot>
</view>
</view>
</template>
<script>
export default {
name: "base-empty",
props: {
text: {
type: String,
default: '暂 无 数 据'
}
},
data() {
return {
};
}
}
</script>
<style lang="scss" scoped>
.base-empty{
box-sizing: border-box;
padding: 10vh 0 0;
}
.error_title{
text-align: center;
display: flex;
align-items: center;
justify-content: center;
color: #303133;
font-weight: bolder;
font-size: 28rpx;
}
</style>
......@@ -7,6 +7,7 @@
<script>
export default {
name:"base-list",
props:{},
data() {
return {
......
......@@ -4,6 +4,10 @@ import './common/intercept_request.js'
// #ifndef VUE3
import Vue from 'vue'
import store from './store/index.js'
import ZPMixin from '@/uni_modules/z-paging/components/z-paging/js/z-paging-mixin'
Vue.mixin(ZPMixin)
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
......
......@@ -34,7 +34,8 @@
"style" :
{
"navigationBarTitleText": "安全考试",
"enablePullDownRefresh": false
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
......@@ -43,7 +44,8 @@
"style" :
{
"navigationBarTitleText": "题库练习",
"enablePullDownRefresh": false
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
......@@ -52,7 +54,8 @@
"style" :
{
"navigationBarTitleText": "错题记录",
"enablePullDownRefresh": false
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
......
<template>
<view class="subject_template_init">
<swiper :current="subjectIndex" class="swiper-box" @change="SwiperChange" :style="{ height: '100%' }">
<swiper-item v-for="(subject, index) in subjectList">
<swiper-item v-for="(subject, index) in subjectList" :key="index">
<view v-if="index - subjectIndex >= -1 && index - subjectIndex <= 1">
<view class="cu-bar bg-white solid-bottom">
<view class="action text-black">
......
......@@ -32,12 +32,14 @@ import footTab from './components/foot_tab.vue';
import subjectTemplate from './components/subject_template.vue';
import { get_examination_subject, start_examination, submit_examination_subject, get_subject_android, submit_test_android } from '../../api/examination';
import { format_time } from '../../common/common';
import { initNativeCall } from '../../common/mixins';
export default {
components: {
questionsSheet,
footTab,
subjectTemplate
},
mixins:[initNativeCall],
computed: {
show_totalTime() {
return this.examination_params['totalTime'] ? format_time('H:m:s', this.examination_params['totalTime']) : '';
......@@ -49,7 +51,6 @@ export default {
userFavor: false, //是否已收藏
currentType: 0, //当前题型
subjectIndex: 0, //跳转索引
title: '安全考试',
subjectList: [],
examination_params: {
totalTime: '',
......@@ -63,9 +64,6 @@ export default {
};
},
async onLoad(e) {
uni.setNavigationBarTitle({
title: this.title
});
//添加用户显示答案字段
// for (let i = 0; i < this.subjectList.length; i++) {
......
......@@ -55,7 +55,7 @@
</view>
<form>
<swiper :current="subjectIndex" class="swiper-box" @change="SwiperChange" :style="{'height':swiperHeight}">
<swiper-item v-for="(subject,index) in subjectList">
<swiper-item v-for="(subject,index) in subjectList" :key="index">
<view v-if="index-subjectIndex>=-1&&index-subjectIndex<=1">
......
<template>
<view>
<view class="init_practice p-16 bs-border">
<z-paging ref="paging" show-refresher-update-time use-page-scroll refresher-update-time-key='practice'
v-model="dataList" @query="queryList">
<view class="list_box" @click="itemClick">
</view>
</z-paging>
</view>
</template>
<script>
import {
initNativeCall
} from '../../common/mixins';
export default {
mixins: [initNativeCall],
data() {
return {
dataList: [],
firstLoaded: false,
};
},
methods: {
queryList(pageNo, pageSize) {
// if (!this.firstLoaded) {
// uni.showLoading({
// mask: false
// });
// }
// //组件加载时会自动触发此方法,因此默认页面加载时会自动触发,无需手动调用
// //这里的pageNo和pageSize会自动计算好,直接传给服务器即可
// //模拟请求服务器获取分页数据,请替换成自己的网络请求
// const params = {
// pageNo: pageNo,
// pageSize: pageSize,
// type: this.tabIndex + 1
// };
// get_job_order_accept_list_no({
// ryid: this.ryid, //登录人员id
// deptid: this.deptid //登录人员部门id
// })
// .then(res => {
// if (res['code'] == '1') {
// this.$refs.paging.setLocalPaging(res.data);
// } else {
// this.$refs.paging.setLocalPaging([]);
// }
// if (!this.firstLoaded) {
// uni.hideLoading();
// }
// })
// .catch(err => {
// this.$refs.paging.setLocalPaging([]);
// if (!this.firstLoaded) {
// uni.hideLoading();
// }
// });
},
itemClick(e) {
if (!e.target.dataset.hasOwnProperty('index')) return;
edit_to_page(
`/pages/job_order_accept/job_order_accept?id=${this.dataList[e.target.dataset.index]['id']}&mode=edit`,
res => {
this.$refs.paging.refresh();
});
}
}
}
</script>
<style scoped lang="scss">
.init_practice {
min-height: 100%;
}
</style>
<template>
<view class="record_init">
<view
class="record_item"
v-for="(item, index) in record"
:key="index"
:class="{
<view class="record_item" v-for="(item, index) in record" :key="index" :class="{
record_item_divider: index != record.length - 1
}"
>
}">
<view class="record_index">{{ index + 1 }}次考试:</view>
<view class="record_title">开始时间:{{ item['kssj'] }}</view>
<view class="record_title">结束时间:{{ item['jssj'] }}</view>
<view class="record_title">考试成绩:{{ item['kscj'] }}</view>
</view>
<view v-if="!record || record.length == 0" class="record_error">
暂 无 数 据
</view>
<base-empty v-if="!record || record.length == 0" class="record_error"></base-empty>
</view>
</template>
<script>
import { get_examination_record, get_record_android } from '../../api/examination.js';
export default {
data() {
return {
id: '',
record: []
};
},
onLoad(e) {
if (e.ryid) {
this.id = e.ryid;
// get_examination_record(e.ryid).then(res => {
// this.record = res
// });
}
// this.record = [
// {
// kssj: '09/28 14:00',
// jssj: '09/28 14:00',
// kscj: '100'
// },
// {
// kssj: '09/28 14:00',
// jssj: '09/28 14:00',
// kscj: '100'
// },
// ];
try {
get_record_android().then(res => {
this.record = res;
});
} catch (err) {
console.error(err, ' --- 提交试卷');
} finally {
uni.hideLoading();
import {
get_examination_record,
get_record_android
} from '../../api/examination.js';
export default {
data() {
return {
id: '',
record: []
};
},
onLoad(e) {
if (e.ryid) {
this.id = e.ryid;
// get_examination_record(e.ryid).then(res => {
// this.record = res
// });
}
// this.record = [
// {
// kssj: '09/28 14:00',
// jssj: '09/28 14:00',
// kscj: '100'
// },
// {
// kssj: '09/28 14:00',
// jssj: '09/28 14:00',
// kscj: '100'
// },
// ];
try {
get_record_android().then(res => {
this.record = res;
});
} catch (err) {
console.error(err, ' --- 提交试卷');
} finally {
uni.hideLoading();
}
}
}
};
};
</script>
<style scoped lang="scss">
.record_init {
box-sizing: border-box;
padding: 20rpx;
color: #303133;
min-height: 100vh;
background-color: #ebeee8;
.record_item {
.record_init {
box-sizing: border-box;
padding: 20rpx;
background-color: #fff;
border-radius: 20rpx;
}
color: #303133;
min-height: 100vh;
background-color: #ebeee8;
.record_item_divider {
// border-bottom: 2rpx solid #9aa7b1;
margin-bottom: 30rpx;
}
.record_item {
box-sizing: border-box;
padding: 20rpx;
background-color: #fff;
border-radius: 20rpx;
}
.record_index {
position: relative;
box-sizing: border-box;
padding: 20rpx 20rpx 20rpx 30rpx;
font-weight: bolder;
// background: linear-gradient(135deg, #2afadf, #4c83ff);
margin-bottom: 30rpx;
border-bottom: 2rpx solid #f8f8f8;
&:before {
content: '';
position: absolute;
top: 50%;
left: 0;
background-color: #47d088;
width: 20rpx;
height: 20rpx;
border-radius: 50%;
transform: translateY(-50%);
.record_item_divider {
// border-bottom: 2rpx solid #9aa7b1;
margin-bottom: 30rpx;
}
}
.record_title {
display: flex;
align-items: center;
margin-bottom: 20rpx;
}
.record_index {
position: relative;
box-sizing: border-box;
padding: 20rpx 20rpx 20rpx 30rpx;
font-weight: bolder;
// background: linear-gradient(135deg, #2afadf, #4c83ff);
margin-bottom: 30rpx;
border-bottom: 2rpx solid #f8f8f8;
.record_context {
margin-top: 15rpx;
text-indent: 2em;
width: 100%;
word-break: break-all;
display: flex;
flex-wrap: wrap;
align-items: center;
}
.record_error{
box-sizing: border-box;
padding: 10vh 0 0;
display: flex;
align-items: center;
justify-content: center;
color: #303133;
font-weight: bolder;
font-size: 24rpx;
}
.record_box {
display: flex;
align-items: flex-start;
margin-bottom: 20rpx;
}
.record_flex {
flex: 1;
display: flex;
align-items: center;
flex-wrap: wrap;
align-self: stretch;
word-break: break-all;
}
.record_shrink {
flex-shrink: 0;
}
&:before {
content: '';
position: absolute;
top: 50%;
left: 0;
background-color: #47d088;
width: 20rpx;
height: 20rpx;
border-radius: 50%;
transform: translateY(-50%);
}
}
.answer {
font-weight: bolder;
color: #4c8045;
}
.record_title {
display: flex;
align-items: center;
margin-bottom: 20rpx;
}
.answer_error {
color: #c12c1f;
.record_context {
margin-top: 15rpx;
text-indent: 2em;
width: 100%;
word-break: break-all;
display: flex;
flex-wrap: wrap;
align-items: center;
}
.record_error {
box-sizing: border-box;
padding: 10vh 0 0;
display: flex;
align-items: center;
justify-content: center;
color: #303133;
font-weight: bolder;
font-size: 24rpx;
}
.record_box {
display: flex;
align-items: flex-start;
margin-bottom: 20rpx;
}
.record_flex {
flex: 1;
display: flex;
align-items: center;
flex-wrap: wrap;
align-self: stretch;
word-break: break-all;
}
.record_shrink {
flex-shrink: 0;
}
.answer {
font-weight: bolder;
color: #4c8045;
}
.answer_error {
color: #c12c1f;
}
}
}
</style>
export default {
systemInfo:state=>state.device.systemInfo
systemInfo:state=>state.device.systemInfo,
baseUrl:state=>state.user.baseUrl,
ryid:state=>state.user.ryid,
}
\ No newline at end of file
import { HTTP_BASE_URL } from "../../common/setting"
export default {
namespaced: true,
state: () => ({
baseUrl:HTTP_BASE_URL,
ryid:'',
}),
mutations: {
SET_BASE_URL(state,url){
state.baseUrl = url
},
SET_RYID(state,id){
state.ryid = id
},
},
actions: {
set_base_url({
commit
}, url) {
commit('SET_BASE_URL', url)
},
set_ryid({
commit
}, id){
commit('SET_RYID', url)
},
},
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册