LoginView.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <view class="">
  3. <customNav :shownav="true" :title="$t('index.dengluzhuce')" titledetl=""></customNav>
  4. <view class="contentV" style="margin-top: 100rpx;">
  5. <label class="titlev">{{$t('index.huanying')}}</label>
  6. <view class="yzmctV">
  7. <input class="noinputV" type="text" :placeholder="$t('index.qsrzhanghao')" @input="phoneinput">
  8. </view>
  9. <view class="yzmctV">
  10. <input class="noinputV" password type="text" :placeholder="$t('index.qsrmima')" @input="smsCodeinput">
  11. </view>
  12. <view class="yzmctV">
  13. <label class="querenBt" @click="loginAC">{{$t('index.dengluzhuce')}}</label>
  14. </view>
  15. <view class="contentInRowR" style="margin-top: 40rpx;align-items: center;">
  16. <text class="textfontB5" style="padding-right: 20rpx;color: darkgray;">{{$t('user.meiyouzhanghao')}}</text>
  17. <text class="zhuceBt" @click="registerAC">{{$t('user.zhuce')}}</text>
  18. </view>
  19. <view class="contentInRowC" style="margin-top: 40rpx;" @click="yueduyszc">
  20. <label class="linktext">{{$t('index.yuedu')}}{{$t('index.yinsizc')}}</label>
  21. </view>
  22. </view>
  23. <view style="height: 50rpx;"></view>
  24. <popViewGG :tips="$t('index.gjqhxz')" :show="showpop" :maskClosable="true" :isCancel="true" @chooseCancel="chooseCancel">
  25. <picker-view :indicator-style="indicatorStyle" :value="pvalue" @change="bindChange" class="picker-view">
  26. <picker-view-column>
  27. <view class="item" v-for="(item,index) in range" :key="index">{{item}}</view>
  28. </picker-view-column>
  29. </picker-view>
  30. </popViewGG>
  31. </view>
  32. </template>
  33. <script>
  34. import api from "@/pages/api/api.js"
  35. import { encrypt,decrypt } from '@/common/jsencrypt.js'
  36. export default {
  37. data() {
  38. return {
  39. pvalue: [0],
  40. indicatorStyle: `height: 50px;`,
  41. range: ["+84","+886","+86"],
  42. showpop:false,
  43. phone:'',
  44. smsCode:'',
  45. guojiadaima:'+84',
  46. cid:''
  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. }
  60. });
  61. //this.UpdataToken();
  62. },
  63. methods: {
  64. bindChange (e) {
  65. var val = e.detail.value[0];
  66. this.guojiadaima=this.range[val];
  67. },
  68. popgjm(){
  69. this.showpop=true;
  70. },
  71. chooseCancel(){
  72. this.showpop=false;
  73. },
  74. duoyuyan(){
  75. uni.navigateTo({
  76. url:'/pages/UserCenter/yonghushezhi/duoyuyan'
  77. })
  78. },
  79. phoneinput(event){
  80. this.phone = event.target.value;
  81. },
  82. smsCodeinput(event){
  83. this.smsCode = event.target.value;
  84. },
  85. yueduyszc(){
  86. uni.navigateTo({
  87. url:'/pages/index/mindex/yinszhengc'
  88. })
  89. },
  90. loginAC(){
  91. if(this.phone.length<=0){
  92. uni.showToast({
  93. title: this.$t('user.qsrzhanghao'),
  94. icon: 'none',
  95. duration: 1500
  96. })
  97. return;
  98. }
  99. if(this.smsCode.length<=0){
  100. uni.showToast({
  101. title: this.$t('user.qingshurmim'),
  102. icon: 'none',
  103. duration: 1500
  104. })
  105. return;
  106. }
  107. this.loginUp();
  108. },
  109. loginUp(){
  110. var that = this;
  111. api('loginByzhmm',{
  112. userName:this.phone,
  113. password:encrypt(this.smsCode),
  114. cid:this.cid
  115. },res=>{
  116. console.log(res)
  117. if(res.data.code==200){
  118. plus.nativeUI.toast(this.$t('api.dengluchengg'), {
  119. icon : "none",// eg. "/img/add.png"
  120. duration : "long",// 持续3.5s,short---2s
  121. align : "center",// 水平居中
  122. verticalAlign : "bottom"// 垂直底部
  123. });
  124. uni.setStorageSync("token",res.data.token);
  125. getApp().globalData.token = res.data.token;
  126. uni.setStorageSync("userId",res.data.data.userId);
  127. let items = JSON.stringify(res.data.data);
  128. uni.setStorageSync('userInfo',items);
  129. uni.navigateBack();
  130. return;
  131. }
  132. if(res.data.code==500){
  133. uni.showToast({
  134. title:res.data.msg,
  135. icon: 'none',
  136. duration: 3500
  137. })
  138. return;
  139. }
  140. uni.showToast({
  141. title: that.$t('api.denglusb'),
  142. icon: 'none',
  143. duration: 3500
  144. })
  145. },failc=>{
  146. //console.log('getadvertis----',failc)
  147. uni.showToast({
  148. title: that.$t('api.denglushibai'),
  149. icon: 'none',
  150. duration: 2500
  151. })
  152. })
  153. },
  154. registerAC(){
  155. uni.navigateTo({
  156. url:'/pages/UserCenter/RegisterView'
  157. })
  158. },
  159. }
  160. }
  161. </script>
  162. <style>
  163. page{
  164. background-color:white;
  165. }
  166. .topimag{
  167. width: 100%;
  168. }
  169. .contentV{
  170. display: flex;
  171. width: 92%;
  172. margin-left: 4%;
  173. flex-direction: column;
  174. justify-content: flex-start;
  175. }
  176. .titlev{
  177. width: 100%;
  178. height: 60rpx;
  179. line-height: 60rpx;
  180. font-size: 32rpx;
  181. font-weight: bold;
  182. text-align: left;
  183. }
  184. .yzmctV{
  185. display: flex;
  186. flex-direction: row;
  187. align-items: center;
  188. justify-content:flex-start;
  189. margin-top: 30rpx;
  190. width: 100%;
  191. }
  192. .noinputV{
  193. width: 100%;
  194. height: 80rpx;
  195. line-height: 80rpx;
  196. border-radius: 10rpx;
  197. border: 2rpx solid #F2F3F7;
  198. background-color: #F2F3F7;
  199. }
  200. .noinputVcode{
  201. width: 100%;
  202. height: 80rpx;
  203. line-height: 80rpx;
  204. border-radius: 10rpx;
  205. border: 2rpx solid #F2F3F7;
  206. background-color: #F2F3F7;
  207. }
  208. .yzmbt{
  209. color: white;
  210. font-size: 26rpx;
  211. width: 170rpx;
  212. height: 60rpx;
  213. line-height: 60rpx;
  214. text-align: center;
  215. margin-left: -190rpx;
  216. border-radius: 2rpx;
  217. background-color:#60BA63;
  218. }
  219. .querenBt{
  220. margin-top: 30rpx;
  221. width: 100%;
  222. height: 60rpx;
  223. line-height: 60rpx;
  224. padding: 10rpx;
  225. border-radius: 20rpx;
  226. border: solid #40AE36;
  227. border-width: 0px 0px 6rpx 0px;
  228. text-align: center;
  229. justify-content: center;
  230. background-color: #40AE36;
  231. color: white;
  232. box-shadow: 0rpx 0rpx 10rpx 0rpx #40AE36;
  233. }
  234. .linktext{
  235. font-size: 24rpx;
  236. color:mediumblue;
  237. text-decoration:underline;
  238. }
  239. .notetext{
  240. color: darkgray;
  241. font-size: 24rpx;
  242. text-align: center;
  243. }
  244. .xialakuangct{
  245. display: flex;
  246. flex-direction: row;
  247. align-items: center;
  248. justify-content:space-between;
  249. padding-left: 16rpx;
  250. margin-right: 20rpx;
  251. width: 140rpx;
  252. height: 80rpx;
  253. line-height: 80rpx;
  254. border-radius: 10rpx;
  255. border: 2rpx solid #F2F3F7;
  256. background-color: #F2F3F7;
  257. }
  258. .xialakuang{
  259. width: 100%;
  260. }
  261. .lineview{
  262. display: flex;
  263. flex-direction: row;
  264. align-items: center;
  265. justify-content: center;
  266. background-color: whitesmoke;
  267. border: solid darkgray;
  268. border-width: 0px 0px 1rpx 0px;
  269. width: 80%;
  270. margin-bottom: 12rpx;
  271. }
  272. .picker-view {
  273. width: 750rpx;
  274. height: 300rpx;
  275. margin-top: 10rpx;
  276. }
  277. .item {
  278. line-height: 100rpx;
  279. text-align: center;
  280. }
  281. .duoyuyanctv{
  282. margin-top: 20rpx;
  283. padding: 30rpx;
  284. border: solid lavender;
  285. border-width: 0px 0px 1rpx 0px;
  286. }
  287. .duoyuyIcon{
  288. width: 40rpx;
  289. height: 40rpx;
  290. }
  291. .zhuceBt{
  292. width: 40%;
  293. height: 60rpx;
  294. line-height: 60rpx;
  295. padding: 10rpx;
  296. border-radius: 20rpx;
  297. text-align: center;
  298. justify-content: center;
  299. background-color: darkgray;
  300. color: white;
  301. box-shadow: 0px 0rpx 10rpx 0rpx darkgray;
  302. }
  303. </style>