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

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