equipmentName.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <view class="">
  3. <view class="xiugai">
  4. {{$t('equipmentname.title')}}
  5. </view>
  6. <view v-for="(list,index) in listName" :key="index" class="body">
  7. <view class="input-two">
  8. <input :id=list.id type="text" class="input" @focus="setStyle()" @blur="setStyle2()" :value=list.name @input="getValue" />
  9. <p id="p2" class="p2" :style="{display:showOrNo}">如:粤A张先生1</p>
  10. </view>
  11. <view class="button2">
  12. <button type="primary" @click="updata1()" class="button">
  13. <p class="p">{{$t('equipmentname.updata')}}</p>
  14. </button>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import {
  21. mapState,
  22. mapActions,
  23. mapMutations
  24. } from 'vuex'
  25. export default {
  26. data() {
  27. return {
  28. name: '',
  29. show: false,
  30. listName: [],
  31. value: null,
  32. id: null,
  33. parm: {
  34. name: null,
  35. id: null
  36. },
  37. showOrNo: null,
  38. avatarUrl: null,
  39. weixinUp: false,
  40. weixinDown: true
  41. };
  42. },
  43. onPullDownRefresh() {
  44. setTimeout(function() {
  45. uni.stopPullDownRefresh();
  46. }, 800);
  47. },
  48. onShow() {
  49. uni.setNavigationBarTitle({title: this.$t('equipmentname.title')});
  50. // uni.startPullDownRefresh();
  51. var me = this;
  52. var name = uni.getStorageSync("name");
  53. me.name = name;
  54. var listName = uni.getStorageSync("listName");
  55. me.listName = listName;
  56. if (listName != '' && listName != null) {
  57. var adminId = listName[0].adminId;
  58. if (adminId != '1' && adminId != null) {
  59. me.show = true;
  60. }
  61. }
  62. var newparm = uni.getStorageSync("newparm");
  63. if (newparm.toString().length > 1) {
  64. if (newparm.avatarUrl.length > 1) {
  65. this.avatarUrl = newparm.avatarUrl;
  66. this.weixinUp = true;
  67. this.weixinDown = false;
  68. }
  69. }
  70. },
  71. onLoad() {
  72. },
  73. methods: {
  74. setStyle() {
  75. this.showOrNo = "block";
  76. },
  77. setStyle2() {
  78. this.showOrNo = "none";
  79. },
  80. getValue: function(event) {
  81. // 绕过v-model 获取input输入框的值
  82. var value = event.target.value;
  83. var id = event.target.id;
  84. this.value = value;
  85. this.id = id;
  86. this.parm.name = value;
  87. this.parm.id = id;
  88. },
  89. ...mapActions('chart', ['updata']),
  90. updata1() {
  91. if (this.parm.id != null) {
  92. this.updata(this.parm)
  93. .then(res => {
  94. uni.showModal({
  95. title: '提示',
  96. content: '名称:' + this.parm.name + res.message,
  97. });
  98. }, _ => void uni.stopPullDownRefresh());
  99. }
  100. }
  101. }
  102. }
  103. </script>
  104. <style>
  105. .settings {
  106. width: 100upx;
  107. height: 64upx;
  108. border-radius: 10upx;
  109. background: #D6101F;
  110. /* padding-right: 50upx; */
  111. /* padding-top: 5upx; */
  112. text-align: center;
  113. margin: 0 auto;
  114. }
  115. .p3 {
  116. /* #ifdef H5 */
  117. top: -13%;
  118. /* #endif */
  119. font-size: 32upx;
  120. color: #FFFFFF;
  121. font-weight: bold;
  122. width: 100upx;
  123. height: 64upx;
  124. /* #ifndef H5 */
  125. padding-top: 3upx;
  126. /* #endif */
  127. position: absolute;
  128. /* 水平居中 */
  129. left: 50%;
  130. -webkit-transform: translateX(-50%);
  131. transform: translateX(-50%);
  132. }
  133. .centerY {
  134. position: absolute;
  135. top: 50%;
  136. -webkit-transform: translateY(-50%);
  137. transform: translateY(-50%);
  138. }
  139. .button2 {
  140. padding-right: 60upx;
  141. padding-top: 2upx;
  142. }
  143. .button {
  144. /* padding: 5upx 10upx 10upx 0upx; */
  145. width: 120upx;
  146. height: 60upx;
  147. border-radius: 10upx;
  148. }
  149. .p {
  150. /* #ifdef H5 */
  151. top: -13%;
  152. /* #endif */
  153. width: 80upx;
  154. height: 60upx;
  155. font-size: 30upx;
  156. /* #ifndef H5 */
  157. padding-top: 3upx;
  158. /* #endif */
  159. position: absolute;
  160. /* 水平居中 */
  161. left: 50%;
  162. -webkit-transform: translateX(-50%);
  163. transform: translateX(-50%);
  164. }
  165. .input {
  166. /* padding: 10upx 20upx 10upx 0upx; */
  167. padding-left: 20upx;
  168. padding-top: 10upx;
  169. background-color: #FFFFFF;
  170. width: 500upx;
  171. height: 50upx;
  172. box-shadow: 0upx 0upx 20upx #D3D3D3;
  173. border-radius: 5upx;
  174. }
  175. .xiugai {
  176. width: 92%;
  177. border-left: 20upx;
  178. border-left: 10upx solid #206DC3;
  179. padding-left: 10upx;
  180. height: 38upx;
  181. padding-bottom: 20upx;
  182. font-family: "PingFang-SC-Bold";
  183. font-weight: bold;
  184. margin: auto;
  185. font-size: 32upx;
  186. color: #363D44;
  187. }
  188. .xiugai2 {
  189. width: 100%;
  190. height: 80upx;
  191. font-family: "PingFang-SC-Bold";
  192. font-weight: bold;
  193. margin: auto;
  194. font-size: 50upx;
  195. color: #363D44;
  196. position: fixed;
  197. bottom: 0;
  198. }
  199. .xiugai3 {
  200. height: 80upx;
  201. font-family: "PingFang-SC-Bold";
  202. font-weight: bold;
  203. margin: auto;
  204. font-size: 40upx;
  205. color: #363D44;
  206. }
  207. .body {
  208. background-color: #FFFFFF;
  209. padding: 10upx 10upx 10upx 10upx;
  210. display: flex;
  211. flex-direction: row;
  212. justify-content: flex-start;
  213. }
  214. .input-two {
  215. width: 600upx;
  216. height: 100upx;
  217. padding-left: 30upx;
  218. }
  219. .p2 {
  220. color: #DD524D;
  221. display: none;
  222. width: 600upx;
  223. height: 50upx;
  224. border: 1px;
  225. }
  226. </style>