412 lines
8.3 KiB

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