LoginView.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <template>
  2. <view class="">
  3. <customNav :shownav="true" :title="$t('user.denglu')" tinColor="#40AE36" jiantou="0"></customNav>
  4. <view class="contentV">
  5. <view class="yzmctV">
  6. <input class="noinputVcode" type="nickname" :placeholder="$t('user.qsrzhanghao')" @input="dengluzhangh">
  7. </view>
  8. <view class="yzmctV">
  9. <input class="noinputVcode" password type="text" :placeholder="$t('user.qingshurmim')" :password="true" @input="denglumima">
  10. </view>
  11. <view class="yzmctV">
  12. <text class="querenBt" @click="loginAC">{{$t('user.denglu')}}</text>
  13. </view>
  14. <view class="contentInRowC" style="margin-top: 40rpx;">
  15. <text class="detealText" style="padding-right: 20rpx;">{{$t('user.meiyouzhanghao')}}</text>
  16. <text class="zhuceBt" @click="registerAC">{{$t('user.zhuce')}}</text>
  17. </view>
  18. <view class="contentColumnC" style="margin-top: 50rpx;" @click="yueduyszc">
  19. <text class="linktext">{{$t('index.yuedu')}}{{$t('index.yinsizc')}}</text>
  20. </view>
  21. <view style="height: 30rpx;"></view>
  22. </view>
  23. <uni-popup style="z-index: 999;" ref="popYsxy" type="center" :isMaskClick="false" :safeArea="true">
  24. <ysxyView v-on:EagrResult="agrResult"></ysxyView>
  25. </uni-popup>
  26. </view>
  27. </template>
  28. <script>
  29. import {
  30. smsCode,
  31. loginByzhmm
  32. } from '@/pages/api/login';
  33. import { encrypt,decrypt } from '@/common/jsencrypt.js'
  34. export default {
  35. data() {
  36. return {// paotui123 123456
  37. zhanghao:'',
  38. mima:'',
  39. cid:'',
  40. cryptform:''
  41. }
  42. },
  43. onReady() {
  44. var yszche=uni.getStorageSync('yszche');
  45. if(1!=yszche){
  46. this.$refs.popYsxy.open('center');
  47. }
  48. },
  49. onShow() {
  50. var that=this;
  51. uni.getPushClientId({
  52. success: (res) => {
  53. that.cid = res.cid;
  54. //console.log('客户端推送标识:',that.cid)
  55. uni.setStorageSync("cid",that.cid);
  56. },
  57. fail(err) {
  58. console.log(err)
  59. uni.showToast({
  60. title:'获取推送标识失败',
  61. icon: 'none',
  62. duration: 4000
  63. })
  64. }
  65. });
  66. //this.UpdataToken();
  67. },
  68. methods: {
  69. dengluzhangh(event){
  70. this.zhanghao = event.target.value;
  71. },
  72. denglumima(event){
  73. this.mima = event.target.value;
  74. },
  75. yueduyszc(){
  76. uni.navigateTo({
  77. url:'/pages/index/yinszhengc'
  78. })
  79. },
  80. agrResult(state){//隐私协议
  81. console.log(state);
  82. if(state==0){
  83. if (plus.os.name.toLowerCase() === 'android') {
  84. console.log('ios');
  85. plus.runtime.quit();
  86. }
  87. else{
  88. console.log('ios');
  89. plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
  90. }
  91. }
  92. if(state==1){
  93. uni.showTabBar();
  94. this.$refs.popYsxy.close();
  95. uni.setStorageSync('yszche',1);
  96. var yszche=uni.getStorageSync('yszche');
  97. console.log(yszche);
  98. }
  99. if(state==2){
  100. uni.navigateTo({
  101. url:'/pages/index/yinszhengc'
  102. })
  103. }
  104. },
  105. loginAC(){
  106. if(this.zhanghao.length<=0){
  107. uni.showToast({
  108. title: this.$t('user.qsrzhanghao'),
  109. icon: 'none',
  110. duration: 1500
  111. })
  112. return
  113. }
  114. if(this.mima.length<=0){
  115. uni.showToast({
  116. title: this.$t('user.qingshurmim'),
  117. icon: 'none',
  118. duration: 1500
  119. })
  120. return;
  121. }
  122. this.loginUp();
  123. },
  124. async loginUp(){
  125. var that = this;
  126. console.log(this.zhanghao)
  127. console.log(encrypt(this.mima))
  128. await this.$http.post(`${loginByzhmm}`, {
  129. userName:this.zhanghao,
  130. password:encrypt(this.mima),
  131. cid:this.cid
  132. },false)
  133. .then(async r => {
  134. console.log(r)
  135. if(r.data.code==200){
  136. plus.nativeUI.toast(this.$t('user.denglucg'), {
  137. icon : "none",// eg. "/img/add.png"
  138. duration : "long",// 持续3.5s,short---2s
  139. align : "center",// 水平居中
  140. verticalAlign : "bottom"// 垂直底部
  141. });
  142. uni.setStorageSync("token",r.data.token);
  143. getApp().globalData.token=r.data.token;
  144. uni.setStorageSync('userInfo',r.data.data);
  145. uni.setStorageSync("userId",r.data.data.userId);
  146. getApp().globalData.initgoEasy();
  147. uni.reLaunch({
  148. url:'/pages/index/index'
  149. })
  150. return;
  151. }
  152. if(r.data.code==500){
  153. uni.showToast({
  154. title: r.data.msg,
  155. icon: 'none',
  156. duration: 3500
  157. })
  158. return;
  159. }
  160. uni.showToast({
  161. title: that.$t('user.denglushib'),
  162. icon: 'none',
  163. duration: 3500
  164. })
  165. //uni.setStorageSync("token",r.data.token);
  166. //uni.navigateBack();
  167. })
  168. .catch(err => {
  169. console.log(err)
  170. uni.showToast({
  171. title: that.$t('user.denglushib'),
  172. icon: 'none',
  173. duration: 2500
  174. })
  175. })
  176. },
  177. duoyuyan(){
  178. uni.navigateTo({
  179. url:'/pages/user/duoyuyan'
  180. })
  181. },
  182. registerAC(){
  183. uni.navigateTo({
  184. url:'/pages/user/RegisterView'
  185. })
  186. },
  187. }
  188. }
  189. </script>
  190. <style lang="scss">
  191. @import '@/common/common.scss';
  192. page{
  193. background-color:white;
  194. }
  195. .topimag{
  196. width: 100%;
  197. }
  198. .contentVB{
  199. position: fixed;
  200. flex-direction: row;
  201. justify-content: center;
  202. align-items: center;
  203. bottom: 30rpx;
  204. width: 100%;
  205. }
  206. .contentV{
  207. display: flex;
  208. width: 92%;
  209. margin-left: 4%;
  210. flex-direction: column;
  211. justify-content: flex-start;
  212. }
  213. .titlev{
  214. width: 100%;
  215. height: 60rpx;
  216. line-height: 60rpx;
  217. font-size: 40rpx;
  218. font-weight: bold;
  219. text-align: left;
  220. }
  221. .yzmctV{
  222. display: flex;
  223. flex-direction: row;
  224. align-items: center;
  225. justify-content:flex-start;
  226. margin-top: 30rpx;
  227. width: 100%;
  228. }
  229. .yzmctVS{
  230. display: flex;
  231. flex-direction: row;
  232. align-items: center;
  233. justify-content:space-between;
  234. margin-top: 30rpx;
  235. width: 100%;
  236. }
  237. .noinputV{
  238. width: 73%;
  239. height: 80rpx;
  240. line-height: 80rpx;
  241. border-radius: 10rpx;
  242. border: 2rpx solid #F2F3F7;
  243. background-color: #F2F3F7;
  244. }
  245. .noinputVcode{
  246. width: 100%;
  247. height: 80rpx;
  248. line-height: 80rpx;
  249. border-radius: 10rpx;
  250. border: 2rpx solid #F2F3F7;
  251. background-color: #F2F3F7;
  252. }
  253. .yzmbt{
  254. color: white;
  255. font-size: 26rpx;
  256. width: 170rpx;
  257. height: 60rpx;
  258. line-height: 60rpx;
  259. text-align: center;
  260. margin-left: -190rpx;
  261. border-radius: 2rpx;
  262. background-color:#006AFF;
  263. }
  264. .yzmdl{
  265. color: white;
  266. font-size: 26rpx;
  267. width: 170rpx;
  268. height: 60rpx;
  269. line-height: 60rpx;
  270. text-align: center;
  271. margin-top: 26rpx;
  272. border-radius: 2rpx;
  273. background-color:#006AFF;
  274. }
  275. .querenBt{
  276. margin-top: 30rpx;
  277. width: 100%;
  278. height: 60rpx;
  279. line-height: 60rpx;
  280. padding: 10rpx;
  281. border-radius: 20rpx;
  282. text-align: center;
  283. justify-content: center;
  284. background-color: #40AE36;
  285. color: white;
  286. box-shadow: 0px 0rpx 10rpx 0rpx #40AE36;
  287. }
  288. .zhuceBt{
  289. width: 40%;
  290. height: 60rpx;
  291. line-height: 60rpx;
  292. padding: 10rpx;
  293. border-radius: 20rpx;
  294. text-align: center;
  295. justify-content: center;
  296. background-color: darkgray;
  297. color: white;
  298. box-shadow: 0px 0rpx 10rpx 0rpx darkgray;
  299. }
  300. .linktext{
  301. font-size: 24rpx;
  302. color:skyblue;
  303. text-decoration:underline;
  304. }
  305. .notetext{
  306. color: darkgray;
  307. font-size: 24rpx;
  308. text-align: center;
  309. }
  310. .xialakuangct{
  311. display: flex;
  312. flex-direction: row;
  313. align-items: center;
  314. justify-content:space-between;
  315. padding-left: 16rpx;
  316. margin-right: 20rpx;
  317. width: 140rpx;
  318. height: 80rpx;
  319. line-height: 80rpx;
  320. border-radius: 10rpx;
  321. border: 2rpx solid #F2F3F7;
  322. background-color: #F2F3F7;
  323. }
  324. .xialakuang{
  325. width: 100%;
  326. }
  327. .lineview{
  328. display: flex;
  329. flex-direction: row;
  330. align-items: center;
  331. justify-content: center;
  332. background-color: whitesmoke;
  333. border: solid darkgray;
  334. border-width: 0px 0px 1rpx 0px;
  335. width: 80%;
  336. margin-bottom: 12rpx;
  337. }
  338. .picker-view {
  339. width: 750rpx;
  340. height: 300rpx;
  341. margin-top: 10rpx;
  342. }
  343. .item {
  344. line-height: 90rpx;
  345. text-align: center;
  346. }
  347. .duoyuyanctv{
  348. margin-top: 20rpx;
  349. padding: 30rpx;
  350. border: solid lavender;
  351. border-width: 0px 0px 1rpx 0px;
  352. }
  353. .duoyuyIcon{
  354. width: 40rpx;
  355. height: 40rpx;
  356. }
  357. </style>