zs 1 year ago
parent
commit
197132c8b4

+ 1 - 1
app.json

@@ -47,7 +47,7 @@
     "lazyCodeLoading": "requiredComponents",
     "lazyCodeLoading": "requiredComponents",
     "window": {
     "window": {
         "backgroundTextStyle": "dark",
         "backgroundTextStyle": "dark",
-        "navigationBarBackgroundColor": "#48D1CC",
+        "navigationBarBackgroundColor": "#40E0D0",
         "navigationBarTitleText": "羽毛球比赛",
         "navigationBarTitleText": "羽毛球比赛",
         "navigationBarTextStyle": "white"
         "navigationBarTextStyle": "white"
     },
     },

+ 11 - 3
icon/icon.wxss

@@ -1,8 +1,8 @@
 @font-face {
 @font-face {
     font-family: "iconfont"; /* Project id 4108322 */
     font-family: "iconfont"; /* Project id 4108322 */
-    src: url('//at.alicdn.com/t/c/font_4108322_xvelu4o729h.woff2?t=1686103833230') format('woff2'),
-         url('//at.alicdn.com/t/c/font_4108322_xvelu4o729h.woff?t=1686103833230') format('woff'),
-         url('//at.alicdn.com/t/c/font_4108322_xvelu4o729h.ttf?t=1686103833230') format('truetype');
+    src: url('//at.alicdn.com/t/c/font_4108322_vug2q9jhqf.woff2?t=1686122696678') format('woff2'),
+         url('//at.alicdn.com/t/c/font_4108322_vug2q9jhqf.woff?t=1686122696678') format('woff'),
+         url('//at.alicdn.com/t/c/font_4108322_vug2q9jhqf.ttf?t=1686122696678') format('truetype');
   }
   }
   
   
   .iconfont {
   .iconfont {
@@ -13,6 +13,14 @@
     -moz-osx-font-smoothing: grayscale;
     -moz-osx-font-smoothing: grayscale;
   }
   }
   
   
+  .icon-youjiantou-copy:before {
+    content: "\e654";
+  }
+  
+  .icon-zhanghaoguanli:before {
+    content: "\e80a";
+  }
+  
   .icon-xiugaimima:before {
   .icon-xiugaimima:before {
     content: "\e66f";
     content: "\e66f";
   }
   }

+ 10 - 8
pagesMy/basic/index.js

@@ -1,18 +1,20 @@
-// pagesMy/basic/index.js
+const app = getApp()
 Page({
 Page({
-
-    /**
-     * 页面的初始数据
-     */
     data: {
     data: {
-
+        info: {}
     },
     },
-
     /**
     /**
      * 生命周期函数--监听页面加载
      * 生命周期函数--监听页面加载
      */
      */
     onLoad(options) {
     onLoad(options) {
-
+        const that = this;
+        wx.showLoading({ title: '加载中', mask: true })
+        that.search()
+        wx.hideLoading()
+    },
+    // 查询通知
+    async search() {
+        const that = this;
     },
     },
 
 
     /**
     /**

+ 1 - 1
pagesMy/basic/index.json

@@ -1,3 +1,3 @@
 {
 {
-    "usingComponents": {}
+    "navigationBarTitleText": "基本信息"
 }
 }

+ 3 - 2
pagesMy/basic/index.wxml

@@ -1,2 +1,3 @@
-<!--pagesMy/basic/index.wxml-->
-<text>pagesMy/basic/index.wxml</text>
+<view class=" content main">
+    基本信息
+</view>

+ 1 - 1
pagesMy/basic/index.wxss

@@ -1 +1 @@
-/* pagesMy/basic/index.wxss */
+@import "../../app.wxss";

+ 10 - 8
pagesMy/exit/index.js

@@ -1,18 +1,20 @@
-// pagesMy/byFollow/index.js
+const app = getApp()
 Page({
 Page({
-
-    /**
-     * 页面的初始数据
-     */
     data: {
     data: {
-
+        info: {}
     },
     },
-
     /**
     /**
      * 生命周期函数--监听页面加载
      * 生命周期函数--监听页面加载
      */
      */
     onLoad(options) {
     onLoad(options) {
-
+        const that = this;
+        wx.showLoading({ title: '加载中', mask: true })
+        that.search()
+        wx.hideLoading()
+    },
+    // 查询通知
+    async search() {
+        const that = this;
     },
     },
 
 
     /**
     /**

+ 1 - 1
pagesMy/exit/index.json

@@ -1,3 +1,3 @@
 {
 {
-    "usingComponents": {}
+    "navigationBarTitleText": "退出登录"
 }
 }

+ 3 - 2
pagesMy/exit/index.wxml

@@ -1,2 +1,3 @@
-<!--pagesMy/byFollow/index.wxml-->
-<text>pagesMy/byFollow/index.wxml</text>
+<view class=" content main">
+    退出登录
+</view>

+ 1 - 1
pagesMy/exit/index.wxss

@@ -1 +1 @@
-/* pagesMy/byFollow/index.wxss */
+@import "../../app.wxss";

+ 96 - 5
pagesMy/home/index.js

@@ -1,7 +1,14 @@
 const app = getApp()
 const app = getApp()
+import { my_menu } from "../../utils/site";
 Page({
 Page({
     data: {
     data: {
-        info: {}
+        logo: '',
+        avatarUrl: '',
+        user: {},
+        // 按钮
+        menuList: my_menu,
+        // 状态
+        statusList: []
     },
     },
     toPath(e) {
     toPath(e) {
         let data = e.detail;
         let data = e.detail;
@@ -11,19 +18,103 @@ Page({
         else if (data.type == '2') wx.relaunch({ url })
         else if (data.type == '2') wx.relaunch({ url })
         else if (data.type == '3') wx.switchTab({ url })
         else if (data.type == '3') wx.switchTab({ url })
     },
     },
-
+    // 我的服务-功能按钮
+    toCommon: function (e) {
+        const that = this;
+        if (that.data.user._id) {
+            let { route } = e.currentTarget.dataset;
+            if (route) wx.navigateTo({ url: `/${route}` })
+        } else {
+            wx.showToast({ title: `暂无用户信息,无法查看`, icon: 'none' });
+        }
+    },
+    // 获取头像
+    async toAvatarUrl(e) {
+        const that = this;
+        const { avatarUrl } = e.detail
+        let res = await app.$apifile('files/zkzx/schfriend/upload', null, avatarUrl)
+        res = JSON.parse(res);
+        if (res.errcode == '0') {
+            let icon = [{ id: res.id, name: res.name, uri: res.uri, url: `${app.globalData.fileserverUrl}` + res.uri }]
+            let arr = await app.$api(`user/${that.data.user._id}`, 'POST', { icon: icon });
+            if (arr.errcode == '0') {
+                wx.showToast({ title: `头像上传成功`, icon: 'success' });
+                that.search()
+            } else {
+                wx.showToast({ title: `${arr.errmsg}`, icon: 'error' });
+            }
+        }
+    },
     /**
     /**
      * 生命周期函数--监听页面加载
      * 生命周期函数--监听页面加载
      */
      */
-    onLoad(options) {
+    async onLoad(options) {
         const that = this;
         const that = this;
         wx.showLoading({ title: '加载中', mask: true })
         wx.showLoading({ title: '加载中', mask: true })
-        that.search()
+        await that.searchOther();
+        await that.searchConfig();
+        await that.search()
         wx.hideLoading()
         wx.hideLoading()
     },
     },
-    // 查询通知
+    searchConfig() {
+        const that = this;
+        wx.getStorage({
+            key: 'config',
+            async success(res) {
+                // 管理员。
+                if (res.data && res.data.logo_url && res.data.logo_url.length > 0) {
+                    let logo = res.data.logo_url[0].url
+                    that.setData({ logo })
+                }
+            },
+            fail(err) {
+                console.log(err);
+            }
+        })
+    },
     async search() {
     async search() {
         const that = this;
         const that = this;
+        wx.getStorage({
+            key: 'token',
+            async success(res) {
+                let arr = await app.$api(`user/${res.data._id}`, 'GET', {})
+                if (arr.errcode == '0') {
+                    let user = arr.data;
+                    // 审核字段处理
+                    user.status_name = that.getDict(user.status, 'statusList')
+                    // 头像字段处理
+                    if (user.icon && user.icon.length > 0) {
+                        let avatarUrl = user.icon[0].url
+                        that.setData({ avatarUrl })
+                    }
+                    that.setData({ user })
+                } else {
+                    wx.showToast({ title: `${arr.errmsg}`, icon: 'error' });
+                }
+
+            },
+            fail(err) {
+                console.log(err);
+            }
+        })
+    },
+    // 过滤字典表
+    getDict(value, model) {
+        const that = this;
+        if (value) {
+            let list = that.data.statusList
+            let data = list.find(i => i.value == value);
+            if (data) return data.label
+            else return '暂无'
+        }
+    },
+    // 查询其他信息
+    async searchOther() {
+        const that = this;
+        let res;
+        // 状态
+        res = await app.$api(`dictData`, 'GET', { type: 'status', is_use: '0' });
+        if (res.errcode == '0') that.setData({ statusList: res.data })
     },
     },
 
 
     /**
     /**

+ 26 - 2
pagesMy/home/index.wxml

@@ -1,5 +1,29 @@
 <home-frame bind:toPath="toPath">
 <home-frame bind:toPath="toPath">
-    <view class="main">
-        我的
+    <view class='main'>
+        <!--头像名称-->
+        <view class="one">
+            <button class="button" open-type="chooseAvatar" bind:chooseavatar="toAvatarUrl">
+                <image class="image" src="{{avatarUrl||logo}}"></image>
+            </button>
+        </view>
+        <view class="two">
+            <view class="two_1">
+                <view class="text"> {{user.name||'暂无姓名'}} </view>
+                <view class="text"> {{user.status_name||'暂无状态'}} </view>
+            </view>
+        </view>
+        <view class="thr">
+            <view class="thr_1">
+                <view class="list" wx:for="{{menuList}}" wx:key="index" wx:for-item="item" bindtap="toCommon" data-route="{{item.route}}">
+                    <view class="list_1">
+                        <text class="iconfont {{item.icon}}"></text>
+                        <text class="title">{{item.title}}</text>
+                    </view>
+                    <view class="list_2">
+                        <text class="iconfont {{item.you}}"></text>
+                    </view>
+                </view>
+            </view>
+        </view>
     </view>
     </view>
 </home-frame>
 </home-frame>

+ 92 - 2
pagesMy/home/index.wxss

@@ -1,3 +1,93 @@
-.main {
-    padding: 1vw;
+/* 图标 */
+@import "../../icon/icon.wxss";
+
+.main .one {
+    display: flex;
+    justify-content: space-between;
+    background-color: var(--rgb40E);
+    padding-top: 50rpx;
+    padding-bottom: 100rpx;
+}
+
+.main .one .button {
+    position: relative;
+    width: 80px;
+    height: 80px;
+    overflow: hidden;
+    border: 1px solid #cccccc;
+    border-radius: 90px;
+}
+
+.main .one .button .image {
+    position: absolute;
+    top: 0;
+    left: 0;
+    width: 80px;
+    height: 80px;
+    overflow: hidden;
+    border-radius: 90px;
+}
+
+.main .two {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    margin-top: -50rpx;
+    margin-bottom: 20rpx;
+}
+
+.main .two .two_1 {
+    display: flex;
+    justify-content: space-between;
+    width: 85%;
+    background-color: #ffffff;
+    border: 1rpx solid rgb(176, 176, 176);
+    border-radius: 25rpx;
+    padding: 20rpx;
+}
+
+.main .thr {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    margin-top: 0rpx;
+}
+
+.main .thr .thr_1 {
+    width: 90%;
+    background-color: #ffffff;
+    border: 1rpx solid rgb(176, 176, 176);
+    border-radius: 30rpx;
+}
+
+.main .thr .thr_1 .list {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    margin: 20rpx;
+    height: 70rpx;
+    border-bottom: 1px solid rgb(176, 176, 176);
+}
+
+.main .thr .thr_1 .list:last-child {
+    border-bottom: none;
+}
+
+.main .thr .thr_1 .list .list_1 {
+    margin: 0 2vw 0 0;
+    color: var(--rgb314);
+}
+
+.main .thr .thr_1 .list .list_1 .iconfont {
+    font-size: 20px;
+    padding: 0 8rpx;
+    color: var(--rgb40E);
+}
+
+.main .thr .thr_1 .list .list_1 .title {
+    font-size: 16px;
+}
+
+.main .thr .thr_1 .list .list_2 {
+    color: #868686;
 }
 }

+ 10 - 8
pagesMy/match/index.js

@@ -1,18 +1,20 @@
-// pagesMy/follow/index.js
+const app = getApp()
 Page({
 Page({
-
-    /**
-     * 页面的初始数据
-     */
     data: {
     data: {
-
+        info: {}
     },
     },
-
     /**
     /**
      * 生命周期函数--监听页面加载
      * 生命周期函数--监听页面加载
      */
      */
     onLoad(options) {
     onLoad(options) {
-
+        const that = this;
+        wx.showLoading({ title: '加载中', mask: true })
+        that.search()
+        wx.hideLoading()
+    },
+    // 查询通知
+    async search() {
+        const that = this;
     },
     },
 
 
     /**
     /**

+ 1 - 1
pagesMy/match/index.json

@@ -1,3 +1,3 @@
 {
 {
-    "usingComponents": {}
+    "navigationBarTitleText": "我的比赛"
 }
 }

+ 3 - 2
pagesMy/match/index.wxml

@@ -1,2 +1,3 @@
-<!--pagesMy/follow/index.wxml-->
-<text>pagesMy/follow/index.wxml</text>
+<view class=" content main">
+    我的比赛
+</view>

+ 1 - 1
pagesMy/match/index.wxss

@@ -1 +1 @@
-/* pagesMy/follow/index.wxss */
+@import "../../app.wxss";

+ 10 - 8
pagesMy/team/index.js

@@ -1,18 +1,20 @@
-// pagesMy/admin/index.js
+const app = getApp()
 Page({
 Page({
-
-    /**
-     * 页面的初始数据
-     */
     data: {
     data: {
-
+        info: {}
     },
     },
-
     /**
     /**
      * 生命周期函数--监听页面加载
      * 生命周期函数--监听页面加载
      */
      */
     onLoad(options) {
     onLoad(options) {
-
+        const that = this;
+        wx.showLoading({ title: '加载中', mask: true })
+        that.search()
+        wx.hideLoading()
+    },
+    // 查询通知
+    async search() {
+        const that = this;
     },
     },
 
 
     /**
     /**

+ 1 - 1
pagesMy/team/index.json

@@ -1,3 +1,3 @@
 {
 {
-    "usingComponents": {}
+    "navigationBarTitleText": "我的团队"
 }
 }

+ 3 - 2
pagesMy/team/index.wxml

@@ -1,2 +1,3 @@
-<!--pagesMy/admin/index.wxml-->
-<text>pagesMy/admin/index.wxml</text>
+<view class=" content main">
+    我的团队
+</view>

+ 1 - 1
pagesMy/team/index.wxss

@@ -1 +1 @@
-/* pagesMy/admin/index.wxss */
+@import "../../app.wxss";

+ 10 - 8
pagesMy/update/index.js

@@ -1,18 +1,20 @@
-// pagesMy/file/index.js
+const app = getApp()
 Page({
 Page({
-
-    /**
-     * 页面的初始数据
-     */
     data: {
     data: {
-
+        info: {}
     },
     },
-
     /**
     /**
      * 生命周期函数--监听页面加载
      * 生命周期函数--监听页面加载
      */
      */
     onLoad(options) {
     onLoad(options) {
-
+        const that = this;
+        wx.showLoading({ title: '加载中', mask: true })
+        that.search()
+        wx.hideLoading()
+    },
+    // 查询通知
+    async search() {
+        const that = this;
     },
     },
 
 
     /**
     /**

+ 1 - 1
pagesMy/update/index.json

@@ -1,3 +1,3 @@
 {
 {
-    "usingComponents": {}
+    "navigationBarTitleText": "修改密码"
 }
 }

+ 3 - 2
pagesMy/update/index.wxml

@@ -1,2 +1,3 @@
-<!--pagesMy/file/index.wxml-->
-<text>pagesMy/file/index.wxml</text>
+<view class=" content main">
+    修改密码
+</view>

+ 1 - 1
pagesMy/update/index.wxss

@@ -1 +1 @@
-/* pagesMy/file/index.wxss */
+@import "../../app.wxss";

+ 4 - 4
utils/site.js

@@ -6,8 +6,8 @@ export const menu = [
 ]
 ]
 export const my_menu = [
 export const my_menu = [
     { title: "基本信息", icon: 'icon-jibenxinxi', you: 'icon-youjiantou-copy', route: "pagesMy/basic/index" },
     { title: "基本信息", icon: 'icon-jibenxinxi', you: 'icon-youjiantou-copy', route: "pagesMy/basic/index" },
-    { title: "我的团队", icon: 'icon-tupianshangchuan', you: 'icon-youjiantou-copy', route: "pagesMy/team/index" },
-    { title: "我的比赛", icon: 'icon-wodeguanzhu', you: 'icon-youjiantou-copy', route: "pagesMy/match/index" },
-    { title: "修改密码", icon: 'icon-iocn_be_concern', you: 'icon-youjiantou-copy', route: "pagesMy/update/index" },
-    { title: "退出登录", icon: 'icon-lianxiguanliyuan', you: 'icon-youjiantou-copy', route: "pagesMy/exit/index" }
+    { title: "我的团队", icon: 'icon-tuandui', you: 'icon-youjiantou-copy', route: "pagesMy/team/index" },
+    { title: "我的比赛", icon: 'icon-bisai1', you: 'icon-youjiantou-copy', route: "pagesMy/match/index" },
+    { title: "修改密码", icon: 'icon-xiugaimima', you: 'icon-youjiantou-copy', route: "pagesMy/update/index" },
+    { title: "退出登录", icon: 'icon-tuichudenglu', you: 'icon-youjiantou-copy', route: "pagesMy/exit/index" }
 ]
 ]