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

286 lines
7.0 KiB

1 year ago
1 year ago
1 year ago
1 year ago
12 months ago
1 year ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
11 months ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
12 months ago
1 year ago
11 months ago
1 year ago
1 year ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
12 months 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. // alert(item.name)
  83. },
  84. chooseIdentity(name) {
  85. // let val = ''
  86. // if(this.FormData.username=='18267103167') {
  87. // val = '实操教练'
  88. // }else if(this.FormData.username=='18267103168') {
  89. // val = '校长'
  90. // }else if (this.FormData.username=='18267103169'){
  91. // val = '考场模拟教练'
  92. // }else {
  93. // val = '模拟器老师'
  94. // this.$store.commit('upDateIdentity', val)
  95. // uni.reLaunch({
  96. // url: '/pages/tabbar/examSimulation/index'
  97. // })
  98. // return false
  99. // }
  100. // if(this.FormData.username=='18267103167') {
  101. // val = '实操教练'
  102. // }else if(this.FormData.username=='18267103168') {
  103. // val = '校长'
  104. // }else if (this.FormData.username=='18267103169'){
  105. // val = '考场模拟教练'
  106. // }else {
  107. // val = '模拟器老师'
  108. // }
  109. // if(name=='模拟器老师') {
  110. // this.$store.commit('upDateIdentity', val)
  111. // uni.reLaunch({
  112. // url: '/pages/tabbar/examSimulation/index'
  113. // })
  114. // return false
  115. // }
  116. this.$store.commit('upDateIdentity', name)
  117. uni.reLaunch({
  118. url: '/pages/tabbar/statistics/index'
  119. })
  120. },
  121. confirmArea(val) {
  122. let item = val.value[0]
  123. this.FormData.tenantName =item.name
  124. this.$store.commit('upDateTenantId', item.id)
  125. this.show = false
  126. },
  127. async tenantPageFn() {
  128. let obj = {
  129. pageNo: 1,
  130. pageSize: 100,
  131. status: 0
  132. }
  133. const {data: res} = await tenantPage(obj)
  134. this.columnsArea.push(res.list)
  135. console.log(res)
  136. },
  137. // 是否选择协议
  138. groupChangeEnvnt(e) {
  139. this.isCheck = e.value
  140. console.log('是否选择协议', this.isCheck)
  141. },
  142. // 发送短信验证码
  143. async goSms() {
  144. const {
  145. FormData
  146. } = this
  147. if (!FormData.phone) return this.$u.toast('请输入手机号');
  148. if (!this.isPhone) return this.$u.toast('手机号格式有误');
  149. if (this.codeOn) return
  150. const data = await getLoginCode({
  151. codeType: 1,
  152. phone: FormData.phone,
  153. })
  154. console.log(data)
  155. // 获取验证码
  156. var time = 60;
  157. var timer = setInterval(() => {
  158. time--;
  159. this.codeText = time + "秒后重新发送"
  160. this.codeOn = true;
  161. if (time == 0) {
  162. clearInterval(timer);
  163. this.codeText = "获取验证码";
  164. this.codeOn = false;
  165. }
  166. }, 1000);
  167. },
  168. async submitFn() {
  169. // this.chooseIdentity('考场模拟教练')
  170. // return
  171. if(!this.btnHighlight) return
  172. const {data: res} = await loginPwd(this.FormData)
  173. this.$store.commit('update_vuex_loginInfo', res)
  174. await this.$store.dispatch('getUserInfo')
  175. console.log(this.role)
  176. this.list = []
  177. this.role.forEach((item)=>{
  178. let obj = {
  179. name: this.roleObj[item]
  180. }
  181. this.list.push(obj)
  182. })
  183. if(this.list.length>1) {
  184. this.showRole = true
  185. }else {
  186. this.chooseIdentity(this.list[0].name)
  187. }
  188. console.log(this.list)
  189. return
  190. }
  191. }
  192. }
  193. </script>
  194. <style lang="scss" scoped>
  195. .main {
  196. width: 100%;
  197. min-height: 100vh;
  198. // background: url('http://192.168.1.20:81/zhili/image/20230922/f5e2cfaf05f441c1b9f897e7dc284f1d.png') no-repeat;
  199. // background-size: 100% 360rpx;
  200. .u-back-top {
  201. padding: 32rpx 0 0 0;
  202. .backBox {
  203. padding: 24rpx;
  204. }
  205. }
  206. .title {
  207. width: 658rpx;
  208. height: 94rpx;
  209. margin: 100rpx auto 100rpx auto;
  210. }
  211. .form {
  212. padding: 0 46rpx;
  213. .form-item {
  214. height: 112rpx;
  215. background: #F4F7FF;
  216. border-radius: 16rpx;
  217. width: 100%;
  218. line-height: 112rpx;
  219. display: flex;
  220. margin-bottom: 40rpx;
  221. padding: 0 40rpx;
  222. .prefix {
  223. display: flex;
  224. align-items: center;
  225. font-size: 32rpx;
  226. color: #333;
  227. font-weight: 600;
  228. }
  229. .inputBox {
  230. flex: 1;
  231. }
  232. .code {
  233. color: #BBBBBB;
  234. margin-left: 30rpx;
  235. &.active {
  236. color: $themC
  237. }
  238. }
  239. }
  240. .forgetTps {
  241. font-size: 28rpx;
  242. color: $themC;
  243. margin-top: -20rpx;
  244. text-align: right;
  245. }
  246. .loginBtn {
  247. width: 100%;
  248. height: 112rpx;
  249. background: rgba(25,137,250,0.3);
  250. border-radius: 16rpx;
  251. text-align: center;
  252. line-height: 112rpx;
  253. font-size: 32rpx;
  254. font-weight: 600;
  255. color: #fff;
  256. margin-top: 100rpx;
  257. &.active {
  258. background: rgba(25,137,250,1);
  259. }
  260. }
  261. .radioWrap {
  262. display: flex;
  263. align-items: center;
  264. margin-top: 40rpx;
  265. .privacyText {
  266. font-size: 24rpx;
  267. color: #888E94;
  268. text {
  269. color: $themC;
  270. }
  271. }
  272. }
  273. }
  274. }
  275. </style>