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