No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

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