AI销管
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

index.vue 8.5 KiB

2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
2 lat temu
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <template>
  2. <view>
  3. <view class="head">
  4. <image class="head-immg" src="https://autoiot.oss-cn-beijing.aliyuncs.com/static/login.png" mode=""></image>
  5. </view>
  6. <view class="input">
  7. <view class="">
  8. <view class="text-1">
  9. 您好,
  10. </view>
  11. <view class="text-2">
  12. 欢迎登录AI销管~
  13. </view>
  14. </view>
  15. <view class="cwjs-cells item-flex" style="margin-top: 80rpx;">
  16. <view class="cwjs-item center">
  17. <image src="https://qufang.oss-cn-beijing.aliyuncs.com/channelHelper/user.png" class="logo_input">
  18. </image>
  19. <input class="cwjs-item cwjs-input" v-model="username" placeholder="请输入账号名" type="number"
  20. maxlength="11" placeholder-style="color:#AAAAAA"></input>
  21. </view>
  22. </view>
  23. <view class="cwjs-cells item-flex" style="margin-top:13rpx;">
  24. <view class="cwjs-item center">
  25. <image src="https://qufang.oss-cn-beijing.aliyuncs.com/channelHelper/lock.png" class="logo_input">
  26. </image>
  27. <input class="cwjs-item cwjs-input" placeholder="请输入密码" placeholder-style="color:#AAAAAA"
  28. type="password" v-model="password" maxlength="16" v-if="passwordType"></input>
  29. <input class="cwjs-item cwjs-input" placeholder="请输入密码" placeholder-style="color:#AAAAAA"
  30. maxlength="16" v-model="password" v-else></input>
  31. </view>
  32. <view class="imagesBox" @tap="changeBindPassword">
  33. <image v-if="passwordType==false" src="../../static/images/zhengkai.png" class="images"
  34. mode="scaleToFill"></image>
  35. <image v-if="passwordType==true" src="../../static/images/bishang.png" class="images"
  36. mode="scaleToFill"></image>
  37. </view>
  38. </view>
  39. <view class="textbox">
  40. <view class="textbox-1" @tap="bindVerification">验证码登录</view>
  41. <view class="textbox-2"></view>
  42. <view class="textbox-11" @tap="bindpassword">忘记密码</view>
  43. </view>
  44. <view class="button" @tap="bindWxBLogin">立即登录</view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. var util = require("../../utils/util.js");
  50. var config = require("../../config");
  51. var app = getApp();
  52. var WXB_SESSION_LOGIN_DATA = 'weapp_session_login_data';
  53. export default {
  54. data() {
  55. return {
  56. username: '',
  57. //获取到的用户名的值
  58. password: '',
  59. //获取到的密码栏中的值
  60. passwordType: true,
  61. agreeChecked: true
  62. };
  63. },
  64. onLoad: function(options) {
  65. uni.hideToast();
  66. },
  67. methods: {
  68. //验证码登录
  69. bindVerification() {
  70. uni.navigateTo({
  71. url: '/pages/login/Verification?role=1',
  72. })
  73. },
  74. //忘记密码
  75. bindpassword() {
  76. // uni.navigateTo({
  77. // url: '/pages/login/Verification?role=2',
  78. // })
  79. uni.navigateTo({
  80. url: '/pages/login/Setthepassword',
  81. })
  82. },
  83. //密码选择
  84. changeBindPassword: function(e) {
  85. this.passwordType=!this.passwordType;
  86. },
  87. //登录
  88. bindWxBLogin: function(e) {
  89. util.showBusy('正在登录...');
  90. var that = this;
  91. if (this.username == '') {
  92. util.showNone("请输入账号名");
  93. return false;
  94. }
  95. if (this.password == '') {
  96. util.showNone("请输入密码");
  97. return false;
  98. }
  99. var loginParams = {
  100. username: this.username,
  101. password: this.password,
  102. scope: 'server',
  103. grant_type: 'password'
  104. };
  105. const user = util.encryption({
  106. data: loginParams,
  107. key: 'pigxpigxpigxpigx',
  108. param: ['password']
  109. })
  110. console.log(user)
  111. // return
  112. // 请求服务器登录地址,获得会话信息
  113. uni.request({
  114. url: config.service.login,
  115. header: {
  116. 'Authorization': 'Basic dGVzdDp0ZXN0',
  117. 'content-type': 'application/x-www-form-urlencoded'
  118. },
  119. method: "POST",
  120. data: {
  121. username:user.username,
  122. password:user.password,
  123. scope: 'server',
  124. grant_type: 'password'
  125. },
  126. success: function(result) {
  127. var data = result.data; //console.log("登录信息", data);
  128. if (data) {
  129. var res = data;
  130. console.log(res.code)
  131. if (res.code!=1) {
  132. var data = {
  133. 'token': res.access_token
  134. };
  135. uni.setStorageSync(WXB_SESSION_LOGIN_DATA, data); //写入缓存
  136. that.getMenu()
  137. that.getUser();
  138. util.showSuccess('登录成功');
  139. } else {
  140. util.showNone("账号名或密码错误,请重试");
  141. return false;
  142. }
  143. } else {
  144. util.showNone(data.message);
  145. return false;
  146. }
  147. },
  148. // 响应错误
  149. fail: function(loginResponseError) {
  150. util.showNone("网络异常,请重试");
  151. return false;
  152. }
  153. });
  154. },
  155. getUser(){
  156. util.getRequestPromise(config.service.getUser, {}, false, "GET").then(data => {
  157. if (data.user.total==0) {
  158. uni.showToast({
  159. title: '暂无绑定项目',
  160. duration: 2000,
  161. icon:"none"
  162. });
  163. return
  164. } else {
  165. let lopan = {
  166. id: data.houseList[0].id,
  167. name: data.houseList[0].propertyName
  168. }
  169. let users=data.user
  170. users.zkProperties=data.houseList
  171. uni.setStorageSync("fendianindex", 0); //写入缓存
  172. uni.setStorageSync("weapp_session_userInfo_data",users); //写入缓存
  173. uni.setStorageSync("buildingID", lopan); //项目id写入缓存
  174. uni.switchTab({
  175. url: '/pages/index/index'
  176. });
  177. }
  178. });
  179. },
  180. //获取权限
  181. getMenu(){
  182. uni.request({
  183. url: config.service.getMenu,
  184. method: "POST",
  185. header: {
  186. 'content-type': 'application/json',
  187. 'Authorization': 'Bearer '+uni.getStorageSync('weapp_session_login_data').token
  188. },
  189. success: (data) => {
  190. let rescor=data.data;
  191. if (rescor.code == 0) {
  192. uni.setStorageSync("weapp_session_Menu_data", rescor.data)
  193. }else{
  194. uni.showToast({
  195. title: rescor.msg,
  196. duration: 2000,
  197. icon:"none"
  198. });
  199. return
  200. }
  201. }
  202. })
  203. },
  204. }
  205. };
  206. </script>
  207. <style lang="scss">
  208. .cwjs-logo {
  209. display: block;
  210. width: 219rpx;
  211. height: 158rpx;
  212. margin: 54rpx auto 66rpx;
  213. }
  214. .cwjs-tips {
  215. font-size: 24rpx;
  216. padding: 80rpx 0;
  217. color: #8a8a8a;
  218. }
  219. .cwjs-form {
  220. position: relative;
  221. margin: 0;
  222. background-color: #fff;
  223. border-radius: 10px;
  224. padding: 20rpx 40rpx 113rpx;
  225. }
  226. .cwjs-cells {
  227. width: 510rpx;
  228. display: flex;
  229. flex-direction: row;
  230. justify-content: space-between;
  231. align-items: center;
  232. margin: 0 auto;
  233. height: 88rpx;
  234. overflow: hidden;
  235. border: 1rpx solid #BFC7D3;
  236. position: relative;
  237. border-radius: 12rpx;
  238. }
  239. .center {
  240. flex: 1;
  241. }
  242. .cwjs-input {
  243. height: 48rpx;
  244. line-height: 48rpx;
  245. padding: 23rpx 23rpx 23rpx 78rpx;
  246. font-size: 28rpx;
  247. font-family: PingFangSC-Regular, PingFang SC;
  248. color: #000;
  249. }
  250. .images {
  251. display: block;
  252. width: 40rpx;
  253. height: 21rpx;
  254. margin-right: 30rpx;
  255. margin-top: 33.5rpx;
  256. }
  257. .mod-btn {
  258. position: absolute;
  259. bottom: -80rpx;
  260. left: 50%;
  261. margin-left: -80rpx;
  262. }
  263. /* 头部 */
  264. .head {
  265. width: 750rpx;
  266. height: 500rpx;
  267. position: relative;
  268. .head-immg {
  269. // width: 118rpx;
  270. // height: 61rpx;
  271. // position: absolute;
  272. // top: 300rpx;
  273. // left: 100rpx;
  274. width: 750rpx;
  275. height: 778rpx;
  276. position: absolute;
  277. }
  278. }
  279. .logo {
  280. width: 248upx;
  281. height: 248upx;
  282. display: block;
  283. position: absolute;
  284. top: 134rpx;
  285. left: 240.5rpx;
  286. }
  287. /* 输入框 */
  288. .input {
  289. width: 630rpx;
  290. height: 824rpx;
  291. padding: 60rpx 60rpx 80rpx 60rpx;
  292. box-sizing: border-box;
  293. background: #FFFFFF;
  294. box-shadow: 0px 14px 20px -6px rgba(6, 16, 88, 0.1);
  295. border-radius: 20px;
  296. position: absolute;
  297. top: 107rpx;
  298. left: 60rpx;
  299. }
  300. .text-1 {
  301. font-size: 44rpx;
  302. line-height: 62rpx;
  303. }
  304. .text-2 {
  305. margin-top: 16rpx;
  306. font-size: 36rpx;
  307. line-height: 50rpx;
  308. }
  309. .logo_input {
  310. width: 34rpx;
  311. height: 38rpx;
  312. position: absolute;
  313. top: 25rpx;
  314. left: 30rpx;
  315. }
  316. /* 登录 */
  317. .button {
  318. width: 510rpx;
  319. height: 86rpx;
  320. background: #2671E2;
  321. box-shadow: 0px 2px 20px 0px rgba(38, 113, 226, 0.5);
  322. border-radius: 12rpx;
  323. text-align: center;
  324. line-height: 89rpx;
  325. color: #fff;
  326. margin: 0 auto;
  327. margin-top: 120rpx;
  328. font-size: 34rpx;
  329. }
  330. .footer {
  331. width: 100%;
  332. height: 157rpx;
  333. position: absolute;
  334. bottom: 0;
  335. left: 0;
  336. }
  337. .imagesBox {
  338. width: 80rpx;
  339. height: 88rpx;
  340. }
  341. .login {
  342. text-decoration: underline;
  343. text-align: center;
  344. margin-top: 40px;
  345. color: #88909E;
  346. font-size: 28rpx;
  347. }
  348. .textbox {
  349. width: 569rpx;
  350. display: flex;
  351. margin-top: 40rpx;
  352. }
  353. .textbox-1 {
  354. width: 30%;
  355. font-size: 30rpx;
  356. color: #999999;
  357. }
  358. .textbox-11 {
  359. width: 30%;
  360. text-align: right;
  361. font-size: 30rpx;
  362. color: #999999;
  363. }
  364. .textbox-2 {
  365. width: 30%;
  366. }
  367. </style>