| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <template>
- <view class="wrap">
- <view class="h1">
- 员工们好!
- </view>
- <view class="h2">
- 欢迎使用员工APP
- </view>
- <view class="">
- <form @submit="formSubmit" @reset="formReset">
- <view class="uni-form-item uni-column">
- <view class="userName">
- <u-input v-model="value" type="number" :border='false' placeholder="请输入手机号码" />
- </view>
- <view class="uni-btn-v">
- <!-- <button form-type="submit">通过手机号登录</button> -->
- <u-button type="success" shape="circle" form-type="submit">通过手机号登录</u-button>
- <!-- <button type="default" form-type="reset">重置</button> -->
- </view>
- </view>
- </form>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- value: ""
- }
- },
- onBackPress(event) { //监听页面返回
- console.log(event)
- return true
- },
- methods: {
- async formSubmit() {
- uni.showLoading({
- title: '登录中...'
- });
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=back_source.production.operator_login',
- data: {
- mobile: this.value,
- }
- })
- console.log(res);
- uni.hideLoading();
- let session_key = res.session_key;
- uni.setStorageSync('session_key', session_key);
- uni.setStorageSync('is_login', 'true');
- uni.setStorageSync('user_name', this.value);
- //传给后端cid
- let pinf = plus.push.getClientInfo();
- let cid = pinf && pinf.clientid || ''; //客户端标识
- plus.push.getClientInfoAsync((info) => {
- cid = info.clientid;
- }, err => {});
- console.log(pinf)
- console.log(cid, 9999)
- console.log('cid', this.$store.state.cid);
- const res2 = await this.$myRequest({
- url: '/api/api_gateway?method=back_source.apppush.set_app_clientid',
- data: {
- client_id: cid,
- }
- })
- uni.redirectTo({
- url: '../index/index',
- fail: () => {
- console.log(111)
- },
- success: () => {
- console.log(222)
- }
- });
- },
- async postCid() {
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=back_source.apppush.set_app_clientid',
- data: {
- client_id: this.$store.state.cid,
- }
- })
- console.log(res)
- },
- formReset() {},
- }
- }
- </script>
- <style lang="scss">
- .wrap {
- padding: 200rpx 40rpx;
- .h1 {
- font-size: 60rpx;
- font-weight: 800;
- line-height: 100rpx;
- }
- .h2 {
- font-size: 50rpx;
- font-weight: 600;
- line-height: 90rpx;
- }
- .userName {
- margin: 50rpx 0;
- border-bottom: 1px solid #ddd;
- }
- }
- </style>
|