LoginView.vue 8.5 KB

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