| | |
| | | }; |
| | | |
| | | //åéçä¿¡éªè¯ç |
| | | export const loginVerifyMessage = async (params) => { |
| | | export const loginVerifyMessage = async (params,extraData={}) => { |
| | | return http.request({ |
| | | url: TEL_LOGIN_URL, |
| | | method: 'POST', |
| | |
| | | headers: { |
| | | 'Content-Type': 'application/x-www-form-urlencoded', |
| | | }, |
| | | ...extraData |
| | | }); |
| | | }; |
| | | |
| | | //åéçä¿¡éªè¯ç ç»å½ |
| | | export const loginMessageUser = async (params) => { |
| | | export const loginMessageUser = async (params,extraData={}) => { |
| | | return http.request({ |
| | | url: Get_LOGIN_SMS, |
| | | method: 'POST', |
| | |
| | | headers: { |
| | | 'Content-Type': 'application/x-www-form-urlencoded', |
| | | }, |
| | | ...extraData |
| | | }); |
| | | }; |
| | |
| | | address: {}, |
| | | // å½åç¹å»ç sectionAId |
| | | sectionAId:'', |
| | | sectionB:null |
| | | sectionB:null, |
| | | user:{ |
| | | phoneNum:'', |
| | | } |
| | | }, |
| | | |
| | | onShow() { |
| | |
| | | // 导å
¥æ¬å°åå¨ api |
| | | import { setStorage } from '@/utils/storage' |
| | | // 导å
¥æ¥å£ API 彿° |
| | | import { PostLogin } from '@/api/account'; |
| | | import { loginMessageUser, loginVerifyMessage, PostLogin } from '@/api/account'; |
| | | // 导å
¥ ComponentWithStore æ¹æ³ |
| | | import { ComponentWithStore } from 'mobx-miniprogram-bindings' |
| | | // 导å
¥ store 对象 |
| | | import { accountStore } from '@/stores/accountStore' |
| | | |
| | | import {STATIC_FILE_BASE_URL} from '@/config/constants' |
| | | |
| | | import { STATIC_FILE_BASE_URL } from '@/config/constants' |
| | | import { verifyPhone } from '@/utils/toolsValidate'; |
| | | const app = getApp(); |
| | | // ä½¿ç¨ ComponentWithStore æ¹æ³æ¿æ¢ Component æ¹æ³æé é¡µé¢ |
| | | ComponentWithStore({ |
| | | // 让页é¢å Store 对象建ç«å
³è |
| | |
| | | }, |
| | | data: { |
| | | activeTab: 'account', |
| | | user: 'tc', |
| | | password: 'a', |
| | | STATIC_FILE_BASE_URL |
| | | user: '', |
| | | password: '', |
| | | STATIC_FILE_BASE_URL, |
| | | countNum: null, |
| | | countTimer: null, |
| | | phoneNumber: '', |
| | | verifyCode: '', |
| | | }, |
| | | lifetimes: { |
| | | attached() { |
| | | wx.hideHomeButton(); |
| | | }, |
| | | |
| | | }, |
| | | pageLifetimes: { |
| | | hide() { |
| | | this.resetContent(); |
| | | } |
| | | }, |
| | | |
| | | methods: { |
| | | |
| | | resetContent() { |
| | | switch (this.data.activeTab) { |
| | | case 'account': |
| | | this.setData({ |
| | | user: '', |
| | | password: '', |
| | | }) |
| | | break; |
| | | case 'cellPhoneNumber': |
| | | this.setData({ |
| | | phoneNumber: '', |
| | | verifyCode: '', |
| | | }) |
| | | this.stopCount(); |
| | | this.setData({ |
| | | countNum: null |
| | | }) |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | }, |
| | | tabChange: function (event) { |
| | | this.setData({ |
| | | activeTab: event.detail.name |
| | | }) |
| | | |
| | | this.resetContent(); |
| | | }, |
| | | async getSMSClick() { |
| | | if (this.data.countNum !== null) { |
| | | return; |
| | | } |
| | | if (!this.data.phoneNumber) { |
| | | toast({ |
| | | title: '请è¾å
¥ææºå·ç ï¼' |
| | | }); |
| | | return; |
| | | } |
| | | console.log(this.data.phoneNumber); |
| | | const isValid = verifyPhone(this.data.phoneNumber) |
| | | console.log(isValid); |
| | | |
| | | if (!isValid) { |
| | | toast({ |
| | | title: '请è¾å
¥æ£ç¡®çææºå·ç ï¼' |
| | | }); |
| | | return; |
| | | } |
| | | this.setData({ |
| | | verifyCode: '' |
| | | }) |
| | | const res = await loginVerifyMessage({ |
| | | phone: this.data.phoneNumber |
| | | },{ |
| | | noAuth: true |
| | | }) |
| | | |
| | | if (!res?.json_ok) { |
| | | return; |
| | | } |
| | | this.startCount(); |
| | | }, |
| | | stopCount() { |
| | | clearInterval(this.data.countTimer) |
| | | }, |
| | | |
| | | startCount() { |
| | | this.stopCount(); |
| | | this.setData({ |
| | | countNum: 60 |
| | | }) |
| | | this.data.countTimer = setInterval(() => { |
| | | if (this.data.countNum === 0) { |
| | | this.setData({ |
| | | countNum: null |
| | | }) |
| | | clearInterval(this.data.countTimer); |
| | | return; |
| | | } |
| | | this.setData({ |
| | | countNum: this.data.countNum - 1 |
| | | }) |
| | | }, 1000); |
| | | }, |
| | | |
| | | handlePhoneNumName(phoneStr){ |
| | | return phoneStr.substr(0,3)+"****"+phoneStr.substr(7); |
| | | }, |
| | | |
| | | // ææç»å½ |
| | | login: wx.$_.debounce(async function () { |
| | | |
| | |
| | | }, { |
| | | noAuth: true |
| | | }); |
| | | if (!res.json_ok || !res.hswatersession) { |
| | | toast({ |
| | | title: res.json_msg |
| | | }) |
| | | return; |
| | | } |
| | | setStorage('username', this.data.user); |
| | | this.setUsername(this.data.user); |
| | | app.globalData.user.phoneNum = ''; |
| | | |
| | | break; |
| | | case 'cellPhoneNumber': |
| | | |
| | | if (!this.data.phoneNumber) { |
| | | toast({ |
| | | title: '请è¾å
¥ææºå·ç ï¼' |
| | | }); |
| | | return; |
| | | } |
| | | if (!verifyPhone(this.data.phoneNumber)) { |
| | | toast({ |
| | | title: '请è¾å
¥æ£ç¡®çææºå·ç ï¼' |
| | | }); |
| | | return; |
| | | } |
| | | if (!this.data.verifyCode) { |
| | | toast({ |
| | | title: '请è¾å
¥éªè¯ç ï¼' |
| | | }); |
| | | return; |
| | | } |
| | | res = await loginMessageUser({ |
| | | phone: this.data.phoneNumber, |
| | | code: this.data.verifyCode, |
| | | }, { |
| | | noAuth: true |
| | | }); |
| | | const phoneName = this.handlePhoneNumName(this.data.phoneNumber) |
| | | setStorage('username',phoneName); |
| | | this.setUsername(phoneName); |
| | | app.globalData.user.phoneNum = this.data.phoneNumber; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | if (!res.json_ok || !res.hswatersession) { |
| | | toast({ |
| | | title: res.json_msg |
| | | }) |
| | | return; |
| | | } |
| | | setStorage('session', res.hswatersession); |
| | | this.setSession(res.hswatersession) |
| | | setStorage('username', this.data.user); |
| | | this.setUsername(this.data.user); |
| | | |
| | | wx.switchTab({ |
| | | url: '/pages/question/question' |
| | | }); |
| | |
| | | <van-tab name="account" title="è´¦å·ç»å½"> |
| | | <van-cell-group> |
| | | <van-field model:value="{{ user }}" placeholder="è´¦å·" /> |
| | | <van-field model:value="{{ password }}" placeholder="å¯ç " border="{{ false }}" /> |
| | | <van-field model:value="{{ password }}" placeholder="å¯ç " type="password" border="{{ false }}" /> |
| | | </van-cell-group> |
| | | </van-tab> |
| | | <van-tab name="cellPhoneNumber" title="éªè¯ç ç»å½"> |
| | | <van-cell-group> |
| | | <van-field value="{{ user }}" placeholder="ææºå·ç "> |
| | | <text slot="button" class="sms-send-btn font-bold font23">è·åéªè¯ç </text> |
| | | <van-field model:value="{{ phoneNumber }}" placeholder="ææºå·ç "> |
| | | <text wx:if="{{countNum===null}}" slot="button" class="sms-send-btn font-bold font23" bind:tap="getSMSClick">è·åéªè¯ç </text> |
| | | |
| | | <text wx:else slot="button" class="sms-send-btn font-bold font23 text-gray-300" >{{countNum+'ç§åéè¯'}}</text> |
| | | |
| | | |
| | | </van-field> |
| | | <van-field value="{{ sms }}" center clearable label="" placeholder="请è¾å
¥çä¿¡éªè¯ç " use-button-slot> |
| | | <van-field model:value="{{ verifyCode }}" center clearable label="" placeholder="请è¾å
¥çä¿¡éªè¯ç " use-button-slot> |
| | | |
| | | </van-field> |
| | | </van-cell-group> |
| | |
| | | import { clearStorage } from "@/utils/storage" |
| | | |
| | | import { clearStorage,getStorage } from "@/utils/storage" |
| | | const app = getApp(); |
| | | // pages/my/my.ts |
| | | Component({ |
| | | |
| | |
| | | * 页é¢çåå§æ°æ® |
| | | */ |
| | | data: { |
| | | |
| | | userName:getStorage('username'), |
| | | phoneNumber: app.globalData.user.phoneNum |
| | | }, |
| | | methods:{ |
| | | logout(){ |
| | |
| | | <view> |
| | | <view class="flex-items-center"> |
| | | <text class="ywicon icon-morentouxiang bg-gray-300 rounded-full text-gray-500 mr-20" style="font-size: 73rpx;"></text> |
| | | <text class="font25 font-bold">183799|å
è´¹ç¨æ·</text> |
| | | <text class="font25 font-bold">{{userName}}</text> |
| | | </view> |
| | | <fui-list marginTop="40"> |
| | | <fui-list-cell highlight="{{false}}">è´¦å·å |
| | | |
| | | <text class="text-gray-400">u645782</text> |
| | | <text class="text-gray-400">{{userName}}</text> |
| | | |
| | | </fui-list-cell> |
| | | <fui-list-cell arrow> |
| | | <!-- <fui-list-cell arrow> |
| | | <text>ä¿®æ¹å¯ç </text> |
| | | </fui-list-cell> |
| | | </fui-list-cell> --> |
| | | <fui-list-cell> |
| | | <text>ææºå·</text> |
| | | <text class="text-gray-400">æªç»å®</text> |
| | | <text class="text-gray-400">{{phoneNumber || 'æªç»å®'}}</text> |
| | | </fui-list-cell> |
| | | <fui-list-cell arrow> |
| | | <!-- <fui-list-cell arrow> |
| | | <text>ä½¿ç¨æµè§å¨ç»å½</text> |
| | | </fui-list-cell> |
| | | </fui-list-cell> --> |
| | | <!-- <fui-list-cell arrow> |
| | | <text>åæ¢è´¦å·å¯ç ç»å½</text> |
| | | </fui-list-cell> --> |
| | |
| | | import { ErrorCode } from "@/utils/http"; |
| | | import { ComponentWithComputed, } from "miniprogram-computed"; |
| | | import { uuid } from "@/utils/uuid"; |
| | | import { getStorage } from "@/utils/storage"; |
| | | |
| | | const app = getApp(); |
| | | // pages/question/question.js |
| | |
| | | displaySampleList: [], |
| | | section_a_id: '', |
| | | sample_id: '', |
| | | }, |
| | | userName:getStorage('username'), |
| | | |
| | | }, |
| | | onClickClear(){ |
| | | console.log('clear'); |
| | | |
| | | this.setData({ |
| | | sendText:'' |
| | | }) |
| | | }, |
| | | async getSampleList() { |
| | | const res = await getSelectSample({ |
| | | section_b_id: '', |
| | |
| | | {{item.sample_title}} |
| | | </view> |
| | | </view> |
| | | <view class="w-300 ml-auto mr-auto mt-30 text-white font28 py-18" style="text-align: center;background: linear-gradient(to right,#37d0e0,#5988e0);border-radius: 300rpx"> |
| | | <!-- <view class="w-300 ml-auto mr-auto mt-30 text-white font28 py-18" style="text-align: center;background: linear-gradient(to right,#37d0e0,#5988e0);border-radius: 300rpx"> |
| | | <text class="ywicon icon-maikefeng"></text> |
| | | å¼å¯è¯é³å¯¹è¯å§~ |
| | | </view> |
| | | </view> --> |
| | | </view> |
| | | </block> |
| | | <block wx:else> |
| | |
| | | </scroll-view> |
| | | </view> |
| | | <view class="flex-0 flex-items-center py-20" style="background-color: #f4f6f8;"> |
| | | <text class="font46 ywicon icon-fenxiang flex-0 mx-15"></text> |
| | | <van-field left-icon="replay" custom-class="py-3 flex-items-center van-field" input-class="ml-10" type="textarea" autosize placeholder="å¨è¿éè¾å
¥ä½ çé®é¢" class="flex-auto" model:value="{{sendText}}" bind:change="onSendTextChange" size="large"></van-field> |
| | | <text class="font45 ywicon {{!sendText? 'icon-dianhua1':'icon-fasongxiaoxi'}} flex-0 mx-15" bind:tap="inputRighBtnClick"></text> |
| | | <!-- <text class="font46 ywicon icon-fenxiang flex-0 mx-15"></text> --> |
| | | <text class="font46 flex-0 mx-15"></text> |
| | | <van-field icon="cross" bind:click-icon="onClickClear" custom-class="py-3 flex-items-center van-field" input-class="ml-10" type="textarea" autosize placeholder="å¨è¿éè¾å
¥ä½ çé®é¢" class="flex-auto" model:value="{{sendText}}" bind:change="onSendTextChange" size="large"></van-field> |
| | | <!-- <text class="font45 ywicon {{!sendText? 'icon-dianhua1':'icon-fasongxiaoxi'}} flex-0 mx-15" bind:tap="inputRighBtnClick"></text> --> |
| | | <text class="font45 ywicon {{!sendText? 'icon-fasongxiaoxi':'icon-fasongxiaoxi'}} flex-0 mx-15" bind:tap="inputRighBtnClick"></text> |
| | | </view> |
| | | <fui-drawer model:show="{{drawerIsShow}}" direction="left"> |
| | | <view class="w-450 flex flex-col relative h-full" > |
| | |
| | | <view class="p-15 flex flex-col justify-between" style="background-color: #e8f0fd;"> |
| | | <view class="flex-items-center"> |
| | | <text class="ywicon icon-morentouxiang bg-gray-300 rounded-full font60 text-gray-500 mr-20"></text> |
| | | <text class="font25 font-bold">183799|å
è´¹ç¨æ·</text> |
| | | <text class="font25 font-bold">{{userName}}</text> |
| | | </view> |
| | | <view class="flex-items-center justify-between mt-20"> |
| | | <van-button class="" color="#000000" custom-style="font-size:20rpx;height:50rpx" round size="small" icon="plus" bind:tap="newChatRoomClick">æ°å»ºè天室</van-button> |
| | |
| | | <text class="ywicon icon-{{iconList[index]}} text-blue-600 font55"></text> |
| | | <!-- <image src="/assets/scene/scene_2.png"></image> --> |
| | | <text class="font-bold font32 my-7">{{item.section_name}}</text> |
| | | <text class="font26 overflow-hidden multi-over-ellisis" style="-webkit-line-clamp: 3;">{{item.section_title}}</text> |
| | | <text class="font26 overflow-hidden over-ellisis-3" style="-webkit-line-clamp: 3;">{{item.section_title}}</text> |
| | | </view> |
| | | </view> |
| | | </block> |
| | |
| | | }, {}) as Record<string, T | T[]>; |
| | | |
| | | return result; |
| | | }; |
| | | }; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | /** |
| | | * ææºå·ç |
| | | * @param val å½åå¼å符串 |
| | | * @returns è¿å true: ææºå·ç æ£ç¡® |
| | | */ |
| | | export function verifyPhone(val: string) { |
| | | // false: ææºå·ç 䏿£ç¡® |
| | | // if (!/^((12[0-9])|(13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0|1,5-9]))\d{8}$/.test(val)) return false; |
| | | if (!/^1[3456789]\d{9}$/.test(val)) return false; |
| | | |
| | | // true: ææºå·ç æ£ç¡® |
| | | else return true; |
| | | } |