25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

322 satır
6.9 KiB

  1. <template>
  2. <view>
  3. <view class="head">
  4. <image class="head-immg" src="https://qufang.oss-cn-beijing.aliyuncs.com/zkgj/xcx/login.png" mode=""></image>
  5. </view>
  6. <view class="input">
  7. <view class="cwjs-cells item-flex">
  8. <view class="cwjs-item center">
  9. <image src="https://qufang.oss-cn-beijing.aliyuncs.com/channelHelper/user.png" class="logo_input">
  10. </image>
  11. <input class="cwjs-item cwjs-input" v-model="username" placeholder="请输入账号名" type="number" maxlength="11" placeholder-style="color:#AAAAAA"/>
  12. </view>
  13. </view>
  14. <view class="cwjs-cells item-flex" style="margin-top:13rpx;">
  15. <view class="cwjs-item center">
  16. <image src="https://qufang.oss-cn-beijing.aliyuncs.com/channelHelper/lock.png" class="logo_input">
  17. </image>
  18. <input class="cwjs-item cwjs-input" placeholder="请输入密码" placeholder-style="color:#AAAAAA" type="password" v-model="password" maxlength="16" v-if="passwordType"/>
  19. <input class="cwjs-item cwjs-input" placeholder="请输入密码" placeholder-style="color:#AAAAAA" maxlength="16" v-model="password" v-else/>
  20. </view>
  21. <view class="imagesBox" @tap="changeBindPassword">
  22. <image v-if="passwordType==false" src="../../static/images/zhengkai.png" class="images" mode="scaleToFill"></image>
  23. <image v-if="passwordType==true" src="../../static/images/bishang.png" class="images" mode="scaleToFill"></image>
  24. </view>
  25. </view>
  26. <view class="textbox">
  27. <view class="textbox-1" @tap="bindVerification">验证码登录</view>
  28. <view class="textbox-2"></view>
  29. <view class="textbox-11" @tap="bindpassword">忘记密码</view>
  30. </view>
  31. </view>
  32. <view class="button" @tap="bindWxBLogin">立即登录</view>
  33. </view>
  34. </template>
  35. <script>
  36. var util = require("../../utils/util.js");
  37. var config = require("../../config");
  38. var app = getApp();
  39. var WXB_SESSION_LOGIN_DATA = 'weapp_session_login_data';
  40. export default {
  41. data() {
  42. return {
  43. username: '',//18831048327 ,18888888800
  44. password: '',//123456
  45. passwordType: true,
  46. agreeChecked: true
  47. };
  48. },
  49. onLoad: function(options) {
  50. uni.hideToast();
  51. },
  52. methods: {
  53. //验证码登录
  54. bindVerification() {
  55. uni.navigateTo({
  56. url: '/pages/login/Verification?role=1',
  57. })
  58. },
  59. //忘记密码
  60. bindpassword() {
  61. uni.navigateTo({
  62. url: '/pages/login/Verification?role=2',
  63. })
  64. },
  65. //密码选择
  66. changeBindPassword: function(e) {
  67. this.passwordType=!this.passwordType;
  68. },
  69. //登录
  70. bindWxBLogin: function(e) {
  71. util.showBusy('正在登录...');
  72. var that = this;
  73. if (this.username == '') {
  74. util.showNone("请输入账号名");
  75. return false;
  76. }
  77. if (this.password == '') {
  78. util.showNone("请输入密码");
  79. return false;
  80. }
  81. var loginParams = {
  82. loginName: this.username,
  83. password: this.password
  84. };
  85. // 请求服务器登录地址,获得会话信息
  86. uni.request({
  87. url: config.service.login,
  88. header: {
  89. 'content-type': 'application/json'
  90. },
  91. method: "POST",
  92. data: loginParams,
  93. success: function(result) {
  94. var data = result.data;
  95. //console.log("登陆信息", data);
  96. if (data && data.code == 10000) {
  97. var res = data.data;
  98. if (res) {
  99. var data = {
  100. 'token': res
  101. };
  102. uni.setStorageSync(WXB_SESSION_LOGIN_DATA, data); //写入缓存
  103. that.getMenu()
  104. that.getUser();
  105. util.showSuccess('登录成功');
  106. } else {
  107. util.showNone("账号名或密码错误,请重试");
  108. return false;
  109. }
  110. // 没有正确响应会话信息
  111. } else {
  112. util.showNone(data.message);
  113. return false;
  114. }
  115. },
  116. // 响应错误
  117. fail: function(loginResponseError) {
  118. util.showNone("网络异常,请重试");
  119. return false;
  120. }
  121. });
  122. },
  123. getUser(){
  124. util.getRequestPromise(config.service.getUser, {}, false, "GET").then(data => {
  125. if (data.zkProperties) {
  126. } else {
  127. data.zkProperties = [{
  128. id: "",
  129. propertyName: ''
  130. }]
  131. }
  132. let lopan = {
  133. id: data.zkProperties[0].id,
  134. name: data.zkProperties[0].propertyName
  135. }
  136. uni.setStorageSync("fendianindex", 0); //写入缓存
  137. uni.setStorageSync("weapp_session_userInfo_data", data); //写入缓存
  138. uni.setStorageSync("buildingID", lopan); //项目id写入缓存
  139. uni.switchTab({
  140. url: '/pages/index/index'
  141. });
  142. });
  143. },
  144. getMenu(){
  145. this.$u.get("/user/getMenu").then(data => {
  146. uni.setStorageSync("weapp_session_Menu_data", data)
  147. })
  148. }
  149. }
  150. };
  151. </script>
  152. <style lang="scss">
  153. .cwjs-logo {
  154. display: block;
  155. width: 219rpx;
  156. height: 158rpx;
  157. margin: 54rpx auto 66rpx;
  158. }
  159. .cwjs-tips {
  160. font-size: 24rpx;
  161. padding: 80rpx 0;
  162. color: #8a8a8a;
  163. }
  164. .cwjs-form {
  165. position: relative;
  166. margin: 0;
  167. background-color: #fff;
  168. border-radius: 10px;
  169. padding: 20rpx 40rpx 113rpx;
  170. }
  171. .cwjs-cells {
  172. width: 569rpx;
  173. display: flex;
  174. flex-direction: row;
  175. justify-content: space-between;
  176. align-items: center;
  177. margin: 0 auto;
  178. height: 88rpx;
  179. overflow: hidden;
  180. border-bottom: 1rpx solid #BFC7D3;
  181. position: relative;
  182. }
  183. .center {
  184. flex: 1;
  185. }
  186. .cwjs-input {
  187. height: 48rpx;
  188. line-height: 48rpx;
  189. padding: 23rpx 23rpx 23rpx 78rpx;
  190. font-size: 28rpx;
  191. font-family: PingFangSC-Regular, PingFang SC;
  192. color: #000;
  193. }
  194. .images {
  195. display: block;
  196. width: 40rpx;
  197. height: 21rpx;
  198. margin-right: 30rpx;
  199. margin-top: 33.5rpx;
  200. }
  201. .mod-btn {
  202. position: absolute;
  203. bottom: -80rpx;
  204. left: 50%;
  205. margin-left: -80rpx;
  206. }
  207. /* 头部 */
  208. .head {
  209. width: 750rpx;
  210. height: 500rpx;
  211. position: relative;
  212. .head-immg{
  213. width: 118rpx;
  214. height: 61rpx;
  215. position: absolute;
  216. top: 300rpx;
  217. left: 100rpx;
  218. }
  219. }
  220. .logo {
  221. width: 248upx;
  222. height: 248upx;
  223. display: block;
  224. position: absolute;
  225. top: 134rpx;
  226. left: 240.5rpx;
  227. }
  228. /* 输入框 */
  229. .input {
  230. width: 100%;
  231. height: auto;
  232. padding: 0 105rpx;
  233. box-sizing: border-box;
  234. }
  235. .logo_input {
  236. width: 34rpx;
  237. height: 38rpx;
  238. position: absolute;
  239. top: 25rpx;
  240. left: 0;
  241. }
  242. /* 登录 */
  243. .button {
  244. width: 630rpx;
  245. height: 86rpx;
  246. background: #2671E2;
  247. box-shadow: 0px 2rpx 20rpx 0px rgba(38, 113, 226, 0.5);
  248. border-radius: 49rpx;
  249. text-align: center;
  250. line-height: 89rpx;
  251. color: #fff;
  252. margin: 0 auto;
  253. margin-top: 239rpx;
  254. font-size: 34rpx;
  255. }
  256. .footer {
  257. width: 100%;
  258. height: 157rpx;
  259. position: absolute;
  260. bottom: 0;
  261. left: 0;
  262. }
  263. .imagesBox {
  264. width: 80rpx;
  265. height: 88rpx;
  266. }
  267. .login {
  268. text-decoration: underline;
  269. text-align: center;
  270. margin-top: 40px;
  271. color: #88909E;
  272. font-size: 28rpx;
  273. }
  274. .textbox {
  275. width: 569rpx;
  276. display: flex;
  277. margin-top: 40rpx;
  278. }
  279. .textbox-1 {
  280. width: 30%;
  281. font-size: 30rpx;
  282. color: #999999;
  283. }
  284. .textbox-11 {
  285. width: 30%;
  286. text-align: right;
  287. font-size: 30rpx;
  288. color: #999999;
  289. }
  290. .textbox-2 {
  291. width: 40%;
  292. }
  293. </style>