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

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