app验收反馈

This commit is contained in:
仲么了
2023-08-11 11:03:31 +08:00
parent f395da8f93
commit 792e1ce7d7
24 changed files with 357 additions and 98 deletions

17
App.vue
View File

@@ -1,6 +1,7 @@
<script>
import { queryDictDataCache } from './common/api/dictionary.js'
import encrypt from './common/js/aes.js'
import { getImageUrl } from '@/common/api/basic'
export default {
onLaunch: function () {
console.log(window)
@@ -14,14 +15,24 @@ export default {
},
})
}
if (!uni.getStorageSync(this.$cacheKey.userInfo)) {
if (!uni.getStorageSync(this.$cacheKey.access_token)) {
uni.reLaunch({
url: '/pages/login/login',
url: '/pages/user/login',
})
}
// 查询字典
queryDictDataCache().then((res) => {
uni.setStorageSync(this.$cacheKey.dictData, res.data)
})
// 更新用户头像
let userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
if (userInfo.headSculpture) {
getImageUrl(userInfo.headSculpture).then((res) => {
userInfo.avatar = res.data
uni.setStorageSync(this.$cacheKey.userInfo, userInfo)
})
}
},
onHide: function () {
console.log('App Hide')

25
common/api/basic.js Normal file
View File

@@ -0,0 +1,25 @@
import request from '../js/request'
import config from '../js/config'
// 上传图片
export const uploadImage = (filePath) => {
return uni.uploadFile({
url: config.domain + '/user-boot/user/uploadImage',
filePath,
name: 'issuesFile',
header: {
Authorization: uni.getStorageSync('access_token'),
},
})
}
// 获取图片url
export const getImageUrl = (headSculpture) => {
return request({
url: '/user-boot/user/getUrl',
method: 'post',
data: {
headSculpture,
},
})
}

View File

@@ -33,3 +33,7 @@ export const queryAppInfoByType = (type) => {
},
})
}
//

View File

@@ -168,7 +168,7 @@ export function apiPwdLogin(params) {
//登录获取公钥
export function gongkey(data) {
console.log(data);
console.log(data)
return request({
url: '/user-boot/user/generateSm2Key',
method: 'get',
@@ -191,3 +191,16 @@ export function apiModifyPsd(params) {
})
}
// 更改用户信息
export function apiUpdateUser(params) {
return request({
url: '/user-boot/user/updateAppUser',
data: {
...params,
},
header: {
'Content-Type': 'application/json',
},
method: 'PUT',
})
}

View File

@@ -149,7 +149,7 @@ page {
margin: 0 20rpx;
display: grid;
grid-gap: 20rpx;
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-template-columns: 1fr 1fr 1fr ;
.header-item {
display: flex;
flex-direction: column;
@@ -161,7 +161,7 @@ page {
background: $uni-theme-color;
border-radius: 12rpx;
.header-item-value {
font-size: 32rpx;
font-size: 44rpx;
}
.header-item-label {
font-size: 24rpx;

View File

@@ -1,5 +1,6 @@
import request from './request'
import cache from './cacheKey.js'
import { getImageUrl } from '@/common/api/basic'
import { queryDictDataCache } from '../api/dictionary.js'
import cacheKey from './cacheKey.js'
const toast = (title, duration = 1500, call, mask = false, icon = 'none') => {
@@ -207,7 +208,14 @@ const loginSuccess = (data) => {
console.log(escape, atob)
var userInfo = JSON.parse(decodeURIComponent(escape(atob(strings[1].replace(/-/g, '+').replace(/_/g, '/')))))
userInfo.authorities = userInfo.authorities[0]
uni.setStorageSync('userInfo', userInfo)
if (userInfo.headSculpture) {
getImageUrl(userInfo.headSculpture).then((res) => {
userInfo.avatar = res.data
uni.setStorageSync(cache.userInfo, userInfo)
})
} else {
uni.setStorageSync(cache.userInfo, userInfo)
}
console.log('reLaunch')
queryDictDataCache().then((res) => {
uni.setStorageSync(cacheKey.dictData, res.data)

View File

@@ -2,8 +2,8 @@
"name" : "灿能物联",
"appid" : "__UNI__88BC25B",
"description" : "",
"versionName" : "1.0.7",
"versionCode" : 107,
"versionName" : "1.0.8",
"versionCode" : 108,
"transformPx" : false,
/* 5+App */
"app-plus" : {
@@ -132,7 +132,7 @@
"/api" : {
"https" : true,
// "target" : "https://china.indpecker.com",
"target" : "http://192.168.1.139:10215",
"target" : "http://192.168.1.115:10215",
"changOrigin" : true,
"pathRewrite" : {
"/api" : ""

View File

@@ -12,7 +12,7 @@
v-for="(item, index) in projectList"
:key="index"
@click="jump(item)"
thumbnail="/static/device.png"
:thumbnail="deviceIcon(item.runStatus)"
>
</uni-card>
<uni-load-more status="nomore"></uni-load-more>
@@ -40,12 +40,27 @@ export default {
}
},
methods: {
deviceIcon(e) {
let str = ''
switch (e) {
case 1:
str = '/static/device_bad.png'
break
case 2:
str = '/static/device.png'
break
default:
str = '/static/device.png'
break
}
return str
},
onClickItem(e) {
this.current = e.currentIndex
},
jump(item) {
uni.navigateTo({
url: '/pages/device/APF/detail?id=' + item.equipmentId + '&isPrimaryUser=' + item.isPrimaryUser,
url: '/pages/device/APF/detail?id=' + item.id + '&isPrimaryUser=0',
})
},
trigger(e) {

View File

@@ -3,7 +3,9 @@
<view slot="body">
<view class="transfer">
<!-- <div class="transfer-img" ref="qrCodeUrl" /> -->
<uqrcode ref="uqrcode" canvas-id="qrcode" :value="content" :options="{ margin: 10 }"></uqrcode>
<!-- <uqrcode ref="uqrcode" canvas-id="qrcode" :value="content" :options="{ margin: 10 }"></uqrcode> -->
<uqrcode ref="uqrcode" canvas-id="qrcode" :value="content" :options="{ margin: 10 }" :loading="false"></uqrcode>
<canvas id="qrcode" width="200" height="200"></canvas>
<view class="transfer-text">请让接收人员扫码接收</view>
<view class="transfer-btn">

View File

@@ -6,14 +6,32 @@
</view> -->
<picker
@change="projectNameChange"
@cancel="selectProject = false"
:value="select.projectNameIndex"
:range="projectList"
range-key="text"
v-if="store.params.engineerId"
>
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectName }">
{{ select.projectName || '项目' }}
<uni-icons type="bottom" size="14" color="#666"></uni-icons>
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectName }" @click="selectProject = true">
{{
select.projectName
? select.projectName.length > 4
? select.projectName.substring(0, 4) + '...'
: select.projectName
: '全部项目'
}}
<uni-icons
type="top"
size="14"
:color="select.projectName ? '#376cf3' : '#666'"
v-if="selectProject"
></uni-icons>
<uni-icons
type="bottom"
size="14"
:color="select.projectName ? '#376cf3' : '#666'"
v-else
></uni-icons>
</view>
</picker>
<view style="flex: 1"></view>
@@ -101,6 +119,7 @@ export default {
projectType: [],
navHeight: 0,
userInfo: {},
selectProject: false,
}
},
computed: {
@@ -231,6 +250,7 @@ export default {
this.select.projectType = this.projectType[e.detail.value].text
},
projectNameChange(e) {
this.selectProject = false
console.log(e)
this.select.projectNameIndex = e.detail.value
if (e.detail.value === 0) {

View File

@@ -105,6 +105,14 @@ export default {
// e的返回格式为json对象{"text":"测试","index":0}
this.drawer = !this.drawer
if (this.drawer) {
// #ifdef APP-PLUS
var webView = this.$mp.page.$getAppWebview()
// 修改buttons
webView.setTitleNViewButtonStyle(0, {
text: '取消',
select: false,
})
// #endif
this.openDrawer()
} else {
this.closeDrawer()
@@ -141,11 +149,29 @@ export default {
// #endif
getDevCount(this.select.engineeringId).then((res) => {
this.devCount = res.data
this.devCount.currentOffLineDevs.forEach((item) => {
item.runStatus = 1
})
this.devCount.offLineDevs.forEach((item) => {
item.runStatus = 1
})
})
this.$refs.device && this.$refs.device.init()
},
closeDrawer(e) {
if (!e) {
// #ifdef APP-PLUS
var webView = this.$mp.page.$getAppWebview()
// 修改buttons
webView.setTitleNViewButtonStyle(0, {
text: this.select.engineeringName
? this.select.engineeringName.length > 7
? this.select.engineeringName.substring(0, 7) + '...'
: this.select.engineeringName
: '请选择工程',
select: true,
})
// #endif
this.$refs.showRight.close()
return
}
@@ -160,7 +186,11 @@ export default {
var webView = this.$mp.page.$getAppWebview()
// 修改buttons
webView.setTitleNViewButtonStyle(0, {
text: this.select.engineeringName,
text:
this.select.engineeringName.length > 7
? this.select.engineeringName.substring(0, 7) + '...'
: this.select.engineeringName,
select: true,
})
// #endif
}

View File

@@ -2,7 +2,8 @@
<view :loading="loading">
<view class="mine">
<view class="mine-header" @click="jump('basic')">
<image mode="aspectFill" class="mine-header-head" src="/static/head.png" />
<image mode="aspectFill" class="mine-header-head" :src="userInfo.avatar" v-if="userInfo.avatar" />
<image mode="aspectFill" class="mine-header-head" src="/static/head.png" v-else />
<view class="mine-header-name hide-txt">
<view>{{ userInfo.nickname }}</view>
<view></view>
@@ -45,7 +46,11 @@
<view class="mine-nav-label">工程列表</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view>
<view class="mine-nav" @click="jump('engineering/setting')" v-if="userInfo.authorities === 'engineering_user'">
<view
class="mine-nav"
@click="jump('engineering/setting')"
v-if="userInfo.authorities === 'engineering_user'"
>
<image mode="aspectFill" class="mine-nav-icon" src="/static/like.png" />
<view class="mine-nav-label">关注工程配置</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
@@ -90,6 +95,7 @@
<script>
import { roleUpdate } from '@/common/api/user'
import { transferDevice } from '@/common/api/device'
export default {
data() {
return {
@@ -124,9 +130,7 @@ export default {
this.init()
},
methods: {
init() {
this.loading = false
},
init() {},
upgrade(code) {
console.log(code)
roleUpdate({
@@ -210,7 +214,7 @@ export default {
},
onShow() {
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
console.log(this.userInfo)
this.loading = false
},
}
</script>

View File

@@ -64,7 +64,7 @@ export default {
}
.login-box-input-btn {
width: 200rpx;
padding:0 40rpx;
margin-left: 40rpx;
background: $uni-theme-color;
color: #fff;

View File

@@ -28,7 +28,7 @@
:key="item.equipmentId"
@click="goDevice(item)"
padding="0"
thumbnail="/static/device.png"
:thumbnail="deviceIcon(item.runStatus)"
>
</uni-card>
<Cn-empty v-if="store.empty"></Cn-empty>
@@ -45,10 +45,6 @@
thumb="/static/head.png"
thumb-size="lg"
>
<template v-slot:footer>
<view class="footer-btn mt20" style="background: #e47470" @click="del">移除</view>
<!-- <view class="footer-btn mt20 ml10" @click="goUserDetail">查看</view> -->
</template>
</uni-list-item>
<uni-list-item
title="李四"
@@ -56,10 +52,6 @@
thumb="/static/head.png"
thumb-size="lg"
>
<template v-slot:footer>
<view class="footer-btn mt20" style="background: #e47470" @click="del">移除</view>
<!-- <view class="footer-btn mt20 ml10" @click="goUserDetail">查看</view> -->
</template>
</uni-list-item>
</uni-list>
</view>
@@ -130,6 +122,21 @@ export default {
}
},
methods: {
deviceIcon(e) {
let str = ''
switch (e) {
case 1:
str = '/static/device_bad.png'
break
case 2:
str = '/static/device.png'
break
default:
str = '/static/device.png'
break
}
return str
},
addAppTopologyDiagram(e) {
console.log(e)
addAppTopologyDiagram(

View File

@@ -232,7 +232,7 @@ export default {
},
chooseLocation() {
uni.chooseLocation({
success: function (res) {
success: (res) => {
this.formData.area = res.name
this.formData.lat = res.latitudeame
this.formData.lng = res.longitude

View File

@@ -1,23 +1,33 @@
<template>
<Cn-page :loading='loading'>
<view slot='body'>
<view class='index'>
<view class="mine-nav" @click="jump('head')" style=" box-shadow: 0 4rpx 8rpx #e7e7e74c;">
<Cn-page :loading="loading">
<view slot="body">
<view class="index">
<view class="mine-nav" @click="jump('head')" style="box-shadow: 0 4rpx 8rpx #e7e7e74c">
<view class="mine-nav-label">头像</view>
<image style="height: 120rpx;width: 120rpx;border-radius:12rpx" src="/static/head.png"
mode="scaleToFill" />
<image
style="height: 120rpx; width: 120rpx; border-radius: 12rpx"
:src="userInfo.avatar"
mode="scaleToFill"
v-if="userInfo.avatar"
/>
<image
style="height: 120rpx; width: 120rpx; border-radius: 12rpx"
src="/static/head.png"
mode="scaleToFill"
v-else
/>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view>
<view class="mine-nav" @click="jump('changeName')" >
<view class="mine-nav" @click="jump('changeName')">
<view class="mine-nav-label">名字</view>
<view class="mine-nav-des">灿能电力</view>
<view class="mine-nav-des">{{ userInfo.nickname }}</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view>
<view class="mine-nav" @click="jump('erweima')" style="border-bottom: none; ">
<view class="mine-nav" @click="jump('erweima')" style="border-bottom: none">
<view class="mine-nav-label">我的二维码</view>
<image
src="/static/erweima.png"
style="height: 50rpx;width: 50rpx;border-radius:12rpx"
style="height: 50rpx; width: 50rpx; border-radius: 12rpx"
mode="scaleToFill"
/>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
@@ -28,30 +38,34 @@
</template>
<script>
export default {
data () {
data() {
return {
loading: false
loading: false,
userInfo: {},
}
},
methods: {
jump(type){
console.log(type);
jump(type) {
console.log(type)
uni.navigateTo({
url: `/pages/user/${type}`,
fail: (err) => {
console.log(err);
}
console.log(err)
},
})
}
}
},
},
onShow() {
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
},
}
</script>
<style lang='scss'>
<style lang="scss">
.index {
padding: 20rpx;
.mine-nav {
padding: 34rpx;
padding: 34rpx;
display: flex;
align-items: center;
background: $uni-theme-white;

View File

@@ -1,20 +1,21 @@
<template>
<Cn-page :loading='loading'>
<view slot='body'>
<view class='change-name'>
<Cn-page :loading="loading">
<view slot="body">
<view class="change-name">
<view class="content">
<uni-easyinput type="text" v-model="name" placeholder="请输入昵称" />
</view>
<view class="btn-wrap">
<view class="btn-wrap-item " @click="submit"> 提交 </view>
<view class="btn-wrap-item" @click="submit"> 提交 </view>
</view>
</view>
</view>
</Cn-page>
</template>
<script>
import { apiUpdateUser } from '@/common/api/user'
export default {
data () {
data() {
return {
loading: false,
// 表单数据
@@ -22,20 +23,36 @@ export default {
}
},
methods: {
submit () {
console.log(this.name)
uni.navigateBack()
submit() {
apiUpdateUser({
name: this.name,
}).then((res) => {
console.log(res)
uni.showToast({
title: '修改成功',
icon: 'none',
})
let userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
userInfo.nickname = this.name
uni.setStorageSync(this.$cacheKey.userInfo, userInfo)
setTimeout(() => {
uni.navigateBack()
}, 1500)
})
},
}
},
onLoad() {
this.name = uni.getStorageSync(this.$cacheKey.userInfo).nickname
},
}
</script>
<style lang='scss'>
<style lang="scss">
.change-name {
padding: 34rpx;
padding: 34rpx;
.content {
margin-bottom: 20rpx;
padding: 34rpx;
padding: 34rpx;
background: $uni-theme-white;
border-radius: 12rpx;
}
@@ -58,4 +75,4 @@ export default {
}
}
}
</style>
</style>

View File

@@ -232,7 +232,7 @@ export default {
}
.login-box-input-btn {
width: 200rpx;
padding:0 40rpx;
margin-left: 40rpx;
background: $uni-theme-color;
color: #fff;

View File

@@ -224,7 +224,7 @@ export default {
}
.login-box-input-btn {
width: 200rpx;
padding:0 40rpx;
margin-left: 40rpx;
background: $uni-theme-color;
color: #fff;

View File

@@ -1,25 +1,84 @@
<template>
<Cn-page :loading='loading'>
<view slot='body'>
<view class='erweima'>
二维码
<Cn-page :loading="loading">
<view slot="body">
<view class="transfer">
<!-- <div class="transfer-img" ref="qrCodeUrl" /> -->
<uqrcode ref="uqrcode" canvas-id="qrcode" :value="content" :options="{ margin: 10 }" :loading="false"></uqrcode>
<canvas id="qrcode" width="200" height="200"></canvas>
<view class="transfer-text">{{ userInfo.nickname }}</view>
<!-- <view class="transfer-btn">
<button class="transfer-btn-item" style="background-color: #fff; color: #111" @click="back">
返回
</button>
<button class="transfer-btn-item ml20" @click="home">转移成功</button>
</view> -->
</view>
</view>
</Cn-page>
</Cn-page>
</template>
<script>
// import QRCode from 'qrcodejs2'
// import UQRCode from '@/uni_modules/Sansnn-uQRCode/js_sdk/uqrcode/uqrcode.js';
export default {
data () {
data() {
return {
loading: false
loading: false,
content: '',
userInfo: {},
}
},
methods: {
}
back() {
this.$util.refreshPrePage(2)
},
home() {
this.$util.refreshPrePage(2)
},
},
onLoad(options) {
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
this.content = JSON.stringify({
type: 'userId',
id: this.userInfo.userIndex,
})
},
}
</script>
<style lang='scss'>
.index {
padding: 20rpx;
<style lang="scss">
.transfer {
padding: 200rpx 34rpx 0;
display: flex;
flex-direction: column;
align-items: center;
.transfer-img {
}
.transfer-text {
font-size: 28rpx;
color: #999999;
margin-top: 30rpx;
}
.transfer-btn {
display: flex;
flex-direction: row;
justify-content: space-between;
margin-top: 100rpx;
width: 100%;
.transfer-btn-item {
flex: 1;
height: 80rpx;
border-radius: 12rpx;
background-color: $uni-theme-color;
font-size: 28rpx;
color: #fff;
display: flex;
justify-content: center;
align-items: center;
}
}
}
</style>
</style>

View File

@@ -202,7 +202,7 @@ export default {
}
.login-box-input-btn {
width: 200rpx;
padding:0 40rpx;
margin-left: 40rpx;
background: $uni-theme-color;
color: #fff;

View File

@@ -1,8 +1,9 @@
<template>
<Cn-page :loading='loading'>
<view slot='body'>
<view class='head'>
<image class="head-img" src="/static/head.png"></image>
<Cn-page :loading="loading">
<view slot="body">
<view class="head">
<image class="head-img" :src="userInfo.avatar" v-if="userInfo.avatar"></image>
<image class="head-img" src="/static/head.png" v-else></image>
<view class="head-setup">
<view class="head-setup-item" @click="take('album')">从相册选一张</view>
<view class="head-setup-item" @click="take('camera')">拍一张照片</view>
@@ -12,29 +13,52 @@
</Cn-page>
</template>
<script>
import { uploadImage, getImageUrl } from '@/common/api/basic'
import { apiUpdateUser } from '@/common/api/user'
export default {
data () {
data() {
return {
loading: false
loading: false,
userInfo: {},
}
},
methods: {
take (type) {
take(type) {
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: [type],
success: (res) => {
console.log(res)
}
uploadImage(res.tempFilePaths[0]).then((res) => {
console.log(res)
let result = JSON.parse(res[1].data)
apiUpdateUser({
headSculpture: result.data.minFileUrl,
}).then((res) => {
console.log(res)
getImageUrl(result.data.minFileUrl).then((url) => {
console.log(url.data)
this.userInfo.headSculpture = result.data.minFileUrl
this.userInfo.avatar = url.data
console.warn(this.userInfo)
uni.setStorageSync(this.$cacheKey.userInfo, this.userInfo)
this.$forceUpdate()
})
})
})
},
})
}
}
},
},
onLoad(options) {
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
},
}
</script>
<style lang='scss'>
<style lang="scss">
.head {
.head-img {
height: 750rpx;
width: 750rpx;
@@ -48,7 +72,7 @@ export default {
padding-bottom: 60rpx;
background-color: #fff;
.head-setup-item{
.head-setup-item {
height: 100rpx;
line-height: 100rpx;
text-align: center;
@@ -56,4 +80,4 @@ export default {
}
}
}
</style>
</style>

View File

@@ -111,6 +111,9 @@ export default {
components: {},
methods: {
getCode() {
if (!this.checkbox) {
return this.$util.toast('请先阅读并同意用户协议和个人信息保护政策!')
}
if (!this.phone) {
return this.$util.toast('请输入手机号!')
}
@@ -249,7 +252,7 @@ export default {
}
.login-box-input-btn {
width: 200rpx;
padding: 0 40rpx;
margin-left: 40rpx;
background: $uni-theme-color;
color: #fff;

View File

@@ -104,6 +104,9 @@ export default {
onLoad() {},
methods: {
getCode() {
if (!this.checkbox) {
return this.$util.toast('请先阅读并同意用户协议和个人信息保护政策!')
}
if (!this.formData.phone) {
return this.$util.toast('请输入手机号!')
}
@@ -210,7 +213,7 @@ export default {
}
.login-box-input-btn {
width: 200rpx;
padding:0 40rpx;
margin-left: 40rpx;
background: $uni-theme-color;
color: #fff;