资料编辑,昵称编辑

msb_beta
ch 4 years ago
parent b375a78167
commit 8797381ba2

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2019-04-01 01:47:12 * @Date: 2019-04-01 01:47:12
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-03-26 18:12:32 * @LastEditTime: 2022-03-28 16:44:23
* @Description: file content * @Description: file content
--> -->
<script> <script>
@ -25,7 +25,7 @@
<style lang="scss"> <style lang="scss">
/* 注意要写在第一行同时给style标签加入lang="scss"属性 */ /* 注意要写在第一行同时给style标签加入lang="scss"属性 */
@import "uview-ui/index.scss"; @import "uview-ui/index.scss";
*{ // *{
font-family: 'PingFang SC-中粗体, PingFang SC'; // font-family: 'PingFang SC-, PingFang SC';
} // }
</style> </style>

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-03-17 16:37:45 * @Date: 2022-03-17 16:37:45
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-03-22 17:25:29 * @LastEditTime: 2022-03-28 10:16:31
* @Description: file content * @Description: file content
*/ */
@ -12,8 +12,19 @@ import {Request, ToAsyncAwait} from '@/common/utils';
* 获取测试信息 * 获取测试信息
* @param {*} params * @param {*} params
*/ */
export const ApiGetBannerData = (params) => const ApiGetBannerData = (params) =>
ToAsyncAwait(Request.get('/edu-course/carousel/app',params)); ToAsyncAwait(Request.get('/edu-course/carousel/app',params));
const ApiPostLogin = (data) => ToAsyncAwait(Request.post('/user/login'), data);
const ApiGetCode = (params) => ToAsyncAwait(Request.get('/user/login/verificationCode'), params);
export {
ApiGetBannerData,
// 登录
ApiPostLogin,
// 获取短信验证码
ApiGetCode
}

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-03-17 16:36:59 * @Date: 2022-03-17 16:36:59
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-03-18 16:05:47 * @LastEditTime: 2022-03-28 10:47:00
* @Description: 针对uniapp request请求做了一次封装使用思维参考axios * @Description: 针对uniapp request请求做了一次封装使用思维参考axios
* *
* *
@ -63,7 +63,11 @@ class MsbUniRequest {
} }
return new Promise((resolve, reject)=>{ return new Promise((resolve, reject)=>{
uni.request(option).then(response => { uni.request(option).then(response => {
if(response.statusCode >= 200 && response.statusCode < 400){
resolve(this.hook.success ? this.hook.success(response[1]) : response); resolve(this.hook.success ? this.hook.success(response[1]) : response);
return false;
}
reject(this.hook.error ? this.hook.error(response[1]) : response);
}).catch(error => { }).catch(error => {
reject(this.hook.error ? this.hook.error(error) : error); reject(this.hook.error ? this.hook.error(error) : error);
}); });

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-03-22 18:28:52 * @Date: 2022-03-22 18:28:52
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-03-24 14:20:14 * @LastEditTime: 2022-03-28 11:11:18
* @Description: file content * @Description: file content
*/ */
import Vue from 'vue' import Vue from 'vue'
@ -11,10 +11,13 @@ import Vuex from 'vuex';
export default new Vuex.Store({ export default new Vuex.Store({
state : { state : {
token : uni.getStorageSync('tk') : ''
}, },
mutations:{ mutations:{
SET_TOKEN (state, token = ''){
state.token = token;
uni.setStorageSync('tk', token);
}
}, },
getters:{ getters:{

@ -2,14 +2,15 @@
* @Author: ch * @Author: ch
* @Date: 2022-03-17 17:42:32 * @Date: 2022-03-17 17:42:32
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-03-22 17:46:43 * @LastEditTime: 2022-03-28 10:50:37
* @Description: 项目接口请求统一处理器返回一个需要token和不需要token的请求封装方法 * @Description: 项目接口请求统一处理器返回一个需要token和不需要token的请求封装方法
*/ */
const { default: MsbUniRequest } = require("../plugins/msbUniRequest"); const { default: MsbUniRequest } = require("../plugins/msbUniRequest");
const ENV = 'test'; const ENV = 'test';
const BASE_URL = { const BASE_URL = {
'test' : 'http://39.103.236.147/api', // 'test' : 'http://39.103.236.147/api',
'test' : '',
'release' : '', 'release' : '',
'prod' : '' 'prod' : ''
}; };
@ -22,10 +23,10 @@ const successIntercept = (response) =>{
return result; return result;
} }
} }
return response.errMsg; return response;
} }
const errorIntercept = (error) =>{ const errorIntercept = (error) =>{
return {msg:error.errMsg,code:error.statusCode}
} }
// 不需要token的接口封装 // 不需要token的接口封装
const Request = new MsbUniRequest(); const Request = new MsbUniRequest();

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-03-20 16:45:27 * @Date: 2022-03-20 16:45:27
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-03-21 17:36:52 * @LastEditTime: 2022-03-28 16:17:12
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -122,6 +122,7 @@
&--title{ &--title{
font-size: 28rpx; font-size: 28rpx;
padding: 20rpx 20rpx; padding: 20rpx 20rpx;
line-height: 36rpx;
} }
&--pirce-box{ &--pirce-box{
padding:0 20rpx; padding:0 20rpx;

@ -0,0 +1,76 @@
<!--
* @Author: ch
* @Date: 2022-03-26 18:29:19
* @LastEditors: ch
* @LastEditTime: 2022-03-28 15:57:22
* @Description: file content
-->
<template>
<view class="uiCell" @click="$emit('click')">
<slot name="icon"></slot>
<view class="uiCell--left">
<text class="uiCell--title">{{title}}</text>
<text class="uiCell--label">{{label}}</text>
</view>
<slot name="value">
<text class="uiCell--value">{{value}}</text>
</slot>
<slot name="right-icon" v-if="rightIcon">
<image class="uiCell--rightIcon" src="@/static/common/arrow.png"/>
</slot>
</view>
</template>
<script>
export default {
props : {
title : {
type: String,
default : ''
},
label : {
type: String,
default : ''
},
value : {
type : String,
default : ''
},
rightIcon : {
type : Boolean,
default : true
}
}
}
</script>
<style lang="scss" scoped>
.uiCell{
min-height: 100rpx;
border-bottom: 1px solid #eee;
display: flex;
justify-content: space-between;
align-items: center;
background: #fff;
&--title{
color: #333;
font-size: 28rpx;
display: block;
}
&--label{
color: #999;
font-size: 24rpx;
display: block;
margin-top: 10rpx;
}
&--value{
flex: 1;
padding: 0 10rpx;
text-align: right;
font-size: 28rpx;
}
&--rightIcon{
width: 10rpx;
height: 20rpx;
margin-left: 18rpx;
}
}
</style>

@ -2,16 +2,14 @@
* @Author: ch * @Author: ch
* @Date: 2022-03-25 10:11:37 * @Date: 2022-03-25 10:11:37
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-03-25 10:36:12 * @LastEditTime: 2022-03-28 17:07:56
* @Description: file content * @Description: file content
--> -->
<template> <template>
<view class="header"> <view class="header">
<view class="header--title"> <image class="header--back" src="@/static/search/arrow.png" @click="$Router.back()"></image>
<image class="header--back" v-if="back" src="@/static/search/arrow.png" @click="$Router.back()"></image>
<slot name="title">{{title}}</slot>
</view>
<slot name="custom"> <slot name="custom">
<text class="header--title">{{title}}</text>
<view class="header--operation"> <view class="header--operation">
<slot name="operation"></slot> <slot name="operation"></slot>
</view> </view>
@ -21,10 +19,6 @@
<script> <script>
export default { export default {
props : { props : {
back : {
type : Boolean,
default : true
},
title : { title : {
type : String, type : String,
default : '' default : ''
@ -49,8 +43,14 @@ export default {
margin-right: 20rpx; margin-right: 20rpx;
} }
&--title{ &--title{
display: flex; flex: 1;
align-items: center; text-align: center;
font-size: 32rpx;
}
&--operation{
position: absolute;
right: 40rpx;
top: 0;
} }
} }

@ -72,6 +72,11 @@
"h5" : { "h5" : {
"router" : { "router" : {
"mode" : "history" "mode" : "history"
},
"devServer" : {
"proxy" : {
"/user/" : "http://192.168.31.102:4500/"
}
} }
} }
} }

@ -8,6 +8,14 @@
"backgroundColor" : "#69ADE5" "backgroundColor" : "#69ADE5"
} }
}, },
{
"path": "pages/login",
"aliasPath" : "/login",
"style": {
"navigationStyle" : "custom",
"navigationBarTitleText": "uni-app"
}
},
{ {
"path": "pages/sekill/index", "path": "pages/sekill/index",
"style": { "style": {
@ -58,7 +66,8 @@
} }
}, },
{ {
"path": "pages/account/login",
"path": "pages/account/cart",
"style": { "style": {
"navigationStyle" : "custom", "navigationStyle" : "custom",
"navigationBarTitleText": "uni-app" "navigationBarTitleText": "uni-app"
@ -66,15 +75,21 @@
}, },
{ {
"path": "pages/account/cart", "path": "pages/account/setting/index",
"style": {
"navigationBarTitleText": "uni-app"
}
},
{
"path": "pages/account/setting/setUserInfo",
"style": { "style": {
"navigationStyle" : "custom",
"navigationBarTitleText": "uni-app" "navigationBarTitleText": "uni-app"
} }
}, },
{ {
"path": "pages/account/setting", "path": "pages/account/setting/setName",
"style": { "style": {
"navigationStyle" : "custom", "navigationStyle" : "custom",
"navigationBarTitleText": "uni-app" "navigationBarTitleText": "uni-app"

@ -1,8 +1,9 @@
<!-- <!--
* @Author: ch * @Author
components: { UiCell },: ch
* @Date: 2019-08-22 19:41:20 * @Date: 2019-08-22 19:41:20
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-03-26 09:38:31 * @LastEditTime: 2022-03-28 17:12:48
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -11,9 +12,9 @@
<u-badge class="header--badge" max="99" :value="9"></u-badge> <u-badge class="header--badge" max="99" :value="9"></u-badge>
<image class="header--msg" src="@/static/account/xx.png" /> <image class="header--msg" src="@/static/account/xx.png" />
</view> </view>
<u-cell :isLink="true" arrow-direction="right" :clickable="false" title="昵称" label="第一个青春是上帝给的..." :border="false"> <UiCell title="昵称" label="第一个青春是上帝给的..." class="header--cell">
<image slot="icon" class="head-img" src="@/static/account/tx.png" shape="circle" /> <image slot="icon" class="head-img" src="@/static/account/tx.png" shape="circle" />
</u-cell> </UiCell>
<view class="order"> <view class="order">
<view class="order--title"> <view class="order--title">
<text>我的订单</text> <text>我的订单</text>
@ -38,23 +39,30 @@
</view> </view>
</view> </view>
<view class="cell"> <view class="cell">
<u-cell class="cell--item" :isLink="true" arrow-direction="right" title="退货/售后"> <UiCell title="退货/售后">
<image slot="icon" class="cell--icon" src="@/static/account/tk.png" shape="circle" /> <image slot="icon" class="cell--icon" src="@/static/account/tk.png" />
</u-cell> </UiCell>
<u-cell class="cell--item" :isLink="true" arrow-direction="right" title="收货地址"> <UiCell title="收货地址">
<image slot="icon" class="cell--icon" src="@/static/common/dz.png" shape="circle" /> <image slot="icon" class="cell--icon" src="@/static/common/dz.png" />
</u-cell> </UiCell>
<u-cell class="cell--item" :isLink="true" arrow-direction="right" title="联系客服"> <UiCell title="联系客服">
<image slot="icon" class="cell--icon" src="@/static/account/kf.png" shape="circle" /> <image slot="icon" class="cell--icon" src="@/static/account/kf.png" />
</u-cell> </UiCell>
<u-cell class="cell--item" :isLink="true" arrow-direction="right" title="设置"> <UiCell title="设置" class="cell--last" @click="$Router.push('/pages/account/setting/index')">
<image slot="icon" class="cell--icon" src="@/static/account/sz.png" shape="circle" /> <image slot="icon" class="cell--icon" src="@/static/account/sz.png" />
</u-cell> </UiCell>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import UiCell from '../../components/UiCell.vue';
export default {
components : { UiCell },
methods: {
}
}
</script> </script>
@ -80,6 +88,11 @@ page{
top: 10rpx; top: 10rpx;
z-index: 99; z-index: 99;
} }
&--cell{
border: 0;
padding: 0 40rpx;
background: none;
}
} }
.head-img{ .head-img{
width: 120rpx; width: 120rpx;
@ -139,7 +152,10 @@ page{
&--icon{ &--icon{
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
margin-right: 10rpx; margin: 0 10rpx;
}
&--last{
border: 0;
} }
} }
</style> </style>

@ -1,19 +0,0 @@
<!--
* @Author: ch
* @Date: 2022-03-22 15:09:06
* @LastEditors: ch
* @LastEditTime: 2022-03-22 16:19:06
* @Description: file content
-->
<template>
<view>
<u-cell :isLink="true" arrow-direction="right" label="昵称">
<u-image slot="icon" shape="circle" width="100rpx" height="100rpx" ></u-image>
</u-cell>
<u-cell label="我的收货地址" :isLink="true" rightIcon="arrow-right"></u-cell>
<u-cell label="版本号" value="1.0.0"></u-cell>
<u-button type="primary" text="退出登录"></u-button>
</view>
</template>
<style lang="scss" scoped>
</style>

@ -0,0 +1,66 @@
<!--
* @Author: ch
* @Date: 2022-03-22 15:09:06
* @LastEditors: ch
* @LastEditTime: 2022-03-28 17:12:14
* @Description: file content
-->
<template>
<view>
<UiCell class="userInfo cell" title="昵称" @click="$Router.push('/pages/account/setting/setUserInfo')">
<image slot="icon" class="userInfo--head" src="@/static/account/tx.png" ></image>
</UiCell>
<UiCell class="cell" title="我的收货地址"></UiCell>
<UiCell class="cell" title="关于我们" ></UiCell>
<UiCell class="cell cell--last" title="版本号" value="1.0.0" valueClass="cell--value" :rightIcon="false"></UiCell>
<view class="logout">退出登录</view>
</view>
</template>
<script>
import UiButton from '@/components/UiButton.vue'
import UiCell from '@/components/UiCell.vue'
export default {
components: { UiCell, UiButton },
}
</script>
<style lang="scss" scoped>
page{
background: #f8f8f8;
}
.userInfo{
margin: 20rpx 0;
border: 0;
height: 200rpx;
&--head{
width: 120rpx;
height: 120rpx;
border-radius: 50%;
margin-right: 40rpx;
}
}
.cell{
padding: 0 40rpx;
&--last{
border: 0;
}
}
.logout{
height: 100rpx;
line-height: 100rpx;
text-align: center;
color: #999;
background: #fff;
margin: 20rpx 0;
font-size: 32rpx;
}
/deep/{
.userInfo .uiCell--title{
font-size: 32rpx;
}
.uiCell--value{
color: #999;
}
}
</style>

@ -0,0 +1,54 @@
<!--
* @Author: ch
* @Date: 2022-03-28 15:38:23
* @LastEditors: ch
* @LastEditTime: 2022-03-28 17:08:34
* @Description: file content
-->
<template>
<view>
<UiPageHeader title="设置昵称">
<view slot="operation" class="headerBtn">确定</view>
</UiPageHeader>
<u--input class="input" placeholder="请输入昵称" clearable ></u--input>
<view class="tips">
<text>请输入1-10个字符</text>
<text>(1/10)</text>
</view>
</view>
</template>
<script>
import UiButton from '@/components/UiButton.vue'
import UiCell from '@/components/UiCell.vue'
import UiPageHeader from '@/components/UiPageHeader.vue'
export default {
components: { UiCell, UiButton, UiPageHeader },
}
</script>
<style lang="scss" scoped>
page{
background: #f8f8f8;
}
.headerBtn{
height: 88rpx;
line-height: 88rpx;
font-size: 28rpx;
color: #FF875B;
}
.input{
padding: 20rpx 40rpx !important;
height: 60rpx;
background: #fff;
border: 0;
font-size: 28rpx;
color: #333;
}
.tips{
padding: 20rpx 40rpx;
font-size: 24rpx;
color: #999;
display: flex;
justify-content: space-between;
}
</style>

@ -0,0 +1,74 @@
<!--
* @Author: ch
* @Date: 2022-03-28 15:38:23
* @LastEditors: ch
* @LastEditTime: 2022-03-28 16:37:16
* @Description: file content
-->
<template>
<view>
<view class="userInfo">
<u-upload class="userInfo--upload" name="6" :fileList="fileList6" @afterRead="headUpload" >
<image class="userInfo--head" src="@/static/account/tx.png" ></image>
</u-upload>
<view>昵称</view>
</view>
<UiCell class="cell" title="昵称" value="马士兵" @click="$Router.push('/pages/account/setting/setName')"></UiCell>
<UiCell class="cell cell--last" title="性别" value="男" @click="sexShow = true"></UiCell>
<u-picker :show="sexShow" :columns="sexData" keyName="label" @cancel="sexShow = false" @confirm="sexChange"></u-picker>
</view>
</template>
<script>
import UiButton from '@/components/UiButton.vue'
import UiCell from '@/components/UiCell.vue'
export default {
components: { UiCell, UiButton },
data(){
return {
fileList: [],
sexShow : false,
sexData : [[{label:'女',val:0},{label:'男',val:1}]]
}
},
methods:{
sexChange(){
this.sexShow = false
},
headUpload(){
}
}
}
</script>
<style lang="scss" scoped>
page{
background: #f8f8f8;
}
.userInfo{
padding: 77rpx 0 60rpx;
text-align: center;
font-size: 28rpx;
color: #333;
&--head,&--upload{
width: 120rpx;
height: 120rpx;
border-radius: 50%;
margin: 0 auto 13rpx;
}
}
.cell{
padding: 0 40rpx;
&--last{
border: 0;
}
}
/deep/{
.userInfo .uiCell--title{
font-size: 32rpx;
}
.uiCell--value{
color: #999;
}
}
</style>

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-03-22 15:36:46 * @Date: 2022-03-22 15:36:46
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-03-24 18:05:59 * @LastEditTime: 2022-03-28 11:06:34
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -23,7 +23,7 @@
@click="getCode">{{tips}}</text> @click="getCode">{{tips}}</text>
</u-form-item> </u-form-item>
</u--form> </u--form>
<u-button class="login--btn" @click="login"></u-button> <UiButton class="login--btn" @click="login"></UiButton>
<label class="login--agreement"> <label class="login--agreement">
<radio class="radio" :checked="checked" @click="checked = !checked" color="#FF875B"/> <radio class="radio" :checked="checked" @click="checked = !checked" color="#FF875B"/>
同意<text class="link">用户协议</text><text class="link">隐私协议</text>,首次登陆将自动注册 同意<text class="link">用户协议</text><text class="link">隐私协议</text>,首次登陆将自动注册
@ -32,7 +32,10 @@
</template> </template>
<script> <script>
import { IsPhone } from '@/common/utils'; import { IsPhone } from '@/common/utils';
import { ApiGetCode, ApiPostLogin } from '@/common/api/index';
import UiButton from '../components/UiButton.vue';
export default { export default {
components: { UiButton },
data(){ data(){
return { return {
tips : '', tips : '',
@ -46,7 +49,7 @@ export default {
codeChange(text) { codeChange(text) {
this.tips = text; this.tips = text;
}, },
getCode() { async getCode() {
if(!this.$refs.uCode.canGetCode){ if(!this.$refs.uCode.canGetCode){
return false return false
} }
@ -54,20 +57,42 @@ export default {
uni.$u.toast('请输入正确手机号'); uni.$u.toast('请输入正确手机号');
return false return false
} }
//
uni.showLoading({ uni.showLoading({
title: '正在获取验证码' title: '正在获取验证码'
}) })
setTimeout(() => { const {error, resutl} = await ApiGetCode({phone: this.phone});
uni.hideLoading(); uni.hideLoading();
// this.start() if(error){
uni.$u.toast(error.msg);
return false;
}
uni.$u.toast('验证码已发送'); uni.$u.toast('验证码已发送');
//
this.$refs.uCode.start(); this.$refs.uCode.start();
}, 2000);
},
login(){
},
async login(){
if(!IsPhone(this.phone)){
uni.$u.toast('请输入正确手机号');
return false;
}
if(!this.code || this.code.length !== 6){
uni.$u.toast('请输入正确的验证码');
return false;
}
if(!this.checked){
uni.$u.toast('请勾选同意《用户协议》和《隐私协议》');
return false
}
const {error, resutl} = await ApiPostLogin({
phone : this.phone,
verificationCode : this.code,
source : 0
});
if(error){
uni.$u.toast(error.msg);
return false;
}
this.$Router.back();
} }
} }
} }
@ -111,11 +136,9 @@ export default {
&--btn{ &--btn{
width: 650rpx; width: 650rpx;
height: 88rpx; height: 88rpx;
border-radius: 45rpx; line-height: 88rpx;
font-size: 32rpx; font-size: 32rpx;
margin: 60rpx 50rpx 40rpx; margin: 60rpx 50rpx 40rpx;
color: #fff;
background: linear-gradient(270deg, #FF875B 0%, #FF512B 100%);
} }
&--agreement{ &--agreement{
width: 650rpx; width: 650rpx;
Loading…
Cancel
Save