123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334 |
- <template>
- <view class="page">
- <view class="header">
- <view class="left">
- <!-- <image class="img" mode="widthFix" src="../../static/login/close.png"></image> -->
- </view>
- </view>
- <view class="tbody">
- <view>
- <image class="img" mode="widthFix" src="../../static/logo.png"></image>
- </view>
- <!-- <view class="name">昵称:</view>
- <view class="item">
- <input type="text" class="input" v-model="nickname" maxlength="30" placeholder="请输入您的昵称" />
- </view> -->
- <view class="name">手机号码:</view>
- <view class="item">
- <input type="text" class="input" v-model="mobile" maxlength="11" placeholder="请输入手机号码" />
- </view>
- <view class="name">验证码:</view>
- <view class="item">
- <input type="text" class="input" v-model="code" maxlength="6" placeholder="请输入验证码" />
- <view class="btn" v-if="captchaTime === 0" @click="getCode">获取验证码</view>
- <view class="btn" v-if="captchaTime > 0">{{captchaTime}}秒后重试</view>
- </view>
- <view class="name">登录密码:</view>
- <view class="item">
- <input type="password" class="input" v-model="password" maxlength="50" placeholder="请输入登录密码" />
- </view>
- <view class="name">确认密码:</view>
- <view class="item">
- <input type="password" class="input" v-model="password2" maxlength="50" placeholder="请再次输入登录密码" />
- </view>
- <view class="other_list">
- <text class="left" v-if="false">忘记密码</text>
- <text class="left" v-else></text>
- <text class="right" @click="goPage('/pages/login/login')">已有账号?去登录</text>
- </view>
- <view class="agree">
- <view class="agree2" @click="agreeChk()">
- <image mode="widthFix" src="../../static/login/sel_no.png" v-if="is_agree == 0"></image>
- <image mode="widthFix" src="../../static/login/sel_yes.png" v-if="is_agree == 1"></image>
- <text>我已阅读并同意</text>
- </view>
- 《
- <text class="xy" @click="goPage('yhxy')">
- 隐私协议
- </text>
- 》和《
- <text class="xy" @click="goPage('yszc')">
- 用户使用协议
- </text>
- 》
- </view>
- <text class="btn_submit" @click="toReg">注册</text>
- </view>
- <view class="blankHeight"></view>
- <!-- 提示框 -->
- <DialogBox ref="DialogBox"></DialogBox>
- </view>
- </template>
- <script>
- import pubc from '@/common/public.js'
- export default {
- components: {},
- data() {
- return {
- title: '',
- sel: 1,
- is_agree: 0,
- mobile: '',
- password: '',
- password2: '',
- code: '',
- ycode: '',
- nickname: '',
- captchaTime: 0,
- is_web3: 0,
- push_token: '',
- lat: '',
- lng: '',
- }
- },
- onLoad(params) {
- this.ycode = params.ycode || '111111';
- this.is_web3 = this.$isWeb3;
- setTimeout(function() {
- uni.setNavigationBarColor({
- frontColor: '#ffffff',
- backgroundColor: '#00000000',
- animation: {
- duration: 400,
- timingFunc: 'easeIn'
- }
- })
- }, 200);
- let that = this;
- // #ifdef APP-PLUS
- uni.getPushClientId({
- success: (res) => {
- console.log("su:", res.cid);
- that.push_token = res.cid;
- },
- fail(err) {
- that.push_token = '';
- console.log(err)
- }
- });
- // #endif
- },
- onShow() {
- let that = this;
- // #ifdef APP-PLUS
- // uni.getLocation({
- // type: 'wgs84',
- // success: function(res) {
- // that.lat = res.latitude;
- // that.lng = res.longitude;
- // },
- // fail: function(error) {
- // console.error('获取位置失败:', error);
- // }
- // });
- // #endif
- },
- methods: {
- onBack() {},
- agreeChk() {
- if (this.is_agree == 0) {
- this.is_agree = 1;
- } else {
- this.is_agree = 0;
- }
- },
- getCodeTime() {
- this.captchaTime = 60;
- let timer = setInterval(() => {
- this.captchaTime--;
- // console.log(this.captchaTime)
- if (this.captchaTime < 1) {
- clearInterval(timer);
- this.captchaTime = 0
- }
- }, 1000)
- },
- getCode() {
- if (this.mobile.length != 11) {
- uni.showToast({
- title: '请输入手机号',
- icon: 'none'
- });
- return;
- }
- if (this.captchaTime > 0) {
- uni.showToast({
- title: '不能重复获取',
- icon: 'none'
- });
- return;
- }
- this.captchaTime = 60;
- uni.request({
- url: this.$apiHost + '/Web/getcode', //仅为示例,并非真实接口地址。
- data: {
- skey: this.skey,
- mobile: this.mobile,
- },
- header: {
- 'content-type': 'application/json' //自定义请求头信息
- },
- success: (res) => {
- console.log("----", res.data)
- uni.showToast({
- title: res.data.str,
- icon: 'none'
- })
- if (res.data.success == 'yes') {
- this.getCodeTime();
- } else {
- this.captchaTime = 0;
- }
- }
- });
- },
- goPage(page) {
- if (page == 'yhxy') {
- uni.navigateTo({
- url: '/pages/AboutUs/yhxy'
- })
- } else if (page == 'yszc') {
- uni.navigateTo({
- url: '/pages/AboutUs/yszc'
- })
- } else {
- uni.navigateTo({
- url: page,
- });
- }
- },
- toReg() {
- if (this.is_agree == 0) {
- uni.showToast({
- title: "请确认并选择协议",
- icon: "none",
- });
- return;
- }
- if (this.mobile.length != 11) {
- uni.showToast({
- title: "请输入手机号",
- icon: "none",
- });
- return;
- }
- if (this.password.length < 6) {
- uni.showToast({
- title: "请输入不小于6位的密码",
- icon: "none",
- });
- return;
- }
- if (this.password != this.password2) {
- uni.showToast({
- title: "两次输入密码不一致",
- icon: "none",
- });
- return;
- }
- if (this.code.length < 4) {
- uni.showToast({
- title: "请输入手机验证码",
- icon: "none",
- });
- return;
- }
- let method = '/Web/reg';
- uni.showLoading({
- mask: true,
- });
- console.log("host", this.$apiHost + method);
- uni.request({
- url: this.$apiHost + method, //仅为示例,并非真实接口地址。
- data: {
- uuid: getApp().globalData.uuid,
- // nickname: this.nickname,
- mobile: this.mobile,
- password: this.password,
- ycode: this.ycode,
- code: this.code,
- is_web3: this.is_web3,
- push_token: this.push_token,
- lat: this.lat,
- lng: this.lng,
- },
- header: {
- "content-type": "application/json"
- },
- success: (res) => {
- console.log("----", res.data);
- if (res.data.success == "yes") {
- // #ifdef APP-PLUS
- uni.setStorageSync("wapptoken", res.data.skey);
- getApp().globalData.skey = res.data.skey;
- if (res.data.header_c != "") {
- getApp().globalData.headerSign = pubc.Encrypt(res.data.header_c + "_" +
- getApp().globalData.uuid);
- uni.setStorageSync("headerSign", getApp().globalData.headerSign);
- }
- getApp().globalData.headerC = res.data.header_c;
- uni.redirectTo({
- url: '/pages/my/step'
- });
- // uni.switchTab({
- // url: "/pages/index/index",
- // });
- // #endif
- // #ifdef H5
- uni.showToast({
- title: res.data.str,
- icon: "none",
- });
- setTimeout(function() {
- uni.navigateTo({
- url: '/pages/login/down'
- })
- }, 1000);
- // #endif
- // setTimeout(function() {}, 1500);
- // console.log("res.data", res.data);
- // uni.setStorageSync("wapptoken", res.data.skey);
- // getApp().globalData.skey = res.data.skey;
- // uni.switchTab({
- // url: "/pages/index/home",
- // });
- } else if (res.data.success == "no") {
- uni.showToast({
- title: res.data.str,
- icon: "none",
- });
- } else {
- uni.showToast({
- title: "操作失败,请联系客服",
- icon: "none",
- });
- }
- },
- complete: (com) => {
- uni.hideLoading();
- },
- });
- },
- }
- }
- </script>
- <style scoped lang="scss">
- @import 'reg.scss';
- </style>
|