合同小程序前端代码仓库
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.

296 lines
5.8 KiB

  1. <template>
  2. <view class="login-container">
  3. <!-- 顶部欢迎语 -->
  4. <view class="login_image">
  5. <image class="login_image_img" src="/static/image/组件 3 – 1.png" ></image>
  6. </view>
  7. <view class="welcome">
  8. <text class="welcome-text">欢迎登陆车辆合同生成</text>
  9. </view>
  10. <!-- 账号输入框 -->
  11. <view class="input-container">
  12. <uni-easyinput prefixIcon="person" class="input" placeholder="请输入您的账号" v-model="username" :inputBorder='false' :clearable='false' >
  13. </uni-easyinput>
  14. <view class="underline"></view>
  15. </view>
  16. <!-- 密码输入框 -->
  17. <view class="input-container">
  18. <uni-easyinput prefixIcon="locked" class="input" type="password" placeholder="请输入您的密码" v-model="password" :inputBorder='false' :passwordIcon="false" :clearable='false'></uni-easyinput>
  19. <view class="underline"></view>
  20. </view>
  21. <!-- 协议提示 -->
  22. <view class="agreement">
  23. <radio class = "login-agree" value="r1" :checked="checked" @click="changeCK">登录即代表同意
  24. </radio>
  25. <text class="link" @click="showModal">《用户协议》</text>
  26. <text class="login-agree">与</text>
  27. <text class="link" @click="showModal">《隐私政策》</text>
  28. </view>
  29. <view class = 'button_container'>
  30. <!-- 登录按钮 -->
  31. <button class="login-button" @click="handleLogin">登陆</button>
  32. </view>
  33. <mosowe-confirm-popup
  34. v-model="popupNoCancelShow"
  35. title="服务协议和隐私政策"
  36. confirmText
  37. cancelText
  38. >
  39. 没有取消弹框
  40. <template v-slot:footer>
  41. <view class="mini_container">
  42. <button class="mini-btn" type="primary" size="mini" @click="closeModal">取消</button>
  43. <button class="mini-btn" type="primary" size="mini" @click="getConfirm">确认</button>
  44. </view>
  45. </template>
  46. </mosowe-confirm-popup>
  47. </view>
  48. </template>
  49. <script>
  50. export default {
  51. data() {
  52. return {
  53. username: '', // 账号
  54. password: '', // 密码
  55. isModalVisible: false, // 控制弹窗显示
  56. modalTitle: '', // 弹窗标题
  57. modalContent: '' ,// 弹窗内容
  58. popupNoCancelShow: false,
  59. checked:false,
  60. };
  61. },
  62. onLoad() {
  63. uni.request(
  64. {
  65. url: 'https://gpt.aiym.run/contract/miniapp/product/categories' ,
  66. method:'GET',
  67. header:{
  68. "Content-Type": "application/json",
  69. "X-Access-Token":'11'
  70. },
  71. success:(res)=>{
  72. console.log(res.data)
  73. }
  74. }
  75. );
  76. },
  77. methods: {
  78. // 处理登录逻辑
  79. handleLogin() {
  80. if (!this.username || !this.password) {
  81. uni.showToast({ title: '请输入账号和密码', icon: 'none' });
  82. return;
  83. }else{
  84. console.log(this.checked);
  85. if(this.checked){
  86. uni.showToast({ title: '登录成功', icon: 'success' });
  87. uni.switchTab({ url: '/pages/home/home' });
  88. }else{
  89. uni.showToast({ title: '请勾选服务协议', icon: 'none' });
  90. }
  91. }
  92. },
  93. // 显示弹窗
  94. showModal() {
  95. this.popupNoCancelShow = true ;
  96. },
  97. // 关闭弹窗
  98. closeModal() {
  99. this.popupNoCancelShow = false ;
  100. },
  101. change(e) {
  102. console.log('当前模式:' + e.type + ',状态:' + e.show);
  103. },
  104. changeCK(){
  105. if(this.checked){
  106. this.checked = false;
  107. }else{
  108. this.checked = true;
  109. }
  110. },
  111. // 处理选中事件
  112. getConfirm(){
  113. console.log("111");
  114. if(this.checked){
  115. this.checked = this.checked;
  116. }else{
  117. this.checked = true;
  118. }
  119. this.popupNoCancelShow = false;
  120. }
  121. }
  122. };
  123. </script>
  124. <style>
  125. /* 页面容器 */
  126. .login-container {
  127. display: flex;
  128. flex-direction: column;
  129. align-items: center;
  130. background-color: #ffffff;
  131. height: 100vh;
  132. width: 100%;
  133. }
  134. .button-text {
  135. color: #fff;
  136. font-size: 12rem;
  137. }
  138. /* 登录图片 */
  139. .login_image{
  140. width: 100%;
  141. height: 40%;
  142. }
  143. .login_image_img{
  144. width: 100%;
  145. height: 100%;
  146. }
  147. /* 欢迎语 */
  148. .welcome {
  149. height: 15%;
  150. margin-bottom: 10%;
  151. display: flex;
  152. justify-content: end;
  153. align-items: center;
  154. }
  155. .welcome-text {
  156. font-size: 1.3rem;
  157. font-weight: bold;
  158. color: #044f7a;
  159. }
  160. /* 输入框容器 */
  161. .input-container {
  162. width: 70%;
  163. height: 7%;
  164. /* background-color: #007aff; */
  165. display: flex;
  166. flex-direction: column;
  167. align-items: center;
  168. }
  169. /* 输入框样式 */
  170. .input {
  171. width: 100%;
  172. height: 99%;
  173. font-size: 1rem;
  174. border: none;
  175. outline: none;
  176. background-color: transparent;
  177. /* z-index: 99; */
  178. }
  179. /* 下划线样式 */
  180. .underline {
  181. width: 100%;
  182. height: 0.1%;
  183. background-color: #f2f2f2;
  184. }
  185. /* 协议提示 */
  186. .agreement {
  187. font-size: 1rem;
  188. color: #666;
  189. margin-bottom: 1.2rem;
  190. width: 90%;
  191. left:10%;
  192. display: flex;
  193. flex-direction: row;
  194. align-items: center;
  195. }
  196. .login-agree{
  197. font-size: 0.6rem;;
  198. }
  199. .link {
  200. color: #007aff;
  201. text-decoration: underline;
  202. font-size: 0.6rem;
  203. }
  204. .button_container{
  205. width: 100%;
  206. height: 40%;
  207. display: flex;
  208. align-items: center;
  209. }
  210. /* 登录按钮 */
  211. .login-button {
  212. width: 70%;
  213. height: 10%;
  214. line-height: 10%;
  215. background-color: #044f7a;
  216. color: #fff;
  217. border: none;
  218. border-radius: 4rem;
  219. font-size: 1rem;
  220. position: absolute;
  221. top:15%;
  222. left:15%;
  223. display: flex;
  224. justify-content: center;
  225. align-items: center;
  226. }
  227. /* 弹窗样式 */
  228. .modal {
  229. position: fixed;
  230. top: 0;
  231. left: 0;
  232. width: 100%;
  233. height: 100%;
  234. background-color: rgba(0, 0, 0, 0.5);
  235. display: flex;
  236. justify-content: center;
  237. align-items: center;
  238. }
  239. .modal-content {
  240. width: 80%;
  241. background-color: #fff;
  242. border-radius: 0.5rem;
  243. padding: 1.5rem;
  244. }
  245. .modal-header {
  246. display: flex;
  247. justify-content: space-between;
  248. align-items: center;
  249. font-size: 1rem;
  250. font-weight: bold;
  251. margin-bottom: 1rem;
  252. }
  253. .close {
  254. font-size: 1.5rem;
  255. cursor: pointer;
  256. }
  257. .modal-body {
  258. font-size: 1rem;
  259. line-height: 1.5;
  260. }
  261. .mini_container{
  262. display: flex;
  263. flex-direction: row;
  264. align-items: center;
  265. }
  266. /* 按钮 */
  267. .mini-btn{
  268. width: 30%;
  269. margin-left: 15%;
  270. }
  271. </style>