测试bug修改
This commit is contained in:
@@ -11,7 +11,7 @@ export function addFeedBack(params) {
|
|||||||
let data = JSON.parse(JSON.stringify(params));
|
let data = JSON.parse(JSON.stringify(params));
|
||||||
delete data.files
|
delete data.files
|
||||||
return uni.uploadFile({
|
return uni.uploadFile({
|
||||||
url: config.domain + '/cs-device-boot/feedback/addFeedBack', //仅为示例,非真实的接口地址
|
url: config.domain + '/cs-system-boot/feedback/addFeedBack', //仅为示例,非真实的接口地址
|
||||||
files: files,
|
files: files,
|
||||||
header: {
|
header: {
|
||||||
Authorization: uni.getStorageSync('access_token'),
|
Authorization: uni.getStorageSync('access_token'),
|
||||||
@@ -27,7 +27,7 @@ export function addFeedBack(params) {
|
|||||||
*/
|
*/
|
||||||
export function queryFeedBackDetail(id) {
|
export function queryFeedBackDetail(id) {
|
||||||
return request({
|
return request({
|
||||||
url: '/cs-device-boot/feedback/queryFeedBackDetail',
|
url: '/cs-system-boot/feedback/queryFeedBackDetail',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: {
|
data: {
|
||||||
id,
|
id,
|
||||||
@@ -38,7 +38,7 @@ export function queryFeedBackDetail(id) {
|
|||||||
// 问题列表
|
// 问题列表
|
||||||
export function queryFeedBackPage(params) {
|
export function queryFeedBackPage(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/cs-device-boot/feedback/queryFeedBackPage',
|
url: '/cs-system-boot/feedback/queryFeedBackPage',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: {
|
data: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
@@ -58,7 +58,7 @@ export function queryFeedBackPage(params) {
|
|||||||
*/
|
*/
|
||||||
export function AddFeedbackChat(params) {
|
export function AddFeedbackChat(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/cs-device-boot/feedbackChat/AddFeedbackChat',
|
url: '/cs-system-boot/feedbackChat/AddFeedbackChat',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params,
|
data: params,
|
||||||
header: {
|
header: {
|
||||||
@@ -77,7 +77,7 @@ export function AddFeedbackChat(params) {
|
|||||||
*/
|
*/
|
||||||
export function updateChatStatus(params) {
|
export function updateChatStatus(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/cs-device-boot/feedbackChat/updateChatStatus',
|
url: '/cs-system-boot/feedbackChat/updateChatStatus',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params,
|
data: params,
|
||||||
header: {
|
header: {
|
||||||
|
|||||||
@@ -19,15 +19,16 @@ export function addAppProject(params, files) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改项目
|
// 修改项目
|
||||||
export function updateAppProject(params, files) {
|
export function updateAppProject(params, files) {
|
||||||
if (files.length === 0) {
|
if (files.length === 0) {
|
||||||
return request({
|
return request({
|
||||||
url: '/cs-device-boot/project/updateAppProject',
|
url: '/cs-device-boot/project/auditAppProject',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params,
|
data: params,
|
||||||
})
|
})
|
||||||
}else{
|
} else {
|
||||||
return uni.uploadFile({
|
return uni.uploadFile({
|
||||||
url: config.domain + '/cs-device-boot/project/auditAppProject', //仅为示例,非真实的接口地址
|
url: config.domain + '/cs-device-boot/project/auditAppProject', //仅为示例,非真实的接口地址
|
||||||
files: files,
|
files: files,
|
||||||
@@ -92,8 +93,16 @@ export function deleteAppTopologyDiagram(id) {
|
|||||||
id,
|
id,
|
||||||
status: 0,
|
status: 0,
|
||||||
},
|
},
|
||||||
header: {
|
})
|
||||||
'Content-Type': 'application/json',
|
}
|
||||||
|
|
||||||
|
// 删除拓扑图
|
||||||
|
export function checkCanDelete(id) {
|
||||||
|
return request({
|
||||||
|
url: '/cs-device-boot/topologyDiagram/checkCanDelete',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
id,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,10 +78,9 @@ export function apiRegister(params) {
|
|||||||
*/
|
*/
|
||||||
export function autoLogin(phone) {
|
export function autoLogin(phone) {
|
||||||
return request({
|
return request({
|
||||||
url: '/user-boot/appUser/autoLogin',
|
url: '/pqs-auth/oauth/autoLogin',
|
||||||
data: {
|
data: {
|
||||||
phone: phone,
|
phone: phone,
|
||||||
devCode: uni.getStorageSync('devCode'),
|
|
||||||
},
|
},
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
})
|
})
|
||||||
@@ -204,3 +203,19 @@ export function apiUpdateUser(params) {
|
|||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新用户推送标识
|
||||||
|
|
||||||
|
export function apiUpdatePush(params) {
|
||||||
|
uni.getPushClientId((res) => {
|
||||||
|
let push_clientid = res.cid
|
||||||
|
request({
|
||||||
|
url: '/user-boot/appUser/updateDevCode',
|
||||||
|
data: {
|
||||||
|
devCode: push_clientid,
|
||||||
|
userId: uni.getStorageSync('userInfo').userIndex,
|
||||||
|
},
|
||||||
|
method: 'POST',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -277,3 +277,15 @@ page {
|
|||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
image {
|
||||||
|
will-change: transform;//解决加载时瞬间拉伸问题
|
||||||
|
width: auto;//解决加载时瞬间拉伸问题
|
||||||
|
height: auto;//解决加载时瞬间拉伸问题
|
||||||
|
image-rendering:-moz-crisp-edges;
|
||||||
|
image-rendering:-o-crisp-edges;
|
||||||
|
image-rendering:-webkit-optimize-contrast;
|
||||||
|
image-rendering: crisp-edges;
|
||||||
|
-ms-interpolation-mode:nearest-neighbor;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import request from './request'
|
import request from './request'
|
||||||
import cache from './cacheKey.js'
|
import cache from './cacheKey.js'
|
||||||
import { getImageUrl } from '@/common/api/basic'
|
import { getImageUrl } from '@/common/api/basic'
|
||||||
|
import { apiUpdatePush } from '@/common/api/user'
|
||||||
import { queryDictDataCache } from '../api/dictionary.js'
|
import { queryDictDataCache } from '../api/dictionary.js'
|
||||||
import cacheKey from './cacheKey.js'
|
import cacheKey from './cacheKey.js'
|
||||||
const toast = (title, duration = 1500, call, mask = false, icon = 'none') => {
|
const toast = (title, duration = 1500, call, mask = false, icon = 'none') => {
|
||||||
@@ -200,7 +201,8 @@ const prePage = () => {
|
|||||||
return prePage
|
return prePage
|
||||||
}
|
}
|
||||||
|
|
||||||
const loginSuccess = (data) => {
|
const loginSuccess = (data, jump = true) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
uni.setStorageSync('access_token', data.token_type + ' ' + data.access_token)
|
uni.setStorageSync('access_token', data.token_type + ' ' + data.access_token)
|
||||||
uni.setStorageSync('refresh_token', data.refresh_token)
|
uni.setStorageSync('refresh_token', data.refresh_token)
|
||||||
@@ -212,11 +214,16 @@ const loginSuccess = (data) => {
|
|||||||
getImageUrl(userInfo.headSculpture).then((res) => {
|
getImageUrl(userInfo.headSculpture).then((res) => {
|
||||||
userInfo.avatar = res.data
|
userInfo.avatar = res.data
|
||||||
uni.setStorageSync(cache.userInfo, userInfo)
|
uni.setStorageSync(cache.userInfo, userInfo)
|
||||||
|
apiUpdatePush()
|
||||||
|
resolve(userInfo)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.setStorageSync(cache.userInfo, userInfo)
|
uni.setStorageSync(cache.userInfo, userInfo)
|
||||||
|
apiUpdatePush()
|
||||||
|
resolve(userInfo)
|
||||||
}
|
}
|
||||||
console.log('reLaunch')
|
console.log('reLaunch')
|
||||||
|
if (jump) {
|
||||||
queryDictDataCache().then((res) => {
|
queryDictDataCache().then((res) => {
|
||||||
uni.setStorageSync(cacheKey.dictData, res.data)
|
uni.setStorageSync(cacheKey.dictData, res.data)
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
@@ -226,6 +233,8 @@ const loginSuccess = (data) => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 只针对列表页的刷新
|
* 只针对列表页的刷新
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view class="html2canvas" :prop="domId" :id="domId" :change:prop="canvasImage.generateImage">
|
<view class="html2canvas" :prop="domId" :change:prop="canvasImage.generateImage">
|
||||||
<slot></slot>
|
<slot ></slot>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -34,10 +34,12 @@ export default {
|
|||||||
let dom = document.getElementById(domId);
|
let dom = document.getElementById(domId);
|
||||||
console.log(dom.offsetWidth, dom.offsetHeight);
|
console.log(dom.offsetWidth, dom.offsetHeight);
|
||||||
html2canvas(dom, {
|
html2canvas(dom, {
|
||||||
scale: 8,
|
scale: 2,
|
||||||
useCORS: true,
|
useCORS: true,
|
||||||
width: dom.offsetWidth,
|
width: dom.offsetWidth,
|
||||||
height: dom.offsetHeight,
|
height: dom.offsetHeight,
|
||||||
|
dpi: 300,
|
||||||
|
taintTest: true,
|
||||||
}).then((canvas) => {
|
}).then((canvas) => {
|
||||||
// this.$refs.header.appendChild(canvas);
|
// this.$refs.header.appendChild(canvas);
|
||||||
const posterImg = canvas.toDataURL()
|
const posterImg = canvas.toDataURL()
|
||||||
@@ -54,4 +56,5 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<style lang="scss"></style>
|
<style lang="scss">
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
"name" : "灿能物联",
|
"name" : "灿能物联",
|
||||||
"appid" : "__UNI__88BC25B",
|
"appid" : "__UNI__88BC25B",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "1.0.8",
|
"versionName" : "1.0.9",
|
||||||
"versionCode" : 108,
|
"versionCode" : 109,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"crypto-js": "^4.1.1",
|
"crypto-js": "^4.1.1",
|
||||||
"html2canvas": "1.0.0-rc.4",
|
"html2canvas": "^1.4.1",
|
||||||
"image-tools": "^1.4.0",
|
"image-tools": "^1.4.0",
|
||||||
"mqtt": "3.0.0",
|
"mqtt": "3.0.0",
|
||||||
"pinyin-pro": "^3.13.2",
|
"pinyin-pro": "^3.13.2",
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<Cn-page :loading="loading" noPadding>
|
<Cn-page :loading="loading" noPadding>
|
||||||
<view slot="body">
|
<view slot="body">
|
||||||
<view class="detail">
|
<view class="detail" :style="{ opacity: domLoading ? '0' : '1' }">
|
||||||
<view class="detail-header">
|
<view class="detail-header">
|
||||||
<Cn-htmlToImg domId="header" @renderFinish="renderFinish">
|
<Cn-htmlToImg domId="header" @renderFinish="renderFinish">
|
||||||
<view class="header" ref="header" @click="previewImg">
|
<view class="header" id="header" ref="header" @click="previewImg">
|
||||||
<img :src="deviceInfo.filePath" style="width: 375px" mode="widthFix" />
|
<img
|
||||||
|
:src="deviceInfo.filePath"
|
||||||
|
style="width: 375px; display: block"
|
||||||
|
mode="widthFix"
|
||||||
|
@load="domLoading = false"
|
||||||
|
/>
|
||||||
<view
|
<view
|
||||||
class="point"
|
class="point"
|
||||||
:style="{ left: item.lat + 'px', top: item.lng + 'px' }"
|
:style="{ left: item.lat + 'px', top: item.lng + 'px' }"
|
||||||
@@ -36,18 +41,6 @@
|
|||||||
<view style="width: 30rpx"> 0 </view>
|
<view style="width: 30rpx"> 0 </view>
|
||||||
<view> °C </view>
|
<view> °C </view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">模块三</view>
|
|
||||||
<view class="item">
|
|
||||||
<view class="status-point-success mr10"></view>
|
|
||||||
<view style="width: 30rpx"> 15 </view>
|
|
||||||
<view> °C </view>
|
|
||||||
</view>
|
|
||||||
<view class="item">模块四</view>
|
|
||||||
<view class="item">
|
|
||||||
<view class="status-point-success mr10"></view>
|
|
||||||
<view style="width: 30rpx"> 15 </view>
|
|
||||||
<view> °C </view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -78,10 +71,10 @@
|
|||||||
<view v-else-if="navMenuActive == 2">
|
<view v-else-if="navMenuActive == 2">
|
||||||
<power :deviceInfo="deviceInfo"></power>
|
<power :deviceInfo="deviceInfo"></power>
|
||||||
</view>
|
</view>
|
||||||
<view v-else-if="navMenuActive == 3">
|
<!-- <view v-else-if="navMenuActive == 3">
|
||||||
<oscillogram></oscillogram>
|
<oscillogram></oscillogram>
|
||||||
</view>
|
</view> -->
|
||||||
<view v-else-if="navMenuActive == 4">
|
<view v-else-if="navMenuActive == 3">
|
||||||
<IO :deviceInfo="deviceInfo"></IO>
|
<IO :deviceInfo="deviceInfo"></IO>
|
||||||
</view>
|
</view>
|
||||||
<view style="height: 20rpx"></view>
|
<view style="height: 20rpx"></view>
|
||||||
@@ -111,7 +104,7 @@ import IO from './comp/IO.vue'
|
|||||||
import { queryTopologyDiagram, deleteDevice } from '@/common/api/device'
|
import { queryTopologyDiagram, deleteDevice } from '@/common/api/device'
|
||||||
import { MQTT_IP, MQTT_OPTIONS } from '@/common/js/mqtt.js'
|
import { MQTT_IP, MQTT_OPTIONS } from '@/common/js/mqtt.js'
|
||||||
import mqtt from 'mqtt/dist/mqtt.js'
|
import mqtt from 'mqtt/dist/mqtt.js'
|
||||||
import { base64ToPath } from 'image-tools'
|
import { base64ToPath, pathToBase64 } from 'image-tools'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
basic,
|
basic,
|
||||||
@@ -122,6 +115,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
domLoading: true,
|
||||||
loading: true,
|
loading: true,
|
||||||
deviceInfo: {},
|
deviceInfo: {},
|
||||||
navMenuActive: 0,
|
navMenuActive: 0,
|
||||||
@@ -364,7 +358,7 @@ export default {
|
|||||||
this.init()
|
this.init()
|
||||||
queryTopologyDiagram(options.id).then((res) => {
|
queryTopologyDiagram(options.id).then((res) => {
|
||||||
this.deviceInfo = res.data
|
this.deviceInfo = res.data
|
||||||
console.log(this.dictData)
|
uni.setNavigationBarTitle({ title: this.deviceInfo.devName || '设备详情' })
|
||||||
this.dictData.forEach((item) => {
|
this.dictData.forEach((item) => {
|
||||||
if (item.code == 'Line_Position') {
|
if (item.code == 'Line_Position') {
|
||||||
item.children.forEach((item2) => {
|
item.children.forEach((item2) => {
|
||||||
@@ -377,16 +371,6 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.initMqtt()
|
this.initMqtt()
|
||||||
console.log(this.loading, 'loading')
|
|
||||||
// this.$nextTick(() => {
|
|
||||||
// // 获取nav高度
|
|
||||||
// uni.createSelectorQuery()
|
|
||||||
// .select('.nav')
|
|
||||||
// .boundingClientRect((rect) => {
|
|
||||||
// this.navHeight = rect.height
|
|
||||||
// })
|
|
||||||
// .exec()
|
|
||||||
// })
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -438,7 +422,7 @@ export default {
|
|||||||
.module {
|
.module {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
right: 20rpx;
|
right: 10rpx;
|
||||||
width: 200rpx;
|
width: 200rpx;
|
||||||
|
|
||||||
.grid-card-content-2,
|
.grid-card-content-2,
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
back() {
|
back() {
|
||||||
this.$util.refreshPrePage(2)
|
uni.navigateBack({ delta: 1 })
|
||||||
},
|
},
|
||||||
home() {
|
home() {
|
||||||
this.$util.refreshPrePage(2)
|
uni.navigateBack({ delta: 1 })
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import list from '../../common/js/list'
|
import list from '../../common/js/list'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [list],
|
mixins: [list],
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<page-meta :page-style="'overflow:'+(show?'hidden':'visible')"></page-meta>
|
<page-meta :page-style="'overflow:'+(show?'hidden':'visible')"></page-meta>
|
||||||
<uni-forms :label-width="80">
|
<uni-forms :label-width="80">
|
||||||
<uni-forms-item label="工程名称">
|
<uni-forms-item label="工程名称">
|
||||||
<uni-easyinput type="text" v-model="formData.name" placeholder="请输入工程名称" />
|
<uni-easyinput type="text" v-model="formData.name" placeholder="请输入工程名称"/>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="位置">
|
<uni-forms-item label="位置">
|
||||||
<!-- <view style="display:flex;">
|
<!-- <view style="display:flex;">
|
||||||
@@ -15,7 +15,8 @@
|
|||||||
<uni-icons type="location" color="#007aff" size="26" class="ml20"
|
<uni-icons type="location" color="#007aff" size="26" class="ml20"
|
||||||
@click="chooseLocation"></uni-icons>
|
@click="chooseLocation"></uni-icons>
|
||||||
</view> -->
|
</view> -->
|
||||||
<uni-data-picker :localdata="localdata" @change="areaChange" v-model="value" @popupopened="show=true" @popupclosed="show=false">
|
<uni-data-picker :localdata="localdata" @change="areaChange" v-model="value"
|
||||||
|
@popupopened="show=true" @popupclosed="show=false">
|
||||||
</uni-data-picker>
|
</uni-data-picker>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="描述">
|
<uni-forms-item label="描述">
|
||||||
@@ -29,15 +30,16 @@
|
|||||||
</uni-forms>
|
</uni-forms>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn-wrap">
|
<view class="btn-wrap">
|
||||||
<view class="btn-wrap-item" @click="submit"> 提交 </view>
|
<view class="btn-wrap-item" @click="submit"> 提交</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</Cn-page>
|
</Cn-page>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { addEngineering, auditEngineering } from '../../common/api/engineering'
|
import {addEngineering, auditEngineering} from '../../common/api/engineering'
|
||||||
import area from '../../common/js/area.json'
|
import area from '../../common/js/area.json'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -52,9 +54,11 @@ export default {
|
|||||||
},
|
},
|
||||||
engineering: {},
|
engineering: {},
|
||||||
show: false,
|
show: false,
|
||||||
|
options: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
this.options = options
|
||||||
if (options.engineering) {
|
if (options.engineering) {
|
||||||
this.engineering = JSON.parse(decodeURIComponent(options.engineering))
|
this.engineering = JSON.parse(decodeURIComponent(options.engineering))
|
||||||
console.log(this.engineering)
|
console.log(this.engineering)
|
||||||
@@ -65,7 +69,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.value = this.engineering.city
|
this.value = this.engineering.city
|
||||||
this.formData.id = this.engineering.id
|
this.formData.id = this.engineering.id
|
||||||
uni.setNavigationBarTitle({ title: '工程编辑' })
|
uni.setNavigationBarTitle({title: '工程编辑'})
|
||||||
}
|
}
|
||||||
uni.getLocation({
|
uni.getLocation({
|
||||||
type: 'wgs84',
|
type: 'wgs84',
|
||||||
@@ -79,7 +83,8 @@ export default {
|
|||||||
console.log(this.$util.prePage())
|
console.log(this.$util.prePage())
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toJSON() {},
|
toJSON() {
|
||||||
|
},
|
||||||
areaChange(e) {
|
areaChange(e) {
|
||||||
if (e.detail.value.length) {
|
if (e.detail.value.length) {
|
||||||
this.formData.province = e.detail.value[0].value
|
this.formData.province = e.detail.value[0].value
|
||||||
@@ -123,10 +128,18 @@ export default {
|
|||||||
this.$util.toast('工程修改成功')
|
this.$util.toast('工程修改成功')
|
||||||
this.$util.refreshPrePage(2)
|
this.$util.refreshPrePage(2)
|
||||||
} else {
|
} else {
|
||||||
await addEngineering(this.formData)
|
let res = await addEngineering(this.formData)
|
||||||
this.$util.toast('工程创建成功')
|
this.$util.toast('工程创建成功')
|
||||||
|
if (this.options.from === 'index') {
|
||||||
|
uni.setStorageSync('engineering', res.data)
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/device/new',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
} else {
|
||||||
this.$util.refreshPrePage()
|
this.$util.refreshPrePage()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ export default {
|
|||||||
res = res[1]
|
res = res[1]
|
||||||
res = JSON.parse(res.data)
|
res = JSON.parse(res.data)
|
||||||
console.log(res);
|
console.log(res);
|
||||||
if (res.code = 'A0000') {
|
if (res.code === 'A0000') {
|
||||||
this.$util.toast(res.message)
|
this.$util.toast(res.message)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.redirectTo({ url: '/pages/message/feedback' })
|
uni.redirectTo({ url: '/pages/message/feedback' })
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
<view style="flex: 1"></view>
|
<view style="flex: 1"></view>
|
||||||
<template v-if="deviceListFilter.length">
|
<template v-if="deviceListFilter.length">
|
||||||
<template v-if="transfer || share">
|
<template v-if="transfer || share">
|
||||||
<view class="nav-menu nav-menu-btn" @click="submit">完成 </view>
|
<view class="nav-menu nav-menu-btn" @click="submit">确定 </view>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<view
|
<view
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="index-zhuyonghu">
|
<view class="index-zhuyonghu">
|
||||||
<view class="canneng-index-title mb20">所有工程统计信息</view>
|
<template v-if="devCount.engineeringListLength > 1">
|
||||||
|
<view class="canneng-index-title mb20">所有工程设备统计</view>
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="header-item">
|
<view class="header-item">
|
||||||
<view class="header-item-value">{{ devCount.onLineDevCount + devCount.offLineDevCount || 0 }}</view>
|
<view class="header-item-value">{{ devCount.onLineDevCount + devCount.offLineDevCount || 0 }}</view>
|
||||||
@@ -15,12 +16,15 @@
|
|||||||
<view class="header-item-label">离线设备</view>
|
<view class="header-item-label">离线设备</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="canneng-index-title mb20 mt20">当前工程统计信息</view>
|
<view class="mt20"></view>
|
||||||
|
</template>
|
||||||
|
<view class="canneng-index-title mb20">当前工程设备统计</view>
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="header-item">
|
<view class="header-item">
|
||||||
<view class="header-item-value">{{
|
<view class="header-item-value">{{
|
||||||
devCount.currentOnLineDevCount + devCount.currentOffLineDevCount || 0
|
devCount.currentOnLineDevCount + devCount.currentOffLineDevCount || 0
|
||||||
}}</view>
|
}}
|
||||||
|
</view>
|
||||||
<view class="header-item-label">设备总数</view>
|
<view class="header-item-label">设备总数</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="header-item" @click="jump('currentOnLineDevs')">
|
<view class="header-item" @click="jump('currentOnLineDevs')">
|
||||||
@@ -37,7 +41,7 @@
|
|||||||
<Cn-grid title="">
|
<Cn-grid title="">
|
||||||
<Cn-grid-item src="/static/device2.png" text="设备注册" @click="registerDevice"></Cn-grid-item>
|
<Cn-grid-item src="/static/device2.png" text="设备注册" @click="registerDevice"></Cn-grid-item>
|
||||||
<!-- <Cn-grid-item src="/static/gateway2.png" text="网关注册" @click="registerGateway"></Cn-grid-item> -->
|
<!-- <Cn-grid-item src="/static/gateway2.png" text="网关注册" @click="registerGateway"></Cn-grid-item> -->
|
||||||
<Cn-grid-item src="/static/feedback2.png" text="提交反馈" @click="submitFeedBack"></Cn-grid-item>
|
<Cn-grid-item src="/static/feedback2.png" text="问题反馈" @click="submitFeedBack"></Cn-grid-item>
|
||||||
</Cn-grid>
|
</Cn-grid>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -57,7 +61,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
submitFeedBack() {
|
submitFeedBack() {
|
||||||
uni.navigateTo({ url: '/pages/home/feedback' })
|
uni.navigateTo({url: '/pages/home/feedback'})
|
||||||
},
|
},
|
||||||
registerDevice() {
|
registerDevice() {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
@@ -66,16 +70,24 @@ export default {
|
|||||||
confirmText: '直连装置',
|
confirmText: '直连装置',
|
||||||
cancelText: '网关接入',
|
cancelText: '网关接入',
|
||||||
cancelColor: '#007aff',
|
cancelColor: '#007aff',
|
||||||
success: ({ confirm, cancel }) => {
|
success: ({confirm, cancel}) => {
|
||||||
if (confirm) {
|
if (confirm) {
|
||||||
|
if (this.devCount.engineeringListLength > 1) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/device/new',
|
url: '/pages/device/new',
|
||||||
})
|
})
|
||||||
} else if (cancel) {
|
} else {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/gateway/list',
|
url: '/pages/engineering/new?from=index'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (cancel) {
|
||||||
|
// uni.navigateTo({
|
||||||
|
// url: '/pages/gateway/list',
|
||||||
|
// })
|
||||||
|
this.$util.toast('功能正在开发,敬请期待')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="index-zhuyonghu">
|
<view class="index-zhuyonghu">
|
||||||
<view class="canneng-index-title mb20">所有工程统计信息</view>
|
<template v-if="devCount.engineeringListLength > 1">
|
||||||
|
<view class="canneng-index-title mb20">所有工程设备统计</view>
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="header-item">
|
<view class="header-item">
|
||||||
<view class="header-item-value">{{ devCount.onLineDevCount + devCount.offLineDevCount || 0 }}</view>
|
<view class="header-item-value">{{ devCount.onLineDevCount + devCount.offLineDevCount || 0 }}</view>
|
||||||
@@ -15,7 +16,9 @@
|
|||||||
<view class="header-item-label">离线设备</view>
|
<view class="header-item-label">离线设备</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="canneng-index-title mb20 mt20">当前工程统计信息</view>
|
<view class="mt20"></view>
|
||||||
|
</template>
|
||||||
|
<view class="canneng-index-title mb20">当前工程设备统计</view>
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="header-item">
|
<view class="header-item">
|
||||||
<view class="header-item-value">{{
|
<view class="header-item-value">{{
|
||||||
@@ -42,7 +45,7 @@ export default {
|
|||||||
default: {},
|
default: {},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods:{
|
methods: {
|
||||||
jump(type) {
|
jump(type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
default:
|
default:
|
||||||
@@ -56,7 +59,7 @@ export default {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss"></style>
|
<style lang="scss"></style>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="index-zhuanzhi">
|
<view class="index-zhuanzhi">
|
||||||
<view class="canneng-index-title mb20">所有工程统计信息</view>
|
<template v-if="devCount.engineeringListLength > 1">
|
||||||
|
<view class="canneng-index-title mb20">所有工程设备统计</view>
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="header-item">
|
<view class="header-item">
|
||||||
<view class="header-item-value">{{ devCount.onLineDevCount + devCount.offLineDevCount || 0 }}</view>
|
<view class="header-item-value">{{ devCount.onLineDevCount + devCount.offLineDevCount || 0 }}</view>
|
||||||
@@ -27,7 +28,9 @@
|
|||||||
<view class="header-item-label">项目个数</view>
|
<view class="header-item-label">项目个数</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="canneng-index-title mb20 mt20">当前工程统计信息</view>
|
<view class="mt20"></view>
|
||||||
|
</template>
|
||||||
|
<view class="canneng-index-title mb20">当前工程设备统计</view>
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="header-item">
|
<view class="header-item">
|
||||||
<view class="header-item-value">{{
|
<view class="header-item-value">{{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="index-zhuyonghu">
|
<view class="index-zhuyonghu">
|
||||||
<view class="canneng-index-title mb20">所有工程统计信息</view>
|
<template v-if="devCount.engineeringListLength > 1">
|
||||||
|
<view class="canneng-index-title mb20">所有工程设备统计</view>
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="header-item">
|
<view class="header-item">
|
||||||
<view class="header-item-value">{{ devCount.onLineDevCount + devCount.offLineDevCount || 0 }}</view>
|
<view class="header-item-value">{{ devCount.onLineDevCount + devCount.offLineDevCount || 0 }}</view>
|
||||||
@@ -15,7 +16,9 @@
|
|||||||
<view class="header-item-label">离线设备</view>
|
<view class="header-item-label">离线设备</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="canneng-index-title mb20 mt20">当前工程统计信息</view>
|
<view class="mt20"></view>
|
||||||
|
</template>
|
||||||
|
<view class="canneng-index-title mb20">当前工程设备统计</view>
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="header-item">
|
<view class="header-item">
|
||||||
<view class="header-item-value">{{
|
<view class="header-item-value">{{
|
||||||
@@ -37,7 +40,7 @@
|
|||||||
<Cn-grid title="">
|
<Cn-grid title="">
|
||||||
<Cn-grid-item src="/static/device2.png" text="设备注册" @click="registerDevice"></Cn-grid-item>
|
<Cn-grid-item src="/static/device2.png" text="设备注册" @click="registerDevice"></Cn-grid-item>
|
||||||
<!-- <Cn-grid-item src="/static/gateway2.png" text="网关注册" @click="registerGateway"></Cn-grid-item> -->
|
<!-- <Cn-grid-item src="/static/gateway2.png" text="网关注册" @click="registerGateway"></Cn-grid-item> -->
|
||||||
<Cn-grid-item src="/static/feedback2.png" text="提交反馈" @click="submitFeedBack"></Cn-grid-item>
|
<Cn-grid-item src="/static/feedback2.png" text="问题反馈" @click="submitFeedBack"></Cn-grid-item>
|
||||||
</Cn-grid>
|
</Cn-grid>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="index-zhuanzhi">
|
<view class="index-zhuanzhi">
|
||||||
<view class="canneng-index-title mb20">所有工程统计信息</view>
|
<template v-if="devCount.engineeringListLength > 1">
|
||||||
|
<view class="canneng-index-title mb20">所有工程设备统计</view>
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="header-item">
|
<view class="header-item">
|
||||||
<view class="header-item-value">{{ devCount.onLineDevCount + devCount.offLineDevCount || 0 }}</view>
|
<view class="header-item-value">{{ devCount.onLineDevCount + devCount.offLineDevCount || 0 }}</view>
|
||||||
@@ -27,7 +28,9 @@
|
|||||||
<view class="header-item-label">项目个数</view>
|
<view class="header-item-label">项目个数</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="canneng-index-title mb20 mt20">当前工程统计信息</view>
|
<view class="mt20"></view>
|
||||||
|
</template>
|
||||||
|
<view class="canneng-index-title mb20">当前工程设备统计</view>
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="header-item">
|
<view class="header-item">
|
||||||
<view class="header-item-value">{{
|
<view class="header-item-value">{{
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ export default {
|
|||||||
let res = await queryEngineering()
|
let res = await queryEngineering()
|
||||||
this.engineeringList = res.data
|
this.engineeringList = res.data
|
||||||
if (this.engineeringList.length === 0) {
|
if (this.engineeringList.length === 0) {
|
||||||
|
uni.removeStorageSync(this.$cacheKey.engineering)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!engineering) {
|
if (!engineering) {
|
||||||
@@ -155,6 +156,8 @@ export default {
|
|||||||
this.devCount.offLineDevs.forEach((item) => {
|
this.devCount.offLineDevs.forEach((item) => {
|
||||||
item.runStatus = 1
|
item.runStatus = 1
|
||||||
})
|
})
|
||||||
|
this.devCount.engineeringListLength = this.engineeringList.length
|
||||||
|
console.log(this.devCount);
|
||||||
})
|
})
|
||||||
this.$refs.device && this.$refs.device.init()
|
this.$refs.device && this.$refs.device.init()
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -93,7 +93,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { roleUpdate } from '@/common/api/user'
|
import { roleUpdate, autoLogin } from '@/common/api/user'
|
||||||
import { transferDevice } from '@/common/api/device'
|
import { transferDevice } from '@/common/api/device'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -137,14 +137,16 @@ export default {
|
|||||||
referralCode: code,
|
referralCode: code,
|
||||||
userId: this.userInfo.userIndex,
|
userId: this.userInfo.userIndex,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
uni.removeStorage('engineering')
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '升级成功',
|
title: '升级成功',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
})
|
})
|
||||||
// 重新登录
|
uni.removeStorageSync('access_token')
|
||||||
uni.reLaunch({
|
// 直接登录
|
||||||
url: '/pages/user/login',
|
autoLogin(this.userInfo.user_name).then((res) => {
|
||||||
|
this.$util.loginSuccess(res.data).then((userInfo) => {
|
||||||
|
this.userInfo = userInfo
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
this.store = this.DataSource('/cs-device-boot/feedback/queryFeedBackPage')
|
this.store = this.DataSource('/cs-system-boot/feedback/queryFeedBackPage')
|
||||||
this.store.params.userId = uni.getStorageSync('userInfo').id
|
|
||||||
this.store.reload()
|
this.store.reload()
|
||||||
},
|
},
|
||||||
jump(item) {
|
jump(item) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<view slot='body'>
|
<view slot='body'>
|
||||||
<view class='about'>
|
<view class='about'>
|
||||||
<image src="/static/logo.png" class="logo"></image>
|
<image src="/static/logo.png" class="logo"></image>
|
||||||
<view class="name">灿能云</view>
|
<view class="name">灿能物联</view>
|
||||||
<view class="version">Version 1.0.0</view>
|
<view class="version">Version 1.0.0</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -23,14 +23,14 @@ export default {
|
|||||||
<style lang='scss'>
|
<style lang='scss'>
|
||||||
.about {
|
.about {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
height: 100vh;
|
|
||||||
padding: 34rpx;
|
padding: 34rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
overflow: hidden;
|
||||||
.logo {
|
.logo {
|
||||||
|
margin-top: 200rpx;
|
||||||
height: 120rpx;
|
height: 120rpx;
|
||||||
width: 120rpx;
|
width: 120rpx;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,10 +37,10 @@
|
|||||||
<view class="mine-nav-label">公司介绍</view>
|
<view class="mine-nav-label">公司介绍</view>
|
||||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
<view class="mine-nav" @click="jump('feedback')">
|
<!-- <view class="mine-nav" @click="jump('feedback')">
|
||||||
<view class="mine-nav-label">意见反馈</view>
|
<view class="mine-nav-label">意见反馈</view>
|
||||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||||
</view>
|
</view> -->
|
||||||
<view class="mine-nav" @click="jump('about')" style="border-bottom: none; ">
|
<view class="mine-nav" @click="jump('about')" style="border-bottom: none; ">
|
||||||
<view class="mine-nav-label">关于我们</view>
|
<view class="mine-nav-label">关于我们</view>
|
||||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
<view v-show="navMenuActive == 0">
|
<view v-show="navMenuActive == 0">
|
||||||
<uni-card
|
<uni-card
|
||||||
:title="item.equipmentName"
|
:title="item.equipmentName"
|
||||||
sub-title="创建时间"
|
:sub-title="'创建时间:' + item.createTime"
|
||||||
v-for="item in store.data"
|
v-for="item in store.data"
|
||||||
:key="item.equipmentId"
|
:key="item.equipmentId"
|
||||||
@click="goDevice(item)"
|
@click="goDevice(item)"
|
||||||
|
|||||||
@@ -18,11 +18,11 @@
|
|||||||
<view class="term-list-bottom">
|
<view class="term-list-bottom">
|
||||||
<view class="term-list-bottom-item">
|
<view class="term-list-bottom-item">
|
||||||
<view>设备个数</view>
|
<view>设备个数</view>
|
||||||
<view>3</view>
|
<view>{{item.devNum}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="term-list-bottom-item">
|
<view class="term-list-bottom-item">
|
||||||
<view>用户个数</view>
|
<view>创建时间</view>
|
||||||
<view>1</view>
|
<view>{{item.createTime}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</uni-card>
|
</uni-card>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
/>
|
/>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="项目名称">
|
<uni-forms-item label="项目名称">
|
||||||
<uni-easyinput v-model="formData.name" placeholder="请输入项目名称" />
|
<uni-easyinput v-model="formData.name" placeholder="请输入项目名称"/>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="区域">
|
<uni-forms-item label="区域">
|
||||||
<view style="display: flex">
|
<view style="display: flex">
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
mode="aspectFill"
|
mode="aspectFill"
|
||||||
/>
|
/>
|
||||||
<view class="temp-choose-content-item-close" @click="deleteImg(index)">
|
<view class="temp-choose-content-item-close" @click="deleteImg(index)">
|
||||||
<uni-icons style="font-size: 18px" type="closeempty" color="#fff" size="20" />
|
<uni-icons style="font-size: 18px" type="closeempty" color="#fff" size="20"/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="temp-choose-content-item" @click="openTemp">
|
<view class="temp-choose-content-item" @click="openTemp">
|
||||||
@@ -63,12 +63,13 @@
|
|||||||
v-model="formData.files"
|
v-model="formData.files"
|
||||||
title="从本地上传拓扑图"
|
title="从本地上传拓扑图"
|
||||||
:sourceType="['album']"
|
:sourceType="['album']"
|
||||||
|
:before-remove="beforeRemove"
|
||||||
@select="select"
|
@select="select"
|
||||||
></uni-file-picker>
|
></uni-file-picker>
|
||||||
</uni-forms>
|
</uni-forms>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn-wrap">
|
<view class="btn-wrap">
|
||||||
<view class="btn-wrap-item" @click="submit"> 提交 </view>
|
<view class="btn-wrap-item" @click="submit"> 提交</view>
|
||||||
</view>
|
</view>
|
||||||
<uni-drawer ref="showRight" mode="right" :mask-click="false">
|
<uni-drawer ref="showRight" mode="right" :mask-click="false">
|
||||||
<uni-indexed-list
|
<uni-indexed-list
|
||||||
@@ -81,7 +82,7 @@
|
|||||||
<view class="popup-header">
|
<view class="popup-header">
|
||||||
<view class="popup-header-title">模版库</view>
|
<view class="popup-header-title">模版库</view>
|
||||||
<view class="popup-header-close" @click="closeTemp">
|
<view class="popup-header-close" @click="closeTemp">
|
||||||
<uni-icons type="closeempty" color="#111" size="20" />
|
<uni-icons type="closeempty" color="#111" size="20"/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="temp-list">
|
<view class="temp-list">
|
||||||
@@ -95,7 +96,7 @@
|
|||||||
v-for="(item, index) in tempList"
|
v-for="(item, index) in tempList"
|
||||||
@click="chooseTempItem(item)"
|
@click="chooseTempItem(item)"
|
||||||
>
|
>
|
||||||
<image class="temp-list-item-img" :src="item.filePath" mode="aspectFill" />
|
<image class="temp-list-item-img" :src="item.filePath" mode="aspectFill"/>
|
||||||
<view class="temp-list-item-name">{{ item.name }}</view>
|
<view class="temp-list-item-name">{{ item.name }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -105,10 +106,11 @@
|
|||||||
</Cn-page>
|
</Cn-page>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { pinyin } from 'pinyin-pro'
|
import {pinyin} from 'pinyin-pro'
|
||||||
import { addAppProject, updateAppProject } from '../../common/api/project'
|
import {addAppProject, updateAppProject, checkCanDelete} from '../../common/api/project'
|
||||||
import { getTopoTemplate } from '../../common/api/device'
|
import {getTopoTemplate} from '../../common/api/device'
|
||||||
import { queryEngineering } from '@/common/api/engineering.js'
|
import {queryEngineering} from '@/common/api/engineering.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -134,7 +136,7 @@ export default {
|
|||||||
engineeringListFilter() {
|
engineeringListFilter() {
|
||||||
let result = []
|
let result = []
|
||||||
this.engineeringList.forEach((item) => {
|
this.engineeringList.forEach((item) => {
|
||||||
let arr = pinyin(item.name[0], { toneType: 'none', type: 'array' })
|
let arr = pinyin(item.name[0], {toneType: 'none', type: 'array'})
|
||||||
let letter = arr[0][0].toUpperCase()
|
let letter = arr[0][0].toUpperCase()
|
||||||
console.log(letter)
|
console.log(letter)
|
||||||
let index = result.findIndex((item) => item.letter === letter)
|
let index = result.findIndex((item) => item.letter === letter)
|
||||||
@@ -198,14 +200,38 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
deleteImg(index) {
|
beforeRemove(e) {
|
||||||
|
console.log(e)
|
||||||
|
if (!e.tempFile.id) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
checkCanDelete(e.tempFile.id).then((res) => {
|
||||||
|
console.log(res)
|
||||||
|
if (res.data) {
|
||||||
|
resolve(true)
|
||||||
|
} else {
|
||||||
|
reject()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async deleteImg(index) {
|
||||||
|
await this.beforeRemove({
|
||||||
|
tempFile: this.formData.tempFiles[index],
|
||||||
|
})
|
||||||
this.formData.tempFiles.splice(index, 1)
|
this.formData.tempFiles.splice(index, 1)
|
||||||
},
|
},
|
||||||
chooseTempItem(item) {
|
async chooseTempItem(item) {
|
||||||
if (this.formData.tempFiles.some((item2) => item2.id === item.id || item2.topoId === item.id)) {
|
console.log(item)
|
||||||
this.formData.tempFiles = this.formData.tempFiles.filter(
|
console.log(this.formData.tempFiles)
|
||||||
(item2) => item2.id !== item.id && item2.topoId !== item.id,
|
// 编辑的时候,如果已经存在就要验证topoId
|
||||||
)
|
let index = this.formData.tempFiles.findIndex((item2) => item2.id === item.id || item2.topoId === item.id)
|
||||||
|
if (index > -1) {
|
||||||
|
await this.beforeRemove({
|
||||||
|
tempFile: this.formData.tempFiles[index],
|
||||||
|
})
|
||||||
|
this.formData.tempFiles.splice(index, 1)
|
||||||
} else {
|
} else {
|
||||||
this.formData.tempFiles.push(item)
|
this.formData.tempFiles.push(item)
|
||||||
}
|
}
|
||||||
@@ -227,8 +253,8 @@ export default {
|
|||||||
},
|
},
|
||||||
select(e) {
|
select(e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
|
this.formData.files.push(...e.tempFiles)
|
||||||
console.log(this.formData.files)
|
console.log(this.formData.files)
|
||||||
this.formData.files = this.formData.files.concat(e.tempFiles)
|
|
||||||
},
|
},
|
||||||
chooseLocation() {
|
chooseLocation() {
|
||||||
uni.chooseLocation({
|
uni.chooseLocation({
|
||||||
@@ -266,19 +292,28 @@ export default {
|
|||||||
let item = this.formData.files[i]
|
let item = this.formData.files[i]
|
||||||
console.log(item)
|
console.log(item)
|
||||||
arr.push({
|
arr.push({
|
||||||
|
...item,
|
||||||
name: 'files',
|
name: 'files',
|
||||||
uri: item.url,
|
uri: item.url,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.formData.topoIds = this.formData.tempFiles.map((item) => (item.topoId ? item.topoId : item.id))
|
console.log(arr)
|
||||||
|
this.formData.topoIds = this.formData.tempFiles.map((item) => (item.topoId))
|
||||||
let data = JSON.parse(JSON.stringify(this.formData))
|
let data = JSON.parse(JSON.stringify(this.formData))
|
||||||
delete data.files
|
|
||||||
let res = {}
|
let res = {}
|
||||||
console.warn(data, arr)
|
console.warn(data, arr)
|
||||||
if (this.project) {
|
if (this.project) {
|
||||||
data.id = this.project.id
|
data.id = this.project.id
|
||||||
|
data.newTopoIds = data.files.filter(item => item.id).map((item) => item.id)
|
||||||
|
data.newTopoIds.push(...data.tempFiles.filter(item => item.id && item.topoId).map((item) => item.id))
|
||||||
|
data.topoIds = data.tempFiles.filter(item => item.id && !item.topoId).map((item) => item.id)
|
||||||
|
delete data.tempFiles
|
||||||
|
delete data.files
|
||||||
|
arr = arr.filter(item => !item.id)
|
||||||
res = await updateAppProject(data, arr)
|
res = await updateAppProject(data, arr)
|
||||||
} else {
|
} else {
|
||||||
|
delete data.tempFiles
|
||||||
|
delete data.files
|
||||||
res = await addAppProject(data, arr)
|
res = await addAppProject(data, arr)
|
||||||
}
|
}
|
||||||
let result = {}
|
let result = {}
|
||||||
@@ -341,17 +376,21 @@ export default {
|
|||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.temp-choose {
|
.temp-choose {
|
||||||
margin-bottom: 44rpx;
|
margin-bottom: 44rpx;
|
||||||
|
|
||||||
.temp-choose-title {
|
.temp-choose-title {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.temp-choose-content {
|
.temp-choose-content {
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, 198rpx);
|
grid-template-columns: repeat(3, 198rpx);
|
||||||
grid-gap: 10rpx;
|
grid-gap: 10rpx;
|
||||||
|
|
||||||
.temp-choose-content-item {
|
.temp-choose-content-item {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border: 1px #eee solid;
|
border: 1px #eee solid;
|
||||||
@@ -360,12 +399,14 @@ export default {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
height: 198rpx;
|
height: 198rpx;
|
||||||
|
|
||||||
.temp-choose-content-item-img {
|
.temp-choose-content-item-img {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: skyblue;
|
background: skyblue;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.temp-choose-content-item-close {
|
.temp-choose-content-item-close {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -398,10 +439,12 @@ export default {
|
|||||||
position: relative;
|
position: relative;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border: 4px solid #f1f1f1;
|
border: 4px solid #f1f1f1;
|
||||||
|
|
||||||
.temp-list-item-img {
|
.temp-list-item-img {
|
||||||
height: 280rpx;
|
height: 280rpx;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.temp-list-item-name {
|
.temp-list-item-name {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
right: 0;
|
||||||
@@ -409,6 +452,7 @@ export default {
|
|||||||
background: #fff;
|
background: #fff;
|
||||||
padding: 4rpx 8rpx;
|
padding: 4rpx 8rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-active {
|
&-active {
|
||||||
border: 4rpx solid $uni-theme-color;
|
border: 4rpx solid $uni-theme-color;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,12 +22,14 @@
|
|||||||
<view class="login-box-input-img"></view>
|
<view class="login-box-input-img"></view>
|
||||||
</view> -->
|
</view> -->
|
||||||
<view class="login-box-input mt40">
|
<view class="login-box-input mt40">
|
||||||
<input type="text" class="login-box-input-main" v-model="yzmForm.code" placeholder="手机验证码" maxlength="6" />
|
<input type="text" class="login-box-input-main" v-model="yzmForm.code"
|
||||||
|
placeholder="手机验证码" maxlength="6"/>
|
||||||
<view
|
<view
|
||||||
class="ml40"
|
class="ml40"
|
||||||
style="font-size: 28rpx; color: #666; width: 200rpx; text-align: center"
|
style="font-size: 28rpx; color: #666; width: 200rpx; text-align: center"
|
||||||
v-if="waitTime > 0"
|
v-if="waitTime > 0"
|
||||||
>{{ waitTime + 's后重新获取' }}</view
|
>{{ waitTime + 's后重新获取' }}
|
||||||
|
</view
|
||||||
>
|
>
|
||||||
<button class="login-box-input-btn" v-else @click="getCode" size="mini">获取验证码</button>
|
<button class="login-box-input-btn" v-else @click="getCode" size="mini">获取验证码</button>
|
||||||
</view>
|
</view>
|
||||||
@@ -55,7 +57,7 @@
|
|||||||
<view class="login-box-input-img"></view>
|
<view class="login-box-input-img"></view>
|
||||||
</view> -->
|
</view> -->
|
||||||
</template>
|
</template>
|
||||||
<view class="login-box-btn" @click="login"> 登录 </view>
|
<view class="login-box-btn" @click="login"> 登录</view>
|
||||||
<view class="login-box-footer">
|
<view class="login-box-footer">
|
||||||
<view @click="loginType = 'pwd'" v-if="loginType == 'yzm'">账号密码登录</view>
|
<view @click="loginType = 'pwd'" v-if="loginType == 'yzm'">账号密码登录</view>
|
||||||
<view @click="loginType = 'yzm'" v-else>短信验证码登录</view>
|
<view @click="loginType = 'yzm'" v-else>短信验证码登录</view>
|
||||||
@@ -68,12 +70,14 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="login-box-tips">
|
<view class="login-box-tips">
|
||||||
<view style="color: #999"
|
<view style="color: #999"
|
||||||
><checkbox
|
>
|
||||||
|
<checkbox
|
||||||
style="transform: scale(0.7)"
|
style="transform: scale(0.7)"
|
||||||
:checked="checkbox"
|
:checked="checkbox"
|
||||||
@click="checkbox = !checkbox"
|
@click="checkbox = !checkbox"
|
||||||
/>
|
/>
|
||||||
我已阅读并同意</view
|
我已阅读并同意
|
||||||
|
</view
|
||||||
>
|
>
|
||||||
<navigator url="/pages/mine/agreement" hover-class="none">《用户协议》</navigator>
|
<navigator url="/pages/mine/agreement" hover-class="none">《用户协议》</navigator>
|
||||||
<navigator url="/pages/mine/policy" hover-class="none">《个人信息保护政策》</navigator>
|
<navigator url="/pages/mine/policy" hover-class="none">《个人信息保护政策》</navigator>
|
||||||
@@ -84,9 +88,9 @@
|
|||||||
</Cn-page>
|
</Cn-page>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { apiGetYms, apiPwdLogin, apiYsmLogin, gongkey } from '@/common/api/user'
|
import {apiGetYms, apiPwdLogin, apiYsmLogin, gongkey} from '@/common/api/user'
|
||||||
import { sm2, encrypt } from '@/common/js/sm2.js'
|
import {sm2, encrypt} from '@/common/js/sm2.js'
|
||||||
import { sm3Digest } from '@/common/js/sm3.js'
|
import {sm3Digest} from '@/common/js/sm3.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@@ -159,7 +163,7 @@ export default {
|
|||||||
console.log(this.phone)
|
console.log(this.phone)
|
||||||
let loginName = encrypt(this.phone)
|
let loginName = encrypt(this.phone)
|
||||||
console.log(loginName)
|
console.log(loginName)
|
||||||
gongkey({ loginName }).then((response) => {
|
gongkey({loginName}).then((response) => {
|
||||||
let publicKey = response.data
|
let publicKey = response.data
|
||||||
let sm3Pwd = sm3Digest(this.pwdForm.pwd)
|
let sm3Pwd = sm3Digest(this.pwdForm.pwd)
|
||||||
let jiamipassword = sm2(sm3Pwd + '|' + this.pwdForm.pwd, publicKey, 0)
|
let jiamipassword = sm2(sm3Pwd + '|' + this.pwdForm.pwd, publicKey, 0)
|
||||||
@@ -194,7 +198,7 @@ export default {
|
|||||||
this.phone = userInfo.user_name
|
this.phone = userInfo.user_name
|
||||||
}
|
}
|
||||||
uni.removeStorageSync(this.$cacheKey.access_token)
|
uni.removeStorageSync(this.$cacheKey.access_token)
|
||||||
uni.removeStorageSync(this.$cacheKey.engineering)
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
33
pnpm-lock.yaml
generated
33
pnpm-lock.yaml
generated
@@ -4,7 +4,7 @@ specifiers:
|
|||||||
'@types/html5plus': ^1.0.2
|
'@types/html5plus': ^1.0.2
|
||||||
'@types/uni-app': ^1.4.4
|
'@types/uni-app': ^1.4.4
|
||||||
crypto-js: ^4.1.1
|
crypto-js: ^4.1.1
|
||||||
html2canvas: 1.0.0-rc.4
|
html2canvas: ^1.4.1
|
||||||
image-tools: ^1.4.0
|
image-tools: ^1.4.0
|
||||||
mqtt: 3.0.0
|
mqtt: 3.0.0
|
||||||
pinyin-pro: ^3.13.2
|
pinyin-pro: ^3.13.2
|
||||||
@@ -13,7 +13,7 @@ specifiers:
|
|||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
crypto-js: 4.1.1
|
crypto-js: 4.1.1
|
||||||
html2canvas: 1.0.0-rc.4
|
html2canvas: 1.4.1
|
||||||
image-tools: 1.4.0
|
image-tools: 1.4.0
|
||||||
mqtt: 3.0.0
|
mqtt: 3.0.0
|
||||||
pinyin-pro: 3.13.2
|
pinyin-pro: 3.13.2
|
||||||
@@ -86,8 +86,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
|
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/base64-arraybuffer/0.2.0:
|
/base64-arraybuffer/1.0.2:
|
||||||
resolution: {integrity: sha512-7emyCsu1/xiBXgQZrscw/8KPRT44I4Yq9Pe6EGs3aPRTsWuggML1/1DTuZUuIaJPIm1FTDUVXl4x/yW8s0kQDQ==}
|
resolution: {integrity: sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==}
|
||||||
engines: {node: '>= 0.6.0'}
|
engines: {node: '>= 0.6.0'}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
@@ -174,10 +174,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==}
|
resolution: {integrity: sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/css-line-break/1.1.1:
|
/css-line-break/2.1.0:
|
||||||
resolution: {integrity: sha512-1feNVaM4Fyzdj4mKPIQNL2n70MmuYzAXZ1aytlROFX1JsOo070OsugwGjj7nl6jnDJWHDM8zRZswkmeYVWZJQA==}
|
resolution: {integrity: sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==}
|
||||||
dependencies:
|
dependencies:
|
||||||
base64-arraybuffer: 0.2.0
|
utrie: 1.0.2
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/csstype/3.1.2:
|
/csstype/3.1.2:
|
||||||
@@ -369,11 +369,12 @@ packages:
|
|||||||
xtend: 4.0.2
|
xtend: 4.0.2
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/html2canvas/1.0.0-rc.4:
|
/html2canvas/1.4.1:
|
||||||
resolution: {integrity: sha512-5sJ+oM3FfNFpGVbMQkJFDl1WH5Sa293l2koMEZWbaehJ3dWHty4mSrmZtfWlWDoLckfGojZS9aZ7Zk3uFouyPw==}
|
resolution: {integrity: sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==}
|
||||||
engines: {node: '>=8.0.0'}
|
engines: {node: '>=8.0.0'}
|
||||||
dependencies:
|
dependencies:
|
||||||
css-line-break: 1.1.1
|
css-line-break: 2.1.0
|
||||||
|
text-segmentation: 1.0.3
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/ieee754/1.2.1:
|
/ieee754/1.2.1:
|
||||||
@@ -673,6 +674,12 @@ packages:
|
|||||||
safe-buffer: 5.2.1
|
safe-buffer: 5.2.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/text-segmentation/1.0.3:
|
||||||
|
resolution: {integrity: sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==}
|
||||||
|
dependencies:
|
||||||
|
utrie: 1.0.2
|
||||||
|
dev: false
|
||||||
|
|
||||||
/through2-filter/3.0.0:
|
/through2-filter/3.0.0:
|
||||||
resolution: {integrity: sha512-jaRjI2WxN3W1V8/FMZ9HKIBXixtiqs3SQSX4/YGIiP3gL6djW48VoZq9tDqeCWs3MT8YY5wb/zli8VW8snY1CA==}
|
resolution: {integrity: sha512-jaRjI2WxN3W1V8/FMZ9HKIBXixtiqs3SQSX4/YGIiP3gL6djW48VoZq9tDqeCWs3MT8YY5wb/zli8VW8snY1CA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -732,6 +739,12 @@ packages:
|
|||||||
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
|
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/utrie/1.0.2:
|
||||||
|
resolution: {integrity: sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==}
|
||||||
|
dependencies:
|
||||||
|
base64-arraybuffer: 1.0.2
|
||||||
|
dev: false
|
||||||
|
|
||||||
/vconsole/3.15.1:
|
/vconsole/3.15.1:
|
||||||
resolution: {integrity: sha512-KH8XLdrq9T5YHJO/ixrjivHfmF2PC2CdVoK6RWZB4yftMykYIaXY1mxZYAic70vADM54kpMQF+dYmvl5NRNy1g==}
|
resolution: {integrity: sha512-KH8XLdrq9T5YHJO/ixrjivHfmF2PC2CdVoK6RWZB4yftMykYIaXY1mxZYAic70vADM54kpMQF+dYmvl5NRNy1g==}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|||||||
@@ -1,53 +1,97 @@
|
|||||||
## 1.1.3(2022-09-22)
|
## 1.1.9(2023-04-11)
|
||||||
- 修复,引入 uni.scss 引入默认主题色报错的问题
|
- 修复 vue3 下 keyboardheightchange 事件报错的bug
|
||||||
## 1.1.2(2022-09-22)
|
## 1.1.8(2023-03-29)
|
||||||
- 增加主题色 primaryColor 配置选项
|
- 优化 trim 属性默认值
|
||||||
## 1.1.1(2022-09-19)
|
## 1.1.7(2023-03-29)
|
||||||
- 修复,输入后回车,change 事件触发两次,[详情](https://ask.dcloud.net.cn/question/152149)
|
- 新增 cursor-spacing 属性
|
||||||
|
## 1.1.6(2023-01-28)
|
||||||
|
- 新增 keyboardheightchange 事件,可监听键盘高度变化
|
||||||
|
## 1.1.5(2022-11-29)
|
||||||
|
- 优化 主题样式
|
||||||
|
## 1.1.4(2022-10-27)
|
||||||
|
- 修复 props 中背景颜色无默认值的bug
|
||||||
## 1.1.0(2022-06-30)
|
## 1.1.0(2022-06-30)
|
||||||
|
|
||||||
- 新增 在 uni-forms 1.4.0 中使用可以在 blur 时校验内容
|
- 新增 在 uni-forms 1.4.0 中使用可以在 blur 时校验内容
|
||||||
- 新增 clear 事件,点击右侧叉号图标触发
|
- 新增 clear 事件,点击右侧叉号图标触发
|
||||||
- 新增 change 事件 ,仅在输入框失去焦点或用户按下回车时触发
|
- 新增 change 事件 ,仅在输入框失去焦点或用户按下回车时触发
|
||||||
- 优化 组件样式,组件获取焦点时高亮显示,图标颜色调整等
|
- 优化 组件样式,组件获取焦点时高亮显示,图标颜色调整等
|
||||||
-
|
|
||||||
## 1.0.5(2022-06-07)
|
## 1.0.5(2022-06-07)
|
||||||
|
|
||||||
- 优化 clearable 显示策略
|
- 优化 clearable 显示策略
|
||||||
|
|
||||||
## 1.0.4(2022-06-07)
|
## 1.0.4(2022-06-07)
|
||||||
|
|
||||||
- 优化 clearable 显示策略
|
- 优化 clearable 显示策略
|
||||||
|
|
||||||
## 1.0.3(2022-05-20)
|
## 1.0.3(2022-05-20)
|
||||||
- 修复 关闭图标某些情况下无法取消的bug
|
|
||||||
|
- 修复 关闭图标某些情况下无法取消的 bug
|
||||||
|
|
||||||
## 1.0.2(2022-04-12)
|
## 1.0.2(2022-04-12)
|
||||||
- 修复 默认值不生效的bug
|
|
||||||
|
- 修复 默认值不生效的 bug
|
||||||
|
|
||||||
## 1.0.1(2022-04-02)
|
## 1.0.1(2022-04-02)
|
||||||
- 修复 value不能为0的bug
|
|
||||||
|
- 修复 value 不能为 0 的 bug
|
||||||
|
|
||||||
## 1.0.0(2021-11-19)
|
## 1.0.0(2021-11-19)
|
||||||
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
|
|
||||||
|
- 优化 组件 UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
|
||||||
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-easyinput](https://uniapp.dcloud.io/component/uniui/uni-easyinput)
|
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-easyinput](https://uniapp.dcloud.io/component/uniui/uni-easyinput)
|
||||||
|
|
||||||
## 0.1.4(2021-08-20)
|
## 0.1.4(2021-08-20)
|
||||||
|
|
||||||
- 修复 在 uni-forms 的动态表单中默认值校验不通过的 bug
|
- 修复 在 uni-forms 的动态表单中默认值校验不通过的 bug
|
||||||
|
|
||||||
## 0.1.3(2021-08-11)
|
## 0.1.3(2021-08-11)
|
||||||
|
|
||||||
- 修复 在 uni-forms 中重置表单,错误信息无法清除的问题
|
- 修复 在 uni-forms 中重置表单,错误信息无法清除的问题
|
||||||
|
|
||||||
## 0.1.2(2021-07-30)
|
## 0.1.2(2021-07-30)
|
||||||
- 优化 vue3下事件警告的问题
|
|
||||||
|
- 优化 vue3 下事件警告的问题
|
||||||
|
|
||||||
## 0.1.1
|
## 0.1.1
|
||||||
|
|
||||||
- 优化 errorMessage 属性支持 Boolean 类型
|
- 优化 errorMessage 属性支持 Boolean 类型
|
||||||
|
|
||||||
## 0.1.0(2021-07-13)
|
## 0.1.0(2021-07-13)
|
||||||
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
|
|
||||||
|
- 组件兼容 vue3,如何创建 vue3 项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
|
||||||
|
|
||||||
## 0.0.16(2021-06-29)
|
## 0.0.16(2021-06-29)
|
||||||
|
|
||||||
- 修复 confirmType 属性(仅 type="text" 生效)导致多行文本框无法换行的 bug
|
- 修复 confirmType 属性(仅 type="text" 生效)导致多行文本框无法换行的 bug
|
||||||
|
|
||||||
## 0.0.15(2021-06-21)
|
## 0.0.15(2021-06-21)
|
||||||
|
|
||||||
- 修复 passwordIcon 属性拼写错误的 bug
|
- 修复 passwordIcon 属性拼写错误的 bug
|
||||||
|
|
||||||
## 0.0.14(2021-06-18)
|
## 0.0.14(2021-06-18)
|
||||||
- 新增 passwordIcon 属性,当type=password时是否显示小眼睛图标
|
|
||||||
|
- 新增 passwordIcon 属性,当 type=password 时是否显示小眼睛图标
|
||||||
- 修复 confirmType 属性不生效的问题
|
- 修复 confirmType 属性不生效的问题
|
||||||
|
|
||||||
## 0.0.13(2021-06-04)
|
## 0.0.13(2021-06-04)
|
||||||
|
|
||||||
- 修复 disabled 状态可清出内容的 bug
|
- 修复 disabled 状态可清出内容的 bug
|
||||||
|
|
||||||
## 0.0.12(2021-05-12)
|
## 0.0.12(2021-05-12)
|
||||||
|
|
||||||
- 新增 组件示例地址
|
- 新增 组件示例地址
|
||||||
|
|
||||||
## 0.0.11(2021-05-07)
|
## 0.0.11(2021-05-07)
|
||||||
|
|
||||||
- 修复 input-border 属性不生效的问题
|
- 修复 input-border 属性不生效的问题
|
||||||
|
|
||||||
## 0.0.10(2021-04-30)
|
## 0.0.10(2021-04-30)
|
||||||
|
|
||||||
- 修复 ios 遮挡文字、显示一半的问题
|
- 修复 ios 遮挡文字、显示一半的问题
|
||||||
|
|
||||||
## 0.0.9(2021-02-05)
|
## 0.0.9(2021-02-05)
|
||||||
- 调整为uni_modules目录规范
|
|
||||||
|
- 调整为 uni_modules 目录规范
|
||||||
- 优化 兼容 nvue 页面
|
- 优化 兼容 nvue 页面
|
||||||
|
|||||||
@@ -1,34 +1,74 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="uni-easyinput" :class="{'uni-easyinput-error':msg}" :style="boxStyle">
|
<view class="uni-easyinput" :class="{ 'uni-easyinput-error': msg }" :style="boxStyle">
|
||||||
<view class="uni-easyinput__content" :class="inputContentClass" :style="inputContentStyle">
|
<view class="uni-easyinput__content" :class="inputContentClass" :style="inputContentStyle">
|
||||||
<uni-icons v-if="prefixIcon" class="content-clear-icon" :type="prefixIcon" color="#c0c4cc"
|
<uni-icons v-if="prefixIcon" class="content-clear-icon" :type="prefixIcon" color="#c0c4cc" @click="onClickIcon('prefix')" size="22"></uni-icons>
|
||||||
@click="onClickIcon('prefix')" size="22"></uni-icons>
|
<textarea
|
||||||
<textarea v-if="type === 'textarea'" class="uni-easyinput__content-textarea"
|
v-if="type === 'textarea'"
|
||||||
:class="{'input-padding':inputBorder}" :name="name" :value="val" :placeholder="placeholder"
|
class="uni-easyinput__content-textarea"
|
||||||
:placeholderStyle="placeholderStyle" :disabled="disabled"
|
:class="{ 'input-padding': inputBorder }"
|
||||||
placeholder-class="uni-easyinput__placeholder-class" :maxlength="inputMaxlength" :focus="focused"
|
:name="name"
|
||||||
:autoHeight="autoHeight" @input="onInput" @blur="_Blur" @focus="_Focus" @confirm="onConfirm"></textarea>
|
:value="val"
|
||||||
<input v-else :type="type === 'password'?'text':type" class="uni-easyinput__content-input"
|
:placeholder="placeholder"
|
||||||
:style="inputStyle" :name="name" :value="val" :password="!showPassword && type === 'password'"
|
:placeholderStyle="placeholderStyle"
|
||||||
:placeholder="placeholder" :placeholderStyle="placeholderStyle"
|
:disabled="disabled"
|
||||||
placeholder-class="uni-easyinput__placeholder-class" :disabled="disabled" :maxlength="inputMaxlength"
|
placeholder-class="uni-easyinput__placeholder-class"
|
||||||
:focus="focused" :confirmType="confirmType" @focus="_Focus" @blur="_Blur" @input="onInput"
|
:maxlength="inputMaxlength"
|
||||||
@confirm="onConfirm" />
|
:focus="focused"
|
||||||
|
:autoHeight="autoHeight"
|
||||||
|
:cursor-spacing="cursorSpacing"
|
||||||
|
@input="onInput"
|
||||||
|
@blur="_Blur"
|
||||||
|
@focus="_Focus"
|
||||||
|
@confirm="onConfirm"
|
||||||
|
@keyboardheightchange="onkeyboardheightchange"
|
||||||
|
></textarea>
|
||||||
|
<input
|
||||||
|
v-else
|
||||||
|
:type="type === 'password' ? 'text' : type"
|
||||||
|
class="uni-easyinput__content-input"
|
||||||
|
:style="inputStyle"
|
||||||
|
:name="name"
|
||||||
|
:value="val"
|
||||||
|
:password="!showPassword && type === 'password'"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
placeholder-class="uni-easyinput__placeholder-class"
|
||||||
|
:disabled="disabled"
|
||||||
|
:maxlength="inputMaxlength"
|
||||||
|
:focus="focused"
|
||||||
|
:confirmType="confirmType"
|
||||||
|
:cursor-spacing="cursorSpacing"
|
||||||
|
@focus="_Focus"
|
||||||
|
@blur="_Blur"
|
||||||
|
@input="onInput"
|
||||||
|
@confirm="onConfirm"
|
||||||
|
@keyboardheightchange="onkeyboardheightchange"
|
||||||
|
/>
|
||||||
<template v-if="type === 'password' && passwordIcon">
|
<template v-if="type === 'password' && passwordIcon">
|
||||||
<!-- 开启密码时显示小眼睛 -->
|
<!-- 开启密码时显示小眼睛 -->
|
||||||
<uni-icons v-if="isVal" class="content-clear-icon" :class="{'is-textarea-icon':type==='textarea'}"
|
<uni-icons
|
||||||
:type="showPassword?'eye-slash-filled':'eye-filled'" :size="22"
|
v-if="isVal"
|
||||||
:color="focusShow ? primaryColor :'#c0c4cc'" @click="onEyes">
|
class="content-clear-icon"
|
||||||
</uni-icons>
|
:class="{ 'is-textarea-icon': type === 'textarea' }"
|
||||||
|
:type="showPassword ? 'eye-slash-filled' : 'eye-filled'"
|
||||||
|
:size="22"
|
||||||
|
:color="focusShow ? primaryColor : '#c0c4cc'"
|
||||||
|
@click="onEyes"
|
||||||
|
></uni-icons>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="suffixIcon">
|
<template v-else-if="suffixIcon">
|
||||||
<uni-icons v-if="suffixIcon" class="content-clear-icon" :type="suffixIcon" color="#c0c4cc"
|
<uni-icons v-if="suffixIcon" class="content-clear-icon" :type="suffixIcon" color="#c0c4cc" @click="onClickIcon('suffix')" size="22"></uni-icons>
|
||||||
@click="onClickIcon('suffix')" size="22"></uni-icons>
|
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<uni-icons v-if="clearable && isVal && !disabled && type !== 'textarea'" class="content-clear-icon"
|
<uni-icons
|
||||||
:class="{'is-textarea-icon':type==='textarea'}" type="clear" :size="clearSize"
|
v-if="clearable && isVal && !disabled && type !== 'textarea'"
|
||||||
:color="msg?'#dd524d':(focusShow? primaryColor :'#c0c4cc')" @click="onClear"></uni-icons>
|
class="content-clear-icon"
|
||||||
|
:class="{ 'is-textarea-icon': type === 'textarea' }"
|
||||||
|
type="clear"
|
||||||
|
:size="clearSize"
|
||||||
|
:color="msg ? '#dd524d' : focusShow ? primaryColor : '#c0c4cc'"
|
||||||
|
@click="onClear"
|
||||||
|
></uni-icons>
|
||||||
</template>
|
</template>
|
||||||
<slot name="right"></slot>
|
<slot name="right"></slot>
|
||||||
</view>
|
</view>
|
||||||
@@ -36,7 +76,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
/**
|
/**
|
||||||
* Easyinput 输入框
|
* Easyinput 输入框
|
||||||
* @description 此组件可以实现表单的输入与校验,包括 "text" 和 "textarea" 类型。
|
* @description 此组件可以实现表单的输入与校验,包括 "text" 和 "textarea" 类型。
|
||||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=3455
|
* @tutorial https://ext.dcloud.net.cn/plugin?id=3455
|
||||||
@@ -61,6 +101,7 @@
|
|||||||
* @property {String} suffixIcon 输入框尾部图标
|
* @property {String} suffixIcon 输入框尾部图标
|
||||||
* @property {String} primaryColor 设置主题色(默认#2979ff)
|
* @property {String} primaryColor 设置主题色(默认#2979ff)
|
||||||
* @property {Boolean} trim 是否自动去除两端的空格
|
* @property {Boolean} trim 是否自动去除两端的空格
|
||||||
|
* @property {Boolean} cursorSpacing 指定光标与键盘的距离,单位 px
|
||||||
* @value both 去除两端空格
|
* @value both 去除两端空格
|
||||||
* @value left 去除左侧空格
|
* @value left 去除左侧空格
|
||||||
* @value right 去除右侧空格
|
* @value right 去除右侧空格
|
||||||
@@ -78,28 +119,28 @@
|
|||||||
* @event {Function} iconClick 点击图标时触发
|
* @event {Function} iconClick 点击图标时触发
|
||||||
* @example <uni-easyinput v-model="mobile"></uni-easyinput>
|
* @example <uni-easyinput v-model="mobile"></uni-easyinput>
|
||||||
*/
|
*/
|
||||||
function obj2strClass(obj) {
|
function obj2strClass(obj) {
|
||||||
let classess = ''
|
let classess = '';
|
||||||
for (let key in obj) {
|
for (let key in obj) {
|
||||||
const val = obj[key]
|
const val = obj[key];
|
||||||
if (val) {
|
if (val) {
|
||||||
classess += `${key} `
|
classess += `${key} `;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return classess
|
return classess;
|
||||||
}
|
}
|
||||||
|
|
||||||
function obj2strStyle(obj) {
|
function obj2strStyle(obj) {
|
||||||
let style = ''
|
let style = '';
|
||||||
for (let key in obj) {
|
for (let key in obj) {
|
||||||
const val = obj[key]
|
const val = obj[key];
|
||||||
style += `${key}:${val};`
|
style += `${key}:${val};`;
|
||||||
}
|
}
|
||||||
return style
|
return style;
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
name: 'uni-easyinput',
|
name: 'uni-easyinput',
|
||||||
emits: ['click', 'iconClick', 'update:modelValue', 'input', 'focus', 'blur', 'confirm', 'clear', 'eyes', 'change'],
|
emits: ['click', 'iconClick', 'update:modelValue', 'input', 'focus', 'blur', 'confirm', 'clear', 'eyes', 'change', 'keyboardheightchange'],
|
||||||
model: {
|
model: {
|
||||||
prop: 'modelValue',
|
prop: 'modelValue',
|
||||||
event: 'update:modelValue'
|
event: 'update:modelValue'
|
||||||
@@ -115,7 +156,7 @@
|
|||||||
formItem: {
|
formItem: {
|
||||||
from: 'uniFormItem',
|
from: 'uniFormItem',
|
||||||
default: null
|
default: null
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
name: String,
|
name: String,
|
||||||
@@ -172,7 +213,11 @@
|
|||||||
},
|
},
|
||||||
trim: {
|
trim: {
|
||||||
type: [Boolean, String],
|
type: [Boolean, String],
|
||||||
default: true
|
default: false
|
||||||
|
},
|
||||||
|
cursorSpacing: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
},
|
},
|
||||||
passwordIcon: {
|
passwordIcon: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -184,12 +229,13 @@
|
|||||||
},
|
},
|
||||||
styles: {
|
styles: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default () {
|
default() {
|
||||||
return {
|
return {
|
||||||
color: '#333',
|
color: '#333',
|
||||||
|
backgroundColor: '#fff',
|
||||||
disableColor: '#F7F6F6',
|
disableColor: '#F7F6F6',
|
||||||
borderColor: '#e5e5e5'
|
borderColor: '#e5e5e5'
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
errorMessage: {
|
errorMessage: {
|
||||||
@@ -214,12 +260,12 @@
|
|||||||
computed: {
|
computed: {
|
||||||
// 输入框内是否有值
|
// 输入框内是否有值
|
||||||
isVal() {
|
isVal() {
|
||||||
const val = this.val
|
const val = this.val;
|
||||||
// fixed by mehaotian 处理值为0的情况,字符串0不在处理范围
|
// fixed by mehaotian 处理值为0的情况,字符串0不在处理范围
|
||||||
if (val || val === 0) {
|
if (val || val === 0) {
|
||||||
return true
|
return true;
|
||||||
}
|
}
|
||||||
return false
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
msg() {
|
msg() {
|
||||||
@@ -228,7 +274,7 @@
|
|||||||
// return this.errorMessage || this.formItem.errMsg;
|
// return this.errorMessage || this.formItem.errMsg;
|
||||||
// }
|
// }
|
||||||
// TODO 处理头条 formItem 中 errMsg 不更新的问题
|
// TODO 处理头条 formItem 中 errMsg 不更新的问题
|
||||||
return this.localMsg || this.errorMessage
|
return this.localMsg || this.errorMessage;
|
||||||
},
|
},
|
||||||
// 因为uniapp的input组件的maxlength组件必须要数值,这里转为数值,用户可以传入字符串数值
|
// 因为uniapp的input组件的maxlength组件必须要数值,这里转为数值,用户可以传入字符串数值
|
||||||
inputMaxlength() {
|
inputMaxlength() {
|
||||||
@@ -237,7 +283,7 @@
|
|||||||
|
|
||||||
// 处理外层样式的style
|
// 处理外层样式的style
|
||||||
boxStyle() {
|
boxStyle() {
|
||||||
return `color:${this.inputBorder && this.msg?'#e43d33':this.styles.color};`
|
return `color:${this.inputBorder && this.msg ? '#e43d33' : this.styles.color};`;
|
||||||
},
|
},
|
||||||
// input 内容的类和样式处理
|
// input 内容的类和样式处理
|
||||||
inputContentClass() {
|
inputContentClass() {
|
||||||
@@ -245,54 +291,55 @@
|
|||||||
'is-input-border': this.inputBorder,
|
'is-input-border': this.inputBorder,
|
||||||
'is-input-error-border': this.inputBorder && this.msg,
|
'is-input-error-border': this.inputBorder && this.msg,
|
||||||
'is-textarea': this.type === 'textarea',
|
'is-textarea': this.type === 'textarea',
|
||||||
'is-disabled': this.disabled
|
'is-disabled': this.disabled,
|
||||||
})
|
'is-focused': this.focusShow
|
||||||
|
});
|
||||||
},
|
},
|
||||||
inputContentStyle() {
|
inputContentStyle() {
|
||||||
const focusColor = this.focusShow ? this.primaryColor : this.styles.borderColor
|
const focusColor = this.focusShow ? this.primaryColor : this.styles.borderColor;
|
||||||
const borderColor = this.inputBorder && this.msg ? '#dd524d' : focusColor
|
const borderColor = this.inputBorder && this.msg ? '#dd524d' : focusColor;
|
||||||
return obj2strStyle({
|
return obj2strStyle({
|
||||||
'border-color': borderColor || '#e5e5e5',
|
'border-color': borderColor || '#e5e5e5',
|
||||||
'background-color': this.disabled ? this.styles.disableColor : '#fff'
|
'background-color': this.disabled ? this.styles.disableColor : this.styles.backgroundColor
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
// input右侧样式
|
// input右侧样式
|
||||||
inputStyle() {
|
inputStyle() {
|
||||||
const paddingRight = this.type === 'password' || this.clearable || this.prefixIcon ? '' : '10px'
|
const paddingRight = this.type === 'password' || this.clearable || this.prefixIcon ? '' : '10px';
|
||||||
return obj2strStyle({
|
return obj2strStyle({
|
||||||
'padding-right': paddingRight,
|
'padding-right': paddingRight,
|
||||||
'padding-left': this.prefixIcon ? '' : '10px'
|
'padding-left': this.prefixIcon ? '' : '10px'
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
value(newVal) {
|
value(newVal) {
|
||||||
this.val = newVal
|
this.val = newVal;
|
||||||
},
|
},
|
||||||
modelValue(newVal) {
|
modelValue(newVal) {
|
||||||
this.val = newVal
|
this.val = newVal;
|
||||||
},
|
},
|
||||||
focus(newVal) {
|
focus(newVal) {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.focused = this.focus
|
this.focused = this.focus;
|
||||||
this.focusShow = this.focus
|
this.focusShow = this.focus;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.init()
|
this.init();
|
||||||
// TODO 处理头条vue3 computed 不监听 inject 更改的问题(formItem.errMsg)
|
// TODO 处理头条vue3 computed 不监听 inject 更改的问题(formItem.errMsg)
|
||||||
if (this.form && this.formItem) {
|
if (this.form && this.formItem) {
|
||||||
this.$watch('formItem.errMsg', (newVal) => {
|
this.$watch('formItem.errMsg', newVal => {
|
||||||
this.localMsg = newVal
|
this.localMsg = newVal;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.focused = this.focus
|
this.focused = this.focus;
|
||||||
this.focusShow = this.focus
|
this.focusShow = this.focus;
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/**
|
/**
|
||||||
@@ -300,11 +347,11 @@
|
|||||||
*/
|
*/
|
||||||
init() {
|
init() {
|
||||||
if (this.value || this.value === 0) {
|
if (this.value || this.value === 0) {
|
||||||
this.val = this.value
|
this.val = this.value;
|
||||||
} else if (this.modelValue || this.modelValue === 0) {
|
} else if (this.modelValue || this.modelValue === 0 || this.modelValue === '') {
|
||||||
this.val = this.modelValue
|
this.val = this.modelValue;
|
||||||
} else {
|
} else {
|
||||||
this.val = null
|
this.val = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -313,15 +360,15 @@
|
|||||||
* @param {Object} type
|
* @param {Object} type
|
||||||
*/
|
*/
|
||||||
onClickIcon(type) {
|
onClickIcon(type) {
|
||||||
this.$emit('iconClick', type)
|
this.$emit('iconClick', type);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示隐藏内容,密码框时生效
|
* 显示隐藏内容,密码框时生效
|
||||||
*/
|
*/
|
||||||
onEyes() {
|
onEyes() {
|
||||||
this.showPassword = !this.showPassword
|
this.showPassword = !this.showPassword;
|
||||||
this.$emit('eyes', this.showPassword)
|
this.$emit('eyes', this.showPassword);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -332,19 +379,19 @@
|
|||||||
let value = event.detail.value;
|
let value = event.detail.value;
|
||||||
// 判断是否去除空格
|
// 判断是否去除空格
|
||||||
if (this.trim) {
|
if (this.trim) {
|
||||||
if (typeof(this.trim) === 'boolean' && this.trim) {
|
if (typeof this.trim === 'boolean' && this.trim) {
|
||||||
value = this.trimStr(value)
|
value = this.trimStr(value);
|
||||||
}
|
}
|
||||||
if (typeof(this.trim) === 'string') {
|
if (typeof this.trim === 'string') {
|
||||||
value = this.trimStr(value, this.trim)
|
value = this.trimStr(value, this.trim);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
if (this.errMsg) this.errMsg = ''
|
if (this.errMsg) this.errMsg = '';
|
||||||
this.val = value
|
this.val = value;
|
||||||
// TODO 兼容 vue2
|
// TODO 兼容 vue2
|
||||||
this.$emit('input', value);
|
this.$emit('input', value);
|
||||||
// TODO 兼容 vue3
|
// TODO 兼容 vue3
|
||||||
this.$emit('update:modelValue', value)
|
this.$emit('update:modelValue', value);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -354,13 +401,13 @@
|
|||||||
*/
|
*/
|
||||||
onFocus() {
|
onFocus() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.focused = true
|
this.focused = true;
|
||||||
})
|
});
|
||||||
this.$emit('focus', null);
|
this.$emit('focus', null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_Focus(event) {
|
_Focus(event) {
|
||||||
this.focusShow = true
|
this.focusShow = true;
|
||||||
this.$emit('focus', event);
|
this.$emit('focus', event);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -370,24 +417,22 @@
|
|||||||
* @param {Object} event
|
* @param {Object} event
|
||||||
*/
|
*/
|
||||||
onBlur() {
|
onBlur() {
|
||||||
this.focused = false
|
this.focused = false;
|
||||||
this.$emit('focus', null);
|
this.$emit('focus', null);
|
||||||
},
|
},
|
||||||
_Blur(event) {
|
_Blur(event) {
|
||||||
let value = event.detail.value;
|
let value = event.detail.value;
|
||||||
this.focusShow = false
|
this.focusShow = false;
|
||||||
this.$emit('blur', event);
|
this.$emit('blur', event);
|
||||||
// 根据类型返回值,在event中获取的值理论上讲都是string
|
// 根据类型返回值,在event中获取的值理论上讲都是string
|
||||||
if (this.isEnter === false) {
|
if (this.isEnter === false) {
|
||||||
this.$emit('change', this.val)
|
this.$emit('change', this.val);
|
||||||
}
|
}
|
||||||
// 失去焦点时参与表单校验
|
// 失去焦点时参与表单校验
|
||||||
if (this.form && this.formItem) {
|
if (this.form && this.formItem) {
|
||||||
const {
|
const { validateTrigger } = this.form;
|
||||||
validateTrigger
|
|
||||||
} = this.form
|
|
||||||
if (validateTrigger === 'blur') {
|
if (validateTrigger === 'blur') {
|
||||||
this.formItem.onFieldChange()
|
this.formItem.onFieldChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -399,10 +444,10 @@
|
|||||||
onConfirm(e) {
|
onConfirm(e) {
|
||||||
this.$emit('confirm', this.val);
|
this.$emit('confirm', this.val);
|
||||||
this.isEnter = true;
|
this.isEnter = true;
|
||||||
this.$emit('change', this.val)
|
this.$emit('change', this.val);
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.isEnter = false
|
this.isEnter = false;
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -415,9 +460,18 @@
|
|||||||
this.$emit('input', '');
|
this.$emit('input', '');
|
||||||
// TODO 兼容 vue2
|
// TODO 兼容 vue2
|
||||||
// TODO 兼容 vue3
|
// TODO 兼容 vue3
|
||||||
this.$emit('update:modelValue', '')
|
this.$emit('update:modelValue', '');
|
||||||
// 点击叉号触发
|
// 点击叉号触发
|
||||||
this.$emit('clear')
|
this.$emit('clear');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 键盘高度发生变化的时候触发此事件
|
||||||
|
* 兼容性:微信小程序2.7.0+、App 3.1.0+
|
||||||
|
* @param {Object} event
|
||||||
|
*/
|
||||||
|
onkeyboardheightchange(event) {
|
||||||
|
this.$emit("keyboardheightchange",event);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -431,9 +485,9 @@
|
|||||||
} else if (pos === 'right') {
|
} else if (pos === 'right') {
|
||||||
return str.trimRight();
|
return str.trimRight();
|
||||||
} else if (pos === 'start') {
|
} else if (pos === 'start') {
|
||||||
return str.trimStart()
|
return str.trimStart();
|
||||||
} else if (pos === 'end') {
|
} else if (pos === 'end') {
|
||||||
return str.trimEnd()
|
return str.trimEnd();
|
||||||
} else if (pos === 'all') {
|
} else if (pos === 'all') {
|
||||||
return str.replace(/\s+/g, '');
|
return str.replace(/\s+/g, '');
|
||||||
} else if (pos === 'none') {
|
} else if (pos === 'none') {
|
||||||
@@ -442,14 +496,14 @@
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
$uni-error: #e43d33;
|
$uni-error: #e43d33;
|
||||||
$uni-border-1: #DCDFE6 !default;
|
$uni-border-1: #dcdfe6 !default;
|
||||||
|
|
||||||
.uni-easyinput {
|
.uni-easyinput {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
width: 100%;
|
width: 100%;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
@@ -458,9 +512,9 @@
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
color: #333;
|
color: #333;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-easyinput__content {
|
.uni-easyinput__content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -474,9 +528,9 @@
|
|||||||
border-color: #fff;
|
border-color: #fff;
|
||||||
transition-property: border-color;
|
transition-property: border-color;
|
||||||
transition-duration: 0.3s;
|
transition-duration: 0.3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-easyinput__content-input {
|
.uni-easyinput__content-input {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
width: auto;
|
width: auto;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
@@ -487,23 +541,23 @@
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
height: 35px;
|
height: 35px;
|
||||||
// min-height: 36px;
|
// min-height: 36px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-easyinput__placeholder-class {
|
.uni-easyinput__placeholder-class {
|
||||||
color: #999;
|
color: #999;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
// font-weight: 200;
|
// font-weight: 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
.is-textarea {
|
.is-textarea {
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
.is-textarea-icon {
|
.is-textarea-icon {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-easyinput__content-textarea {
|
.uni-easyinput__content-textarea {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@@ -512,28 +566,28 @@
|
|||||||
margin: 6px;
|
margin: 6px;
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
height: 80px;
|
height: 80px;
|
||||||
// min-height: 80px;
|
min-height: 80px;
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
// min-height: 80px;
|
min-height: 80px;
|
||||||
width: auto;
|
width: auto;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-padding {
|
.input-padding {
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-clear-icon {
|
.content-clear-icon {
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.label-icon {
|
.label-icon {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
margin-top: -1px;
|
margin-top: -1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 显示边框
|
// 显示边框
|
||||||
.is-input-border {
|
.is-input-border {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
display: flex;
|
display: flex;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@@ -545,9 +599,9 @@
|
|||||||
/* #ifdef MP-ALIPAY */
|
/* #ifdef MP-ALIPAY */
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-error-message {
|
.uni-error-message {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: -17px;
|
bottom: -17px;
|
||||||
left: 0;
|
left: 0;
|
||||||
@@ -555,51 +609,49 @@
|
|||||||
color: $uni-error;
|
color: $uni-error;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-error-msg--boeder {
|
.uni-error-msg--boeder {
|
||||||
position: relative;
|
position: relative;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
line-height: 22px;
|
line-height: 22px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.is-input-error-border {
|
.is-input-error-border {
|
||||||
border-color: $uni-error;
|
border-color: $uni-error;
|
||||||
|
|
||||||
.uni-easyinput__placeholder-class {
|
.uni-easyinput__placeholder-class {
|
||||||
color: mix(#fff, $uni-error, 50%);
|
color: mix(#fff, $uni-error, 50%);
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-easyinput--border {
|
||||||
.uni-easyinput--border {
|
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
padding: 10px 15px;
|
padding: 10px 15px;
|
||||||
// padding-bottom: 0;
|
// padding-bottom: 0;
|
||||||
border-top: 1px #eee solid;
|
border-top: 1px #eee solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-easyinput-error {
|
.uni-easyinput-error {
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.is-first-border {
|
.is-first-border {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
border: none;
|
border: none;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
/* #ifdef APP-NVUE */
|
/* #ifdef APP-NVUE */
|
||||||
border-width: 0;
|
border-width: 0;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
}
|
}
|
||||||
|
|
||||||
.is-disabled {
|
.is-disabled {
|
||||||
background-color: #F7F6F6;
|
background-color: #f7f6f6;
|
||||||
color: #D5D5D5;
|
color: #d5d5d5;
|
||||||
|
|
||||||
.uni-easyinput__placeholder-class {
|
.uni-easyinput__placeholder-class {
|
||||||
color: #D5D5D5;
|
color: #d5d5d5;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-easyinput",
|
"id": "uni-easyinput",
|
||||||
"displayName": "uni-easyinput 增强输入框",
|
"displayName": "uni-easyinput 增强输入框",
|
||||||
"version": "1.1.3",
|
"version": "1.1.9",
|
||||||
"description": "Easyinput 组件是对原生input组件的增强",
|
"description": "Easyinput 组件是对原生input组件的增强",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uni-ui",
|
"uni-ui",
|
||||||
|
|||||||
@@ -106,7 +106,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// #endif
|
// #endif
|
||||||
|
beforeRemove: {
|
||||||
|
type: Function,
|
||||||
|
default: () => {}
|
||||||
|
},
|
||||||
disabled: {
|
disabled: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
@@ -514,7 +517,12 @@
|
|||||||
* 删除文件
|
* 删除文件
|
||||||
* @param {Object} index
|
* @param {Object} index
|
||||||
*/
|
*/
|
||||||
delFile(index) {
|
async delFile(index) {
|
||||||
|
let res = await this.beforeRemove({
|
||||||
|
tempFile: this.files[index],
|
||||||
|
tempFilePath: this.files[index].url
|
||||||
|
})
|
||||||
|
if (res === false) return
|
||||||
this.$emit('delete', {
|
this.$emit('delete', {
|
||||||
tempFile: this.files[index],
|
tempFile: this.files[index],
|
||||||
tempFilePath: this.files[index].url
|
tempFilePath: this.files[index].url
|
||||||
@@ -569,6 +577,7 @@
|
|||||||
let newFilesData = []
|
let newFilesData = []
|
||||||
files.forEach(v => {
|
files.forEach(v => {
|
||||||
newFilesData.push({
|
newFilesData.push({
|
||||||
|
...v,
|
||||||
extname: v.extname,
|
extname: v.extname,
|
||||||
fileType: v.fileType,
|
fileType: v.fileType,
|
||||||
image: v.image,
|
image: v.image,
|
||||||
|
|||||||
Reference in New Issue
Block a user