123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- <template>
- <view class="page-fill">
- <view class="headimg"></view>
- <view class="header">
- <image src="../../static/img/userimg.png" class="face"></image>
- <view class="info-wapper">
- <view class="nickname">
- {{name}}
- </view>
- </view>
- <view class="tuichu">
- <button @tap="bindLogout" class="settings"><p class="p3">退出</p></button>
- </view>
- </view>
- <view v-if="show">
- <view class="xiugai">
- 修改设备名称
- </view>
- <view v-for="(list,index) in listName" :key="index" class="body">
- <view class="input-two">
- <input :id=list.id type="text" class="input" @focus="setStyle()" @blur="setStyle2()" :value=list.name @input="getValue" />
- <p id="p2" class="p2" :style="{display:showOrNo}">如:广东省广州市xx广场301型x号机</p>
- </view>
- <view class="button2">
- <button type="primary" @click="updata1()" class="button">
- <p class="p">更改</p>
- </button>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapActions,
- mapMutations
- } from 'vuex'
- export default {
- data() {
- return {
- name: '',
- show: false,
- listName: [],
- value: null,
- id: null,
- parm: {
- name: null,
- id: null
- },
- showOrNo: null
- };
- },
- onPullDownRefresh() {
- setTimeout(function() {
- uni.stopPullDownRefresh();
- }, 800);
- },
- onShow() {
- // uni.startPullDownRefresh();
- var me = this;
- var name = uni.getStorageSync("name");
- me.name = name;
- var listName = uni.getStorageSync("listName");
- me.listName = listName;
- if (listName != '' && listName != null) {
- var adminId = listName[0].adminId;
- if (adminId != '1' && adminId != null) {
- me.show = true;
- }
- }
- },
- onLoad() {
- },
- methods: {
- bindLogout() {
- //清楚缓存
- uni.clearStorageSync();
- uni.reLaunch({
- url: '/pages/Login/Login',
- });
- },
- setStyle() {
- this.showOrNo = "block";
- },
- setStyle2() {
- this.showOrNo = "none";
- },
- // updata() {
- // //挂载方式
- // var serverurl = this.serverurl;
- // var id = this.id;
- // var value = this.value;
- // if (value != null && value != '') {
- // uni.request({
- // url: serverurl+'/TEquipment/updateName',
- // data: {
- // id: id,
- // name: value
- // },
- // dataType: 'json',
- // method: "POST",
- // success: (res) => {
- // uni.showModal({
- // title: '提示',
- // content: '名称:' + value + res.data.message,
- // });
- // }
- // });
- // }
- // },
- getValue: function(event) {
- // 绕过v-model 获取input输入框的值
- var value = event.target.value;
- var id = event.target.id;
- this.value = value;
- this.id = id;
- this.parm.name = value;
- this.parm.id = id;
- },
- ...mapActions('chart', ['updata']),
- updata1() {
- if (this.parm.id != null) {
- this.updata(this.parm)
- .then(res => {
- uni.showModal({
- title: '提示',
- content: '名称:' + this.parm.name + res.message,
- });
- }, _ => void uni.stopPullDownRefresh());
- }
- }
- }
- }
- </script>
- <style>
- .page-fill {
- width: 100%;
- height: 100%;
- background: #FFFFFF;
- }
- .headimg{
- height: 148upx;
- background: #206DC3;
- width: 750upx;
- }
- .header {
- height:160upx;
- width: 690upx;
- background:#FFFFFF;
- margin: auto;
- padding-top: 50upx;
- box-shadow:0upx -1upx 20upx #D3D3D3;
- border-radius: 15upx;
- transform: translateY(-80upx);
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- }
- .face {
- width: 116upx;
- height: 116upx;
- padding-left: 30upx;
- border-radius: 50%;
- flex-shrink: 0;
- }
- .info-wapper {
- width: 50%;
- margin-left: 30upx;
- display: flex;
- flex-direction: column;
- }
- .nickname {
- color: #363D44;
- font-size: 16px;
- font-weight: 600;
- padding: 30upx 0upx 0upx 0upx;
- font-family: "PingFang-SC-Bold";
- }
- .set-wapper {
- display: flex;
- flex-direction: row;
- justify-content: flex-end;
- width: 15%;
- }
- .settings {
- width: 140upx;
- height: 70upx;
- border-radius: 10upx;
- background: #D6101F;
- padding-top: 5upx;
- }
- .button {
- padding: 5upx 10upx 10upx 0upx;
- width: 80upx;
- height: 60upx;
- }
- .button2{
- padding-right: 50upx;
- padding-top: 3upx;
- }
- .input {
- /* padding: 10upx 20upx 10upx 0upx; */
- padding-left: 20upx;
- padding-top: 10upx;
- background-color: #FFFFFF;
- width: 500upx;
- height: 50upx;
- box-shadow:0upx 0upx 20upx #D3D3D3;
- border-radius: 5upx;
- }
- .tuichu{
- padding-top: 30upx;
- padding-right: 30upx;
- }
- .xiugai{
- width: 92%;
- border-left: 20upx;
- border-left: 10upx solid #0ea391;
- padding-left: 10upx;
- height: 38upx;
- padding-bottom: 20upx;
- font-family: "PingFang-SC-Bold";
- font-weight: bold;
- margin: auto;
- font-size: 32upx;
- color: #363D44;
- }
- .body {
- background-color: #FFFFFF;
- padding: 10upx 10upx 10upx 10upx;
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- }
- .input-two {
- width: 600upx;
- height: 100upx;
- padding-left: 30upx;
- }
- .p {
- width: 80upx;
- height: 50upx;
- }
- .p2 {
- color: #DD524D;
- display: none;
- width: 600upx;
- height: 50upx;
- border: 1px;
- }
- .p3{
- font-size: 32upx;
- padding-left: 5upx;
- color: #FFFFFF;
- font-weight: bold;
- width: 64upx;
- height: 33upx;
- }
- </style>
|