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

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