Browse Source

add tid1807 logic for mine

tid1867
刘嘉炜 4 months ago
parent
commit
012285f539
  1. 2
      src/App.vue
  2. 4
      src/js/api.js
  3. 3
      src/pages.json
  4. 110
      src/pages/menu/forth.vue
  5. 3
      src/pages/web_view/web_view.vue
  6. 36
      src/subpackage/menu/components/mine/header.vue
  7. 4
      src/subpackage/menu/components/mine/line_tab.vue

2
src/App.vue

@ -3,7 +3,7 @@
import util from './utils/util';
export default {
onLaunch: function() {
this.$store.commit('setLoginState', { loginState: false });
// this.$store.commit('setLoginState', { loginState: false });
this.updateManager();
},
methods: {

4
src/js/api.js

@ -167,5 +167,9 @@ API['party'] = {
bindingOpenId: `${ORIGIN}/assistant/bindingOpenId`, //改为小程序端绑定openid
}
API['mine'] = {
userCurrent:`${ORIGIN}/user/current`, //获取账户信息, (不要传品牌id)
}
export default { ORIGIN, API };

3
src/pages.json

@ -16,7 +16,8 @@
"componentPlaceholder": {
"mine-header": "view",
"bottom-logo": "view",
"line-tab": "view"
"line-tab": "view",
"authorization-login": "view"
}
}
},

110
src/pages/menu/forth.vue

@ -1,29 +1,49 @@
<template>
<view class="forth-menu">
<mine-header @on:munted="menuPackageLoaded = true"></mine-header>
<mine-header
@on:munted="menuPackageLoaded = true"
:is-login="loginState"
@click:login="loginBtn"
:nickname="userInfo.nickname"
:name="userInfo.actual_name"
:account="userInfo.mobile"
:photo="userInfo.avatar_url"
></mine-header>
<block v-if="menuPackageLoaded">
<line-tab :icon-num='0'>
<template slot="default">账号管理</template>
<template slot="right">
<view class="ft-account">
<view class="fc-name">账号名</view>
<view class="fc-name" v-if="loginState">{{ extension.brand_name || '-' }}</view>
<image class="fc-icon" mode="aspectFit" src="/static/images/icon/arrow_b2.png"></image>
</view>
</template>
</line-tab>
<line-tab :icon-num='1'>帮助中心</line-tab>
<line-tab :icon-num='2'>教练助手</line-tab>
<line-tab :icon-num='3'>
<template slot="default">收银系统</template>
<template slot="right">
<view class="fm-copy">(复制网址)</view>
</template>
</line-tab>
<line-tab :icon-num='4'>总后台(<text class="fm-txt">admin.ouxuanzhineng.cn <text class="ft-copy">复制</text></text>)</line-tab>
<line-tab :icon-num='1' @click="toWebView(deadData.helpCenterLink)">帮助中心</line-tab>
<block v-if="loginState">
<line-tab :icon-num='2' @click="toMiniProgram(deadData.assistantCoachAppid)">教练助手</line-tab>
<line-tab :icon-num='3'>
<template slot="default">收银系统</template>
<template slot="right">
<view class="fm-copy" @click="copyLink(deadData.cashierSystemLink)">(复制网址)</view>
</template>
</line-tab>
<line-tab :icon-num='4'>
<template slot="default">总后台</template>
<template slot="right">
<view class="fm-copy" @click="copyLink(deadData.backstageLink)">(复制网址)</view>
</template>
</line-tab>
</block>
<!-- <line-tab :icon-num='4'>总后台(<text class="fm-txt">{{ deadData.backstageLink }}<text class="ft-copy" @click="copyLink(deadData.backstageLink)">复制</text></text>)</line-tab> -->
<line-tab :icon-num='5' @click="toComplaint">投诉建议</line-tab>
<line-tab :icon-num='6'>解绑退出</line-tab>
<line-tab :icon-num='6' v-if="loginState">解绑退出</line-tab>
</block>
<bottom-logo></bottom-logo>
<authorization-login ref="authorizationLogin"></authorization-login>
</view>
</template>
@ -31,27 +51,89 @@
import mineHeader from "@/subpackage/menu/components/mine/header.vue";
import lineTab from "@/subpackage/menu/components/mine/line_tab.vue";
import bottomLogo from "@/subpackage/menu/components/bottom_logo.vue";
import { routeTo, debounce, showLoad, hideLoad, showModal, showNone } from "@/utils/util.js";
import authorizationLogin from "@/subpackage/authorization/components/login.vue";
import { routeTo, debounce, showLoad, hideLoad, showModal, showNone, jsonStr } from "@/utils/util.js";
import { mapGetters } from 'vuex';
import { servers } from '../../js/server';
import { API } from '../../js/api';
export default {
components:{
mineHeader,
lineTab,
bottomLogo,
authorizationLogin,
},
data(){
return {
brand_id: '',
menuPackageLoaded: false
menuPackageLoaded: false,
userInfo: {},
deadData: {
helpCenterLink: 'https://help.ouxuanzhineng.cn/', //
cashierSystemLink: 'https://kb.ouxuanzhineng.cn/', //
backstageLink: 'https://admin.ouxuanzhineng.cn/', //
assistantCoachAppid: 'wxd71043ec955dfecf', // AppID
},
}
},
computed: {
...mapGetters([ 'loginState' ]),
extension(){
return this.userInfo?.extension || {}
},
},
onLoad(options){
this.brand_id = options?.brand_id ?? '';
if(this.loginState)this.getUserInfo();
},
methods: {
toMiniProgram(appid){
uni.navigateToMiniProgram({ appId: appid });
},
toWebView(url){
routeTo(`/pages/web_view/web_view?src=${jsonStr(url)}`, 'nT');
},
copyLink(url){
uni.setClipboardData({ data: url });
},
toComplaint(){
let { brand_id } = this;
routeTo(`/subpackage/message/pages/complaint/list?brand_id=${brand_id}`, 'nT');
},
loginBtn(){
this.$refs?.authorizationLogin?.alert?.({
success: ()=>{
this.getUserInfo();
},
fail: err =>{
// console.warn('pages index showAuthor authorizationLogin Err ->', err)
}
})
},
getUserInfo(){
showLoad();
return servers.post({
url: API.mine.userCurrent,
data: {},
isDefaultGet: false,
})
.then(res => {
hideLoad();
let _data = res?.data || {};
if(_data.code === 0){
this.userInfo = _data?.data || {};
console.log('pages menu getUserInfo res --->', _data);
}else{
return Promise.reject(_data);
}
})
.catch(err => {
hideLoad();
showModal({ content: err?.message || '加载用户失败!' });
console.warn('pages menu getUserInfo err --->', err);
// return Promise.reject(err);
})
},
}
}
</script>

3
src/pages/web_view/web_view.vue

@ -2,6 +2,7 @@
<web-view :src="address"></web-view>
</template>
<script>
import { jsonPar } from "@/utils/util.js";
export default {
data(){
return {
@ -10,7 +11,7 @@ export default {
},
onLoad(options){
console.log('web_view options', options);
this.address = decodeURIComponent(options?.src || 'https://www.ouxuanzhineng.cn');
this.address = jsonPar(decodeURIComponent(options?.src ?? ''));
}
}
</script>

36
src/subpackage/menu/components/mine/header.vue

@ -1,20 +1,42 @@
<template>
<view class="mine-header">
<view class="mh-user">
<image class="mu-photo"></image>
<view class="mu-info" v-if="false">
<view class="mi-line">昵称猫星人</view>
<view class="mi-line">姓名小雪</view>
<view class="mi-line">账号18316553872</view>
<image class="mu-photo" mode="aspectFill" :src="photo"></image>
<view class="mu-info" v-if="isLogin">
<view class="mi-line">昵称{{ nickname || '-' }}</view>
<view class="mi-line">姓名{{ name || '-' }}</view>
<view class="mi-line">账号{{ account || '-' }}</view>
</view>
<button v-else class="mu-login">点击登录</button>
<button v-else class="mu-login" @click="$emit('click:login')">点击登录</button>
</view>
<view class="mh-update">更新头像昵称</view>
<view class="mh-update" v-if="isLogin" @click="$emit('click:update')">更新头像昵称</view>
</view>
</template>
<script>
export default {
props: {
isLogin: {
type: Boolean,
default: false
},
nickname: {
type: String,
default: ''
},
name: {
type: String,
default: ''
},
account: {
type: String,
default: ''
},
photo: {
type: String,
default: ''
}
},
mounted(){
console.log('mounted');
this.$emit('on:munted');

4
src/subpackage/menu/components/mine/line_tab.vue

@ -43,17 +43,15 @@ export default {
.lt-right{
flex-grow: 1;
@include ctf(space-between);
flex-grow: 1;
.lr-left{
.lr-name{
@include flcw(32upx, 48upx, #9A9A9D);
@include tHide;
}
}
.lr-right{
flex-shrink: 0;
max-width: 40%;
max-width: 60%;
font-size: 0;
.lr-arrow{
width: 30upx;

Loading…
Cancel
Save