hookehuyr

页面废弃

1 <!-- 1 <!--
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-10-09 15:24:04 4 + * @LastEditTime: 2022-10-25 13:07:53
5 - * @FilePath: /swx/src/pages/userSearch/index.vue 5 + * @FilePath: /swx/src/pages/userAdd/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
8 <template> 8 <template>
9 <view class="user-search-page"> 9 <view class="user-search-page">
10 - <view style="padding: 5%; background-color: #FFFFFF; position: fixed; z-index: 1; width: 90%;"> 10 + <view id="page-header" style="padding: 5%; background-color: #FFFFFF; z-index: 1; width: 90%;">
11 - <view style="border: 1px solid #199A74; border-radius: 1rem;"> 11 + <view style="border: 1px solid #199A74; border-radius: 2rem;">
12 <van-row> 12 <van-row>
13 <van-col span="20"> 13 <van-col span="20">
14 - <view style="padding: 0.5rem 1rem;"> 14 + <view style="padding: 0.7rem 1rem 0rem 1.5rem;">
15 - <input :value="value1" class="weui-input" maxlength="11" @input="bindKeyInput" 15 + <input :value="search" class="weui-input" @input="bindKeyInput" placeholder="请输入用户名姓名/手机号查找" style="width: 100%;" />
16 - placeholder="请输入用户名姓名/昵称/手机号查找" />
17 </view> 16 </view>
18 </van-col> 17 </van-col>
19 <van-col span="4"> 18 <van-col span="4">
20 - <view 19 + <view @tap="onSearch"
21 - style="background-color: #199A74; border-top-right-radius: 0.8rem; border-bottom-right-radius: 0.8rem; text-align: center;"> 20 + style="background-color: #199A74; border-top-right-radius: 2rem; border-bottom-right-radius: 2rem; text-align: center; height: auto;">
22 - <van-icon name="search" size="2.25rem" color="white" style="margin-top: 2px;" /> 21 + <van-icon name="search" size="2.25rem" color="white" style="margin-top: 0.43rem;" />
23 </view> 22 </view>
24 </van-col> 23 </van-col>
25 </van-row> 24 </van-row>
26 </view> 25 </view>
27 </view> 26 </view>
28 - <view style="height: 5rem;"></view> 27 + <scroll-view :scroll-y="true" :style="scrollStyle" @scrolltolower="onScrollToLower">
29 <view style="padding: 1rem;"> 28 <view style="padding: 1rem;">
30 - <view v-for="(item, index) in activityList" :key="index" class="list-item" style="position: relative;"> 29 + <view v-for="(item, index) in member_list" :key="index" class="list-item" style="position: relative;">
31 <van-row> 30 <van-row>
32 <van-col span="6"> 31 <van-col span="6">
33 - <view class="avatar" :style="{ backgroundImage: `url(${item.avatar})`, position: 'relative' }"></view> 32 + <view class="avatar" :style="{ backgroundImage: `url(${item.avatar ? item.avatar : 'http://gyzs.onwall.cn/tou%402x.png'})`, position: 'relative' }"></view>
34 </van-col> 33 </van-col>
35 <van-col span="14"> 34 <van-col span="14">
36 <view class="content"> 35 <view class="content">
...@@ -43,22 +42,23 @@ ...@@ -43,22 +42,23 @@
43 </van-col> 42 </van-col>
44 <van-col span="4"> 43 <van-col span="4">
45 <view style="margin-top: 0.5rem;"> 44 <view style="margin-top: 0.5rem;">
46 - <van-tag v-if="item.status === '1'" :round="true" color="#FFF5E4" text-color="#FF7808" size="large">待分配 45 + <van-tag v-if="!item.partner" :round="true" color="#FFF5E4" text-color="#FF7808" size="large">待分配
47 </van-tag> 46 </van-tag>
48 <van-tag v-else :round="true" color="#D7FFD7" text-color="#019200" size="large">已分配</van-tag> 47 <van-tag v-else :round="true" color="#D7FFD7" text-color="#019200" size="large">已分配</van-tag>
49 </view> 48 </view>
50 </van-col> 49 </van-col>
51 </van-row> 50 </van-row>
52 <view style="position: absolute; right: 0; bottom: 0.75rem;"> 51 <view style="position: absolute; right: 0; bottom: 0.75rem;">
53 - <view @tap="addUser" 52 + <view @tap="addUser(item)"
54 style="color: #FFFFFF; background-color: #199A74; border-bottom-left-radius: 0.85rem; border-top-left-radius: 0.85rem; padding: 0.25rem 0.5rem 0.25rem 1rem; font-size: 0.9rem;"> 53 style="color: #FFFFFF; background-color: #199A74; border-bottom-left-radius: 0.85rem; border-top-left-radius: 0.85rem; padding: 0.25rem 0.5rem 0.25rem 1rem; font-size: 0.9rem;">
55 添加成员</view> 54 添加成员</view>
56 </view> 55 </view>
57 </view> 56 </view>
58 </view> 57 </view>
58 + </scroll-view>
59 </view> 59 </view>
60 <van-dialog id="van-dialog" /> 60 <van-dialog id="van-dialog" />
61 - 61 + <van-toast id="van-toast" />
62 </template> 62 </template>
63 63
64 <script setup> 64 <script setup>
...@@ -66,79 +66,98 @@ import Taro from '@tarojs/taro' ...@@ -66,79 +66,98 @@ import Taro from '@tarojs/taro'
66 import { ref } from "vue"; 66 import { ref } from "vue";
67 import icon_tel from '@/images/icon/tel@2x.png' 67 import icon_tel from '@/images/icon/tel@2x.png'
68 import Dialog from '@vant/weapp/dist/dialog/dialog'; 68 import Dialog from '@vant/weapp/dist/dialog/dialog';
69 - 69 +import Toast from '@/components/vant-weapp/toast/toast';
70 -const value1 = ref('')
71 -const bindKeyInput = (e) => {
72 - value1.value = e.detail.value;
73 -}
74 -
75 -const activityList = ref([{
76 - avatar: 'https://img.yzcdn.cn/vant/cat.jpeg',
77 - name: '净妙',
78 - phone: '18789800786',
79 - status: '1',
80 -}, {
81 - avatar: 'https://img.yzcdn.cn/vant/cat.jpeg',
82 - name: '人在路途',
83 - phone: '18789800786',
84 - status: '2',
85 -}, {
86 - avatar: 'https://img.yzcdn.cn/vant/cat.jpeg',
87 - name: '寒潭秋月心如洗',
88 - phone: '18789800786',
89 - status: '3',
90 -}, {
91 - avatar: 'https://img.yzcdn.cn/vant/cat.jpeg',
92 - name: '净妙',
93 - phone: '18789800786',
94 - status: '1',
95 -}, {
96 - avatar: 'https://img.yzcdn.cn/vant/cat.jpeg',
97 - name: '人在路途',
98 - phone: '18789800786',
99 - status: '2',
100 -}, {
101 - avatar: 'https://img.yzcdn.cn/vant/cat.jpeg',
102 - name: '寒潭秋月心如洗',
103 - phone: '18789800786',
104 - status: '3',
105 -}, {
106 - avatar: 'https://img.yzcdn.cn/vant/cat.jpeg',
107 - name: '人在路途',
108 - phone: '18789800786',
109 - status: '2',
110 -}, {
111 - avatar: 'https://img.yzcdn.cn/vant/cat.jpeg',
112 - name: '寒潭秋月心如洗',
113 - phone: '18789800786',
114 - status: '3',
115 -}])
116 70
117 const onPhoneClick = (number) => { 71 const onPhoneClick = (number) => {
118 Taro.makePhoneCall({ 72 Taro.makePhoneCall({
119 phoneNumber: number 73 phoneNumber: number
120 }) 74 })
121 } 75 }
76 +</script>
77 +
78 +<script>
79 +import "./index.less";
80 +import { listMemberAPI, setRoleMemberAPI } from '@/api/Member/index';
81 +import { $ } from '@tarojs/extend'
82 +import mixin from '@/utils/mixin';
83 +import { getCurrentPageParam } from "@/utils/weapp";
122 84
123 -const addUser = () => { 85 +export default {
86 + name: "userAddPage",
87 + mixins: [mixin.init],
88 + async onShow () {
89 + },
90 + onHide () { // 离开当前页面
91 + this.page = 0;
92 + this.flag = true;
93 + },
94 + mounted () {
95 + // 设置滚动列表可视高度
96 + const windowHeight = wx.getSystemInfoSync().windowHeight;
97 + setTimeout(async () => {
98 + const headerHeight = await $('#page-header').height();
99 + this.scrollStyle = {
100 + height: windowHeight - headerHeight + 'px'
101 + }
102 + }, 500);
103 + },
104 + data() {
105 + return {
106 + member_list: [],
107 + role: 'player',
108 + flag: true,
109 + page: 0,
110 + limit: 10,
111 + scrollStyle: { height: '1000rpx' },
112 + activated: 1,
113 + search: '',
114 + };
115 + },
116 + methods: {
117 + onSearch () {
118 + this.getList()
119 + },
120 + bindKeyInput (e) {
121 + this.search = e.detail.value;
122 + },
123 + onScrollToLower () {
124 + if(!this.flag){
125 + return
126 + }
127 + this.flag = false;
128 + this.getList();
129 + },
130 + async getList () {
131 + // 获取推荐活动列表
132 + const { code, data } = await listMemberAPI({ search: this.search, host_id: getCurrentPageParam().host_id, role: this.role, page: this.page, limit: this.limit });
133 + if (code) {
134 + if (data.member_list.length) {
135 + this.member_list = this.member_list.concat(data.member_list);
136 + this.page = this.page + 1;
137 + this.flag = true;
138 + } else {
139 + Toast('没有数据')
140 + }
141 + }
142 + },
143 + addUser ({ id }) {
124 Dialog.confirm({ 144 Dialog.confirm({
125 title: '温馨提示', 145 title: '温馨提示',
126 message: '是否确认添加成员?', 146 message: '是否确认添加成员?',
127 - // confirmButtonColor: '#199A74' 147 + confirmButtonColor: '#199A74'
128 }) 148 })
129 - .then(() => { 149 + .then(async () => {
130 - // on confirm 150 + // 添加成员
151 + const { code } = await setRoleMemberAPI({ i: id, role: 'volunteer' });
152 + if (code) {
153 + this.member_list.splice(this.member_list.findIndex(item => item.id === id), 1);
154 + Toast.success('添加成功');
155 + }
131 }) 156 })
132 .catch(() => { 157 .catch(() => {
133 // on cancel 158 // on cancel
134 }); 159 });
135 -} 160 + }
136 -</script> 161 + },
137 -
138 -<script>
139 -import "./index.less";
140 -
141 -export default {
142 - name: "demoPage",
143 }; 162 };
144 </script> 163 </script>
......
1 <!-- 1 <!--
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-10-09 15:24:04 4 + * @LastEditTime: 2022-10-25 12:59:30
5 * @FilePath: /swx/src/pages/userSearch/index.vue 5 * @FilePath: /swx/src/pages/userSearch/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
12 <van-row> 12 <van-row>
13 <van-col span="20"> 13 <van-col span="20">
14 <view style="padding: 0.5rem 1rem;"> 14 <view style="padding: 0.5rem 1rem;">
15 - <input :value="value1" class="weui-input" maxlength="11" @input="bindKeyInput" placeholder="请输入用户名姓名/昵称/手机号查找" /> 15 + <input :value="value1" class="weui-input" maxlength="11" @input="bindKeyInput" placeholder="请输入用户名姓名/手机号查找" />
16 </view> 16 </view>
17 </van-col> 17 </van-col>
18 <van-col span="4"> 18 <van-col span="4">
......