index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <template>
  2. <view>
  3. <view class="loginway">
  4. <div class="navigation"></div>
  5. <image class="loginimg" mode="widthFix" src="/static/login/logo_word.png"></image>
  6. <view class="input_wrap">
  7. <u--form labelPosition="left" :model="form" :rules="rules" ref="uForm">
  8. <u-form-item label="" prop="username" class="inputFormWrap">
  9. <u--input shape="circle" clearable prefixIcon="/static/login/icon-account.png"
  10. :prefixIconStyle="prefixIconStyle" v-model="form.username" placeholder="请输入账号"></u--input>
  11. </u-form-item>
  12. <u-form-item label="" prop="password" class="inputFormWrap">
  13. <u--input shape="circle" clearable password prefixIcon="/static/login/icon-password.png"
  14. :prefixIconStyle="prefixIconStyle" v-model="form.password" placeholder="请输入密码"></u--input>
  15. </u-form-item>
  16. <u-form-item label="" prop="" class="inputFormWrap">
  17. <u-checkbox-group v-model="checkboxs" placement="column" @change="changeRemember">
  18. <u-checkbox :label="'记住密码'" :name="'remember'"></u-checkbox>
  19. </u-checkbox-group>
  20. </u-form-item>
  21. <u-form-item>
  22. <u-button type="primary" text="登录" shape="circle" @click="handleLogin"></u-button>
  23. </u-form-item>
  24. <!-- <u-form-item>
  25. <view class="network_configuration_box">
  26. <view class="netWrokSet" @click="handleToConfiguration">
  27. <image src="/static/login/network.png" mode=""></image>
  28. <text class="text">呼叫中心配置</text>
  29. </view>
  30. </view>
  31. </u-form-item> -->
  32. </u--form>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. export default {
  39. data() {
  40. return {
  41. // systemList,
  42. prefixIconStyle: {
  43. width: "16px",
  44. height: "16px",
  45. marginRight: "4px",
  46. marginLeft: "10px"
  47. },
  48. form: {
  49. // password: "Huilong@#$999",
  50. password: "",
  51. systemCode: "system_crm",
  52. username: "",
  53. clientFlag: "2",
  54. // username: "huihui",
  55. code: "996007qa.code",
  56. uuid: "123"
  57. },
  58. checkboxs: [],
  59. rules: {
  60. username: {
  61. type: 'string',
  62. required: true,
  63. message: '请输入账号',
  64. trigger: []
  65. },
  66. password: {
  67. type: 'string',
  68. required: true,
  69. message: '请输入密码',
  70. trigger: []
  71. }
  72. },
  73. // mac: getMacAddress(),
  74. };
  75. },
  76. computed: {
  77. systemList() {
  78. return this.$store.state.user.systemList;
  79. },
  80. remember: {
  81. get() {
  82. return this.checkboxs.length > 0
  83. },
  84. set(value) {
  85. this.checkboxs = value ? ['remember'] : [];
  86. }
  87. }
  88. },
  89. mounted() {
  90. // 触发水印隐藏
  91. this.systemChange(this.form.systemCode);
  92. this.getUserByCache();
  93. },
  94. methods: {
  95. changeRemember(value){
  96. if (value.length > 0) {
  97. uni.setStorageSync('username', this.form.username);
  98. uni.setStorageSync('password', this.form.password);
  99. } else {
  100. uni.removeStorageSync('username');
  101. uni.removeStorageSync('password');
  102. }
  103. },
  104. getUserByCache() {
  105. const savedUsername = uni.getStorageSync('username');
  106. const savedPassword = uni.getStorageSync('password');
  107. if (savedUsername && savedPassword) {
  108. this.form.username = savedUsername;
  109. this.form.password = savedPassword;
  110. this.remember = true;
  111. }
  112. },
  113. handleToConfiguration() {
  114. uni.navigateTo({
  115. url: "/pages/configuration/index"
  116. })
  117. },
  118. systemChange(e) {
  119. if (!e) return;
  120. uni.$u.api.getAppSystemList().then((res) => {
  121. const systemCodeList = res.data;
  122. this.$store.dispatch("user/setSystemlist", systemCodeList);
  123. const system = this.systemList.find(v => v.value === e);
  124. this.$store.commit("user/SET_SYSTEM", system);
  125. }).catch((e) => {
  126. uni.$u.toast("服务网络不通");
  127. })
  128. },
  129. handleLogin() {
  130. this.$refs.uForm.validate().then(() => {
  131. if (this.remember) {
  132. uni.setStorageSync('username', this.form.username);
  133. uni.setStorageSync('password', this.form.password);
  134. } else {
  135. uni.removeStorageSync('username');
  136. uni.removeStorageSync('password');
  137. }
  138. this.$store.dispatch("user/login", this.form).then(() => {
  139. uni.switchTab({
  140. url: `/pages/person/index`,
  141. success: () => {
  142. this.$store.dispatch("app/register");
  143. uni.$u.toast("登录成功");
  144. }
  145. })
  146. }).catch(() => {
  147. uni.$u.toast("请检查您是否有该系统权限");
  148. })
  149. })
  150. },
  151. },
  152. }
  153. </script>
  154. <style lang="scss">
  155. .network_configuration_box {
  156. margin: auto;
  157. .netWrokSet {
  158. display: flex;
  159. align-items: center;
  160. image {
  161. width: 30rpx;
  162. height: 30rpx;
  163. }
  164. .text {
  165. margin-left: 10rpx;
  166. font-size: 26rpx;
  167. }
  168. }
  169. }
  170. .systemLabel_wrap {
  171. display: flex;
  172. align-items: center;
  173. .label {
  174. margin-left: 10rpx;
  175. }
  176. }
  177. .systemCode_wrap {
  178. position: relative;
  179. ::v-deep .uni-select {
  180. border-radius: 100px;
  181. border: 1px solid #dadbde;
  182. height: 40px;
  183. padding: 0px 10px 0px 46px;
  184. &:before {
  185. content: "";
  186. display: block;
  187. width: 16px;
  188. height: 16px;
  189. background-image: url("../../static/login/icon-system.png");
  190. background-size: 16px 16px;
  191. position: absolute;
  192. left: 20px;
  193. top: 50%;
  194. transform: translate(0%, -50%);
  195. }
  196. .uni-select__input-placeholder {
  197. font-size: 14px;
  198. color: rgb(192, 196, 204);
  199. }
  200. }
  201. .system_debt {
  202. ::v-deep .uni-select {
  203. &:before {
  204. background-image: url("../../static/outbound/icon-zycs.png");
  205. }
  206. }
  207. }
  208. .system_debt_ccb {
  209. ::v-deep .uni-select {
  210. &:before {
  211. background-image: url("../../static/outbound/icon-zycs.png");
  212. }
  213. }
  214. }
  215. .system_debt_spdb {
  216. ::v-deep .uni-select {
  217. &:before {
  218. background-image: url("../../static/outbound/icon-zycs.png");
  219. }
  220. }
  221. }
  222. .system_debt_public {
  223. ::v-deep .uni-select {
  224. &:before {
  225. background-image: url("../../static/outbound/icon-zycs.png");
  226. }
  227. }
  228. }
  229. .system_debt_dfkl {
  230. ::v-deep .uni-select {
  231. &:before {
  232. background-image: url("../../static/outbound/icon-zycs.png");
  233. }
  234. }
  235. }
  236. .system_debt_cib {
  237. ::v-deep .uni-select {
  238. &:before {
  239. background-image: url("../../static/outbound/icon-zycs.png");
  240. }
  241. }
  242. }
  243. .system_debt_icbc_h {
  244. ::v-deep .uni-select {
  245. &:before {
  246. background-image: url("../../static/outbound/icon-zycs.png");
  247. }
  248. }
  249. }
  250. .system_debt_tjxt {
  251. ::v-deep .uni-select {
  252. &:before {
  253. background-image: url("../../static/outbound/icon-zycs.png");
  254. }
  255. }
  256. }
  257. // .systemIcon{
  258. // width: 16px;
  259. // height: 16px;
  260. // position: absolute;
  261. // left: 20px;
  262. // top: 50%;
  263. // transform: translate(0%, -50%);
  264. // display: none;
  265. // }
  266. }
  267. .inputFormWrap {
  268. ::v-deep .u-border {
  269. border: 1px solid #dadbde !important;
  270. }
  271. }
  272. .max {
  273. width: 500rpx;
  274. height: 500rpx;
  275. }
  276. page {
  277. background: #fff;
  278. }
  279. .loginway {
  280. display: flex;
  281. flex-direction: column;
  282. height: 100vh;
  283. .navigation {
  284. background-color: #108cff;
  285. width: 100%;
  286. height: 120rpx;
  287. }
  288. .loginimg {
  289. display: block;
  290. width: 100%;
  291. height: 100%;
  292. }
  293. .input_wrap {
  294. padding: 20rpx 30rpx;
  295. }
  296. }
  297. </style>