江西小程序管理端
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.

284 lines
6.9 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <view class="main">
  3. <view class="u-back-top">
  4. <view class="backBox">
  5. <u-icon name="arrow-left" color="#333" size="28"></u-icon>
  6. </view>
  7. </view>
  8. <view class="title">
  9. <image :src="imgUrl" mode=""></image>
  10. </view>
  11. <view class="form">
  12. <view class="form-item">
  13. <mySelect :value="FormData.tenantName" @click.native="show=true" placeholder="请选择服务地区"/>
  14. </view>
  15. <view class="form-item">
  16. <view class="inputBox my">
  17. <u--input placeholder="请输入登录账号" border="none" clearable v-model="FormData.username"></u--input>
  18. </view>
  19. </view>
  20. <view class="form-item">
  21. <view class="inputBox my">
  22. <u--input placeholder="请输入密码" border="none" clearable style="height: 100%;" :clearable="false" v-model="FormData.password"></u--input>
  23. </view>
  24. </view>
  25. <view class="forgetTps" @click="$u.toast('请联系管理员重置密码!')">忘记密码</view>
  26. <view class="loginBtn" :class="{active: btnHighlight}" @click="submitFn"> </view>
  27. <!-- <view class="radioWrap">
  28. <u-checkbox-group >
  29. <u-checkbox v-model="isCheck" shape="circle" label="已阅读并同意" :labelSize="12" ></u-checkbox>
  30. </u-checkbox-group>
  31. <view class="privacyText">
  32. <text>用户协议</text> <text>隐私协议</text>
  33. </view>
  34. </view> -->
  35. </view>
  36. <u-picker :show="show" :columns="columnsArea" keyName="name" @confirm="confirmArea" @close="show=false"></u-picker>
  37. <u-action-sheet :actions="list" :title="title" :show="showRole" @select="selectClick" ></u-action-sheet>
  38. </view>
  39. </template>
  40. <script>
  41. import { loginPwd, tenantPage } from '@/config/api.js'
  42. import { imgUrl } from '@/config/site.config.js'
  43. export default {
  44. data() {
  45. return {
  46. isCheck: false,
  47. codeText: '获取验证码',
  48. FormData: {
  49. username: '',
  50. password: '',
  51. tenantName: ''
  52. },
  53. imgUrl: imgUrl+'loginTitle.png',
  54. codeOn: false,
  55. show: false,
  56. columnsArea: [],
  57. list: [],
  58. title: '请选择您要登录的角色',
  59. showRole: false,
  60. roleObj: {
  61. schoolManager: '校长',
  62. schoolFinance: '驾校财务',
  63. coach: '实操教练',
  64. examSiteCoach: '考场模拟教练',
  65. bookingSimulationTeacher: '模拟器老师'
  66. }
  67. }
  68. },
  69. onLoad() {
  70. this.tenantPageFn()
  71. },
  72. computed: {
  73. btnHighlight() {
  74. let { FormData } = this
  75. return FormData.username.length>3&&FormData.password.length>3&&FormData.tenantName
  76. }
  77. },
  78. methods: {
  79. selectClick(item) {
  80. this.showRole = false
  81. this.chooseIdentity(item.name)
  82. },
  83. chooseIdentity(name) {
  84. // let val = ''
  85. // if(this.FormData.username=='18267103167') {
  86. // val = '实操教练'
  87. // }else if(this.FormData.username=='18267103168') {
  88. // val = '校长'
  89. // }else if (this.FormData.username=='18267103169'){
  90. // val = '考场模拟教练'
  91. // }else {
  92. // val = '模拟器老师'
  93. // this.$store.commit('upDateIdentity', val)
  94. // uni.reLaunch({
  95. // url: '/pages/tabbar/examSimulation/index'
  96. // })
  97. // return false
  98. // }
  99. // if(this.FormData.username=='18267103167') {
  100. // val = '实操教练'
  101. // }else if(this.FormData.username=='18267103168') {
  102. // val = '校长'
  103. // }else if (this.FormData.username=='18267103169'){
  104. // val = '考场模拟教练'
  105. // }else {
  106. // val = '模拟器老师'
  107. // }
  108. // if(name=='模拟器老师') {
  109. // this.$store.commit('upDateIdentity', val)
  110. // uni.reLaunch({
  111. // url: '/pages/tabbar/examSimulation/index'
  112. // })
  113. // return false
  114. // }
  115. this.$store.commit('upDateIdentity', name)
  116. uni.reLaunch({
  117. url: '/pages/tabbar/statistics/index'
  118. })
  119. },
  120. confirmArea(val) {
  121. let item = val.value[0]
  122. this.FormData.tenantName =item.name
  123. this.$store.commit('upDateTenantId', item.id)
  124. this.show = false
  125. },
  126. async tenantPageFn() {
  127. let obj = {
  128. pageNo: 1,
  129. pageSize: 100,
  130. status: 0
  131. }
  132. const {data: res} = await tenantPage(obj)
  133. this.columnsArea.push(res.list)
  134. console.log(res)
  135. },
  136. // 是否选择协议
  137. groupChangeEnvnt(e) {
  138. this.isCheck = e.value
  139. console.log('是否选择协议', this.isCheck)
  140. },
  141. // 发送短信验证码
  142. async goSms() {
  143. const {
  144. FormData
  145. } = this
  146. if (!FormData.phone) return this.$u.toast('请输入手机号');
  147. if (!this.isPhone) return this.$u.toast('手机号格式有误');
  148. if (this.codeOn) return
  149. const data = await getLoginCode({
  150. codeType: 1,
  151. phone: FormData.phone,
  152. })
  153. console.log(data)
  154. // 获取验证码
  155. var time = 60;
  156. var timer = setInterval(() => {
  157. time--;
  158. this.codeText = time + "秒后重新发送"
  159. this.codeOn = true;
  160. if (time == 0) {
  161. clearInterval(timer);
  162. this.codeText = "获取验证码";
  163. this.codeOn = false;
  164. }
  165. }, 1000);
  166. },
  167. async submitFn() {
  168. // this.chooseIdentity('考场模拟教练')
  169. // return
  170. if(!this.btnHighlight) return
  171. const {data: res} = await loginPwd(this.FormData)
  172. this.$store.commit('update_vuex_loginInfo', res)
  173. await this.$store.dispatch('getUserInfo')
  174. console.log(this.role)
  175. this.role.forEach((item)=>{
  176. let obj = {
  177. name: this.roleObj[item]
  178. }
  179. this.list.push(obj)
  180. })
  181. if(this.list.length>1) {
  182. this.showRole = true
  183. }else {
  184. this.chooseIdentity(this.list[0].name)
  185. }
  186. console.log(this.list)
  187. return
  188. }
  189. }
  190. }
  191. </script>
  192. <style lang="scss" scoped>
  193. .main {
  194. width: 100%;
  195. min-height: 100vh;
  196. // background: url('http://192.168.1.20:81/zhili/image/20230922/f5e2cfaf05f441c1b9f897e7dc284f1d.png') no-repeat;
  197. // background-size: 100% 360rpx;
  198. .u-back-top {
  199. padding: 32rpx 0 0 0;
  200. .backBox {
  201. padding: 24rpx;
  202. }
  203. }
  204. .title {
  205. width: 658rpx;
  206. height: 94rpx;
  207. margin: 100rpx auto 100rpx auto;
  208. }
  209. .form {
  210. padding: 0 46rpx;
  211. .form-item {
  212. height: 112rpx;
  213. background: #F4F7FF;
  214. border-radius: 16rpx;
  215. width: 100%;
  216. line-height: 112rpx;
  217. display: flex;
  218. margin-bottom: 40rpx;
  219. padding: 0 40rpx;
  220. .prefix {
  221. display: flex;
  222. align-items: center;
  223. font-size: 32rpx;
  224. color: #333;
  225. font-weight: 600;
  226. }
  227. .inputBox {
  228. flex: 1;
  229. }
  230. .code {
  231. color: #BBBBBB;
  232. margin-left: 30rpx;
  233. &.active {
  234. color: $themC
  235. }
  236. }
  237. }
  238. .forgetTps {
  239. font-size: 28rpx;
  240. color: $themC;
  241. margin-top: -20rpx;
  242. text-align: right;
  243. }
  244. .loginBtn {
  245. width: 100%;
  246. height: 112rpx;
  247. background: rgba(25,137,250,0.3);
  248. border-radius: 16rpx;
  249. text-align: center;
  250. line-height: 112rpx;
  251. font-size: 32rpx;
  252. font-weight: 600;
  253. color: #fff;
  254. margin-top: 100rpx;
  255. &.active {
  256. background: rgba(25,137,250,1);
  257. }
  258. }
  259. .radioWrap {
  260. display: flex;
  261. align-items: center;
  262. margin-top: 40rpx;
  263. .privacyText {
  264. font-size: 24rpx;
  265. color: #888E94;
  266. text {
  267. color: $themC;
  268. }
  269. }
  270. }
  271. }
  272. }
  273. </style>