loginOld.vue 11 KB

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