Commit 45422886 authored by Morson's avatar Morson

Merge branch 'master' of https://git.banshouhui.com/lijundan/self-support

# Conflicts:
#	src/common/api/order.js
parents ce18827b 95ef590c
......@@ -5,17 +5,14 @@ const formType = {'content-type': 'application/x-www-form-urlencoded'}
let orderApiFun = function(vm){
// 接口公共前缀
const prefix = '/wxh-worker-rest/rest/'
let prefix2 = '/wxh-worker-rest/rest/' + vm.vuex_token
let order = '/wxh-worker-rest/rest/order/'
let settle = '/wxh-worker-rest/rest/settle/' + vm.vuex_token
let token = vm.vuex_token
let settle = '/wxh-worker-rest/rest/settle/'
let listByRecommendOrder = async (params = {}) => await vm.$u.get('/wxh-worker-rest/rest/recommend/order', params);
/**
* 工单数量查询接口
*/
let listOrderCount = async (params = {}) => await vm.$u.get(prefix2 + '/wokerOrder/queryOrdersCount/V2', params);
let listOrderCount = async (params = {}) => await vm.$u.get(prefix + vm.vuex_token + '/wokerOrder/queryOrdersCount/V2', params);
/**
* 工单列表接口
......@@ -25,7 +22,7 @@ let orderApiFun = function(vm){
/**
* 获取师傅的预约日历
*/
let workerCalendar = async (params = {}) => await vm.$u.get(prefix2 + '/wokerOrder/appointment/calendar', params);
let workerCalendar = async (params = {}) => await vm.$u.get(prefix + vm.vuex_token + '/wokerOrder/appointment/calendar', params);
/**
* 师傅预约
......@@ -37,7 +34,7 @@ let orderApiFun = function(vm){
/**
* 师傅签到接口
*/
let maintainWorkerCheckin = async (params = {},orderId) => await vm.$u.post(prefix2 + '/order/'+orderId+'/maintainWorkerCheckin', params,formType);
let maintainWorkerCheckin = async (params = {},orderId) => await vm.$u.post(prefix + vm.vuex_token + '/order/'+orderId+'/maintainWorkerCheckin', params,formType);
/**
* 订单详情查询
*/
......@@ -50,7 +47,7 @@ let orderApiFun = function(vm){
let traceAndAppointment = async (params = {}, orderId) => await vm.$u.post('/wxh-worker-rest/rest/order/traceAndAppointment/trace/V2/' + vm.vuex_token + `/`+orderId, params)
/* 师傅拒单 */
let rejectOrder = async (params = {}, orderId) => await vm.$u.get(prefix2 + `/order/${orderId}/workerReject/V2`, params)
let rejectOrder = async (params = {}, orderId) => await vm.$u.get(prefix + vm.vuex_token + `/order/${orderId}/workerReject/V2`, params)
/**
......@@ -61,7 +58,7 @@ let orderApiFun = function(vm){
/**
* 接单
*/
let orderAccept = async (params = {},orderId) => await vm.$u.post(prefix2+'/order/'+orderId+'/accept', params, formType);
let orderAccept = async (params = {},orderId) => await vm.$u.post(prefix + vm.vuex_token+'/order/'+orderId+'/accept', params, formType);
/**
* 抢单
......@@ -71,31 +68,31 @@ let orderApiFun = function(vm){
/**
* 获取拍照标准
*/
let orderStandard = async (params = {}) => await vm.$u.get(prefix2+'/photo/standard', params);
let orderStandard = async (params = {}) => await vm.$u.get(prefix + vm.vuex_token+'/photo/standard', params);
/**
* 获取拍照标准单独项目
*/
let orderStandardItem = async (params = {}) => await vm.$u.get(prefix2+'/photo/standard/only', params);
let orderStandardItem = async (params = {}) => await vm.$u.get(prefix + vm.vuex_token+'/photo/standard/only', params);
/**
* 保存图片信息
*/
let saveImage = async (params = {},orderId) => await vm.$u.post(prefix2 + '/order/'+orderId+'/maintain/saveImage', params);
let saveImage = async (params = {},orderId) => await vm.$u.post(prefix + vm.vuex_token + '/order/'+orderId+'/maintain/saveImage', params);
/**
* 获取师傅水印 or 默认水印
*/
let getWatermark = async (params = {}) => await vm.$u.get(prefix2 + '/photo/watermark', params);
let getWatermark = async (params = {}) => await vm.$u.get(prefix + vm.vuex_token + '/photo/watermark', params);
/**
* 保存师傅水印
*/
let saveWatermark = async (params = {}) => await vm.$u.post(prefix2 + '/photo/watermark', params);
let saveWatermark = async (params = {}) => await vm.$u.post(prefix + vm.vuex_token + '/photo/watermark', params);
/**
* 获取师傅开放可选时间段
*/
let openTimerange = async (params = {}) => await vm.$u.get(prefix2 + '/wokerOrder/appointment/timerange', params);
let openTimerange = async (params = {}) => await vm.$u.get(prefix + vm.vuex_token + '/wokerOrder/appointment/timerange', params);
/**
* 联系时间接口
......@@ -116,7 +113,7 @@ let orderApiFun = function(vm){
/**
* 获取订单的完工项目(配置+数据)
*/
let getCompleteConfigAndData= async (orderId) => await vm.$u.get(prefix2+'/order/'+ orderId +'/maintain/info');
let getCompleteConfigAndData= async (orderId) => await vm.$u.get(prefix + vm.vuex_token+'/order/'+ orderId +'/maintain/info');
/**
* 查询措施
......@@ -131,16 +128,16 @@ let orderApiFun = function(vm){
/**
* 保存售后记录
*/
let saveCompleteData = async (params = {},orderId) => await vm.$u.post(prefix2+'/order/'+ orderId +'/maintain/saveMaintainInfoV2', params);
let saveCompleteData = async (params = {},orderId) => await vm.$u.post(prefix + vm.vuex_token+'/order/'+ orderId +'/maintain/saveMaintainInfoV2', params);
/**
* 保内工单完工
*/
let inOrderFinish = async (orderId) => await vm.$u.post(prefix2+'/order/'+ orderId +'/finishedAndConfirm',{}, formType);
let inOrderFinish = async (orderId) => await vm.$u.post(prefix + vm.vuex_token+'/order/'+ orderId +'/finishedAndConfirm',{}, formType);
/**
* 保外工单完工
*/
let outOrderFinish = async (params = {},orderId) => await vm.$u.post(prefix2+'/order/'+ orderId +'/v1/finishedAndConfirmOutGuaranteePeriod', params, formType);
let outOrderFinish = async (params = {},orderId) => await vm.$u.post(prefix + vm.vuex_token+'/order/'+ orderId +'/v1/finishedAndConfirmOutGuaranteePeriod', params, formType);
/**
......@@ -151,21 +148,21 @@ let orderApiFun = function(vm){
/**
* 我的库存明细(物料)
*/
let listBystock= async () => await vm.$u.get(prefix2 +'/myinfo/stock', {}, jsonType);
let listBystock= async () => await vm.$u.get(prefix + vm.vuex_token +'/myinfo/stock', {}, jsonType);
/**
* 我的出入库流水
*/
let listAccessHistory= async (params = {}) => await vm.$u.get(prefix2 +'/myinfo/access/history', params, jsonType);
let listAccessHistory= async (params = {}) => await vm.$u.get(prefix + vm.vuex_token +'/myinfo/access/history', params, jsonType);
// 获取我的钱包-资产信息
let getAssets = async (params = {}) => await vm.$u.get(settle + '/v2/total', params);
// 获取我的钱包-师傅提现
let workerApplyPay = async (payableId) => await vm.$u.post(`/wxh-worker-rest/rest/${token}/applypay/${payableId}/workerApplyPay`);
// 获取我的钱包-结算账单
let payableRecord = async (params = {}) => await vm.$u.post(settle + '/payable/v2/queryPayableRecord', params, formType);
let getAssets = async (params = {}) => await vm.$u.get(settle + vm.vuex_token + '/v2/total', params);
// 获取我的钱包-收入流水
let listStatement = async (params = {}) => await vm.$u.get(settle + '/v2/statement', params);
let listStatement = async (params = {}) => await vm.$u.get(settle + vm.vuex_token + '/v2/statement', params);
// 获取我的钱包-支付单一览
let payableRecord = async (params = {}) => await vm.$u.get(settle + vm.vuex_token + '/payable/v2/queryPayableRecord', params);
// 获取我的钱包-师傅提现
let workerApplyPay = async (payableId) => await vm.$u.post(`/wxh-worker-rest/rest/${vm.vuex_token}/applypay/${payableId}/workerApplyPay`);
const orderApi = {
listByRecommendOrder,
listOrderCount,
......
......@@ -17,6 +17,16 @@
type: String,
default: '请输入'
},
item: {
type: Object,
default() {
return {}
}
},
type: {
type: String,
default: 'text'
}
// width: { // 例如:454rpx
// type: String,
// default: '100%'
......@@ -24,32 +34,36 @@
},
data() {
return {
maxlength: 140,
inputType: 'text',
// type: 'text'
}
},
computed: {
type() {
if (this.item) {
let ty = this.item.fieldsType.toLocaleLowerCase()
switch (ty) {
case 'text':
return 'textarea'
case 'password':
return this.item.fieldsType
case 'decimal':
case 'number':
case 'double':
case 'integer':
this.maxlength = 9
return 'digit'
case 'textarea':
default:
return 'text'
}
} else {
return 'text'
}
// type() {
// if (this.item) {
// let ty = this.item.fieldsType.toLocaleLowerCase()
// switch (ty) {
// case 'text':
// return 'textarea'
// case 'password':
// return this.item.fieldsType
// case 'decimal':
// case 'number':
// case 'double':
// case 'integer':
// this.maxlength = 9
// return 'digit'
// case 'textarea':
// default:
// return 'text'
// }
// } else {
// return 'text'
// }
// },
maxlength() {
return this.type == 'digit' ? 9 : 140
},
fieldsWidth() {
return this.item.fieldsWidth ? (this.item.fieldsWidth + 'rpx') : '100%'
......@@ -71,7 +85,7 @@
return this.textarea
},
textarea() {
return this.type == 'textarea'
return this.inputType == 'textarea'
},
backgroundColor() {
return this.textarea ? 'transparent' : '#F4F5F7'
......
......@@ -3,7 +3,7 @@
<view>
<view class="list u-flex u-row-between">
<image class="item-image" :src="mixingImage" v-if="item.required"></image>
<view class="u-m-r-20">{{item.fieldsTitle}}</view>
<view class="u-m-r-20 title-text">{{item.fieldsTitle}}</view>
<view class="u-flex-1 location-name" >{{valueTxt}}</view>
</view>
</view>
......@@ -55,13 +55,18 @@
line-height: 40rpx;
color: #fa3534;
}
.title-text {
font-size: 26rpx;
color: #333333;
}
.item-image {
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
}
.location-name {
color: #2272FF;
color: #333333;
font-size: 26rpx;
text-align: right;
}
.location {
......
<!-- ******************* 输入框 ******************* -->
<template>
<view>
<view class="list u-flex u-row-between">
<image class="item-image" :src="mixingImage" v-if="item.required"></image>
<view class="u-m-r-20">{{item.fieldsTitle}}</view>
<view class="u-flex-1 location-name" @click="toMaterialPage">
<u-icon name="map" color="#2979ff" size="30"></u-icon>请选择
<view class="list u-flex item-row-between">
<view class="item-title">
<image class="item-image" :src="mixingImage" v-if="item.required"></image>
<view class="u-m-r-20">{{item.fieldsTitle}}</view>
</view>
<view class="location-name" @click="toMaterialPage">
<text class="arrow-text">{{arrowText}}</text>
<u-icon name="arrow-right" color="#2979ff" size="30"></u-icon>
</view>
</view>
<!-- <view class="u-flex-1 location">{{valueTxt || '正在获取中...'}}</view> -->
......@@ -36,6 +39,9 @@
computed: {
mixingImage() {
return process.uniEnv.qn_base_url + 'mixing.png'
},
arrowText() {
return false ? '已选择' : '请选择'
}
},
watch: {},
......@@ -57,7 +63,7 @@
}
</script>
<style scoped>
<style lang="scss" scoped>
.required {
padding-right: 10rpx;
font-size: 28rpx;
......@@ -69,10 +75,29 @@
height: 24rpx;
margin-right: 10rpx;
}
.location-name {
color: #2272FF;
text-align: right;
.item-row-between {
display: flex;
align-items: center;
justify-content: space-between;
.item-title {
display: flex;
font-size: 26rpx;
color: #333333;
align-items: center;
}
.location-name {
color: #2272FF;
text-align: right;
font-size: 26rpx;
display: flex;
align-items: center;
.arrow-text {
margin-right: 6rpx;
}
}
}
.location {
background: #F4F5F7;
padding: 10rpx 20rpx;
......
......@@ -27,7 +27,7 @@
<view class="line-view"></view>
<view class="reason-view" v-if="showReason">
<view><text class="reason-title">未通过原因:</text></view>
<view class="reason-title"><text>未通过原因:</text></view>
<view class="reason-text"><text v-for="(item, index) in orderData.auditResults" :key="index">{{item}}</text></view>
</view>
<view class="bottom-view">
......
<template>
<view>
<view class="topView" :style="{'height':navHeight/2 + 'px'}"></view>
<view class="contentView">
<!-- <u-image class="pic" :src="files[0]" bg-color="transparent" @click="showPreviewFn"></u-image> -->
<image class="pic" :src="files[0]" v-lazy mode="aspectFit" @click="showPreviewFn"></image>
......@@ -29,12 +30,13 @@
keys: [],
token: '',
product: '',
allImages: []
allImages: [],
navHeight: 130
}
},
created(e) {
// 获取照片选项对象
console.log(getApp().globalData.photo.currentItem)
this.navHeight = getApp().globalData.navHeight
const product = app.globalData.photo.product
this.product = `?brandId=${product.brandId}&brand=${product.brandName}&classifyId=${product.classifyId}&systemId=${product.systemId}`
if(app.globalData.photo.currentItem) {
......@@ -73,17 +75,7 @@
})
}
}
// if(photo.currentItem){
// photo.currentItem.imageList.unshift(photo.tempPath.mixWater)
// }
// if(photo.productList && photo.productList[photo.topIndex]){
// const topArr = photo.productList[photo.topIndex]
// if(topArr[photo.itemIndex]){
// topArr[photo.itemIndex].imageList.push(photo.tempPath.mixWater)
// }
// }
// photo.
if(photo.tempPath.mixWater){
// 保存水印处理图片到本地
path = photo.tempPath.mixWater
......@@ -122,6 +114,7 @@
},
finishPhoto(){
const photo = getApp().globalData.photo
if (photo.currentItemLength === 10) return
photo.currentItemLength = 10
this.continuePhoto()
// 完成本项
......@@ -149,29 +142,18 @@
}else{
this.$emit('finish')
}
},
downloadImages() {
let self = this;
for (let url of this.images) {
uni.downloadFile({
url: url, //仅为示例,并非真实的资源
success(res) {
// 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
if (res.statusCode === 200) {
self.files.push(res.tempFilePath)
}
},
fail(e) {
}
})
}
},
}
}
}
</script>
<style lang="scss">
.topView {
background: #000;
width: 100%;
position: fixed;
top: 0;
}
.contentView {
background-color: #333333;
/* padding-top: 120rpx; */
......@@ -181,7 +163,7 @@
flex-direction: column;
}
/deep/ .u-image{
height:100%!important;
height:100% !important;
}
/deep/ .u-image__loading{
background-color: transparent!important;
......@@ -192,8 +174,8 @@
.pic {
flex:1;
width: 100%;
/* height:auto */
height: 100%;
// height:auto;
/* height: 760rpx; */
}
......
......@@ -265,6 +265,7 @@
top: 0;
left: 0;
width: 100%;
height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
......
......@@ -88,7 +88,7 @@
markImage: 'https://qn-static.banshouhui.com/live_mark.png'
},
tempImgs: {
'markImage': '', // 拍照水印
'markImage': 'https://qn-static.banshouhui.com/live_mark.png', // 拍照水印
'origin': '', // 无水印照片
'mixWater': '', // 有水印照片
},
......@@ -206,10 +206,6 @@
},
updateTime() {
this.waterInfo.date = this.getTime()
// let timer = setTimeout(() => {
// clearTimeout(timer);
// this.updateTime()
// }, 1000)
},
setCameraInfo(type) {
// 设置相机前置后置、闪关灯等
......@@ -261,7 +257,6 @@
const {
errMsg
} = e.detail
// console.log(e.detail, 'e.detail')
if (errMsg !== 'insertCamera:fail auth deny') {
return
}
......@@ -431,10 +426,10 @@
}
canvas.fillText(title.substr(0, 14), 10, canvasHeight - txtHeight * h++ - titleHeight / 2 + 10);
}
if (this.waterSetting && this.waterSetting.mid_text) {
// if (this.waterSetting && this.waterSetting.mid_text) {
//加入 水印图片
canvas.drawImage(this.tempImgs.markImage, canvasWidth / 2 - 100, canvasHeight / 2 - 25, 200, 50)
}
// }
// canvas.drawImage(this.tempImgs.markImage, canvasWidth / 2 - 100, canvasHeight / 2 - 25, 200, 50)
canvas.draw(false,
setTimeout(() => {
......
......@@ -94,14 +94,14 @@
"path": "news-details",
"style": {
"navigationBarTitleText": "",
"navigationStyle":"default"
"navigationStyle":"custom"
}
},
{
"path":"section",
"style" :{
"navigationBarTitleText": "",
"navigationStyle":"default"
"navigationStyle":"custom"
}
},
{
......@@ -221,6 +221,13 @@
}
},
{
"path":"contract/out",
"style":{
"navigationBarTitleText":""
}
},
{
"path": "customer/index",
"style": {
"navigationStyle":"custom",
......
......@@ -53,7 +53,7 @@
</view>
<view class="bottomRightView">
<view :class="isSelect ? 'nextBtn selectBackColor' : 'nextBtn defaultBackColor' "
@click="handleClick()">
@click="$u.throttle(handleClick, 500)">
<text class="bottomTitle">{{bottomTitle}}</text>
</view>
</view>
......
......@@ -23,7 +23,10 @@
</scroll-view>
</swiper-item>
<swiper-item @touchmove.stop.prevent="stopTouchMove" v-show="current == 1">
<scroll-view scroll-y style="height:100%;width:100%;" @scrolltolower="onreachBottom">
<scroll-view scroll-y style="height:100%;width:100%;" @scrolltolower="onreachBottom"
scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered"
:refresher-threshold="100" @refresherpulling="onPulling" @refresherrefresh="onRefresh"
@refresherrestore="onRestore" @refresherabort="onAbort">
<view v-for="item in list" :key="item.id" class="notice" @click="bbb(item)">
<view class="n-head">
{{item.title}}
......@@ -258,7 +261,7 @@
desc: '通过本认证,是接单的必要条件',
condition: '随机20题,及格20题',
status: '',
pic: process.uniEnv.qn_base_url + "guifan1@3x.png",
pic: process.uniEnv.qn_base_url + "fwgf-e-3x.png",
id: 2,
examId: '',
examStatus: '',
......@@ -269,7 +272,7 @@
desc: '快速认证,是否具备接单操作能力',
condition: '随机20题,及格16题',
status: '',
pic: process.uniEnv.qn_base_url + "guifan2@3x.png",
pic: process.uniEnv.qn_base_url + "jdgf-e-3x.png",
id: 2,
examId: '',
examStatus: '',
......@@ -281,7 +284,7 @@
desc: '通过本认证,是接单的必要条件',
condition: '随机10题,及格10题',
status: '',
pic: process.uniEnv.qn_base_url + "guifan1@3x.png",
pic: process.uniEnv.qn_base_url + "fwgf-e-3x.png",
id: 3,
examId: '',
examStatus: '',
......@@ -292,7 +295,7 @@
desc: '快速认证,是否具备接单操作能力',
condition: '随机4题,及格4题',
status: '',
pic: process.uniEnv.qn_base_url + "guifan2@3x.png",
pic: process.uniEnv.qn_base_url + "jdgf-e-3x.png",
id: 4,
examId: '',
examStatus: '',
......@@ -304,7 +307,7 @@
desc: '通过本认证,是接单的必要条件',
condition: '随机20题,及格20题',
status: '',
pic: process.uniEnv.qn_base_url + "guifan1@3x.png",
pic: process.uniEnv.qn_base_url + "fwgf-e-3x.png",
id: 3,
examId: '',
examStatus: '',
......@@ -315,7 +318,7 @@
desc: '快速认证,是否具备接单操作能力',
condition: '随机20题,及格16题',
status: '',
pic: process.uniEnv.qn_base_url + "guifan2@3x.png",
pic: process.uniEnv.qn_base_url + "jdgf-e-3x.png",
id: 4,
examId: '',
examStatus: '',
......@@ -359,7 +362,7 @@
desc: courseListJson[0].desc,
percent: courseListJson[0].percent,
status: courseListJson[0].status,
pic: process.uniEnv.qn_base_url + "fwgf@3x.png",
pic: process.uniEnv.qn_base_url + "fwgf-3x.png",
id: courseListJson[0].id,
sectionId: courseListJson[0].sectionId
},
......@@ -368,7 +371,7 @@
desc: courseListJson[1].desc,
percent: courseListJson[1].percent,
status: courseListJson[1].status,
pic: process.uniEnv.qn_base_url + "jdgf@3x.png",
pic: process.uniEnv.qn_base_url + "jdgf-3x.png",
id: courseListJson[1].id,
sectionId: courseListJson[1].sectionId
},
......@@ -377,7 +380,7 @@
desc: courseListJson[2].desc,
percent: courseListJson[2].percent,
status: courseListJson[2].status,
pic: process.uniEnv.qn_base_url + "cdz@3x.png",
pic: process.uniEnv.qn_base_url + "cdz-3x.png",
id: courseListJson[2].id,
sectionId: courseListJson[2].sectionId,
}
......@@ -420,12 +423,17 @@
loadStatus: "loading",
isLoadMore: false,
exam: null,
jianBianImg: process.uniEnv.qn_base_url + "jianbian@3x_bak1.png"
jianBianImg: process.uniEnv.qn_base_url + "jianbian@3x_bak1.png",
isReflesh: true,
triggered: false,
_freshing: false,
new:{
isTopReflesh:false
}
};
},
onLoad(param) {
console.log('--node_env--');
console.log(process.uniEnv.node_env);
var that = this;
try {
if (param.tabs) {
this.current = param.tabs;
......@@ -438,19 +446,48 @@
return process.uniEnv.qn_base_url + "banner-xx@3x.png";
},
},
onShow: function() {
this.tabsChange(this.current);
console.log('--返回也可以执行--');
onShow: function(param) {
if(this.current == 2 || this.current == 3){
this.tabsChange(this.current);
}
},
methods: {
stopPull() {
let that = this;
setTimeout(function(){
that.triggered = false;
that._freshing = false;
}, 1000)
},
onPulling(e) {
return true
console.log("onpulling", e);
},
onRefresh() {
if (this._freshing) return;
this.triggered = true;
this._freshing = true;
this.isLoadMore = false;
this.loadStatus = "loading";
this.loadNews();
},
onRestore() {
this.triggered = 'restore'; // 需要重置
console.log("onRestore");
},
onAbort() {
console.log("onAbort");
},
stopTouchMove() {
return false;
},
getList() {
let that = this;
this.$u.api
.getTrainingNoticeList(this.params)
.then((res) => {
this.timeFormat();
that.stopPull();
that.timeFormat();
if (res.code == 200) {
if (res.data) {
let length = res.data.length;
......@@ -458,18 +495,18 @@
res.data[i].create_at = this.timeFormat(res.data[i].create_at,
'yyyy.MM.dd hh:mm');
}
this.list = this.list.concat(res.data);
that.list = that.list.concat(res.data);
if (res.data.length < 5) {
//判断接口返回数据量小于请求数据量,则表示此为最后一页
this.isLoadMore = true;
this.loadStatus = "nomore";
that.isLoadMore = true;
that.loadStatus = "nomore";
} else {
this.isLoadMore = false;
that.isLoadMore = false;
}
} else {
this.isLoadMore = true;
this.loadStatus = "nomore";
that.isLoadMore = true;
that.loadStatus = "nomore";
}
} else {
//接口请求失败的处理
......@@ -477,9 +514,9 @@
title: res.message,
icon: "none",
});
this.isLoadMore = false;
if (this.params.start > 0) {
this.page -= 5;
that.isLoadMore = false;
if (that.params.start > 0) {
that.page -= 5;
}
}
})
......@@ -488,9 +525,9 @@
title: err,
icon: "none",
});
this.isLoadMore = false;
if (this.params.start > 0) {
this.page -= 5;
that.isLoadMore = false;
if (that.params.start > 0) {
that.page -= 5;
}
});
},
......@@ -555,19 +592,21 @@
this.swiperCurrent = index;
switch (index) {
case 1:
this.params.start = 0;
this.list = [];
this.getList();
this.loadNews()
break;
case 2:
this.getCourseList();
console.log('重新加载学习进度');
break;
case 3:
this.getUserExamInfo();
break;
}
},
loadNews() {
this.params.start = 0;
this.list = [];
this.getList();
},
animationfinish(e) {
let current = e.detail.current;
this.$refs.uTabs.setFinishCurrent(current);
......@@ -576,7 +615,6 @@
},
//scroll-view到底部加载更多
onreachBottom() {
console.log("上拉触底函数");
//上拉触底函数
if (!this.isLoadMore) {
this.isLoadMore = true;
......@@ -586,6 +624,9 @@
}
}
},
refleshNews() {
this.loadNews()
},
//跳转到拍照小程序首页
goToPrint() {
console.log("111111");
......@@ -695,6 +736,7 @@
body: e.body,
title: e.title
};
let that = this;
wx.navigateTo({
url: '/pages/learn/news-details',
success: function(res) {
......
<template>
<view class="backView">
<Examine :index="3">
<view class="bottom-padding" v-if="currentItem">
<view class="title-view">
<view :class="['title-text', {'radio': currentItem.question ? currentItem.question.answerType == 1 : true}]">
<text>{{ titleText[Math.max(0, currentItem.question ? currentItem.question.answerType - 1 : 0)] }}</text>
</view>
<view class="title-right-view">
<image class="timeIcon" :src="time1Image" mode=""></image>
<text class="timeText">倒计时:</text><text class="time-count-down">{{currentTime}}</text>
</view>
</view>
<view class="topicView">
<text class="topicText">{{currentItem.question.content}}</text>
</view>
<view :class="['itemView',item.isSelect ? 'active':'']" v-for="(item,ikey) in currentItem.answerList" :key="ikey" @click="itemClick(item,ikey)">
<view :class="item.isSelect ? 'itemIndexView' : 'itemIndexView grayBorder' ">
<text
:class="item.isSelect ? 'itemIndexText whiteColor selectBackColor' : 'itemIndexText gray-color' ">
{{alphaArr[ikey]}}
</text>
</view>
<view
:class="item.isSelect ? 'itemText selectedColor' : 'itemText defaultColor' ">{{contentFilter(item.content)}}</view>
</view>
</view>
<!-- </template> -->
<template v-slot:bottom>
<view class="answerBottomView">
<view class="bottom-left-view">
<!-- <image class="bottom-icon" :src="timuImage" mode=""></image> -->
<text class="numberText">{{progress}}</text>
</view>
<view class="bottomRightView">
<view :class="isSelect ? 'nextBtn selectBackColor' : 'nextBtn defaultBackColor' "
@click="handleClick()">
<text class="bottomTitle">{{bottomTitle}}</text>
</view>
</view>
</view>
</template>
</Examine>
<view class="mask" v-show="isComplete">
<view class="box">
<image class="icon" :src="chenggongImage"></image>
<view class="txt">您已成功完成考试</view>
<button class="btn" @click="toSubmit()">
去提交
</button>
</view>
</view>
</view>
<view class="backView">
<Examine :index="3">
<view class="bottom-padding" v-if="currentItem">
<view class="title-view">
<view :class="['title-text', {'radio': currentItem.question ? currentItem.question.answerType == 1 : true}]">
<text>{{ titleText[Math.max(0, currentItem.question ? currentItem.question.answerType - 1 : 0)] }}</text>
</view>
<view class="title-right-view">
<image class="timeIcon" :src="time1Image" mode=""></image>
<text class="timeText">倒计时:</text><text class="time-count-down">{{currentTime}}</text>
</view>
</view>
<view class="topicView">
<text class="topicText">{{currentItem.question.content}}</text>
</view>
<view :class="['itemView',item.isSelect ? 'active':'']" v-for="(item,ikey) in currentItem.answerList" :key="ikey" @click="itemClick(item,ikey)">
<view :class="item.isSelect ? 'itemIndexView' : 'itemIndexView grayBorder' ">
<text :class="item.isSelect ? 'itemIndexText whiteColor selectBackColor' : 'itemIndexText gray-color' ">
{{alphaArr[ikey]}}
</text>
</view>
<view :class="item.isSelect ? 'itemText selectedColor' : 'itemText defaultColor' ">{{contentFilter(item.content)}}</view>
</view>
</view>
<!-- </template> -->
<template v-slot:bottom>
<view class="answerBottomView">
<view class="bottom-left-view">
<!-- <image class="bottom-icon" :src="timuImage" mode=""></image> -->
<text class="numberText">{{progress}}</text>
</view>
<view class="bottomRightView">
<view :class="isSelect ? 'nextBtn selectBackColor' : 'nextBtn defaultBackColor' " @click="handleClick()">
<text class="bottomTitle">{{bottomTitle}}</text>
</view>
</view>
</view>
</template>
</Examine>
<view class="mask" v-show="isComplete">
<view class="box">
<image class="icon" :src="chenggongImage"></image>
<view class="txt">您已成功完成考试</view>
<button class="btn" @click="toSubmit()">
去提交
</button>
</view>
</view>
</view>
</template>
<script>
import Examine from '@/components/settle/examine.vue'
import utils from '@/utils/util.js'
const globalUrl = process.uniEnv || {}
const systemApiUrl = globalUrl.systemUrl.apiUrl
const ucenterApiUrl = globalUrl.ucenterUrl.apiUrl
export default {
components: {
Examine
},
data() {
return {
examId: null,
userExamId: null,
userAnswerIds: '',
isStart: true,
currentNumber: 1,
currentItem: null,
isSelect: false,
timeDefine: {
"time-id-2": 1800,
"time-id-3": 900,
"time-id-4": 360,
},
endTime: 0,
currentTime: 100,
everyTime: 90,
progress: '',
bottomTitle: '下一题',
isStop: false,
clock_url: 'https://qn-static.banshouhui.com/clock_exam.png',
examScore: 0,
alphaArr: ['A', 'B', 'C', 'D', 'E'],
timer: null,
isComplete: false, // 是否已经考试完成判定
examInfo: null,
}
},
computed: {
titleText() {
return ['单选', '多选', '问答']
},
time1Image() {
return process.uniEnv.qn_base_url + 'time1.png'
},
chenggongImage() {
return process.uniEnv.qn_base_url + 'chenggong.png'
},
timuImage() {
return process.uniEnv.qn_base_url + 'timu-new.png'
}
},
onLoad(e) {
this.examId = e.examId;
this.applyExam();
// this.getUserExamInfo();
},
methods: {
formatTimeToMini(timestamp) {
let result = timestamp;
let h = Math.floor(result / 3600) < 10 ? '0' + Math.floor(result / 3600) : Math.floor(result / 3600);
let m = Math.floor((result / 60 % 60)) < 10 ? '0' + Math.floor((result / 60 % 60)) : Math.floor((result / 60 % 60));
let s = Math.floor((result % 60)) < 10 ? '0' + Math.floor((result % 60)) : Math.floor((result % 60));
let res = '';
if(h !== '00') res += `${h}:`;
if(m !== '00') res += `${m}:`;
res += `${s}`;
return res;
import Examine from "@/components/settle/examine.vue";
import utils from "@/utils/util.js";
const globalUrl = process.uniEnv || {};
const systemApiUrl = globalUrl.systemUrl.apiUrl;
const ucenterApiUrl = globalUrl.ucenterUrl.apiUrl;
export default {
components: {
Examine,
},
data() {
return {
examId: null,
userExamId: null,
userAnswerIds: "",
isStart: true,
currentNumber: 1,
currentItem: null,
isSelect: false,
timeDefine: {
"time-id-2": 1800,
"time-id-3": 900,
"time-id-4": 450,
},
toSubmit() {
//判断是否通过,通过去成功页,失败去失败页
let examInfo = this.examInfo;
let examId = this.examId;
let status = examInfo.examLevelResult == '通过';
if(status){
wx.navigateTo({
url: "/pages/learn/exam-pass?userExamId=" + this.userExamId + "&examId=" + examId,
endTime: 0,
currentTime: 100,
everyTime: 20,
progress: "",
bottomTitle: "下一题",
isStop: false,
clock_url: "https://qn-static.banshouhui.com/clock_exam.png",
examScore: 0,
alphaArr: ["A", "B", "C", "D", "E"],
timer: null,
isComplete: false, // 是否已经考试完成判定
examInfo: null,
};
},
computed: {
titleText() {
return ["单选", "多选", "问答"];
},
time1Image() {
return process.uniEnv.qn_base_url + "time1.png";
},
chenggongImage() {
return process.uniEnv.qn_base_url + "chenggong.png";
},
timuImage() {
return process.uniEnv.qn_base_url + "timu-new.png";
},
},
onLoad(e) {
this.examId = e.examId;
this.applyExam();
// this.getUserExamInfo();
},
methods: {
formatTimeToMini(timestamp) {
let result = timestamp;
let h =
Math.floor(result / 3600) < 10
? "0" + Math.floor(result / 3600)
: Math.floor(result / 3600);
let m =
Math.floor((result / 60) % 60) < 10
? "0" + Math.floor((result / 60) % 60)
: Math.floor((result / 60) % 60);
let s =
Math.floor(result % 60) < 10
? "0" + Math.floor(result % 60)
: Math.floor(result % 60);
let res = "";
if (h !== "00") res += `${h}:`;
if (m !== "00") res += `${m}:`;
res += `${s}`;
return res;
},
toSubmit() {
//判断是否通过,通过去成功页,失败去失败页
let examInfo = this.examInfo;
let examId = this.examId;
let status = examInfo.examLevelResult == "通过";
if (status) {
wx.navigateTo({
url:
"/pages/learn/exam-pass?userExamId=" +
this.userExamId +
"&examId=" +
examId,
});
} else {
wx.navigateTo({
url:
"/pages/learn/result?userExamId=" +
this.userExamId +
"&examId=" +
examId,
});
}
},
contentFilter(txt) {
if (!txt) {
return txt;
}
let reg = /\w+\.?/;
const result = txt.replace(reg, "");
return result;
},
//开始考试 点击
startClick: function () {
this.isStart = true;
//this.getData()
//this.applyExam()
this.getUserExamInfo();
},
//获取考试信息
getUserExamInfo: function () {
uni.showLoading({
title: "请稍候",
});
let that = this;
uni.request({
url:
systemApiUrl +
"/wxh-worker-rest/rest/exam" +
"/serviceRule/userExamInfo/" +
that.vuex_token +
"?examId=" +
this.examId,
method: "POST",
data: {
//examId:this.examId,
},
header: {
"Content-Type": "application/x-www-form-urlencoded",
},
success: (res) => {
uni.hideLoading();
if (!res.data) {
return;
}
if (res.data.code == 401 || res.data.code == 403) {
uni.navigateTo({
url: "/pages/login/wxlogin",
});
return;
}
if (res.data.code == 200) {
//examStatus 用户考试状态 0考试中 1考试完成 2未参与
if (res.data.data.examStatus == 2) {
that.applyExam();
return;
}
if (res.data.data.examStatus == 1) {
console.log("111111111111111111111111111");
that.isComplete = true;
that.examScore = res.data.data.examScore;
return;
}
if (res.data.data.examStatus == 0) {
that.userExamId = res.data.data.id;
that.getNext();
}
} else {
uni.showToast({
icon: "none",
title: res.data.message,
});
}
},
fail: (e) => {
uni.hideLoading();
uni.showToast({
icon: "none",
title: "获取考试信息失败",
});
},
});
},
//申请考试
applyExam: function () {
uni.showLoading({
title: "请稍候",
});
let that = this;
uni.request({
url:
systemApiUrl +
"/wxh-worker-rest/rest/exam" +
"/serviceRule/" +
that.vuex_token +
"?examId=" +
this.examId,
method: "POST",
data: {
//examId:this.examId,
},
header: {
"Content-Type": "application/x-www-form-urlencoded",
},
success: (res) => {
uni.hideLoading();
if (res.statusCode == 401) {
uni.navigateTo({
url: "/pages/login/wxlogin",
});
return;
}
if (res.data.code == 200) {
if (res.data.data.userExamId) {
that.userExamId = res.data.data.userExamId;
//申请完考试设置倒计时总时间
let time = parseInt(
this.timeDefine["time-id-" + this.examId]
);
this.endTime = time;
// let timestamp = new Date().getTime();
// this.endTime = timestamp + time * 1000;
this.currentTime = parseInt(time * 1000); //this.formatTimeToMini(timestamp);//endTime-currentTime再格式化时间显示
that.getNext();
console.log(
this.endTime,
this.currentTime,
"总时间"
);
}
} else {
uni.showToast({
icon: "none",
title: res.data.message,
});
}
},
fail: (e) => {
uni.hideLoading();
uni.showToast({
icon: "none",
title: "申请考试 失败",
});
}else{
wx.navigateTo({
url: "/pages/learn/result?userExamId=" + this.userExamId + "&examId=" + examId,
});
},
});
},
//获取下一题
getNext: function () {
var questionId = "";
if (
this.currentItem &&
this.currentItem.question &&
this.currentItem.question.id
) {
questionId = this.currentItem.question.id;
}
uni.showLoading({
title: "请稍候",
});
let that = this;
uni.request({
url:
systemApiUrl +
"/wxh-worker-rest/rest/exam" +
"/serviceRule/next/" +
that.vuex_token +
"?userExamId=" +
this.userExamId +
"&questionId=" +
questionId +
"&userAnswerIds=" +
(this.userAnswerIds || "9999"), // 9999超时自动下一题
method: "POST",
data: {
// userExamId:this.userExamId,
// questionId:this.currentItem.question.id,
// userAnswerIds:this.userAnswerIds,
},
header: {
"Content-Type": "application/x-www-form-urlencoded",
},
success: (res) => {
uni.hideLoading();
if (res.statusCode == 401) {
uni.navigateTo({
url: "/pages/login/wxlogin",
});
return;
}
if (res.data.code == 200) {
that.currentItem = res.data.data;
that.progress = res.data.data.progress;
if (res.data.data.answerList) {
that.handleData();
// that.currentTime = 100
this.everyTime = 90; //每道题90s
that.isSelect = false;
clearTimeout(this.timer);
that.startCounting();
} else {
that.isSelect = true;
that.getUserExamInfo();
clearTimeout(this.timer);
this.isComplete = true;
//用来考完试判断跳转
this.examInfo = that.currentItem;
// that.bottomTitle = '完成考试,现在签约'
}
} else {
uni.showToast({
icon: "none",
title: res.data.message,
});
}
},
fail: (e) => {
uni.hideLoading();
uni.showToast({
icon: "none",
title: "获取下一题 失败",
});
},
});
},
handleData: function () {
this.currentItem.answerList.forEach((item, index) => {
item.isSelect = false;
this.$set(this.currentItem.answerList, index, item);
});
},
startCounting: function () {
if (this.isStop) {
return;
}
this.endTime = this.endTime - 1;
this.currentTime = this.formatTimeToMini(this.endTime);
this.everyTime = this.everyTime - 1;
if (this.everyTime > 0) {
this.timer = setTimeout(this.startCounting, 1000);
console.log(
"endTime:" + this.endTime,
"everyTime:" + this.everyTime,
"currentTime:" + this.currentTime
);
} else {
clearTimeout(this.timer);
this.everyTime = 90;
this.nextClick();
}
},
itemClick: function (currentItem, ikey) {
this.isSelect = true;
// console.log('选点点击--处理前--this.currentItem:')
// console.log(this.currentItem)
// console.log('选点点击--处理前--ikey:')
// console.log(ikey)
// console.log('选点点击--处理前--题目类型,1单选,2多选,3简答:')
// console.log(this.currentItem.question.answerType)
//answerType 题目类型,1单选,2多选,3简答,
for (let i = 0; i < this.currentItem.answerList.length; i++) {
var item = this.currentItem.answerList[i];
if (this.currentItem.question.answerType == 2) {
//多选
if (ikey == i) {
item.isSelect = !item.isSelect;
}
} else {
//单选/简答
if (ikey == i) {
item.isSelect = !item.isSelect;
} else {
item.isSelect = false;
}
}
},
contentFilter(txt) {
if (!txt) {
return txt
}
let reg = /\w+\.?/;
const result = txt.replace(reg, '')
return result
},
//开始考试 点击
startClick: function() {
this.isStart = true
//this.getData()
//this.applyExam()
this.getUserExamInfo()
},
//获取考试信息
getUserExamInfo: function() {
uni.showLoading({
title: '请稍候'
})
let that = this
uni.request({
url: systemApiUrl +
'/wxh-worker-rest/rest/exam' +
'/serviceRule/userExamInfo/' +
that.vuex_token +
'?examId=' + this.examId,
method: 'POST',
data: {
//examId:this.examId,
},
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
success: (res) => {
uni.hideLoading()
if (!res.data) {
return
}
if (res.data.code == 401 || res.data.code == 403) {
uni.navigateTo({
url: '/pages/login/wxlogin'
})
return
}
if (res.data.code == 200) {
//examStatus 用户考试状态 0考试中 1考试完成 2未参与
if (res.data.data.examStatus == 2) {
that.applyExam()
return
}
if (res.data.data.examStatus == 1) {
console.log('111111111111111111111111111')
that.isComplete = true
that.examScore = res.data.data.examScore
return
}
if (res.data.data.examStatus == 0) {
that.userExamId = res.data.data.id
that.getNext()
}
} else {
uni.showToast({
icon: 'none',
title: res.data.message
})
}
},
fail: (e) => {
uni.hideLoading()
uni.showToast({
icon: 'none',
title: '获取考试信息失败'
})
}
})
},
//申请考试
applyExam: function() {
uni.showLoading({
title: '请稍候'
})
let that = this
uni.request({
url: systemApiUrl +
'/wxh-worker-rest/rest/exam' +
'/serviceRule/' +
that.vuex_token +
'?examId=' + this.examId,
method: 'POST',
data: {
//examId:this.examId,
},
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
success: (res) => {
uni.hideLoading()
if (res.statusCode == 401) {
uni.navigateTo({
url: '/pages/login/wxlogin'
})
return
}
if (res.data.code == 200) {
if (res.data.data.userExamId) {
that.userExamId = res.data.data.userExamId
//申请完考试设置倒计时总时间
let time = parseInt(this.timeDefine['time-id-' + this.examId]);
this.endTime = time;
// let timestamp = new Date().getTime();
// this.endTime = timestamp + time * 1000;
this.currentTime = parseInt(time * 1000);//this.formatTimeToMini(timestamp);//endTime-currentTime再格式化时间显示
that.getNext()
}
} else {
uni.showToast({
icon: 'none',
title: res.data.message
})
}
},
fail: (e) => {
uni.hideLoading()
uni.showToast({
icon: 'none',
title: '申请考试 失败'
})
}
})
},
//获取下一题
getNext: function() {
var questionId = ''
if (this.currentItem &&
this.currentItem.question &&
this.currentItem.question.id) {
questionId = this.currentItem.question.id
}
uni.showLoading({
title: '请稍候'
})
let that = this
uni.request({
url: systemApiUrl +
'/wxh-worker-rest/rest/exam' +
'/serviceRule/next/' +
that.vuex_token +
'?userExamId=' + this.userExamId +
'&questionId=' + questionId +
'&userAnswerIds=' + (this.userAnswerIds || '9999'), // 9999超时自动下一题
method: 'POST',
data: {
// userExamId:this.userExamId,
// questionId:this.currentItem.question.id,
// userAnswerIds:this.userAnswerIds,
},
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
success: (res) => {
uni.hideLoading()
if (res.statusCode == 401) {
uni.navigateTo({
url: '/pages/login/wxlogin'
})
return
}
if (res.data.code == 200) {
that.currentItem = res.data.data
that.progress = res.data.data.progress
if (res.data.data.answerList) {
that.handleData()
// that.currentTime = 100
this.everyTime = 90;//每道题90s
that.isSelect = false
clearTimeout(this.timer)
that.startCounting()
} else {
that.isSelect = true
that.getUserExamInfo()
clearTimeout(this.timer)
this.isComplete = true
//用来考完试判断跳转
this.examInfo = that.currentItem;
// that.bottomTitle = '完成考试,现在签约'
}
} else {
uni.showToast({
icon: 'none',
title: res.data.message
})
}
},
fail: (e) => {
uni.hideLoading()
uni.showToast({
icon: 'none',
title: '获取下一题 失败'
})
}
})
},
handleData: function() {
this.currentItem.answerList.forEach((item, index) => {
item.isSelect = false
this.$set(this.currentItem.answerList, index, item)
})
},
startCounting: function() {
if (this.isStop) {
return
}
this.endTime = this.endTime - 1;
this.currentTime = this.formatTimeToMini(this.endTime)
this.everyTime = this.everyTime - 1;
if (this.everyTime > 0) {
this.timer = setTimeout(this.startCounting, 1000);
} else {
clearTimeout(this.timer)
this.everyTime = 90
this.nextClick()
}
},
itemClick: function(currentItem, ikey) {
this.isSelect = true
// console.log('选点点击--处理前--this.currentItem:')
// console.log(this.currentItem)
// console.log('选点点击--处理前--ikey:')
// console.log(ikey)
// console.log('选点点击--处理前--题目类型,1单选,2多选,3简答:')
// console.log(this.currentItem.question.answerType)
//answerType 题目类型,1单选,2多选,3简答,
for (let i = 0; i < this.currentItem.answerList.length; i++) {
var item = this.currentItem.answerList[i]
if (this.currentItem.question.answerType == 2) { //多选
if (ikey == i) {
item.isSelect = !item.isSelect
}
} else { //单选/简答
if (ikey == i) {
item.isSelect = !item.isSelect
} else {
item.isSelect = false
}
}
this.$set(this.currentItem.answerList[i], isSelect, item.isSelect)
}
var isSelect = false
this.currentItem.answerList.forEach(item => {
if (item.isSelect) {
isSelect = true
}
})
//有选答案
this.isSelect = isSelect
// console.log('选点点击--处理后--this.currentItem.answerList:')
// console.log(this.currentItem.answerList)
},
// 点击下一步
handleClick() {
// 判断有没有选
if (!this.isSelect) {
return
}
this.nextClick()
},
//下一题
nextClick: function() {
clearTimeout(this.timer)
this.currentNumber = this.currentNumber + 1
//this.getData()
this.handleAnswer()
//this.getNext()
},
//上传考试结果
postResult: function() {
uni.showLoading({
title: '请稍候'
})
let that = this
uni.request({
url: ucenterApiUrl + '/v1/settled/update-settled-exam-score' +
'?access-token=' + that.vuex_token,
method: 'POST',
data: {
score: this.examScore || 0,
},
success: (res) => {
uni.hideLoading()
if (res.statusCode == 401) {
uni.navigateTo({
url: '/pages/login/wxlogin'
})
return
}
if (res.statusCode == 200) {
// uni.navigateTo({
// url: '/pages/settle/prompt'
// })
} else {
uni.showToast({
icon: 'none',
title: "上传考试结果失败"
})
}
},
fail: (e) => {
uni.hideLoading()
uni.showToast({
icon: 'none',
title: '上传考试结果失败'
})
}
})
},
//所选答案
handleAnswer: function() {
/*
this.$set(
this.currentItem.answerList[i],
isSelect,
item.isSelect
);
}
var isSelect = false;
this.currentItem.answerList.forEach((item) => {
if (item.isSelect) {
isSelect = true;
}
});
//有选答案
this.isSelect = isSelect;
// console.log('选点点击--处理后--this.currentItem.answerList:')
// console.log(this.currentItem.answerList)
},
// 点击下一步
handleClick() {
// 判断有没有选
if (!this.isSelect) {
return;
}
this.nextClick();
},
//下一题
nextClick: function () {
clearTimeout(this.timer);
this.currentNumber = this.currentNumber + 1;
//this.getData()
this.handleAnswer();
//this.getNext()
},
//上传考试结果
postResult: function () {
uni.showLoading({
title: "请稍候",
});
let that = this;
uni.request({
url:
ucenterApiUrl +
"/v1/settled/update-settled-exam-score" +
"?access-token=" +
that.vuex_token,
method: "POST",
data: {
score: this.examScore || 0,
},
success: (res) => {
uni.hideLoading();
if (res.statusCode == 401) {
uni.navigateTo({
url: "/pages/login/wxlogin",
});
return;
}
if (res.statusCode == 200) {
// uni.navigateTo({
// url: '/pages/settle/prompt'
// })
} else {
uni.showToast({
icon: "none",
title: "上传考试结果失败",
});
}
},
fail: (e) => {
uni.hideLoading();
uni.showToast({
icon: "none",
title: "上传考试结果失败",
});
},
});
},
//所选答案
handleAnswer: function () {
/*
userAnswerIds
本题回答。
多选题时id按从小到大排序,并英文逗号,分隔;
......@@ -505,327 +545,319 @@
如果是第一次答题,不需要传。
*/
//每次清空
this.userAnswerIds = ''
this.currentItem.answerList.forEach(item => {
if (item.isSelect) {
//this.userAnswerIds = item.id + ',' + this.userAnswerIds
//answerType 题目类型,1单选,2多选,3简答,
if (this.currentItem.question.answerType == 2) { //多选
///*
if (this.userAnswerIds.length == 0) {
this.userAnswerIds = item.id
} else { // if(this.userAnswerIds.length == 1)
this.userAnswerIds = item.id + ',' + this.userAnswerIds
}
//*/
} else { //单选
this.userAnswerIds = item.id
}
}
})
this.getNext()
},
}
}
//每次清空
this.userAnswerIds = "";
this.currentItem.answerList.forEach((item) => {
if (item.isSelect) {
//this.userAnswerIds = item.id + ',' + this.userAnswerIds
//answerType 题目类型,1单选,2多选,3简答,
if (this.currentItem.question.answerType == 2) {
//多选
///*
if (this.userAnswerIds.length == 0) {
this.userAnswerIds = item.id;
} else {
// if(this.userAnswerIds.length == 1)
this.userAnswerIds =
item.id + "," + this.userAnswerIds;
}
//*/
} else {
//单选
this.userAnswerIds = item.id;
}
}
});
this.getNext();
},
},
};
</script>
<style lang="scss">
.backView {
background-color: #F4F5F7;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
overflow-y:auto;
overflow-y:auto;
}
.noticeView {
margin-top: 100rpx;
width: 100%;
display: flex;
}
.noticeText {
font-size: 32rpx;
color: #555555;
padding-left: 40rpx;
padding-right: 40rpx;
}
.numberView {
margin-top: 40rpx;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.numberText {
color: #333333;
font-size: 28rpx;
font-weight: bold;
}
.topicView {
margin-top: 40rpx;
width: 100%;
display: flex;
align-items: center;
margin-bottom: 40rpx;
}
.topicText {
color: #333333;
font-size: 32rpx;
line-height: 48rpx;
font-weight: bold;
}
.itemView {
margin-top: 30rpx;
background-color: #F4F5F7;
width: 100%;
padding: 40rpx 30rpx;
display: flex;
align-items: flex-start;
border-radius: 12rpx;
border: 2rpx solid transparent;
font-size: 28rpx;
&.active {
background-color: #FFFFFF;
border: 2rpx solid #2272FF;
}
}
.itemIndexView {
width: 40rpx;
height: 40rpx;
border-radius: 8rpx;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
flex-shrink:0
}
.grayBorder {
border: 2rpx solid #999999;
}
.gray-color {
color: #999999;
}
.itemIndexText {
border-radius: 8rpx;
width: 36rpx;
height: 36rpx;
display: block;
line-height: 36rpx;
text-align: center;
font-size: 28rpx;
}
.itemText {
margin-left: 20rpx;
font-size: 28rpx;
}
.bottomView {
background-color: #FFFFFF;
width: 100%;
height: 140rpx;
display: flex;
align-items: center;
justify-content: center;
position: fixed;
bottom: 0;
}
.bottomBtn {
background-color: #007AFF;
width: 60%;
height: 80rpx;
border-radius: 40rpx;
display: flex;
align-items: center;
justify-content: center;
}
.bottomTitle {
font-size: 32rpx;
color: #FFFFFF;
}
.title-view {
display: flex;
justify-content: space-between;
align-items: center;
.title-text {
border-radius: 8rpx;
background-color: #FF930D;
font-size: 20rpx;
color: #FFFFFF;
width: 72rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
&.radio {
background-color: #2272FF;
}
}
.title-right-view {
display: flex;
flex-direction: row;
align-items: center;
.timeIcon {
margin-right: 12rpx;
width: 32rpx;
height: 32rpx;
}
.timeText {
font-size: 28rpx;
color: #333333;
}
.time-count-down {
width: 50rpx;
text-align: right;
}
}
}
.bottomRightView {
display: flex;
flex-direction: row;
align-items: center;
margin-right: 30rpx;
}
.nextBtn {
width: 300rpx;
height: 104rpx;
border-radius: 52rpx;
display: flex;
align-items: center;
justify-content: center;
}
.defaultColor {
color: #333333;
}
.defaultBackColor {
background-color: #D1D4D4;
}
.selectedColor {
color: #2272FF;
}
.whiteColor {
color: #FFFFFF;
}
.selectBackColor {
background-color: #2272FF;
}
.bottom-padding {
// margin-bottom: 188rpx;
background-color: #FFFFFF;
border-radius: 12rpx;
padding: 40rpx 30rpx 40rpx 30rpx;
}
.answerBottomView {
display: flex;
align-items: center;
justify-content: space-between;
.bottom-left-view {
display: flex;
align-items: center;
margin-left: 30rpx;
.bottom-icon {
width: 44rpx;
height: 44rpx;
}
.numberText {
color: #666666;
font-size: 32rpx;
margin-left: 30rpx;
}
}
}
.mask {
position: fixed;
left: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
background: rgba(0, 0, 0, 0.5);
}
.box {
width: 660rpx;
height: 696rpx;
padding: 0 70rpx;
border-radius: 12rpx;
background-color: #fff;
.icon {
margin: 80rpx auto 0;
display: block;
width: 224rpx;
height: 224rpx;
}
.txt {
margin-top: 20rpx;
margin-bottom: 98rpx;
font-weight: bold;
font-size: 40rpx;
line-height: 66rpx;
color: #2272FF;
text-align: center;
}
.btn {
line-height: 104rpx;
border-radius: 52rpx;
background: #2272ff;
font-size: 32rpx;
color: #fff;
}
}
.backView {
background-color: #f4f5f7;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
overflow-y: auto;
overflow-y: auto;
}
.noticeView {
margin-top: 100rpx;
width: 100%;
display: flex;
}
.noticeText {
font-size: 32rpx;
color: #555555;
padding-left: 40rpx;
padding-right: 40rpx;
}
.numberView {
margin-top: 40rpx;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.numberText {
color: #333333;
font-size: 28rpx;
font-weight: bold;
}
.topicView {
margin-top: 40rpx;
width: 100%;
display: flex;
align-items: center;
margin-bottom: 40rpx;
}
.topicText {
color: #333333;
font-size: 32rpx;
line-height: 48rpx;
font-weight: bold;
}
.itemView {
margin-top: 30rpx;
background-color: #f4f5f7;
width: 100%;
padding: 40rpx 30rpx;
display: flex;
align-items: flex-start;
border-radius: 12rpx;
border: 2rpx solid transparent;
font-size: 28rpx;
&.active {
background-color: #ffffff;
border: 2rpx solid #2272ff;
}
}
.itemIndexView {
width: 40rpx;
height: 40rpx;
border-radius: 8rpx;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.grayBorder {
border: 2rpx solid #999999;
}
.gray-color {
color: #999999;
}
.itemIndexText {
border-radius: 8rpx;
width: 36rpx;
height: 36rpx;
display: block;
line-height: 36rpx;
text-align: center;
font-size: 28rpx;
}
.itemText {
margin-left: 20rpx;
font-size: 28rpx;
}
.bottomView {
background-color: #ffffff;
width: 100%;
height: 140rpx;
display: flex;
align-items: center;
justify-content: center;
position: fixed;
bottom: 0;
}
.bottomBtn {
background-color: #007aff;
width: 60%;
height: 80rpx;
border-radius: 40rpx;
display: flex;
align-items: center;
justify-content: center;
}
.bottomTitle {
font-size: 32rpx;
color: #ffffff;
}
.title-view {
display: flex;
justify-content: space-between;
align-items: center;
.title-text {
border-radius: 8rpx;
background-color: #ff930d;
font-size: 20rpx;
color: #ffffff;
width: 72rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
&.radio {
background-color: #2272ff;
}
}
.title-right-view {
display: flex;
flex-direction: row;
align-items: center;
.timeIcon {
margin-right: 12rpx;
width: 32rpx;
height: 32rpx;
}
.timeText {
font-size: 28rpx;
color: #333333;
}
.time-count-down {
width: 50rpx;
text-align: right;
}
}
}
.bottomRightView {
display: flex;
flex-direction: row;
align-items: center;
margin-right: 30rpx;
}
.nextBtn {
width: 300rpx;
height: 104rpx;
border-radius: 52rpx;
display: flex;
align-items: center;
justify-content: center;
}
.defaultColor {
color: #333333;
}
.defaultBackColor {
background-color: #d1d4d4;
}
.selectedColor {
color: #2272ff;
}
.whiteColor {
color: #ffffff;
}
.selectBackColor {
background-color: #2272ff;
}
.bottom-padding {
// margin-bottom: 188rpx;
background-color: #ffffff;
border-radius: 12rpx;
padding: 40rpx 30rpx 40rpx 30rpx;
}
.answerBottomView {
display: flex;
align-items: center;
justify-content: space-between;
.bottom-left-view {
display: flex;
align-items: center;
margin-left: 30rpx;
.bottom-icon {
width: 44rpx;
height: 44rpx;
}
.numberText {
color: #666666;
font-size: 32rpx;
margin-left: 30rpx;
}
}
}
.mask {
position: fixed;
left: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
background: rgba(0, 0, 0, 0.5);
}
.box {
width: 660rpx;
height: 696rpx;
padding: 0 70rpx;
border-radius: 12rpx;
background-color: #fff;
.icon {
margin: 80rpx auto 0;
display: block;
width: 224rpx;
height: 224rpx;
}
.txt {
margin-top: 20rpx;
margin-bottom: 98rpx;
font-weight: bold;
font-size: 40rpx;
line-height: 66rpx;
color: #2272ff;
text-align: center;
}
.btn {
line-height: 104rpx;
border-radius: 52rpx;
background: #2272ff;
font-size: 32rpx;
color: #fff;
}
}
</style>
<template>
<view class="content">
<u-navbar
back-icon-color="#FFFFFF"
:background="background"
title-color="#fff"
:border-bottom="false"
></u-navbar>
<u-navbar back-icon-color="#FFFFFF" :background="background" title-color="#fff" :border-bottom="false"></u-navbar>
<view class="title">考试规则</view>
<view class="test">
<view class="slogan">
这是一场严肃的考试,请认真查看 规则,预祝您顺利通过考试!
</view>
<view class="text">
<text class="left">考试科目:</text
><text style="color: #007aff">{{ desc.title }}</text>
<text class="left">考试科目:</text><text style="color: #007aff">{{ desc.title }}</text>
</view>
<view class="text">
<text class="left">合格条件:</text><text>{{ desc.score }}</text>
......@@ -22,7 +16,7 @@
<text class="left">考试时间:</text><text>{{ desc.time }}</text>
</view>
<view class="text">
<text class="left">题目来源:</text><text>系统随机{{ desc.number }}题</text>
<text class="left">题目来源:</text><text>{{ ruleDisc }}</text>
</view>
<button @click="getUserExamId()">开始考试</button>
</view>
......@@ -31,66 +25,66 @@
<script>
let condition = {
"dev": {
dev: {
"id-2": {
"score": "60分",
"time": "30分钟",
"number": "20",
"title": "服务规范"
score: "60分",
time: "30分钟",
number: "20",
title: "服务规范",
},
"id-3": {
"score": "30分",
"time": "15分钟",
"number": "10",
"title": "服务规范"
score: "30分",
time: "15分钟",
number: "10",
title: "服务规范",
},
"id-4": {
"score": "15分",
"time": "6分钟",
"number": "4",
"title": "交付规范"
}
score: "15分",
time: "6分钟",
number: "4",
title: "交付规范",
},
},
"test": {
test: {
"id-2": {
"score": "60分",
"time": "30分钟",
"number": "20",
"title": "服务规范"
score: "60分",
time: "30分钟",
number: "20",
title: "服务规范",
},
"id-3": {
"score": "30分",
"time": "15分钟",
"number": "10",
"title": "服务规范"
score: "30分",
time: "15分钟",
number: "10",
title: "服务规范",
},
"id-4": {
"score": "15分",
"time": "6分钟",
"number": "4",
"title": "交付规范"
}
score: "15分",
time: "6分钟",
number: "4",
title: "交付规范",
},
},
"prod": {
prod: {
"id-2": {
"score": "60分",
"time": "30分钟",
"number": "20",
"title": "服务规范"
score: "60分",
time: "30分钟",
number: "20",
title: "服务规范",
},
"id-3": {
"score": "30分",
"time": "15分钟",
"number": "10",
"title": "服务规范"
score: "30分",
time: "15分钟",
number: "10",
title: "服务规范",
},
"id-4": {
"score": "15分",
"time": "6分钟",
"number": "4",
"title": "交付规范"
}
}
score: "15分",
time: "6分钟",
number: "4",
title: "交付规范",
},
},
};
let env = process.uniEnv.node_env;
let desc = condition[env];
......@@ -102,11 +96,13 @@ export default {
examId: null,
exam: null,
userExamId: null,
ruleDisc: "",
};
},
onLoad(param) {
this.examId = param.examId
this.desc = desc["id-" + this.examId]
this.examId = param.examId;
this.desc = desc["id-" + this.examId];
this.getExamResult();
// this.getUserExamInfo();
},
methods: {
......@@ -119,33 +115,58 @@ export default {
},
getUserExamInfo() {
uni.request({
url:
process.uniEnv.systemUrl.apiUrl +
"/wxh-worker-rest/rest/exam/serviceRule/" +
this.vuex_token +
"?examId=" +
this.examId,
method: "POST",
header: {
"Content-Type": "application/x-www-from-urlencoded",
},
url:
process.uniEnv.systemUrl.apiUrl +
"/wxh-worker-rest/rest/exam/serviceRule/" +
this.vuex_token +
"?examId=" +
this.examId,
method: "POST",
header: {
"Content-Type": "application/x-www-from-urlencoded",
},
success: (res) => {
console.log("标识符1", res.data);
uni.hideLoading();
if (res.data.code == 200) {
if (res.data.data.userExamId) {
this.userExamId = res.data.data.userExamId;
console.log("这个是个标识符", this.userExamId);
}
}
},
success: (res) => {
console.log("标识符1", res.data);
uni.hideLoading();
if (res.data.code == 200) {
if (res.data.data.userExamId) {
this.userExamId = res.data.data.userExamId;
console.log("这个是个标识符", this.userExamId);
}
}
},
});
setTimeout(() => {
wx.navigateTo({
url: "/pages/learn/answer?userExamId=" + this.userExamId,
});
}, 1000);
wx.navigateTo({
url: "/pages/learn/answer?userExamId=" + this.userExamId,
});
}, 1000);
},
getExamResult() {
uni.request({
url:
process.uniEnv.systemUrl.apiUrl +
"/wxh-worker-rest/rest/exam/serviceRule/userExamInfo/" +
this.vuex_token +
"?examId=" +
this.examId,
method: "POST",
header: {
"Content-Type": "application/x-www-from-urlencoded",
},
success: (res) => {
uni.hideLoading();
if (res.data.code == 200) {
if (res.data.data.ruleDisc) {
console.log(res.data.data.ruleDisc);
var str = res.data.data.ruleDisc;
console.log(str.substring(0, 11));
this.ruleDisc = str.substring(0, 11);
}
}
},
});
},
},
};
......
<template>
<view>
<view>
<u-navbar
back-icon-color="#000000"
:background="background"
title-color="#000000"
:border-bottom="false">
</u-navbar>
<view class="title">
{{ title }}
</view>
......@@ -25,7 +31,7 @@
that.body = data.body;
})
this.$u.mpShare.path = ''
},
},
}
</script>
......
<template>
<view class="">
<view class="learn-vedio" v-if="isShowVideo">
<u-navbar
back-icon-color="#000000"
:background="background"
title-color="#000000"
:border-bottom="false">
</u-navbar>
<view class="uni-padding-wrap uni-common-mt">
<view><video object-fit="cover" class="course-video" id="courseVideo" :src="courseSrc"
:options="playerOptions" :playsinline="true" @play="playCourse" @error="videoErrorCallback"
......@@ -137,9 +143,9 @@
},
gklog: '',
videoTotalTime: 0,
howTimeToUpdateLearnedStatus: 5, //设置几秒提交一次状态
howTimeToUpdateLearnedStatus: 10, //设置几秒提交一次状态
status: 1, //是否已学习默认1已学习
howLongIsLearned: this.videoTotalTime / 2, //默认设置观看1/2就是已学
isLearned: false, //默认设置观看1/2就是已学
};
},
computed: {
......@@ -185,19 +191,21 @@
this.videoContext = uni.createVideoContext("courseVideo");
// #endif
},
onUnload() {
wx.reLaunch({
url: '/pages/index/learn?tabs=2'
});
},
methods: {
goNext(info) {
uni.navigateTo({
url: "./section?section_id=" + info.id + "&course_id=" + info.course_id
url: "/pages/learn/section?section_id=" + info.id + "&course_id=" + info.course_id
});
},
onPlayerTimeupdate(player) {
console.log('-----onplay----');
console.log(player);
let intCurrentTime = parseInt(player.detail.currentTime);
this.updateLearnedStatus(intCurrentTime);
this.gklog = intCurrentTime;
console.log(' onPlayerTimeupdate!', this.gklog)
},
videoErrorCallback: function(e) {
uni.showModal({
......@@ -220,7 +228,6 @@
}
},
playerReadied(player) {
console.log('i go to playerReadied gklog:' + this.gklog)
player.currentTime(this.gklog)
},
getCourseSection(param) {
......@@ -240,7 +247,7 @@
this.section_content = res.data.content;
this.teacher.name = res.data.teachers[0].name;
this.teacherImage = res.data.teachers[0].avatar;
this.teacherIntro = res.data.teachers[0].intro.replace(/<p.*?>|<\/p>/ig, "");
this.teacherIntro = res.data.teachers[0].intro.replace(/<.*?>|<\/.*?>/ig, "");
this.params.course_id = res.data.course_id;
if (this.isShowVideo) {
let coureWareList = res.data.courseware;
......@@ -254,8 +261,6 @@
}
})
.catch((err) => {
console.log('--------settttt---------');
console.log(err);
uni.showToast({
title: err,
icon: "none",
......@@ -272,10 +277,7 @@
status: 1,
};
this.$u.api.updateLearnCourses(param).then((res) => {
// console.log('--' + this.howTimeToUpdateLearnedStatus + '更新一次观看状态--time:' + nowTime);
}).catch((err) => {
console.log('--------updateLearnedStatusForText---------');
console.log(err);
uni.showToast({
title: err,
icon: "none",
......@@ -284,11 +286,13 @@
},
updateLearnedStatus(nowTime) {
if (this.gklog != nowTime && nowTime % this.howTimeToUpdateLearnedStatus == 0) {
if (nowTime < this.howLongIsLearned) {
let howLongIsLearned = parseInt(this.videoTotalTime / 2);
if (nowTime < howLongIsLearned) {
this.status = 0;
} else if(this.isLearned){
return;
} else {
this.status = 1;
console.log('--大于规定时间标记为已学习--');
}
let param = {
......@@ -297,20 +301,13 @@
status: this.status,
};
this.$u.api.updateLearnCourses(param).then((res) => {
console.log('--' + this.howTimeToUpdateLearnedStatus + '更新一次观看状态--time:' + nowTime);
}).catch((err) => {
console.log('--------updateLearnedStatus---------');
console.log(err);
uni.showToast({
title: err,
icon: "none",
});
});
}
},
//获取章节详情
getCapterDetails() {
console.log('获取章节详情')
this.$u.api
.ChapterDetails(this.params)
.then((res) => {
......@@ -325,8 +322,6 @@
this.list[i].isActive = this.active_section_id == this.list[i].id ? true :
false;
}
console.log('--select-list--')
console.log(this.list)
}
} else {
//接口请求失败的处理
......@@ -493,7 +488,7 @@
}
.color-teacher {
color: #999999;
color: #000000;
}
.catalogue {
......
......@@ -8,16 +8,16 @@
></u-navbar>
<view class="content">
<text class="title">合同清单</text>
<view class="jf-currency-class" v-for="item in res" :key="item.id">
<view
class="jf-currency-class"
v-for="item in res"
:key="item.id"
@click="goBaidu(item.url)"
>
<view class="left">{{ item.name }}</view>
<view class="text1">《{{ item.name }}》</view>
<view class="text2">下载时间: {{ item.create_at }}</view>
</view>
<!-- <view class="jf-currency-class">
<view class="left">新风机技工入驻签约合同</view>
<view class="text1">《新风机技工入驻签约合同》</view>
<view class="text2">下载时间: 2021.05.06 15:01:48</view>
</view> -->
</view>
</view>
</template>
......@@ -28,14 +28,6 @@ export default {
return {
background: {
backgroundColor: "#F4F5F7",
// 导航栏背景图
// background: 'url(https://cdn.uviewui.com/uview/swiper/1.jpg) no-repeat',
// 还可以设置背景图size属性
// backgroundSize: 'cover',
// 渐变色
// backgroundImage: 'linear-gradient(45deg, rgb(28, 187, 180), rgb(141, 198, 63))'
},
res: [],
type: "充电桩",
......@@ -52,50 +44,37 @@ export default {
if (res.data) {
let length = res.data.length;
for (let i = 0; i < length; i++) {
var re = /[^\u4e00-\u9fa5]/gi;
// res.data.name = res.data.name.replace(re, "");
let data = new Date(
Number(res.data[i].create_at) * 1000
);
res.data[i].create_at = moment(data).format(
"yyyy.MM.DD HH:mm:ss"
);
res.data[i].name = res.data[i].name.replace(re, "");
}
this.res = this.res.concat(res.data);
console.log(this.res);
}
} else {
console.log(res.code);
//接口请求失败的处理
uni.showToast({
title: res.message,
icon: "none",
});
}
});
},
add0(m) {
return m < 10 ? "0" + m : m;
goBaidu(a) {
getApp().globalData.contractUrl = a;
wx.navigateTo({
url: "./out",
success: function () {}, //成功回调
fail: function () {},
complete: function () {},
});
},
// format(shijianchuo) {
// //shijianchuo是整数,否则要parseInt转换
// var time = new Date(shijianchuo * 1000);
// var y = time.getFullYear();
// var m = time.getMonth() + 1;
// var d = time.getDate();
// var h = time.getHours();
// var mm = time.getMinutes();
// var s = time.getSeconds();
// return (
// y +
// "." +
// this.add0(m) +
// "." +
// this.add0(d) +
// " " +
// this.add0(h) +
// ":" +
// this.add0(mm) +
// ":" +
// this.add0(s)
// );
// // },
// gettime(time) {
// moment(new Date(time).format("yyyy.MM.DD HH:mm:ss"));
// },
},
};
</script>
......@@ -122,7 +101,6 @@ export default {
}
.jf-currency-class {
width: 100%;
height: 180rpx;
border-radius: 12rpx;
padding-top: 40rpx;
margin-top: 74rpx;
......
<template>
<view>
<web-view :src="url"></web-view>
</view>
</template>
<script>
export default {
data() {
return {
url: "",
};
},
onLoad(option) {
this.url = option.url;
var app = getApp();
this.url = app.globalData.contractUrl;
console.log(app.globalData, "这是个标识符");
},
methods: {},
};
</script>
<style>
</style>
\ No newline at end of file
......@@ -3,7 +3,7 @@
<complete-check :show="completeCheckStatus" :list-data="completeCheckResult" :pass="pass" @close="closeCheckResult" @handle="handerProgrom" @change="confirm"></complete-check>
<view class="u-wrap">
<u-navbar :background="{background: '#2272FF'}" back-icon-color="#fff" :title-size="32" title-color="#fff" :border-bottom="false" title="完工信息"></u-navbar>
<u-tabs-swiper class="order-tabs" ref="tabs" :current="tabIndex" name="panelName" :list="list" @change="tabsChange" :is-scroll="false" bg-color="#2272FF" inactive-color="#a6c6ff" active-color="#fff" height="80" font-size="32"></u-tabs-swiper>
<u-tabs class="order-tabs" ref="tabs" :current="tabIndex" name="panelName" :list="list" @change="tabsChange" :is-scroll="false" bg-color="#2272FF" inactive-color="#a6c6ff" active-color="#fff" height="80" font-size="32"></u-tabs>
<view class="u-menu-wrap">
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="scrollTop" :scroll-into-view="itemId" v-if="list[tabIndex].items.length > 1">
<view v-for="(item,index) in list[tabIndex].items" :key="index" class="u-tab-item"
......@@ -29,7 +29,7 @@
{{item.fieldsTitle}}
</view>
<template v-if="item.fieldsType">
<xh-input v-if="typeToComponentType(item.fieldsType)==='input'" :groupIndex="groupIndex"
<xh-input v-if="typeToComponentType(item.fieldsType)==='input'" :groupIndex="groupIndex" :type="inputType(item.fieldsType)"
:itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""' @value-change="fieldValueChange">
</xh-input>
<xh-multi-input v-else-if="typeToComponentType(item.fieldsType)==='multiinput'"
......@@ -487,6 +487,30 @@
})
}
},
inputType(type) {
var inputType = ''
let ty = type.toLocaleLowerCase()
switch (ty) {
case 'text':
inputType = 'textarea'
break
case 'password':
inputType = ty
break
case 'decimal':
case 'number':
case 'double':
case 'integer':
inputType = 'digit'
break
case 'textarea':
default:
inputType = 'text'
break
}
return inputType
},
typeToComponentType(type) {
// 将fieldType类型统一转换为公共组件判定类型
let formType = ''
......
......@@ -13,7 +13,8 @@
<view class="line-view"></view>
<u-tr class="u-tr" v-for="(item, index) in list" :key="index">
<u-td class="u-td" v-for="(value, key) in titles" :key="key">
<text :class="['tab-th-txt', {'left': key == firstKey}]">{{item[key]}}</text>
<u-input v-if="key == 'useLength'" @blur="handleBlur(item)" @focus="handleFocus(item)" type="digit" :placeholder="null" v-model="item[key]" placeholder-style="color: #999999;font-size:26rpx" input-align="center" :clearable="false"><u-icon name="edit"></u-icon></u-input>
<text v-else :class="['tab-th-txt', {'left': key == firstKey}]">{{item[key]}}</text>
</u-td>
</u-tr>
</u-table>
......@@ -80,22 +81,12 @@
};
},
titles() {
if(this.isMaterial){
return {
matName: '材料名称',
matUnit: '单位',
freeLength: '免费量',
unitAmt: '单价/元',
useLength: '用量'
}
}else{
return {
matName: '工艺名称',
matUnit: '单位',
freeLength: '免费量',
unitAmt: '单价/元',
useLength: '用量'
}
return {
matName: this.isMaterial ? '工艺名称' : '材料名称',
matUnit: '单位',
freeLength: '免费量',
unitAmt: '单价/元',
useLength: '用量'
}
},
thStyle() {
......@@ -148,6 +139,15 @@
self.formatServiceMoreList(data)
}
});
/*
// 测试数据
var item = {matName: '碳纤维',
matUnit: '米',
freeLength: 4,
unitAmt: '2',
useLength: 6}
this.list = [{...item}, {...item}, {...item}, {...item}]
*/
},
created() {
},
......@@ -174,6 +174,16 @@
}
})
},
handleBlur(item) { // 失去焦点如果没输入用原先的值
if (!item.useLength) {
item.useLength = item.temp
}
},
handleFocus(item) { // 点击清空
item.temp = item.useLength;
item.useLength = ''
},
/* 其他添加新的 */
handleAdd() {
this.other.push({
......
<template>
<view>
<view class="contentView">
<u-image class="pic" :src="files[0]" bg-color="transparent" @click="showPreviewFn"></u-image>
<!-- <image class="pic" :src="files[0]" v-lazy mode="aspectFit"></image> -->
</view>
<view class="bottomView">
<image class="btn" :src="btn_remake" @click="$u.throttle(remakePhoto, 3000)"></image>
<image class="btn" :src="btn_continue" @click="$u.throttle(continuePhoto, 3000)"></image>
</view>
<image class="btn finish" src="/static/photo/finish.png" @click="$u.throttle(finishPhoto, 3000)"></image>
</view>
</template>
<script>
import qiniup from '@/components/upload/qiniup';
const app = getApp()
export default {
mixins: [qiniup],
data() {
return {
protocolContent: '',
btn_remake: 'https://qn-static.banshouhui.com/take_order/photo/remake.png',
btn_continue: '/static/photo/continue.png',
standardId: '',
images: [],
files: [],
fileMaps: [],
keys: [],
token: '',
product: '',
}
},
onLoad(e) {
// 获取照片选项对象
const product = app.globalData.photo.product
this.product = `?brandId=${product.brandId}&brand=${product.brandName}&classifyId=${product.classifyId}&systemId=${product.systemId}`
if(app.globalData.photo.currentItem) {
// 获取规格Id
this.standardId = app.globalData.photo.currentItem._id
}
getApp().trackPage('照片预览页')
const globalTempPath = getApp().globalData.photo.tempPath
if(globalTempPath && globalTempPath.mixWater){
this.files = [globalTempPath.mixWater]
}
if(e.standardId) {
this.standardId = e.standardId
}
this.token = this.vuex_token
},
methods: {
// 保存照片到本地
async saveTempToLocal(tempImagePath) {
//has_origin //是否保存原图
let that = this
const photo = getApp().globalData.photo
if(!photo.tempPath){
return
}
let path = ''
if(photo.tempPath.origin && photo.waterSetting && photo.waterSetting.has_origin){
// 保存原图到本地
path = photo.tempPath.origin
let result = await this.saveLocal(path)
if(result){
uni.showToast({
icon: 'none',
title: '已将照片原图保存到本地相册'
})
}
}
if(photo.currentItem){
photo.currentItem.imageList.unshift(photo.tempPath.mixWater)
}
// if(photo.productList && photo.productList[photo.topIndex]){
// const topArr = photo.productList[photo.topIndex]
// if(topArr[photo.itemIndex]){
// topArr[photo.itemIndex].imageList.push(photo.tempPath.mixWater)
// }
// }
// photo.
if(photo.tempPath.mixWater){
// 保存水印处理图片到本地
path = photo.tempPath.mixWater
let result1 = await this.saveLocal(path)
if(result1){
uni.showToast({
icon: 'none',
title: '已将水印图片保存到本地相册'
})
}
}
},
saveLocal(path){
return new Promise((resolve,reject)=>{
uni.saveImageToPhotosAlbum({
filePath: path,
success() {
resolve(true)
},
fail() {
reject('保存失败')
}
})
})
},
showPreviewFn(img) {
uni.previewImage({
current: 0,
urls: this.files
});
},
// 重拍图片
remakePhoto() {
uni.navigateBack({
delta:1
})
},
finishPhoto(){
const photo = getApp().globalData.photo
photo.currentItemLength = 10
this.continuePhoto()
// 完成本项
// uni.navigateBack({
// delta:2
// })
},
// 确认图片
continuePhoto() {
let self = this
uni.showLoading({
title:'图片保存中…'
})
self.saveTempToLocal()
self.confirmUpload(true)
},
submitFile() {
let self = this
if(self.keys.length) {
for (let s of self.keys) {
self.$u.cloudApi.saveImage({
"token": self.token,
"standardId": self.standardId,
"url": s,
}).then(async res =>{
console.log(res, "云服务保存图片");
if(res.result.code) {
// TODO 参数是否要来回传递
const photo = getApp().globalData.photo
photo.currentItemLength = photo.currentItemLength + 1
uni.hideLoading()
// 当前项的图片显示
// 拍照项张数目增加 等于10张
if(photo.currentItemLength<10){
uni.navigateBack({
delta:1
})
}else{
uni.navigateBack({
delta:2
})
}
// let timer = setTimeout(()=>{
// if(photo.currentItemLength<10){
// uni.navigateBack({
// delta:1
// })
// }else{
// uni.navigateBack({
// delta:2
// })
// }
// },2000)
} else {
uni.showToast({
title:'图片上传失败 '+ res.result.msg
})
}
})
}
}
},
downloadImages() {
let self = this;
for (let url of this.images) {
uni.downloadFile({
url: url, //仅为示例,并非真实的资源
success(res) {
// 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
if (res.statusCode === 200) {
self.files.push(res.tempFilePath)
}
},
fail(e) {
}
})
}
},
}
}
</script>
<style lang="scss">
.contentView {
background-color: #333333;
/* padding-top: 120rpx; */
padding-bottom:228rpx;
height: 100vh;
display: flex;
flex-direction: column;
}
/deep/ .u-image{
height:100vh !important;
}
/deep/ .u-image__loading{
background-color: transparent!important;
}
/deep/ .u-image__error{
background-color: transparent!important;
}
.pic {
flex:1;
width: 100%;
/* height:auto */
/* height: 760rpx; */
}
.bottomView {
box-shadow: 0 0 1rpx 6rpx rgba(255,255,255,0.05);
background-color: #333333;
width: 100%;
padding:70rpx 0;
position: fixed;
bottom: 0;
display: flex;
justify-content: space-around;
align-items: center;
.btn{
display: block;
width: 200rpx;
height: 88rpx;
}
}
.btn{
display: block;
width: 232rpx;
height: 80rpx;
&.finish{
position: fixed;
top:30rpx;
right:30rpx;
}
}
</style>
<template>
<view>
<view class="contentView">
<u-image class="pic" :src="files[0]" bg-color="transparent" @click="showPreviewFn"></u-image>
<!-- <image class="pic" :src="files[0]" v-lazy mode="aspectFit"></image> -->
</view>
<view class="bottomView">
<image class="btn" :src="btn_remake" @click="$u.throttle(remakePhoto, 3000)"></image>
<image class="btn" :src="btn_continue" @click="$u.throttle(continuePhoto, 3000)"></image>
</view>
<image class="btn finish" src="/static/photo/finish.png" @click="$u.throttle(finishPhoto, 3000)"></image>
</view>
</template>
<script>
import qiniup from '@/components/upload/qiniup';
const app = getApp()
export default {
mixins: [qiniup],
data() {
return {
protocolContent: '',
btn_remake: 'https://qn-static.banshouhui.com/take_order/photo/remake.png',
btn_continue: '/static/photo/continue.png',
standardId: '',
images: [],
files: [],
fileMaps: [],
keys: [],
token: '',
product: '',
}
},
onLoad(e) {
// 获取照片选项对象
const product = app.globalData.photo.product
this.product = `?brandId=${product.brandId}&brand=${product.brandName}&classifyId=${product.classifyId}&systemId=${product.systemId}`
if(app.globalData.photo.currentItem) {
// 获取规格Id
this.standardId = app.globalData.photo.currentItem._id
}
getApp().trackPage('照片预览页')
const globalTempPath = getApp().globalData.photo.tempPath
if(globalTempPath && globalTempPath.mixWater){
this.files = [globalTempPath.mixWater]
}
if(e.standardId) {
this.standardId = e.standardId
}
this.token = this.vuex_token
},
methods: {
// 保存照片到本地
async saveTempToLocal(tempImagePath) {
//has_origin //是否保存原图
let that = this
const photo = getApp().globalData.photo
if(!photo.tempPath){
return
}
let path = ''
if(photo.tempPath.origin && photo.waterSetting && photo.waterSetting.has_origin){
// 保存原图到本地
path = photo.tempPath.origin
let result = await this.saveLocal(path)
if(result){
uni.showToast({
icon: 'none',
title: '已将照片原图保存到本地相册'
})
}
}
if(photo.currentItem){
photo.currentItem.imageList.unshift(photo.tempPath.mixWater)
}
// if(photo.productList && photo.productList[photo.topIndex]){
// const topArr = photo.productList[photo.topIndex]
// if(topArr[photo.itemIndex]){
// topArr[photo.itemIndex].imageList.push(photo.tempPath.mixWater)
// }
// }
// photo.
if(photo.tempPath.mixWater){
// 保存水印处理图片到本地
path = photo.tempPath.mixWater
let result1 = await this.saveLocal(path)
if(result1){
uni.showToast({
icon: 'none',
title: '已将水印图片保存到本地相册'
})
}
}
},
saveLocal(path){
return new Promise((resolve,reject)=>{
uni.saveImageToPhotosAlbum({
filePath: path,
success() {
resolve(true)
},
fail() {
reject('保存失败')
}
})
})
},
showPreviewFn(img) {
uni.previewImage({
current: 0,
urls: this.files
});
},
// 重拍图片
remakePhoto() {
uni.navigateBack({
delta:1
})
},
finishPhoto(){
const photo = getApp().globalData.photo
photo.currentItemLength = 10
this.continuePhoto()
// 完成本项
// uni.navigateBack({
// delta:2
// })
},
// 确认图片
continuePhoto() {
let self = this
uni.showLoading({
title:'图片保存中…'
})
self.saveTempToLocal()
self.confirmUpload(true)
},
submitFile() {
let self = this
if(self.keys.length) {
for (let s of self.keys) {
self.$u.cloudApi.saveImage({
"token": self.token,
"standardId": self.standardId,
"url": s,
}).then(async res =>{
console.log(res, "云服务保存图片");
if(res.result.code) {
// TODO 参数是否要来回传递
const photo = getApp().globalData.photo
photo.currentItemLength = photo.currentItemLength + 1
uni.hideLoading()
// 当前项的图片显示
// 拍照项张数目增加 等于10张
if(photo.currentItemLength<10){
uni.navigateBack({
delta:1
})
}else{
uni.navigateBack({
delta:2
})
}
// let timer = setTimeout(()=>{
// if(photo.currentItemLength<10){
// uni.navigateBack({
// delta:1
// })
// }else{
// uni.navigateBack({
// delta:2
// })
// }
// },2000)
} else {
uni.showToast({
title:'图片上传失败 '+ res.result.msg
})
}
})
}
}
},
downloadImages() {
let self = this;
for (let url of this.images) {
uni.downloadFile({
url: url, //仅为示例,并非真实的资源
success(res) {
// 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
if (res.statusCode === 200) {
self.files.push(res.tempFilePath)
}
},
fail(e) {
}
})
}
},
}
}
</script>
<style lang="scss">
.contentView {
background-color: #333333;
/* padding-top: 120rpx; */
padding-bottom:228rpx;
height: 100vh;
display: flex;
flex-direction: column;
}
/deep/ .u-image{
height:100vh !important;
}
/deep/ .u-image__loading{
background-color: transparent!important;
}
/deep/ .u-image__error{
background-color: transparent!important;
}
.pic {
flex:1;
width: 100%;
/* height:auto */
/* height: 760rpx; */
}
.bottomView {
box-shadow: 0 0 1rpx 6rpx rgba(255,255,255,0.05);
background-color: #333333;
width: 100%;
padding:70rpx 0;
position: fixed;
bottom: 0;
display: flex;
justify-content: space-around;
align-items: center;
.btn{
display: block;
width: 200rpx;
height: 88rpx;
}
}
.btn{
display: block;
width: 232rpx;
height: 80rpx;
&.finish{
position: fixed;
top:30rpx;
right:30rpx;
}
}
</style>
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