You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

309 lines
6.6 KiB

  1. <template>
  2. <view class="content">
  3. <view class="sadsadasdasdsadasd">智能高效客户管理平台</view>
  4. <view class="sction">
  5. <view class="mama">
  6. <view class="mamaz">
  7. <input type="text" v-model="msg" maxlength="4" placeholder="请输入验证码" placeholder-class="input-class" class="input" />
  8. </view>
  9. <view class="mamay">
  10. <view class="sada" v-if="sendAuthCode" style="font-size: 35rpx;" @click="getAuthCode">获取验证码</view>
  11. <text class="sada" v-if="!sendAuthCode">
  12. 重新发送
  13. <text>({{ auth_time }})</text>
  14. </text>
  15. </view>
  16. </view>
  17. <view class="login-btn" :style="{ background: msg == '' ? '#F2F2F2' : '#2B6EFF' }" @click="denglu"><text
  18. class="">登录</text></view>
  19. <view class="code-login" @click="passwordlogin"><text>密码登录</text></view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. var util = require("../../utils/util.js");
  25. var config = require("../../config");
  26. var app = getApp();
  27. var WXB_SESSION_LOGIN_DATA = 'weapp_session_login_data';
  28. export default {
  29. data() {
  30. return {
  31. sendAuthCode: true,
  32. auth_time: 0,
  33. msg: '',
  34. phonecet: '',
  35. role:''
  36. };
  37. },
  38. onLoad: function(options) {
  39. var phonese = options.username;
  40. var phonexxz = phonese.substring(0, 3) + '****' + phonese.substring(7);
  41. this.phone = phonexxz,
  42. this.phonecet = options.username,
  43. this.role = options.role
  44. this.sendAuthCode = false;
  45. this.auth_time = 60;
  46. var auth_timetimer = setInterval(() => {
  47. this.auth_time--;
  48. if (this.auth_time <= 0) {
  49. this.sendAuthCode = true;
  50. clearInterval(auth_timetimer);
  51. }
  52. }, 1000);
  53. },
  54. methods: {
  55. //跳转密码登录页面
  56. passwordlogin() {
  57. uni.reLaunch()({
  58. url: '/pages/login/index',
  59. })
  60. },
  61. //获取验证码
  62. getAuthCode() {
  63. uni.request({
  64. url: config.service.sendCode + "?mobile=" + this.phonecet,
  65. method: "GET",
  66. header: {
  67. 'content-type': 'application/json',
  68. 'Access-Token': uni.getStorageSync('weapp_session_login_data').token
  69. },
  70. success: (data) => {
  71. console.log(data)
  72. // 成功地响应会话信息
  73. if (data.data.code == 10000) {
  74. util.showSuccess('发送成功');
  75. this.sendAuthCode = false;
  76. this.auth_time = 60;
  77. var auth_timetimer = setInterval(() => {
  78. this.auth_time--;
  79. if (this.auth_time <= 0) {
  80. this.sendAuthCode = true;
  81. clearInterval(auth_timetimer);
  82. }
  83. }, 1000);
  84. } else {
  85. util.showNone(data.data.message);
  86. return false;
  87. }
  88. },
  89. })
  90. },
  91. //登录
  92. denglu() {
  93. if (this.msg=='') {
  94. uni.showToast({
  95. title: '验证码不能为空',
  96. icon: 'none'
  97. });
  98. return
  99. }
  100. if (this.msg.length == 4) {
  101. let porme = {
  102. loginName: this.phonecet,
  103. password: this.msg
  104. }
  105. uni.request({
  106. url: config.service.plogin,
  107. method: "POST",
  108. data: porme,
  109. header: {
  110. 'content-type': 'application/json',
  111. 'Access-Token': uni.getStorageSync('weapp_session_login_data').token
  112. },
  113. success: (data) => {
  114. // 成功地响应会话信息
  115. if (data.data.code == 10000) {
  116. util.showSuccess('登录成功');
  117. var token = {
  118. 'token': data.data.data
  119. };
  120. uni.setStorageSync(WXB_SESSION_LOGIN_DATA, token); //写入缓存
  121. this.getMenu()
  122. this.getUser()
  123. } else {
  124. util.showNone(data.data.message);
  125. return false;
  126. }
  127. },
  128. })
  129. } else {
  130. uni.showToast({
  131. title: '验证码位数不正确',
  132. icon: 'none'
  133. });
  134. }
  135. },
  136. getMenu(){
  137. this.$u.get("/user/getMenu").then(data => {
  138. uni.setStorageSync("weapp_session_Menu_data", data)
  139. })
  140. },
  141. getUser(){
  142. util.getRequestPromise(config.service.getUser, {}, false, "GET").then(data => {
  143. if (data.zkProperties) {
  144. } else {
  145. data.zkProperties = [{
  146. id: "",
  147. propertyName: ''
  148. }]
  149. }
  150. let lopan = {
  151. id: data.zkProperties[0].id,
  152. name: data.zkProperties[0].propertyName
  153. }
  154. uni.setStorageSync("fendianindex", 0); //写入缓存
  155. uni.setStorageSync("weapp_session_userInfo_data", data); //写入缓存
  156. uni.setStorageSync("buildingID", lopan); //楼盘id写入缓存
  157. uni.switchTab({
  158. url: '/pages/index/index'
  159. });
  160. });
  161. }
  162. }
  163. };
  164. </script>
  165. <style>
  166. .mama {
  167. width: 620rpx;
  168. display: flex;
  169. border-bottom: 1px solid #E1E1E1;
  170. margin: 60rpx auto;
  171. }
  172. .sadsadasdasdsadasd {
  173. font-size: 34rpx;
  174. font-family: PingFangSC-Medium, PingFang SC;
  175. font-weight: 500;
  176. color: #008EF2;
  177. width: 100%;
  178. text-align: center;
  179. padding-top: 340rpx;
  180. }
  181. .mamaz {
  182. width: 50%;
  183. height: 90rpx;
  184. }
  185. .mamay {
  186. width: 50%;
  187. height: 90rpx;
  188. }
  189. .input {
  190. width: 350rpx;
  191. color: #78DFB0;
  192. height: 100%;
  193. line-height: 90rpx;
  194. font-size: 17px;
  195. color: #171717;
  196. }
  197. .sada {
  198. width: 70%;
  199. line-height: 90rpx;
  200. color: #2B6EFF;
  201. text-align: right;
  202. font-size: 35rpx;
  203. margin-left: 100rpx;
  204. display: block;
  205. }
  206. .content {
  207. margin: 0;
  208. padding: 0;
  209. background-image: url(https://qufang.oss-cn-beijing.aliyuncs.com/channelHelper/background.png);
  210. background-size: 100vw auto;
  211. background-repeat: no-repeat;
  212. }
  213. .login-text {
  214. font-size: 60rpx;
  215. font-family: PingFang SC;
  216. font-weight: 500;
  217. color: rgba(23, 23, 23, 1);
  218. letter-spacing: 8rpx;
  219. margin-left: 75rpx;
  220. font-weight: bold;
  221. }
  222. .login-input {
  223. border-bottom: 1px solid #e1e1e1;
  224. color: #c9cac9;
  225. margin: 98rpx 64rpx 200rpx 75rpx;
  226. font-size: 17px;
  227. }
  228. .login-btn {
  229. margin: 0 auto;
  230. margin-top: 240rpx;
  231. width: 567rpx;
  232. height: 86rpx;
  233. border-radius: 2em;
  234. font-size: 17px;
  235. font-weight: bold;
  236. border: none;
  237. display: flex;
  238. justify-content: center;
  239. align-items: center;
  240. color: #ffffff;
  241. }
  242. .code-login {
  243. display: flex;
  244. justify-content: center;
  245. margin-top: 40rpx;
  246. color: #D6D7D6;
  247. margin-bottom: 200rpx;
  248. font-size: 30rpx;
  249. }
  250. .log-box {
  251. display: flex;
  252. flex-direction: row;
  253. justify-content: center;
  254. align-items: center;
  255. font-size: 28rpx;
  256. color: #bfc0bf;
  257. margin-bottom: 65rpx;
  258. }
  259. .hengx {
  260. margin: 0 20rpx 0 20rpx;
  261. height: 2rpx;
  262. width: 232rpx;
  263. background: #e1e1e1;
  264. }
  265. .wechat {
  266. display: flex;
  267. justify-content: center;
  268. align-items: center;
  269. width: 93rpx;
  270. height: 93rpx;
  271. background: rgba(255, 255, 255, 1);
  272. box-shadow: 0px 10rpx 30rpx rgba(120, 223, 176, 0.22);
  273. border-radius: 50%;
  274. margin: 0 auto;
  275. }
  276. .btn-get {
  277. width: 250rpx;
  278. font-size: 17px;
  279. color: #c9cac9;
  280. position: relative;
  281. top: -290rpx;
  282. right: -450rpx;
  283. }
  284. .input-class {
  285. color: #D6D7D6;
  286. font-size: 17px;
  287. letter-spacing: 1rpx;
  288. }
  289. </style>