login.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. <template>
  2. <view>
  3. <view class="bg">
  4. <image :src="$imageURL+'/bigdata_app/log/bg.png'" mode="" class="bgimg"></image>
  5. </view>
  6. <!-- <view class="status_bar"></view> -->
  7. <view class="apptitle">
  8. 云飞智控
  9. </view>
  10. <view class="set" @click="set" v-if="setTF">
  11. <u-icon name="setting-fill" size="50" color="#fff"></u-icon>
  12. </view>
  13. <view class="formbox">
  14. <form @submit="formSubmit">
  15. <view class="uni-form-item uni-column">
  16. <view class="username">
  17. <u-icon name="account" size="36" style="margin-right:30rpx;color: #fff;"></u-icon>
  18. <u-input class="uni-input" name="username" v-model="formdata.username"
  19. placeholder-class="icon iconfont icon-bianji1" placeholder="请输入用户名"
  20. placeholderStyle="color:#ffffff;" color="#FFFFFF" @blur="blur" />
  21. </view>
  22. <view class="passwold">
  23. <u-icon name="lock" size="36" style="margin-right:30rpx;color: #fff;"></u-icon>
  24. <u-input v-model="formdata.passwold" type="password" :password-icon="true" :clearable="false"
  25. placeholder="请输入密码" @confirm="formSubmit" @input="passwoldddata"
  26. placeholderStyle="color:#fff;" suffixIconStyle="color:#fff;" color="#fff"
  27. class="uni-input" />
  28. </view>
  29. <view class="aboutpass">
  30. <u-checkbox-group>
  31. <u-checkbox v-model="checked" :label-disabled="false" size="28" @change="rempass">记住密码
  32. </u-checkbox>
  33. </u-checkbox-group>
  34. </view>
  35. <view class="uni-btn-v">
  36. <button form-type="submit" @click="denglu">登 录</button>
  37. </view>
  38. </view>
  39. </form>
  40. </view>
  41. <u-modal title="升级中请勿随意操作" :show-confirm-button="false" v-model="showA" :content="contentA">
  42. <view class="upgradeBox">
  43. <u-line-progress v-show="isShow" active-color="#19be6b" :striped="true" :percent="percentNum"
  44. :striped-active="true"></u-line-progress>
  45. </view>
  46. </u-modal>
  47. </view>
  48. </template>
  49. <script>
  50. export default {
  51. data() {
  52. return {
  53. checked: false,
  54. formdata: {
  55. username: '',
  56. passwold: ''
  57. },
  58. setbgtf: false,
  59. setTF: false,
  60. value: "http://8.136.98.49:8002",
  61. httparr: ["http://8.136.98.49:8002", "http://114.115.147.140:8002"],
  62. arrowtf: false,
  63. showA: false, //
  64. contentA: '',
  65. isShow: false, //进度条
  66. percentNum: 0, //在线下载进度
  67. passvalue: false
  68. }
  69. },
  70. onLoad() {
  71. uni.getStorage({
  72. key: 'user_pass',
  73. success: (res) => {
  74. if (res.data) {
  75. this.formdata.passwold = res.data
  76. this.checked = true
  77. } else {
  78. this.checked = false
  79. }
  80. }
  81. })
  82. uni.getStorage({
  83. key: 'user_name',
  84. success: (res) => {
  85. this.formdata.username = res.data
  86. }
  87. })
  88. uni.getStorage({
  89. key: 'http',
  90. success: (res) => {
  91. this.value = res.data
  92. }
  93. })
  94. this.getEquipList()
  95. },
  96. onShow() {
  97. },
  98. methods: {
  99. async getEquipList() {
  100. const res = await this.$myRequest({
  101. url: '/api/api_gateway?method=home.homes.app_version_record',
  102. data: {
  103. ret: "first"
  104. }
  105. })
  106. console.log(res)
  107. this.appName = res[0].app_name
  108. // uni.getStorage({
  109. // key: 'session_key',
  110. // success: (res) => {
  111. // console.log(res)
  112. // if (res.data != "") {
  113. // uni.switchTab({
  114. // url: "../index/index"
  115. // })
  116. // }
  117. // },
  118. // })
  119. // }
  120. },
  121. async formSubmit() {
  122. const res = await this.$myRequest({
  123. url: '/api/api_gateway?method=user.login.login_user',
  124. data: {
  125. username: this.formdata.username,
  126. password: this.formdata.passwold
  127. }
  128. })
  129. console.log(res.session_key)
  130. let session_key = res.session_key
  131. uni.setStorage({
  132. key: 'session_key',
  133. data: session_key,
  134. success: () => {
  135. uni.switchTab({
  136. url: "../index/index"
  137. })
  138. }
  139. })
  140. },
  141. passwoldddata() {
  142. this.formdata.passwold = this.formdata.passwold.replace(/[\u4E00-\u9FA5]/g, '')
  143. },
  144. rempass(val) {
  145. this.passvalue = val.value
  146. if (val.value) {
  147. uni.setStorage({
  148. key: 'user_pass',
  149. data: this.formdata.passwold,
  150. success: function() {
  151. console.log('success');
  152. }
  153. })
  154. }
  155. },
  156. blur(val) {
  157. uni.setStorage({
  158. key: 'user_name',
  159. data: val,
  160. success: function() {
  161. console.log('success');
  162. }
  163. })
  164. },
  165. logoTime() {
  166. this.setTF = true
  167. },
  168. set() {
  169. this.setbgtf = true
  170. },
  171. sethttp() {
  172. uni.setStorage({
  173. key: 'http',
  174. data: this.value,
  175. success: () => {
  176. // console.log(this.value);
  177. this.setbgtf = false
  178. uni.showToast({
  179. title: "修改成功",
  180. icon: "none"
  181. })
  182. this.getEquipList()
  183. }
  184. });
  185. },
  186. arrow() {
  187. this.arrowtf = !this.arrowtf
  188. },
  189. denglu() {
  190. if (this.passvalue) {
  191. uni.setStorage({
  192. key: 'user_pass',
  193. data: this.formdata.passwold,
  194. success: function() {
  195. console.log('success');
  196. }
  197. })
  198. } else {
  199. uni.removeStorage({
  200. key: 'user_pass',
  201. success: function() {
  202. console.log('success');
  203. }
  204. })
  205. }
  206. }
  207. }
  208. }
  209. </script>
  210. <style lang="scss">
  211. .bg{
  212. width: 100%;
  213. height: 100vh;
  214. position: absolute;
  215. top: 0;
  216. left: 0;
  217. .bgimg{
  218. width: 100%;
  219. height: 100%;
  220. }
  221. }
  222. .apptitle{
  223. font-size: 52rpx;
  224. color: #fff;
  225. width: 80%;
  226. margin: 600rpx auto 40rpx;
  227. }
  228. .logo {
  229. width: 100%;
  230. height: 340rpx;
  231. text-align: center;
  232. display: flex;
  233. align-items: center;
  234. padding-top: 240rpx;
  235. image {
  236. width: 280rpx;
  237. margin: 0 auto;
  238. height: 120rpx;
  239. }
  240. }
  241. .set {
  242. position: absolute;
  243. right: 50rpx;
  244. top: 150rpx;
  245. }
  246. .bg {
  247. width: 100%;
  248. position: fixed;
  249. bottom: 0;
  250. left: 0;
  251. z-index: -1;
  252. image {
  253. width: 100%;
  254. }
  255. }
  256. /deep/.u-input__right-icon {
  257. line-height: 35px !important;
  258. }
  259. .uni-form-item {
  260. width: 100%;
  261. .username {
  262. width: 80%;
  263. margin: 0 auto;
  264. display: flex;
  265. margin-bottom: 40rpx;
  266. padding-bottom: 10rpx;
  267. border-bottom: 2rpx solid rgba(249,249,249,0.4);
  268. .u-icon__icon {
  269. margin-top: 17rpx;
  270. }
  271. .uni-input {
  272. width: 100%;
  273. color: #fff;
  274. }
  275. .u-input__input{
  276. color: #fff !important;
  277. }
  278. }
  279. .passwold {
  280. width: 80%;
  281. margin: 0 auto;
  282. display: flex;
  283. margin-bottom: 40rpx;
  284. padding-bottom: 10rpx;
  285. border-bottom: 2rpx solid rgba(249,249,249,0.4);
  286. .u-icon__icon {
  287. margin-top: 17rpx;
  288. }
  289. /deep/.u-input__input{
  290. color: #fff;
  291. }
  292. .uni-input {
  293. width: 100%;
  294. color: #fff;
  295. }
  296. /deep/.uicon-eye{
  297. color: #fff !important;
  298. }
  299. }
  300. .aboutpass {
  301. width: 80%;
  302. margin: 0 auto;
  303. display: flex;
  304. justify-content: flex-end;
  305. p {
  306. color: #fff;
  307. font-size: 28rpx;
  308. }
  309. /deep/.uicon-checkbox-mark{
  310. border-color: #FF0000;
  311. // color: #f00 !important;
  312. }
  313. /deep/.u-checkbox__label {
  314. font-size: 28rpx;
  315. color: #fff;
  316. margin-right: 0;
  317. }
  318. }
  319. .uni-btn-v {
  320. width: 80%;
  321. margin: 112rpx auto 0;
  322. position: relative;
  323. z-index: 100;
  324. button {
  325. width: 100%;
  326. height: 90rpx;
  327. line-height: 90rpx;
  328. color: #FFFFFF;
  329. font-size: 36rpx;
  330. background-image: linear-gradient(to bottom, rgba(249,249,249,0.6), rgba(249, 249, 249, 0.1));
  331. color: #5DC18B;
  332. }
  333. }
  334. }
  335. .setbg {
  336. width: 100%;
  337. height: 100vh;
  338. position: absolute;
  339. top: 0;
  340. z-index: 99999;
  341. .mengban {
  342. width: 100%;
  343. height: 100vh;
  344. position: absolute;
  345. top: 0;
  346. background-color: rgba($color: #000000, $alpha: 0.5);
  347. }
  348. .set_http {
  349. position: absolute;
  350. width: 90%;
  351. left: 5%;
  352. top: 30%;
  353. .set_http_top {
  354. display: flex;
  355. justify-content: space-around;
  356. background-color: #5DC18B;
  357. height: 60px;
  358. line-height: 60px;
  359. color: #FFFFFF;
  360. border-top-right-radius: 20px;
  361. border-top-left-radius: 20px;
  362. font-size: 32rpx;
  363. }
  364. .set_http_bot {
  365. height: 150px;
  366. background-color: #FFFFFF;
  367. border-bottom-right-radius: 20px;
  368. border-bottom-left-radius: 20px;
  369. padding: 30px;
  370. .set_http_bot_input {
  371. margin-top: 20rpx;
  372. border: 2rpx solid #bdb6a6;
  373. border-radius: 20rpx;
  374. padding: 10rpx 40rpx 0 20rpx;
  375. font-size: 32rpx;
  376. height: 30px;
  377. display: flex;
  378. justify-content: space-between;
  379. input {
  380. width: 90%;
  381. }
  382. }
  383. }
  384. .scroll-Y {
  385. border: 2rpx solid #d0d0d0;
  386. border-radius: 20rpx;
  387. .scroll-view-item {
  388. padding-left: 20rpx;
  389. height: 70rpx;
  390. font-size: 28rpx;
  391. line-height: 70rpx;
  392. border-bottom: 2rpx solid #d0d0d0;
  393. }
  394. }
  395. }
  396. }
  397. .upgradeBox {
  398. padding: 15rpx;
  399. }
  400. </style>