Commit c3a4cfce authored by 刘用法's avatar 刘用法

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

parents 3b42c6ed 172d2b29
......@@ -9,6 +9,7 @@ const UNI_APP = {
// apiUrl: 'http://apidoc.banshouhui.com:3000/mock/31', // mock端域名请求头
},
qn_base_url: 'https://qn-static.banshouhui.com/self-support/',
qn_asset_url: 'http://deudn.c.pp.cc/',
qn_asset_url: 'http://deudn.c.pp.cc/',
argoDebugMode: 1
}
module.exports = UNI_APP;
......@@ -8,7 +8,8 @@ const UNI_APP = {
apiUrl:'https://system.banshouhui.com', //java端域名请求头
},
qn_base_url: 'https://qn-static.banshouhui.com/self-support/',
qn_asset_url: 'https://qn-static.banshouhui.com'
qn_asset_url: 'https://qn-static.banshouhui.com',
argoDebugMode: 0
}
module.exports = UNI_APP;
......@@ -8,6 +8,7 @@ const UNI_APP = {
apiUrl: 'https://system.dev.banshouhui.com', //java端域名请求头
},
qn_base_url: 'https://qn-static.banshouhui.com/self-support/',
qn_asset_url: 'https://qn-static.banshouhui.com'
qn_asset_url: 'https://qn-static.banshouhui.com',
argoDebugMode: 1
}
module.exports = UNI_APP;
......@@ -245,7 +245,7 @@ export default {
let userInfo = {
mobile: user.mobile,
userfrom_id: user.uid,
userfrom: "家维广场",
userfrom: "自营平台",
avatar: user.avatar,
nickname: user.nickname,
username: user.username,
......
......@@ -2,10 +2,6 @@
<template>
<view>
<view class="file-box">
<!-- <view class="u-flex">
<view class="txt u-flex-1">{{item.fieldsTitle}}</view>
<u-icon name="arrow-right" color="#666" size="28"></u-icon>
</view> -->
<view class="pics u-flex u-flex-wrap">
<view class="img-list" v-for="(item,index) in imgList" :key="index">
<u-image class="pic" width="160" height="160" :src="item.path ? item.path : item.src + '?imageView2/1/w/100/h/100/q/75'" :border-radius="10" @click.stop="prviewImage(item,index)"></u-image>
......@@ -14,13 +10,14 @@
<view class="icon-del rotate"></view>
</view>
</view>
<view class="img-list">
<slot></slot>
<!-- <view class="img-list">
<u-image class="pic" width="160rpx" height="160rpx" :border-radius="10" @click="selectUpload" :src="uploadImage"></u-image>
</view>
</view> -->
</view>
<u-action-sheet :list="list" v-model="maskShow" :cancel-btn="true" @click="uploadSelect"></u-action-sheet>
<!-- <u-action-sheet :list="list" v-model="maskShow" :cancel-btn="true" @click="uploadSelect"></u-action-sheet> -->
</view>
<take-photo v-if="takeStatus" @close="closeTake" :upload="false" :currentItem="currentItemDate"></take-photo>
<!-- <take-photo v-if="takeStatus" @close="closeTake" :upload="false" :currentItem="currentItemDate"></take-photo> -->
</view>
</template>
......@@ -86,6 +83,26 @@
}
},
methods: {
setTmpValue(values) {
this.imgList = this.imgList.concat(values)
const dataValue = this.imgList.map(v => v.src)
this.valueChange(dataValue)
},
setValue() {
const dataValue = this.imgList.map(item => item.src)
this.valueChange(dataValue)
},
prviewImage(item, index) {
uni.previewImage({
urls: [item.path ? item.path : item.src],
current: index
});
},
delFile(index) {
this.imgList.splice(index, 1)
this.setValue()
},
/*
selectUpload(){
if (this.imgList.length === 10) {
return this.$refs.uToast.show({
......@@ -122,18 +139,6 @@
this.photograph()
this.getWatermark()
},
setTmpValue(values) {
this.imgList = this.imgList.concat(values)
const dataValue = values.map(v => v.key)
this.valueChange(dataValue)
},
setValue() {
const dataValue = []
this.imgList.map(item=>{
dataValue.push(item.src)
})
this.valueChange(dataValue)
},
closeTake(val) {
if(val && val.length > 0){
// val.forEach(item=>{
......@@ -164,16 +169,6 @@
// }
// uploader.qnFileUpload(options)
},
prviewImage(item, index) {
uni.previewImage({
urls: [item.path ? item.path : item.src],
current: index
});
},
delFile(index) {
this.imgList.splice(index, 1)
this.setValue()
},
photograph(){// 获取拍照规范接口
let self = this
let param = {"partnerCompanyId":self.partnerCompanyId,
......@@ -201,7 +196,7 @@
console.log("获取水印备注异常",res.data.message)
}
});
}
}*/
}
}
</script>
......
......@@ -8,7 +8,7 @@
<view class="u-flex u-row-between picker-common">
<picker mode="selector" :value="index" range-key="label" :range="settings" @click="show = true" @change="pickerChange" class="u-flex-1">
<view class="txt">{{text}}</view>
<view class="txt">{{text || '请选择'}}</view>
</picker>
<u-icon class="input-icon" color="#2272FF" :name="show ? 'arrow-up' : 'arrow-down'"></u-icon>
</view>
......@@ -33,7 +33,8 @@
},
data() {
return {
show: false
show: false,
index: ''
}
},
computed: {
......@@ -89,8 +90,8 @@
this.valueChange(id)
},
pickerChange(data) {
const index = data.detail.value
const id = this.item.fieldsOptions[index].key
this.index = data.detail.value
const id = this.item.fieldsOptions[this.index].key
this.dataValue = id
this.valueChange(id)
},
......
......@@ -8,7 +8,7 @@
<u-picker v-model="showPicker" range-key="label" @columnchange="columnchange" :mode="isNotMulti?'selector':'multiSelector'" @confirm="pickerConfirm" :range="settings"></u-picker> -->
<view class="u-flex u-row-between picker-common">
<picker :mode="isNotMulti?'selector':'multiSelector'" :value="index" range-key="label" :range="settings" @click="showPicker = true" @change="pickerChange" class="txt u-flex-1">
<view>{{text}}</view>
<view>{{text || '请选择'}}</view>
</picker>
<u-icon class="input-icon" color="#2272FF" :name="showPicker ? 'arrow-up' : 'arrow-down'"></u-icon>
</view>
......
......@@ -8,7 +8,7 @@
<!-- <u-picker :params="params" v-model="showPicker" mode="time" @confirm="pickerConfirm"></u-picker> -->
<view class="u-flex u-row-between">
<picker mode="date" :value="dataValue" @change="bindDateChange" class="txt u-flex-1">
<view>{{dataValue}}</view>
<view>{{dataValue || '请选择时间'}}</view>
</picker>
<u-icon name="arrow-right" color="#666" size="28"></u-icon>
</view>
......@@ -18,7 +18,6 @@
<script>
import stringMixin from './stringMixin'
export default {
name: 'XhInput', // 新建 input
components: {},
mixins: [stringMixin],
props: {},
......
......@@ -17,7 +17,7 @@ uni.hideTabBar()
### Props
| 属性名 | 类型 | 默认值 | 可选值 | 说明 |
| :-: | :-: | :-: | :-: | :-: |
| update | Boolean | true | true/false | 是否默认上传 true:会自动上传好图片并返回绝对路径 false: 只返回临时路径,需要在父组件做上传动作 |
| upload | Boolean | true | true/false | 是否默认上传 true:会自动上传好图片并返回绝对路径 false: 只返回临时路径,需要在父组件做上传动作 |
| num | Number | 10 | 1-10 | 拍照数量,只能传1-10的正整数 |
| currentItem | Object | - | - | 对应的规范数据,用于获取示意图和水印,以及保存图片所需的ID **格式见下文** |
......@@ -67,10 +67,12 @@ uni.hideTabBar()
```javascript
import takePhoto from '@/components/take/index.vue'
import baseFile from '@/components/upload/index' // upload为false时需加上
export default {
components: {
'take-photo': takePhoto
},
mixins: [baseFile], // upload为false时需加上
data() {
return {
takeStatus: false,
......@@ -86,6 +88,11 @@ export default {
// 拍照完成或关闭相机
closeTake(images) {
this.takeStatus = false
// upload为false时处理
const files = images.map(v => v.path)
const value = await this.saveToTask(files)
console.log("value", value)
}
}
}
......
......@@ -48,10 +48,11 @@ export default {
async saveToTask(files) {
// 生成key返回,然后把key放到异步上传的任务队列
let lists = files.map(v => {
const key = randomChar(10)
return {
key: randomChar(10),
key: key,
path: v,
src: ''
src: key
}
})
// for (let i = 0; i < files.length; i++) {
......@@ -92,10 +93,11 @@ export default {
tempFilePath: path,
success(e) {
const { savedFilePath } = e
const key = randomChar(10)
const img = {
key: randomChar(10),
key: key,
path: savedFilePath,
src: ''
src: key
}
resolve(img)
},
......
......@@ -7,7 +7,7 @@ let argo ={
1 开启调试模式,数据不入库。类型:Number。
2 开启调试模式,数据入库。类型:Number。
*/
debugMode:0,
debugMode: process.uniEnv.argoDebugMode,
autoTrack:true,
uploadURL: 'https://argo.banshouhui.com/'
}
......
......@@ -674,7 +674,7 @@ export default {
}
if (res.data.examStatus == 1) {
that.examList[i].isComplete =
this.examList[i].status == "通过";
this.examList[i].status == "已通过";
that.examScore = res.data.examScore;
return;
}
......
<template>
<view class="backView">
<Examine :index="3">
<view class="bottom-padding" v-if="currentItem">
<view class="bottom-padding">
<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>
......@@ -70,7 +70,13 @@ export default {
userAnswerIds: "",
isStart: true,
currentNumber: 1,
currentItem: null,
currentItem: {
question: {
answerType: 1,
content: ""
},
answerList: {}
},
isSelect: false,
timeDefine: {
"time-id-2": 1800,
......@@ -89,6 +95,7 @@ export default {
timer: null,
isComplete: false, // 是否已经考试完成判定
examInfo: null,
isLoadQuestion: true
};
},
computed: {
......@@ -107,11 +114,15 @@ export default {
},
onLoad(e) {
this.examId = e.examId;
this.applyExam();
this.userExamId = e.userExamId;
this.getNext();
// this.applyExam();
// this.getUserExamInfo();
},
onUnload() {
clearTimeout(this.timer);
let key = 'exma-' + this.examId;
uni.setStorageSync(key, this.endTime);
},
methods: {
formatTimeToMini(timestamp) {
......@@ -335,11 +346,6 @@ export default {
(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",
},
......@@ -359,6 +365,20 @@ export default {
if (res.data.code == 200) {
that.currentItem = res.data.data;
that.progress = res.data.data.progress;
if(this.isLoadQuestion){
this.isLoadQuestion = false;
if(!res.data.data.isQuestion){
this.applyExam()
return
}
let key = 'exma-' + this.examId;
let limitTime = uni.getStorageSync(key);
console.log(limitTime);
// let limitTime = this.getLimitTime(that.progress);
// console.log(limitTime);
this.endTime = parseInt(limitTime);
this.currentTime = parseInt(limitTime * 1000);
}
if (res.data.data.isQuestion) {
let str = res.data.data.question.content;
var wz = str.indexOf(".");
......@@ -397,7 +417,12 @@ export default {
},
});
},
getLimitTime(progress){
let arr = progress.split('/');
let how = arr[0].replace(/[^0-9]/ig,"");
let total = arr[1].replace(/[^0-9]/ig,"");
return (total - how + 1) * this.currentTime;
},
handleData: function () {
this.currentItem.answerList.forEach((item, index) => {
item.isSelect = false;
......
......@@ -7,13 +7,13 @@
这是一场严肃的考试,请认真查看 规则,预祝您顺利通过考试!
</view>
<view class="text">
<text class="left">考试科目:</text><text style="color: #007aff">{{ desc.title }}</text>
<text class="left">考试科目:</text><text style="color: #007aff">{{ title }}</text>
</view>
<view class="text">
<text class="left">合格条件:</text><text>{{ desc.score }}</text>
<text class="left">合格条件:</text><text>{{ score }}</text>
</view>
<view class="text">
<text class="left">考试时间:</text><text>{{ desc.time }}</text>
<text class="left">考试时间:</text><text>{{ time }}</text>
</view>
<view class="text">
<text class="left">题目来源:</text><text>{{ ruleDisc }}</text>
......@@ -24,122 +24,46 @@
</template>
<script>
let condition = {
dev: {
"id-2": {
score: "60分",
time: "30分钟",
number: "20",
title: "服务规范",
},
"id-3": {
score: "30分",
time: "15分钟",
number: "10",
title: "服务规范",
},
"id-4": {
score: "15分",
time: "6分钟",
number: "4",
title: "交付规范",
},
},
test: {
"id-2": {
score: "60分",
time: "30分钟",
number: "20",
title: "服务规范",
},
"id-3": {
score: "30分",
time: "15分钟",
number: "10",
title: "服务规范",
},
"id-4": {
score: "15分",
time: "6分钟",
number: "4",
title: "交付规范",
},
},
prod: {
"id-2": {
score: "60分",
time: "30分钟",
number: "20",
title: "服务规范",
},
"id-3": {
score: "30分",
time: "15分钟",
number: "10",
title: "服务规范",
},
"id-4": {
score: "15分",
time: "6分钟",
number: "4",
title: "交付规范",
},
},
};
let env = process.uniEnv.node_env;
let desc = condition[env];
export default {
data() {
return {
desc: null,
title: "",
score: "",
time: "",
ruleDisc: "",
examId: null,
exam: null,
userExamId: null,
ruleDisc: "",
userExamId: null
};
},
onLoad(param) {
this.examId = param.examId;
this.desc = desc["id-" + this.examId];
this.getExamResult();
// this.getUserExamInfo();
},
onUnload() {
uni.switchTab({
url: '/pages/index/learn'
});
},
methods: {
//申请考试获取userExamId
getUserExamId: function () {
let examId = this.examId;
let userExamId = this.userExamId;
let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
let length = routes.length
if(length > 8){
uni.showToast({
icon: "none",
title: "打开页面过多,请返回后再操作",
});
return;
}
console.log(length);
wx.navigateTo({
url: "/pages/learn/answer?examId=" + examId,
});
},
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",
},
success: (res) => {
uni.hideLoading();
if (res.data.code == 200) {
if (res.data.data.userExamId) {
this.userExamId = res.data.data.userExamId;
}
}
},
url: "/pages/learn/answer?examId=" + examId + "&userExamId=" + userExamId,
});
setTimeout(() => {
wx.navigateTo({
url: "/pages/learn/answer?userExamId=" + this.userExamId,
});
}, 1000);
},
getExamResult() {
uni.request({
......@@ -158,10 +82,12 @@ export default {
if (res.data.code == 200) {
if (res.data.data.ruleDisc) {
var str = res.data.data.ruleDisc;
this.userExamId = res.data.data.id;
let strArr = str.split("(")[0].split(",");
this.desc.title = strArr[0];
this.desc.score = strArr[1];
this.desc.time = strArr[2];
this.title = strArr[0];
this.score = strArr[1];
this.time = strArr[2];
this.ruleDisc = strArr[3];
}
}
......
......@@ -77,7 +77,6 @@ export default {
//再次考试
getAgain: function () {
let examId = this.examId;
let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
uni.navigateTo({
url: "/pages/learn/assessment?examId=" + examId,
});
......
......@@ -10,25 +10,20 @@
<view class="left">电话</view>
<input disabled v-model="mobile" type="text" placeholder-class="line" placeholder="请填写电话" />
</view>
<u-field
v-model="address"
label="地址"
label-width="88"
type="textarea"
:border-bottom="false"
placeholder="请填写地址">
<view slot="right" class="right" @tap="autoLocation">
<u-icon name="map" color="#2272FF" size="30"></u-icon>
<text>自动定位</text>
<view class="item address">
<view class="left label">地址</view>
<textarea v-model="address" type="text" placeholder-class="line" placeholder="请填写地址" />
<view class="right" @tap="autoLocation">
<u-icon
name="map"
color="#2272FF"
size="30"
label="自动定位"
label-size="24"
label-color="#2272FF"
></u-icon>
</view>
</u-field>
<!-- <view class="site-clipboard">
<textarea placeholder-class="line" value="" placeholder="粘贴文本,可自动识别姓名和地址等" />
<view class="clipboard">
地址粘贴板
<u-icon name="arrow-down" class="icon" :size="20"></u-icon>
</view>
</view> -->
</view>
</view>
<view class="bottom">
<button class="btn, bottom-btn" @click="show = true">
......@@ -70,7 +65,6 @@
<script>
let r = require("libs/bmap-wx.min.js");
let h = new r.BMapWX({
// ak: "rpVq5d3yxaRCoKzVwmFMo0o4iC524CAG",
ak: "lF1HoyXdiv4uZx6TrGQEZs48F5y8kEHI"
});
export default {
......@@ -142,8 +136,6 @@ export default {
};
if (lat && long) {
let e = lat + "," + long
// let e = "113.88308" + ',' + "22.55329"
// let e = "22.55329" + ',' + "113.88308"
t.location = e;
}
h.regeocoding(t);
......@@ -176,14 +168,11 @@ export default {
address: self.address
}
let res = await self.$u.api.syncAddress(params)
const callback = (vm, res) => {
vm.$u.route({type: 'back'})
}
if(res && res.code == 200) {
self.$u.route({
type: 'redirect',
url: "pages/mine/address/index",
params: {
sync: true
}
})
getApp().getBaseInfo(this, callback);
}
}
}
......@@ -218,59 +207,24 @@ export default {
text-align: left;
}
}
/deep/ .u-field {
.address {
padding: 24rpx 0;
border-bottom: solid 2rpx $u-border-color;
.u-label-text {
font-weight: 400;
color: #999999;
}
align-items: flex-start;
textarea {
line-height: 40rpx;
}
.u-button-wrap {
align-self: flex-start;
margin-left: 42rpx;
height: 240rpx;
background-color: #f7f7f7;
line-height: 60rpx;
padding: 20rpx;
width: 400rpx;
}
.right {
text-align: right;
width: 160rpx;
font-size: 24rpx;
font-weight: 400;
color: #2272FF;
line-height: 40rpx;
}
}
.address {
padding: 20rpx 0;
textarea {
// width: 100%;
height: 150rpx;
background-color: #f7f7f7;
line-height: 60rpx;
margin: 40rpx auto;
padding: 20rpx;
}
}
.site-clipboard {
padding-right: 40rpx;
textarea {
// width: 100%;
height: 150rpx;
background-color: #f7f7f7;
line-height: 60rpx;
margin: 40rpx auto;
padding: 20rpx;
}
.clipboard {
display: flex;
justify-content: center;
align-items: center;
font-size: 26rpx;
color: $u-tips-color;
height: 80rpx;
.icon {
margin-top: 6rpx;
margin-left: 10rpx;
}
line-height: 88rpx;
}
}
}
......
<template>
<view class="address-wrap">
<w-navbar title="收货地址"></w-navbar>
<view class="item" v-if="hasAdderss">
<view class="item" v-if="hasAdderss" @tap="toAddSite('修改地址')">
<view class="top">
<view class="name">{{ settled.id_card_name || settled.nickname || settled.name || '--' }}</view>
<view class="phone">{{ settled.mobile }}</view>
</view>
<view class="bottom">
<view class="address">{{ settled.address }}</view>
<u-icon :name="editPen" :size="32" color="#999999" @tap="toAddSite('修改地址')"></u-icon>
<u-icon :name="editPen" :size="32" color="#999999"></u-icon>
</view>
<view class="default" v-show="true">
<u-icon name="checkmark-circle" color="#2272FF" size="32"></u-icon>
<text class="txt">默认地址</text>
</view>
</view>
<!-- <view class="addSite" @tap="toAddSite('新增地址')">
<view class="add">
<u-icon name="plus" color="#ffffff" class="icon" :size="30"></u-icon>新建收货地址
</view>
</view> -->
</view>
</template>
......@@ -45,11 +40,9 @@ export default {
return this.settled && this.settled.address && this.settled.id_card_name
},
},
onLoad(e) {
onShow() {
if(!this.vuex_token) {
this.$u.route({url: 'pages/login/index'})
} else if (e && e.sync) {
this.getData();
} else if(!this.settled) {
this.getData();
}
......@@ -61,7 +54,6 @@ export default {
},
toAddSite(title){
this.$u.route({
type: 'redirect',
url: 'pages/mine/address/addSite',
params: {
title: title
......@@ -120,24 +112,4 @@ export default {
}
}
}
.addSite {
display: flex;
justify-content: space-around;
width: 600rpx;
line-height: 100rpx;
position: absolute;
bottom: 30rpx;
left: 80rpx;
background-color: red;
border-radius: 60rpx;
font-size: 30rpx;
.add{
display: flex;
align-items: center;
color: #ffffff;
.icon{
margin-right: 10rpx;
}
}
}
</style>
......@@ -45,7 +45,7 @@
},
computed: {
amount() {
return this.settled && this.settled.deposit || '0.00';
return this.vuex_settled && this.vuex_settled.hasPaid || '0.00';
},
settled() {
return this.vuex_settled && this.vuex_settled.record || null
......
......@@ -11,7 +11,7 @@
<text class="u-line-1">{{item.name}}</text>
</view>
</scroll-view>
<scroll-view :scroll-top="scrollRightTop" scroll-y enhanced scroll-with-animation class="right-box" @scroll="rightScroll">
<scroll-view :scroll-top="scrollRightTop" :enhanced="true" scroll-y scroll-with-animation class="right-box" @scroll="rightScroll">
<u-form :model="form" ref="uForm">
<template v-for="(groupItem, groupIndex) in (list.length>0?list[tabIndex].items:[])">
<view class="class-item" :key="groupIndex">
......@@ -43,10 +43,19 @@
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'
@value-change="fieldValueChange">
</xh-select>
<xh-files v-else-if="item.formType==='file'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :partnerCompanyId="partnerCompanyId" :categoryId="categoryId" :value='form[item.fieldsName] || []'
@value-change="fieldValueChange">
</xh-files>
<view v-else-if="item.formType==='file'">
<xh-files
:ref="`fileChild${itemIndex}`"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :partnerCompanyId="partnerCompanyId" :categoryId="categoryId" :value='form[item.fieldsName] || []'
@value-change="fieldValueChange">
<template v-slot>
<view class="img-list">
<u-image class="pic" width="160rpx" height="160rpx" :border-radius="10" @click="selectUpload(JSON.stringify(item), groupIndex, itemIndex)" :src="uploadImage"></u-image>
</view>
</template>
</xh-files>
</view>
<xh-location v-else-if="item.formType==='location'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'
@value-change="fieldValueChange">
......@@ -100,10 +109,11 @@
</view>
</view>
<u-toast ref="uToast" />
<take-photo v-if="takeStatus" @close="closeTake" :upload="false" :currentItem="currentItemDate"></take-photo>
<u-action-sheet :list="carmeraList" v-model="maskShow" :cancel-btn="true" @click="uploadSelect"></u-action-sheet>
</view>
</template>
<script>
import classifyData from '@/common/classify.data.js';
import XhInput from '@/components/createCom/XhInput.vue'
import XhMultiInput from '@/components/createCom/XhMultiInput.vue'
import XhRadio from '@/components/createCom/XhRadio.vue'
......@@ -117,6 +127,8 @@
import XhServiceMeasure from '@/components/createCom/XhServiceMeasure.vue'
import XhServiceMore from "../../components/createCom/XhServiceMore";
import XhLabel from "../../components/createCom/XhLabel";
import takePhoto from '@/components/take/index.vue'
import baseFile from '@/components/upload/index';
// import XhRadio from '@/components/createCom/XhRadio.vue'
export default {
data() {
......@@ -135,39 +147,12 @@
menuHeight: 0, // 左边菜单的高度
menuItemHeight: 0, // 左边菜单item的高度
itemId: '', // 栏目右边scroll-view用于滚动的id
groupList: classifyData, // 基本信息、安装 、勘察(其中一项表单数据)
menuItemPos: [],
arr: [],
scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度
timer: null, // 定时器
form: { // 一维表单
},
rules: {
name: [{
required: true,
min: 10,
message: '姓名不能为空',
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}],
mobile: [{
required: true,
min: 10,
message: '姓名不能为空',
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}, {
// 自定义验证函数,见上说明
validator: (rule, value, callback) => {
// 上面有说,返回true表示校验通过,返回false表示不通过
// this.$u.test.mobile()就是返回true或者false的
return this.$u.test.mobile(value);
},
message: '手机号码不正确',
// 触发器可以同时用blur和change
trigger: ['change', 'blur'],
}]
},
submitBtnStatus: false,
completeCheckStatus: false,
completeCheckResult: [],
......@@ -175,6 +160,19 @@
waitHandlerGroupIndex: 0,
waitHandlerEleIndex: 0,
pass: false,
// 上传组件相关
carmeraList: [
{
text: '相册'
},
{
text: '拍照'
}
],
maskShow: false,
takeStatus: false,
currentItemDate:{},
photoItem: {}
}
},
components: {
......@@ -190,8 +188,10 @@
XhTime,
XhServiceMeasure,
XhServiceMore,
XhLabel
XhLabel,
'take-photo': takePhoto
},
mixins: [baseFile],
created() {
// console.log(allComponents,'allComponents')
},
......@@ -212,7 +212,6 @@
this.getCompleteData()
},
onReady() {
this.$refs.uForm.setRules(this.rules);
// 导航栏滚动切换
this.getMenuItemTop()
},
......@@ -223,6 +222,9 @@
mixingImage() {
return process.uniEnv.qn_base_url + 'mixing.png'
},
uploadImage() {
return process.uniEnv.qn_base_url + 'upload-file.png'
},
buttonStyle() {
return {
'color': '#FFFFFF',
......@@ -457,8 +459,8 @@
locationCompleteItem(panelIndex,groupIndex,eleIndex){ // 页面定位到某一项
this.tabIndex = panelIndex
this.arr = []
this.scrollRightTop = 0;
this.current = 0;
this.scrollRightTop = 0
this.current = groupIndex
this.$nextTick(function() {
this.swichMenu(groupIndex)
})
......@@ -566,88 +568,92 @@
})
}
},
// 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 = ''
// type = type.toLocaleLowerCase()
// switch (type) {
// case 'text':
// case 'password':
// case 'textarea':
// case 'number':
// case 'decimal':
// case 'double':
// case 'integer':
// formType = 'input'
// break
// case 'multiinput':
// formType = 'multiinput'
// break;
// case 'select':
// case 'specifications':
// formType = 'select'
// break
// case 'radio':
// formType = 'radio'
// break
// case 'checkbox':
// formType = 'checkbox'
// break
// case 'file':
// case 'photos':
// formType = 'file'
// break
// case 'location':
// formType = 'location'
// break
// case 'scan':
// case 'machine_code':
// formType = 'scan'
// break
// case 'picker':
// case 'mutipicker':
// formType = 'picker'
// break
// case 'service_measures':
// formType = 'servicemeasure'
// break
// case 'time':
// case 'date':
// formType = 'time'
// break
// case 'form':
// formType = 'form'
// break
// case 'label':
// formType = 'label'
// break
// }
// return formType
// },
// ------------------------- 以下方法为上传组件相关 -------------------------
// 弹出上传选项
selectUpload(item, groupIndex, itemIndex){
const imgList = this.$refs[`fileChild${itemIndex}`][0].imgList
if (imgList.length === 10) {
return this.$refs.uToast.show({
title: '图片已超出最大数量',
type: 'error',
})
}
this.photoItem = {
...JSON.parse(item),
groupIndex,
itemIndex,
}
// 弹窗展示
this.maskShow = true
},
// 区分上传动作
uploadSelect(index) {
if (index === 0) {
this.uploadFile('photo')
} else {
this.uploadFile()
}
},
// 拍照回调
async closeTake(val) {
if(val && val.length > 0){
const files = val.map(v => v.path)
const value = await this.saveToTask(files)
this.$refs[`fileChild${this.photoItem.itemIndex}`][0].setTmpValue(value)
}
this.takeStatus = false
},
// 上传图片
async uploadFile(type){
const self = this
if(type&&type==='photo'){
// 直接打开相册
let options = {
sourceType:['album'],//['album', 'camera']
count: 3,
sizeType: ['compressed']
}
const value = await this.chooseImg(options)
self.$refs[`fileChild${self.photoItem.itemIndex}`][0].setTmpValue(value)
return
}
// 使用拍照工具拍摄
this.photograph()
this.getWatermark()
},
// 获取拍照规范
photograph(){
let self = this
let param = {"partnerCompanyId":this.partnerCompanyId,
"categoryId":this.categoryId,
"brandId":this.brandId,
"fieldName":this.photoItem.fieldsName}
this.$u.api.orderStandardItem(param).then((res)=>{
if (res.code == 200 && res.data.length>0) {
self.currentItemDate = res.data[0]
}else{
console.log("获取完工项的拍照标准异常",res.data.message)
}
self.takeStatus = true
})
},
// 获取水印
getWatermark(){
if(getApp().globalData.photo.waterSetting){
return
}
var data={partnerCompanyId:this.partnerCompanyId}
this.$u.api.getWatermark(data).then((res) => {
if (res.code == 200) {
getApp().globalData.photo.waterSetting = res.data
} else {
console.log("获取水印备注异常",res.data.message)
}
});
},
// ------------------------- 以上方法为上传组件相关 -------------------------
// ------------------------- 以下方法为展示滚动切换 -------------------------
// 点击左边的栏目切换
async swichMenu(index) {
......@@ -959,4 +965,18 @@
font-size: 32rpx;
font-weight: bold;
}
.img-list {
position: relative;
margin: 8rpx;
width: 160rpx;
height: 160rpx;
.pic{
// margin-right: 15rpx;
// margin-bottom: 15rpx;
&:nth-child(3n){
margin-right: 0;
}
}
}
</style>
......@@ -29,7 +29,7 @@
</view>
</template>
</scroll-view>
<take-photo type="test" v-if="takeStatus" :currentItem="currentItemDate" @close="closeTake"></take-photo>
<take-photo type="test" v-if="takeStatus" :upload="false" :currentItem="currentItemDate" @close="closeTake"></take-photo>
<!-- <u-button v-if="activeTop + 1 === dataList.length" class="ph-list-button" type="error" shape="circle"
:disabled="buttonDisabled" :custom-style="buttonStyle" @click="isPopShow = true">一键清空展示图片</u-button> -->
</view>
......@@ -57,6 +57,7 @@
<script>
import takePhoto from '@/components/take/index.vue'
import baseFile from '@/components/upload/index';
export default {
components: {
'take-photo': takePhoto
......@@ -81,6 +82,7 @@
title: '全部'
}
},
mixins: [baseFile],
onLoad(e) {
getApp().trackPage('照片规范列表页')
if (e && e.brandId) {
......@@ -242,22 +244,27 @@
uni.hideTabBar()
this.takeStatus = true
},
closeTake(img) {
if(img !==undefined ){
async closeTake(img) {
if(img !==undefined){
const files = img.map(v => v.path)
const value = await this.saveToTask(files)
if (!this.currentItemDate.orderImages) this.currentItemDate.orderImages = []
// step1 添加图片
img.forEach(v => {
this.currentItemDate.orderImages.push(v.key)
// 复制一份 用于保存
let saveList = this.currentItemDate.orderImages.concat();
value.map(item =>{
// step1 添加缓存图片 到显示
this.currentItemDate.orderImages.push(item.path)
// 文件key添加保存数组中
saveList.push(item.key)
})
// step2 保存图片
var data={
type : this.currentItemDate.type,
images : Array.from(this.currentItemDate.orderImages),
images : Array.from(saveList),
fieldsName:this.currentItemDate.fieldName
}
this.$u.api.saveImage(data,this.orderId).then((res) => {
if (res.code == 200) {
console.log("===", res.data)
} else {
console.log("保存图片异常",res.data.message)
}
......
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