Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

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