LoginView.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <template>
  2. <view class="">
  3. <customNav :shownav="true" :title="$t('index.dengluzhuce')" titledetl=""></customNav>
  4. <image class="topimag" src="/static/defimages/denglutop.png" mode="widthFix"></image>
  5. <view class="contentV">
  6. <text class="titlev">{{$t('index.huanying')}}</text>
  7. <!-- <view class="">
  8. <view class="contentInRowS duoyuyanctv" @click="duoyuyan">
  9. <view class="contentInRowL">
  10. <image class="duoyuyIcon" src="/static/images/yuyan@3x.png" mode="scaleToFill"></image>
  11. <text>Ngôn ngữ/语言</text>
  12. </view>
  13. <image style="width: 30rpx;" src="/static/images/fanhui@3x.png" mode="widthFix"></image>
  14. </view>
  15. </view> -->
  16. <view class="yzmctV">
  17. <view class="xialakuangct" @click="popgjm">
  18. <text>{{guojiadaima}}</text>
  19. <image style="width: 36rpx;height: 36rpx;padding-right: 16rpx;" src="/static/images/xiala@3x.png"
  20. mode="scaleToFill"></image>
  21. </view>
  22. <input class="noinputV" type="number" :placeholder="$t('index.shoujihao')" @input="phoneinput">
  23. </view>
  24. <view class="yzmctV noinputVcode">
  25. <input class="yzminputV" type="text" :placeholder="$t('index.yanzhengma')" @input="smsCodeinput">
  26. <text class="yzmbt" @click="getSMScode">{{smsCodeNote}}</text>
  27. </view>
  28. <view class="yzmctV">
  29. <text class="querenBt" @click="loginAC">{{$t('index.dengluzhuce')}}</text>
  30. </view>
  31. <view class="contentInRowC" style="margin-top: 40rpx;" @click="yueduyszc">
  32. <text class="linktext">{{$t('index.yuedu')}}{{$t('index.yinsizc')}}</text>
  33. </view>
  34. </view>
  35. <popViewGG :tips="$t('index.gjqhxz')" :show="showpop" :maskClosable="true" :isCancel="true"
  36. @chooseCancel="chooseCancel">
  37. <picker-view :indicator-style="indicatorStyle" :value="pvalue" @change="bindChange" class="picker-view">
  38. <picker-view-column>
  39. <view class="item" v-for="(item,index) in range" :key="index">{{item}}</view>
  40. </picker-view-column>
  41. </picker-view>
  42. </popViewGG>
  43. </view>
  44. </template>
  45. <script>
  46. import api from "@/pages/api/api.js";
  47. export default {
  48. data() {
  49. return {
  50. pvalue: [0],
  51. indicatorStyle: `height: 50px;`,
  52. range: ["+84", "+886", "+86"],
  53. showpop: false,
  54. phone: '',
  55. smsCode: '',
  56. smsCodeNote: '',
  57. timer: '',
  58. timeCall: 0,
  59. guojiadaima: '+84',
  60. cid: ''
  61. }
  62. },
  63. onShow() {
  64. var that = this;
  65. this.smsCodeNote = this.$t('index.huoquyzm');
  66. // uni.getPushClientId({
  67. // success: (res) => {
  68. // that.cid = res.cid;
  69. // console.log('客户端推送标识:',that.cid)
  70. // uni.setStorageSync("cid",that.cid);
  71. // },
  72. // fail(err) {
  73. // // uni.showToast({
  74. // // title:'获取推送标识失败',
  75. // // icon: 'none',
  76. // // duration: 4000
  77. // // })
  78. // console.log(err)
  79. // }
  80. // });
  81. //this.UpdataToken();
  82. },
  83. methods: {
  84. bindChange(e) {
  85. var val = e.detail.value[0];
  86. this.guojiadaima = this.range[val];
  87. },
  88. popgjm() {
  89. this.showpop = true;
  90. },
  91. chooseCancel() {
  92. this.showpop = false;
  93. },
  94. duoyuyan() {
  95. uni.navigateTo({
  96. url: '/pages/UserCenter/yonghushezhi/duoyuyan'
  97. })
  98. },
  99. phoneinput(event) {
  100. this.phone = event.target.value;
  101. },
  102. smsCodeinput(event) {
  103. this.smsCode = event.target.value;
  104. },
  105. yueduyszc() {
  106. uni.navigateTo({
  107. url: '/pages/index/mindex/yinszhengc'
  108. })
  109. },
  110. getSMScode() {
  111. if (this.phone.length <= 0) {
  112. uni.showToast({
  113. title: this.$t('index.shoujihao'),
  114. icon: 'none',
  115. duration: 3500
  116. })
  117. return;
  118. }
  119. var top = this.phone.substring(0, 1);
  120. if (top == '0') {
  121. this.phone = this.phone.slice(1);
  122. }
  123. console.log(this.phone)
  124. if (this.timeCall == 0) {
  125. this.getSMScodeact();
  126. this.timeCall = 60;
  127. } else {
  128. return;
  129. }
  130. var that = this;
  131. this.timer = setInterval(() => {
  132. that.timeCall = that.timeCall - 1;
  133. if (that.timeCall == 0) {
  134. clearInterval(that.timer);
  135. that.smsCodeNote = that.$t('index.huoquyzm');
  136. } else {
  137. that.smsCodeNote = that.$t('index.chongxhq') + '(' + that.timeCall + ')';
  138. }
  139. }, 1000);
  140. },
  141. getSMScodeact() {
  142. console.log("getSMScodeact");
  143. api('smsCode', {
  144. phone: this.guojiadaima + this.phone
  145. }, res => {
  146. uni.showToast({
  147. title: res.data.msg,
  148. icon: 'none',
  149. duration: 1500
  150. })
  151. }, failc => {
  152. //console.log('getadvertis----',failc)
  153. })
  154. },
  155. loginAC() {
  156. if (this.phone.length <= 0) {
  157. uni.showToast({
  158. title: this.$t('index.shoujihao'),
  159. icon: 'none',
  160. duration: 3500
  161. })
  162. return;
  163. }
  164. var top = this.phone.substring(0, 1);
  165. if (top == '0') {
  166. this.phone = this.phone.slice(1);
  167. }
  168. if (this.smsCode.length <= 0) {
  169. uni.showToast({
  170. title: this.$t('index.yanzhengma'),
  171. icon: 'none',
  172. duration: 3500
  173. })
  174. return;
  175. }
  176. this.loginUp();
  177. },
  178. loginUp() {
  179. console.log(this.guojiadaima + this.phone, this.smsCode, this.cid)
  180. api('loginBySmsCode', {
  181. phone: this.guojiadaima + this.phone,
  182. code: this.smsCode,
  183. cid: this.cid
  184. }, res => {
  185. console.log(res)
  186. if (res.data.code == 200) {
  187. if (typeof plus !== 'undefined' && plus.nativeUI && plus.nativeUI.toast) {
  188. plus.nativeUI.toast(this.$t('api.dengluchengg'), {
  189. icon: "none",
  190. duration: "long",
  191. align: "center",
  192. verticalAlign: "bottom"
  193. });
  194. } else {
  195. uni.showToast({
  196. title: this.$t('api.dengluchengg'),
  197. icon: 'none',
  198. duration: 3500
  199. });
  200. }
  201. getApp().globalData.token = res.data.token;
  202. uni.setStorageSync("token", res.data.token);
  203. uni.setStorageSync("userId", res.data.data.userId);
  204. uni.setStorageSync('userInfo', res.data.data);
  205. getApp().globalData.initgoEasy();
  206. uni.navigateBack();
  207. return;
  208. }
  209. if (res.data.code == 500) {
  210. uni.showToast({
  211. title: res.data.msg,
  212. icon: 'none',
  213. duration: 3500
  214. })
  215. return;
  216. }
  217. uni.showToast({
  218. title: this.$t('api.denglusb'),
  219. icon: 'none',
  220. duration: 3500
  221. })
  222. }, failc => {
  223. uni.showToast({
  224. title: this.$t('api.denglushibai'),
  225. icon: 'none',
  226. duration: 2500
  227. })
  228. })
  229. },
  230. }
  231. }
  232. </script>
  233. <style>
  234. page {
  235. background-color: white;
  236. }
  237. .topimag {
  238. width: 100%;
  239. }
  240. .contentV {
  241. display: flex;
  242. width: 92%;
  243. margin-left: 4%;
  244. flex-direction: column;
  245. justify-content: flex-start;
  246. }
  247. .titlev {
  248. width: 100%;
  249. height: 60rpx;
  250. line-height: 60rpx;
  251. font-size: 36rpx;
  252. font-weight: bold;
  253. text-align: left;
  254. }
  255. .yzmctV {
  256. display: flex;
  257. flex-direction: row;
  258. align-items: center;
  259. justify-content: flex-start;
  260. margin-top: 30rpx;
  261. width: 100%;
  262. }
  263. .noinputV {
  264. width: 73%;
  265. height: 80rpx;
  266. line-height: 80rpx;
  267. border-radius: 10rpx;
  268. border: 2rpx solid #F2F3F7;
  269. background-color: #F2F3F7;
  270. }
  271. .yzminputV {
  272. width: 73%;
  273. }
  274. .noinputVcode {
  275. width: 99%;
  276. height: 80rpx;
  277. line-height: 80rpx;
  278. border-radius: 10rpx;
  279. border: 2rpx solid #F2F3F7;
  280. background-color: #F2F3F7;
  281. }
  282. .yzmbt {
  283. color: white;
  284. font-size: 26rpx;
  285. width: 170rpx;
  286. height: 60rpx;
  287. line-height: 60rpx;
  288. text-align: center;
  289. margin-left: auto;
  290. margin-right: 10rpx;
  291. border-radius: 2rpx;
  292. background-color: #60BA63;
  293. }
  294. .querenBt {
  295. margin-top: 30rpx;
  296. width: 100%;
  297. height: 60rpx;
  298. line-height: 60rpx;
  299. padding: 10rpx;
  300. border-radius: 20rpx;
  301. border: solid #00A6FF;
  302. border-width: 0px 0px 6rpx 0px;
  303. text-align: center;
  304. justify-content: center;
  305. background-color: #00A6FF;
  306. color: white;
  307. box-shadow: 0rpx 0rpx 10rpx 0rpx #00A6FF;
  308. }
  309. .linktext {
  310. font-size: 24rpx;
  311. color: skyblue;
  312. text-decoration: underline;
  313. }
  314. .notetext {
  315. color: darkgray;
  316. font-size: 24rpx;
  317. text-align: center;
  318. }
  319. .xialakuangct {
  320. display: flex;
  321. flex-direction: row;
  322. align-items: center;
  323. justify-content: space-between;
  324. padding-left: 16rpx;
  325. margin-right: 20rpx;
  326. width: 140rpx;
  327. height: 80rpx;
  328. line-height: 80rpx;
  329. border-radius: 10rpx;
  330. border: 2rpx solid #F2F3F7;
  331. background-color: #F2F3F7;
  332. }
  333. .xialakuang {
  334. width: 100%;
  335. }
  336. .lineview {
  337. display: flex;
  338. flex-direction: row;
  339. align-items: center;
  340. justify-content: center;
  341. background-color: whitesmoke;
  342. border: solid darkgray;
  343. border-width: 0px 0px 1rpx 0px;
  344. width: 80%;
  345. margin-bottom: 12rpx;
  346. }
  347. .picker-view {
  348. width: 750rpx;
  349. height: 300rpx;
  350. margin-top: 10rpx;
  351. }
  352. .item {
  353. line-height: 100rpx;
  354. text-align: center;
  355. }
  356. .duoyuyanctv {
  357. margin-top: 20rpx;
  358. padding: 30rpx;
  359. border: solid lavender;
  360. border-width: 0px 0px 1rpx 0px;
  361. }
  362. .duoyuyIcon {
  363. width: 40rpx;
  364. height: 40rpx;
  365. }
  366. </style>