Commit 6871ae58 authored by Morson's avatar Morson
parents 20020e2e a7d87ed3
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
} }
if (ENV_VAR) { if (ENV_VAR) {
process.uniEnv = {}; process.uniEnv = {};
process.uniEnv['node_env'] = NODE_ENV; process.uniEnv['node_env'] = NODE_ENV;
for (let key in ENV_VAR) { for (let key in ENV_VAR) {
process.uniEnv[key] = ENV_VAR[key]; process.uniEnv[key] = ENV_VAR[key];
} }
......
...@@ -77,7 +77,7 @@ export default { ...@@ -77,7 +77,7 @@ export default {
// 系统自动登录::每次运行小程序重新获取用户信息 // 系统自动登录::每次运行小程序重新获取用户信息
await this.autoLogin(); await this.autoLogin();
this.deleteTempImg() //this.deleteTempImg()
}, },
onShow: async function () { onShow: async function () {
// 应用启动,或从后台进入前台显示 // 应用启动,或从后台进入前台显示
......
This diff is collapsed.
...@@ -164,6 +164,9 @@ ...@@ -164,6 +164,9 @@
.text-title { .text-title {
font-size: 26rpx; font-size: 26rpx;
color: #333333; color: #333333;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
} }
} }
</style> </style>
...@@ -48,8 +48,8 @@ ...@@ -48,8 +48,8 @@
}; };
}, },
computed: { computed: {
cusQrcode() { cusQrcode() {
return process.uniEnv.qn_base_url + 'erweima-bg.png' return process.uniEnv.qn_base_url + (this.isMine ? 'erweima-rk.png' : 'erweima-bg.png')
}, },
minekefutuImage() { minekefutuImage() {
return process.uniEnv.qn_base_url + this.imageName return process.uniEnv.qn_base_url + this.imageName
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
complete() {} complete() {}
}); });
}, },
download() { download() {
let self = this let self = this
uni.downloadFile({ //获得二维码的临时地址 uni.downloadFile({ //获得二维码的临时地址
url: self.cusQrcode, url: self.cusQrcode,
...@@ -150,8 +150,6 @@ ...@@ -150,8 +150,6 @@
color: #666666; color: #666666;
width: 100%; width: 100%;
margin-top: 10rpx; margin-top: 10rpx;
display: flex;
align-items: flex-end;
.title-text { .title-text {
font-weight: bold; font-weight: bold;
......
...@@ -87,7 +87,6 @@ ...@@ -87,7 +87,6 @@
if(photo.tempPath.mixWater){ if(photo.tempPath.mixWater){
// 保存水印处理图片到本地 // 保存水印处理图片到本地
path = photo.tempPath.mixWater path = photo.tempPath.mixWater
console.log("path", path)
let result1 = await this.saveLocal(path) let result1 = await this.saveLocal(path)
if(result1){ if(result1){
uni.showToast({ uni.showToast({
......
import uploader from '@/plugins/uploader/index.js' import uploader from '@/plugins/uploader/index.js'
const globalUrl = process.uniEnv || {} const globalUrl = process.uniEnv || {}
const randomChar = function(l, url = "") { const randomChar = function(l, url = "") {
const x = "0123456789qwertyuioplkjhgfdsazxcvbnm"; const x = "0123456789qwertyuioplkjhgfdsazxcvbnm";
let tmp = ""; let tmp = "";
let time = new Date(); let time = new Date();
for (let i = 0; i < l; i++) { for (let i = 0; i < l; i++) {
tmp += x.charAt(Math.ceil(Math.random() * 100000000) % x.length); tmp += x.charAt(Math.ceil(Math.random() * 100000000) % x.length);
} }
return ( return (
"file/" + "file/" +
url + url +
time.getTime() + time.getTime() +
tmp tmp
); );
} }
export default { export default {
name: 'upload', name: 'upload',
components: {}, components: {},
data() { data() {
return { return {
imgList:[], imgList:[],
// 上传文件种类:0--头像、1--证件、2--身份证 // 上传文件种类:0--头像、1--证件、2--身份证
categories: ['avatar', 'cert', 'id'], categories: ['avatar', 'cert', 'id'],
}; };
}, },
created() { created() {
// this.initQiniu() // this.initQiniu()
}, },
methods: { methods: {
async uploadPath(type){ async uploadPath(type){
// 可以直接上传path // 可以直接上传path
const self = this const self = this
let imgList = [] let imgList = []
let options = { let options = {
files:[] // 文件路径 files:[] // 文件路径
} }
if(type==='qiniu'){ if(type==='qiniu'){
let res = await uploader.qnFileUpload(options) let res = await uploader.qnFileUpload(options)
return return
} }
let res = await uploader.urlFileUpload(options) let res = await uploader.urlFileUpload(options)
}, },
/** /**
* 存储图片到任务队列 * 存储图片到任务队列
* @param {Array} files 图片路径 * @param {Array} files 图片路径
*/ */
async saveToTask(files) { async saveToTask(files) {
// 生成key返回,然后把key放到异步上传的任务队列 // 生成key返回,然后把key放到异步上传的任务队列
let lists = [] let lists = files.map(v => {
for (let i = 0; i < files.length; i++) { return {
const path = files[i] key: randomChar(10),
const row = await this.saveFiles(path) path: v,
lists.push(row) src: ''
} }
})
const data = this.uploadTask // for (let i = 0; i < files.length; i++) {
const saveLists = data.concat(lists) // const path = files[i]
this.$u.vuex('uploadTask', saveLists) // const row = await this.saveFiles(path)
return lists // lists.push(row)
}, // }
/** const data = this.uploadTask
* 选择图片 const saveLists = data.concat(lists)
* @param {Object} data option this.$u.vuex('uploadTask', saveLists)
*/ return lists
async chooseImg(data){ },
const self = this /**
return new Promise((resolve, reject) => { * 选择图片
uni.chooseImage({ * @param {Object} data option
count: data.count || 9, //默认9 */
sizeType: data.sizeType || ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 async chooseImg(data){
sourceType: data.sourceType || ['album', 'camera'], //从相册选择 const self = this
success: function(res) { return new Promise((resolve, reject) => {
const lists = self.saveToTask(res.tempFilePaths) uni.chooseImage({
resolve(lists) count: data.count || 9, //默认9
}, sizeType: data.sizeType || ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
fail: err => { sourceType: data.sourceType || ['album', 'camera'], //从相册选择
console.log("err", err) success: function(res) {
} const lists = self.saveToTask(res.tempFilePaths)
}) resolve(lists)
}) },
}, fail: err => {
// 保存图片到本地 console.log("err", err)
saveFiles(path) { }
return new Promise((resolve, reject) => { })
uni.saveFile({ })
tempFilePath: path, },
success(e) { // 保存图片到本地
const { savedFilePath } = e saveFiles(path) {
const img = { return new Promise((resolve, reject) => {
key: randomChar(10), uni.saveFile({
path: savedFilePath, tempFilePath: path,
src: '' success(e) {
} const { savedFilePath } = e
resolve(img) const img = {
}, key: randomChar(10),
fail: reject path: savedFilePath,
}) src: ''
}) }
}, resolve(img)
/** },
* 上传图片公用组件 fail: reject
* @param {Object} type 文件上传方式 })
* @param {Object} attr 文件属性:图片种类[category](身份证、证件、头像); })
* 图片上传其他配置[options】(如,选择图片或拍摄options.consourceType,['album', 'camera'];)其他 },
*/ /**
async chooseImage(type, attr={}){ * 上传图片公用组件
const self = this * @param {Object} type 文件上传方式
let imgList = [] * @param {Object} attr 文件属性:图片种类[category](身份证、证件、头像);
if(type==='qiniu'){ * 图片上传其他配置[options】(如,选择图片或拍摄options.consourceType,['album', 'camera'];)其他
// 图片种类 */
let category = attr && attr.category || self.categories[0] async chooseImage(type, attr={}){
let config = attr && attr.options || {} // 图片上传参数配置 const self = this
// 七牛上传 let imgList = []
let options = { if(type==='qiniu'){
onProgressUpdate(res){ // 图片种类
let item = { let category = attr && attr.category || self.categories[0]
path:res.path, // 图片临时缓存路径 let config = attr && attr.options || {} // 图片上传参数配置
key:'', // 图片上传成功后相对路径 // 七牛上传
src:'', // 访问图片的绝对路径 let options = {
progress:res.progress // 图片上传进度 onProgressUpdate(res){
} let item = {
if(res.fileIndex<imgList.length){ path:res.path, // 图片临时缓存路径
imgList[res.fileIndex].progress = res.progress key:'', // 图片上传成功后相对路径
}else{ src:'', // 访问图片的绝对路径
imgList.push(item) progress:res.progress // 图片上传进度
} }
imgList[res.fileIndex] if(res.fileIndex<imgList.length){
self.imgList = imgList imgList[res.fileIndex].progress = res.progress
// 多文件上传每个文件进度条 }else{
}, imgList.push(item)
onEachUpdate(res){ }
// 多文件上传每个文件上传成功触发 imgList[res.fileIndex]
if(imgList.length>res.fileIndex){ self.imgList = imgList
imgList[res.fileIndex].key = res.url // 多文件上传每个文件进度条
imgList[res.fileIndex].src = uploader.qiniuTokenObj.visitPrefix + res.url },
} onEachUpdate(res){
self.imgList = imgList // 多文件上传每个文件上传成功触发
}, if(imgList.length>res.fileIndex){
cardType: category, imgList[res.fileIndex].key = res.url
...config imgList[res.fileIndex].src = uploader.qiniuTokenObj.visitPrefix + res.url
} }
self.imgList = imgList
// 不需要进度条等可直接获取 },
let res = await uploader.qnImgUpload(options) cardType: category,
// let imgList = res.map(item=>{ ...config
// return { }
// key:item,
// src:uploader.qiniuTokenObj.visitPrefix + item // 不需要进度条等可直接获取
// } let res = await uploader.qnImgUpload(options)
// }) // let imgList = res.map(item=>{
// this.imgList = imgList // return {
return // key:item,
} // src:uploader.qiniuTokenObj.visitPrefix + item
// 本地服务上传 // }
let res = await uploader.urlUpload() // })
this.imgList = res // this.imgList = imgList
}, return
perviewImg(index) { }
let urls = [] // 本地服务上传
this.imgList.map(item => { let res = await uploader.urlUpload()
urls.push(item.src) this.imgList = res
}) },
uni.previewImage({ perviewImg(index) {
current: index, let urls = []
urls: urls this.imgList.map(item => {
}); urls.push(item.src)
}, })
removeImg(index) { uni.previewImage({
this.imgList.splice(index, 1) current: index,
// this.$emit('image-change', this.imgList) //将图片回传父页面 urls: urls
}, });
},
} removeImg(index) {
} this.imgList.splice(index, 1)
// this.$emit('image-change', this.imgList) //将图片回传父页面
},
}
}
...@@ -32,7 +32,7 @@ export default { ...@@ -32,7 +32,7 @@ export default {
} }
}) })
uni.setStorageSync('delImg', delImg) // 已上传完的图片,会在启动系统的时候做一次清理 // uni.setStorageSync('delImg', delImg) // 已上传完的图片,会在启动系统的时候做一次清理
that.$u.vuex('uploadTask', newTask) that.$u.vuex('uploadTask', newTask)
} }
......
...@@ -4,8 +4,7 @@ ...@@ -4,8 +4,7 @@
<text class="title-view">学习</text> <text class="title-view">学习</text>
</u-navbar> </u-navbar>
<image :src="bannerImage" mode="" class="banner"></image> <image :src="bannerImage" mode="" class="banner"></image>
<u-tabs-swiper bg-color="#F4F5F7" inactive-color="#999999" font-size="28" ref="uTabs" :list="tabs" <u-tabs-swiper bg-color="#F4F5F7" inactive-color="#999999" font-size="28" ref="uTabs" :list="tabs" :current="current" @change="tabsChange" :is-scroll="false" :bar-width="52" swiperWidth="750"></u-tabs-swiper>
:current="current" @change="tabsChange" :is-scroll="false" :bar-width="52" swiperWidth="750"></u-tabs-swiper>
<swiper class="swiper_group" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish"> <swiper class="swiper_group" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish">
<swiper-item @touchmove.stop.prevent="stopTouchMove"> <swiper-item @touchmove.stop.prevent="stopTouchMove">
<scroll-view scroll-y style="height:100%;width:100%;"> <scroll-view scroll-y style="height:100%;width:100%;">
...@@ -410,7 +409,6 @@ export default { ...@@ -410,7 +409,6 @@ export default {
isReflesh: true, isReflesh: true,
triggered: false, triggered: false,
_freshing: false, _freshing: false,
isOnLoad: 0
}; };
}, },
onLoad(param) { onLoad(param) {
...@@ -428,14 +426,13 @@ export default { ...@@ -428,14 +426,13 @@ export default {
}, },
}, },
onShow: function (param) { onShow: function (param) {
this.isOnLoad = 1;
try { try {
if (param.tabs) { if (param.tabs) {
this.current = param.tabs; this.current = param.tabs;
this.swiperCurrent = param.tabs; this.swiperCurrent = param.tabs;
} }
} catch (e) {} } catch (e) {}
if (this.current == 1 ||this.current == 2 || this.current == 3) { if (this.current == 2 || this.current == 3) {
this.tabsChange(this.current); this.tabsChange(this.current);
} }
}, },
...@@ -636,10 +633,8 @@ export default { ...@@ -636,10 +633,8 @@ export default {
}, },
//考核认证,通用认证,考试通过or未通过查询接口请求 //考核认证,通用认证,考试通过or未通过查询接口请求
getUserExamInfo() { getUserExamInfo() {
uni.showLoading({ uni.hideLoading();
title: "请稍候",
});
let that = this; let that = this;
let token = that.vuex_token; let token = that.vuex_token;
let length = this.examList.length; let length = this.examList.length;
...@@ -662,14 +657,16 @@ export default { ...@@ -662,14 +657,16 @@ export default {
this.examList[i].status = this.examList[i].status =
examResult != "" ? examResult : "未通过"; examResult != "" ? examResult : "未通过";
//动态获取条件 //动态获取条件
let ruleDisc = res.data.ruleDisc; let ruleDisc = res.data.ruleDisc;
let targetIndex = ruleDisc.indexOf('('); let targetIndex = ruleDisc.indexOf("(");
if(targetIndex){ if (targetIndex) {
this.examList[i].condition = ruleDisc.substr(targetIndex + 1).replace(')', ''); this.examList[i].condition = ruleDisc
.substr(targetIndex + 1)
.replace(")", "");
} }
// examStatus 用户考试状态 0考试中 1考试完成 2未参与 // examStatus 用户考试状态 0考试中 1考试完成 2未参与
that.exam = res.data; that.exam = res.data;
if (res.data.examStatus == 2) { if (res.data.examStatus == 2) {
......
...@@ -53,13 +53,12 @@ ...@@ -53,13 +53,12 @@
}, },
avatar() { avatar() {
return this.vuex_settled && this.vuex_settled.avatar return this.vuex_settled && this.vuex_settled.avatar
}, },
name() { name() {
return this.settled && (this.settled.id_card_name return (this.settled && (this.settled.id_card_name || this.settled.name)) || (this.vuex_user && (this.vuex_user.name || this.vuex_user.loginName))
|| this.settled.nickname || this.settled.name)
}, },
mobile() { mobile() {
return this.settled && this.settled.mobile return (this.settled && this.settled.mobile) || (this.vuex_user && this.vuex_user.mobile)
}, },
items() { items() {
return [ return [
......
...@@ -158,7 +158,7 @@ export default { ...@@ -158,7 +158,7 @@ export default {
if (res.data.code == 200) { if (res.data.code == 200) {
if (res.data.data.ruleDisc) { if (res.data.data.ruleDisc) {
var str = res.data.data.ruleDisc; var str = res.data.data.ruleDisc;
let strArr = str.split('(')[0].split(','); let strArr = str.split("(")[0].split(",");
this.desc.title = strArr[0]; this.desc.title = strArr[0];
this.desc.score = strArr[1]; this.desc.score = strArr[1];
this.desc.time = strArr[2]; this.desc.time = strArr[2];
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
<u-navbar back-icon-color="#000000" :background="background" title-color="#000000" :border-bottom="false"> <u-navbar back-icon-color="#000000" :background="background" title-color="#000000" :border-bottom="false">
</u-navbar> </u-navbar>
<view class="uni-padding-wrap uni-common-mt"> <view class="uni-padding-wrap uni-common-mt">
<view><video object-fit="cover" class="course-video" id="courseVideo" :src="courseSrc" <view><video object-fit="fill" class="course-video" id="courseVideo" :src="courseSrc"
:options="playerOptions" :playsinline="true" @play="playCourse" @error="videoErrorCallback" :options="playerOptions" :playsinline="true" @play="playCourse" @error="videoErrorCallback"
@ready="playerReadied" @timeupdate="onPlayerTimeupdate($event)" autoplay="true" @ready="playerReadied" @timeupdate="onPlayerTimeupdate($event)" @ended="setLearned()" autoplay="true"
controls></video></view> controls></video></view>
<view class="title-content"> <view class="title-content">
<view class="item-content"> <view class="item-content">
...@@ -149,6 +149,16 @@ ...@@ -149,6 +149,16 @@
this.scrollValue = 0 this.scrollValue = 0
} }
}, },
setLearned() {
let param = {
section_id: this.section_id,
video_time: this.videoTotalTime,
status: 1
};
this.$u.api.updateLearnCourses(param).then((res) => {}).catch((err) => {
console.log(err)
});
},
onPlayerTimeupdate(player) { onPlayerTimeupdate(player) {
let intCurrentTime = parseInt(player.detail.currentTime); let intCurrentTime = parseInt(player.detail.currentTime);
this.updateLearnedStatus(intCurrentTime) this.updateLearnedStatus(intCurrentTime)
...@@ -247,20 +257,17 @@ ...@@ -247,20 +257,17 @@
video_time: nowTime, video_time: nowTime,
status: this.status status: this.status
}; };
nowTime = parseInt(nowTime);
if(nowTime == this.nowTime){ if(nowTime == this.nowTime){
return return
} }
this.nowTime = nowTime; this.nowTime = nowTime;
if(this.status == 1 || nowTime < 5){ if(nowTime % this.howTimeToUpdateLearnedStatus != 0){
//固定时间更新一次
return return
} }
if(nowTime == this.videoTotalTime){ if(this.status == 1){
param.status = this.status = 1 //已学再学时间设置为结束时间
}else if(nowTime % this.howTimeToUpdateLearnedStatus != 0){ param.video_time = this.videoTotalTime
return
}else{
param.status = 0;
} }
this.$u.api.updateLearnCourses(param).then((res) => {}).catch((err) => { this.$u.api.updateLearnCourses(param).then((res) => {}).catch((err) => {
console.log(err) console.log(err)
......
This diff is collapsed.
...@@ -159,7 +159,7 @@ export default { ...@@ -159,7 +159,7 @@ export default {
label: "电工证照", label: "电工证照",
required: true, required: true,
maxImgs: 1, maxImgs: 1,
tips: "上传电工证证照片,图片大小不大于3M", tips: "上传电工证或特种作业操作证",
imgs: [], imgs: [],
placeholderImages: [process.uniEnv.qn_base_url + 'diangong.png'] placeholderImages: [process.uniEnv.qn_base_url + 'diangong.png']
}, },
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
4.有充电桩安装经验优先;' 4.有充电桩安装经验优先;'
}, { }, {
title: '结算价格', title: '结算价格',
content: '1.不同车企品牌结算价格不一,675元-1890元不等;\n\ content: '1.不同车企品牌结算价格不一,600元-2000元不等;\n\
2.结算价格为包工包料价,安装材料根据车企品牌规格自行采购(电缆、空开、漏保);\n\ 2.结算价格为包工包料价,安装材料根据车企品牌规格自行采购(电缆、空开、漏保);\n\
3.结算账期:周结50%,剩余50%次月20号结算;' 3.结算账期:周结50%,剩余50%次月20号结算;'
}, { }, {
......
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
'icon-prompt.png' 'icon-prompt.png'
}, },
erweimaImage() { erweimaImage() {
return process.uniEnv.qn_base_url + 'erweima-bg.png' return process.uniEnv.qn_base_url + 'erweima-rk.png'
}, },
}, },
onLoad(e) { onLoad(e) {
......
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