Browse Source

no message

USER-20230908AJ\Administrator 1 năm trước cách đây
mục cha
commit
7e2197daff

+ 34 - 13
common/system_popup/system_popup.vue

@@ -31,7 +31,7 @@
 		<view class="system-button m-b50">
 			<view class="system-quit">
 			</view>
-			<view class="system-button button-text size-28 button-color sys-weight-600">
+			<view class="system-button button-text size-28 button-color sys-weight-600" @click="exitAccount">
 				退出登录
 			</view>
 		</view>
@@ -39,7 +39,9 @@
 </template>
 
 <script>
-	export default {
+	import {logout} from "@/api/user";
+
+  export default {
 		props: {
 			memberData: {
 				default: {
@@ -77,23 +79,42 @@
 		created() {
 			this.topNavHeight = getApp().globalData.topNavHeight
 		},
-		methods: {
+    mounted() {
+    },
+    methods: {
 			moveHandle() {
 				return false
 			},
+      exitAccount() {
+        uni.showModal({
+          title: '提示',
+          content: '是否退出当前账户?',
+          success: (res) => {
+            if (res.confirm) {
+              logout()
+              uni.clearStorageSync()
+              uni.reLaunch({
+                url: `/pages/login/index`
+              })
+            }
+          }
+        });
+      },
 			onGoSetting(item) {
-				if (item.id == 1) {
+				if (item.id === 1) {
 					return uni.navigateTo({
-						url: `/page_subpack/personal_details/personal_details?id=${item.id}&title=${item.name}`
-					})
-				} else {
-					uni.navigateTo({
-						url: `/pages/login/index`
+						url: `/page_subpack/personal_details/personal_details`
 					})
-				}
-				// uni.navigateTo({
-				// 	url: `/page_subpack/system_setting/system_setting?id=${item.id}&title=${item.name}`
-				// })
+				} else if(item.id===4){
+          // uni.navigateTo({
+          // 	url: `/page_subpack/system_setting/system_setting?id=${item.id}&title=${item.name}`
+          // })
+        }else {
+          uni.navigateTo({
+            url: `/page_subpack/system_setting/system_setting?id=${item.id}&title=${item.name}`
+          })
+        }
+
 			}
 		}
 	}

+ 25 - 4
page_subpack/personal_details/personal_details.vue

@@ -6,7 +6,7 @@
 					style="border-radius: 20rpx 20rpx 0 0;" hover-class="is-hovers">
 					<text class="size-28 text-color-666">头像</text>
 					<view class="row-c">
-						<image class="wh-80 r-100 m-r10" src="../../static/img/logo.png" mode=""></image>
+						<image class="wh-80 r-100 m-r10" :src="memberData.head_img" mode=""></image>
 						<uni-icons type="forward" size="20" color="#999999"></uni-icons>
 					</view>
 				</view>
@@ -14,7 +14,7 @@
 					@click="onSetMessage(4,'修改昵称')">
 					<text class="size-28 text-color-666">昵称</text>
 					<view class="row-c line-34">
-						<text class="text-color-12">团子</text>
+						<text class="text-color-12">{{memberData.nickname}}</text>
 						<uni-icons type="forward" size="16" color="#999999"></uni-icons>
 					</view>
 				</view>
@@ -22,7 +22,7 @@
 					@click="onSetMessage(5,'修改姓名')">
 					<text class="size-28 text-color-666">姓名</text>
 					<view class="row-c line-34">
-						<text class="text-color-12">张杰</text>
+						<text class="text-color-12">{{memberData.name}}</text>
 						<uni-icons type="forward" size="16" color="#999999"></uni-icons>
 					</view>
 				</view>
@@ -30,7 +30,7 @@
 					hover-class="is-hover_pass" @click="onSetMessage(3,'修改手机号')">
 					<text class="size-28 text-color-666">手机号</text>
 					<view class="row-c line-34">
-						<text class="text-color-12">123456797</text>
+						<text class="text-color-12">{{memberData.phone}}</text>
 						<uni-icons type="forward" size="16" color="#999999"></uni-icons>
 					</view>
 				</view>
@@ -51,6 +51,7 @@
 
 <script>
 	import EnInput from "@/components/en-from/en-input/index.vue";
+  import {getMemberInfo} from "@/api/user";
 
 	export default {
 		components: {
@@ -61,13 +62,33 @@
 				id: 0,
 				title: '',
 				phoneShake: false,
+        memberData:{
+          'head_img':"",
+          'name':"",
+          'nickname':"",
+          'phone':"",
+          'position_name':"",
+        }
 			}
 		},
 		onLoad(options) {
 			this.id = options.id
 			this.title = options.title
+      this.getMemberInfo()
+      uni.$on('updateMemberInfo',()=>{
+        this.getMemberInfo()
+      })
 		},
 		methods: {
+      getMemberInfo() {
+        getMemberInfo({
+          'type': 2
+        }).then((res) => {
+          if (res.code === 1) {
+            this.memberData = res.data;
+          }
+        })
+      },
 			onSubmit() {
 				this.phoneShake = true
 				setTimeout(() => {

+ 128 - 22
page_subpack/system_setting/system_setting.vue

@@ -2,46 +2,46 @@
 	<view class="total-page page-box">
 		<Nav :type="1" :genre="2" :title="title" :is_fixed="true">
 			<view class="sys-background-fff m-30 r-30 p-lr30">
-				<view class="from-animation animate__animated animate__fadeIn" v-if="id == 2">
+				<view class="from-animation animate__animated animate__fadeIn" v-if="id === 2">
 					<view class="p-tb30 bor-bottom-1 row-c" :class="{'apply-shake':phoneShake}">
 						<text class="size-28 sys-weight-400 input-text">原密码</text>
-						<en-input focus type="number" class="m-l30" placeholder="请输入原密码" v-model="loginData.phone"
+						<en-input focus type="password" class="m-l30" placeholder="请输入原密码" v-model="passData.old_password"
 							maxlength="11"></en-input>
 					</view>
 					<view class="p-tb30 row-c">
 						<text class="size-28 sys-weight-400 input-text">新密码</text>
 						<en-input type="password" class="m-l30" placeholder="请输入新密码"
-							v-model="loginData.password"></en-input>
+							v-model="passData.password"></en-input>
 					</view>
 					<view class="p-tb30 row-c">
 						<text class="size-28 sys-weight-400 input-text">确认密码</text>
 						<en-input type="password" class="m-l30" placeholder="请确认密码"
-							v-model="loginData.password"></en-input>
+							v-model="passData.pass_two"></en-input>
 					</view>
 				</view>
-				<view class="from-animation animate__animated animate__fadeIn" v-if="id == 3">
+				<view class="from-animation animate__animated animate__fadeIn" v-if="id === 3">
 					<view class="p-tb30 bor-bottom-1 row-c" :class="{'apply-shake':phoneShake}">
 						<text class="size-28 sys-weight-400">手机号</text>
-						<en-input focus type="number" class="m-l30" placeholder="请输入手机号" v-model="loginData.phone"
+						<en-input focus type="number" class="m-l30" placeholder="请输入手机号" v-model="memberData.phone"
 							maxlength="11"></en-input>
 					</view>
 					<view class="p-tb30 row-c">
 						<text class="size-28 sys-weight-400 p-r30">验证码</text>
 						<en-input type="password" class="flex" placeholder="验证码"
-							v-model="loginData.password"></en-input>
-						<view class="text-color-dominant sys-size-28 sys-weight-400" @click="getVerifiedCode">发送验证码
+							v-model="memberData.code"></en-input>
+						<view class="text-color-dominant sys-size-28 sys-weight-400" @click="getVerifiedCode" v-if="timeNum<=0">发送验证码
 						</view>
-						<!-- <view class="login-send text-color-dominant sys-size-28 sys-weight-400" v-else>s</view> -->
+						 <view class="login-send text-color-dominant sys-size-28 sys-weight-400" v-else>{{timeNum}} s</view>
 					</view>
 				</view>
-				<view class="p-tb30 row-c" :class="{'apply-shake':phoneShake}" v-if="id == 4">
+				<view class="p-tb30 row-c" :class="{'apply-shake':phoneShake}" v-if="id === 4">
 					<text class="size-28 sys-weight-400">昵称</text>
-					<en-input focus class="m-l30" placeholder="请输入昵称" v-model="loginData.phone"
+					<en-input focus class="m-l30" placeholder="请输入昵称" v-model="memberData.nickname"
 						maxlength="11"></en-input>
 				</view>
-				<view class="p-tb30 row-c" :class="{'apply-shake':phoneShake}" v-if="id == 5">
+				<view class="p-tb30 row-c" :class="{'apply-shake':phoneShake}" v-if="id === 5">
 					<text class="size-28 sys-weight-400">姓名</text>
-					<en-input focus class="m-l30" placeholder="请输入姓名" v-model="loginData.phone"
+					<en-input focus class="m-l30" placeholder="请输入姓名" v-model="memberData.name"
 						maxlength="11"></en-input>
 				</view>
 			</view>
@@ -52,6 +52,9 @@
 
 <script>
 	import EnInput from "@/components/en-from/en-input/index.vue";
+  import {getMemberInfo, setPassword, updateMemberInfo, updatePhone} from "@/api/user";
+  import tools from "@/service/tools";
+  import {commonSend} from "@/api/common";
 
 	export default {
 		components: {
@@ -60,26 +63,129 @@
 		data() {
 			return {
 				id: 0,
+        timeNum: 0,
 				title: '',
 				placeholder: '',
 				phoneShake: false,
-				loginData: {}
+        memberData:{
+          'head_img':"",
+          'name':"",
+          'nickname':"",
+          'phone':"",
+          'position_name':"",
+          code:'',
+        },
+        passData:{
+          old_password:'',
+          password:'',
+          pass_two:'',
+        },
 			}
 		},
 		onLoad(options) {
-			this.id = options.id
+			this.id = options.id*1
 			this.title = options.title
+      this.getMemberInfo()
 		},
 		methods: {
+      getMemberInfo() {
+        getMemberInfo({
+          'type': 2
+        }).then((res) => {
+          if (res.code === 1) {
+            this.memberData = res.data;
+          }
+        })
+      },
+      updateMemberInfo(){
+
+        updateMemberInfo(this.memberData).then((res)=>{
+          if(res.code===1){
+            tools.success('设置成功')
+            uni.$emit('updateMemberInfo')
+            setTimeout(()=>{
+             tools.leftClick()
+            },1500)
+          }else {
+            tools.error(res.msg)
+          }
+        })
+      },
 			onSubmit() {
-				this.phoneShake = true
-				setTimeout(() => {
-					this.phoneShake = false
-					this.passwordShake = false
-					this.codedShake = false
-				}, 500)
+				// this.phoneShake = true
+				// setTimeout(() => {
+				// 	this.phoneShake = false
+				// 	this.passwordShake = false
+				// 	this.codedShake = false
+				// }, 500)
+        if(this.id>=4){
+          this.updateMemberInfo()
+        }else if(this.id===3){
+          this.updatePhone()
+        }else {
+          this.setPassword()
+        }
 			},
-			getVerifiedCode() {}
+      setPassword(){
+        if(this.passData.password!==this.passData.pass_two){
+          tools.error('两次密码不一致')
+          return
+        }
+        setPassword(this.passData).then((res)=>{
+          if(res.code===1){
+            tools.success(res.msg)
+            setTimeout(()=>{
+              this.leftClick();
+            },1500)
+          }else {
+            tools.error(res.msg)
+          }
+        })
+      },
+      updatePhone(){
+        updatePhone(this.memberData).then((res)=>{
+          if(res.code===1){
+            tools.success(res.msg)
+            uni.$emit('updateMemberInfo')
+            setTimeout(()=>{
+              this.leftClick();
+            },1500)
+          }else {
+            tools.error(res.msg)
+          }
+        })
+      },
+			getVerifiedCode() {
+        if (this.timeNum > 0) {
+          return;
+        }
+        if (this.memberData.phone === '') {
+          tools.error("请输入手机号码")
+          return;
+        }
+        let regPhone = /^(?:(?:\+|00)86)?1\d{10}$/;
+        if (!regPhone.test(this.memberData.phone)) {
+          tools.error("手机号码格式错误")
+          return;
+        }
+        commonSend({
+          'phone': this.memberData.phone,
+          'send_type': 'retrieve'
+        }).then((res) => {
+          if (res.code === 1) {
+            tools.success(res.msg);
+            this.timeNum = 60;
+            this.timer = setInterval(() => {
+              this.timeNum--;
+              if (this.timeNum <= 0) {
+                clearInterval(this.timer);
+              }
+            }, 1000);
+          } else {
+            tools.error(res.msg);
+          }
+        })
+      }
 		}
 	}
 </script>