parent
							
								
									820e1df84e
								
							
						
					
					
						commit
						0bac3e55f4
					
				| @ -0,0 +1,25 @@ | ||||
| import request from '@/utils/request' | ||||
| 
 | ||||
| export function getWxBindInfos(query) { | ||||
|   return request({ | ||||
|     url: '/wxbind/info', | ||||
|     method: 'get', | ||||
|     params: query | ||||
|   }) | ||||
| } | ||||
| 
 | ||||
| export function updateWxBindInfo(data) { | ||||
|   return request({ | ||||
|     url: '/wxbind/info', | ||||
|     method: 'put', | ||||
|     data | ||||
|   }) | ||||
| } | ||||
| 
 | ||||
| export function deleteWxBind(data) { | ||||
|   return request({ | ||||
|     url: '/wxbind/info', | ||||
|     method: 'delete', | ||||
|     data | ||||
|   }) | ||||
| } | ||||
| @ -0,0 +1,152 @@ | ||||
| <template> | ||||
|   <div class="app-container"> | ||||
|     <el-form ref="postForm" :model="postForm" label-width="100px" :disabled="!is_edit"> | ||||
|       <el-row> | ||||
|         <el-col :span="12"> | ||||
|           <el-form-item label="用户ID"> | ||||
|             <el-row :gutter="12"> | ||||
|               <el-col :span="16"> | ||||
|                 <el-input :value="postForm.user_id" disabled /> | ||||
|               </el-col> | ||||
|             </el-row> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="微信openid"> | ||||
|             <el-row :gutter="12"> | ||||
|               <el-col :span="16"> | ||||
|                 <el-input v-model="postForm.openid" disabled /> | ||||
|               </el-col> | ||||
|             </el-row> | ||||
|           </el-form-item> | ||||
| 
 | ||||
|           <el-form-item label="微信昵称"> | ||||
|             <el-row :gutter="12"> | ||||
|               <el-col :span="16"> | ||||
|                 <el-input v-model="postForm.nickname" /> | ||||
|               </el-col> | ||||
|             </el-row> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="地址"> | ||||
|             <el-row :gutter="12"> | ||||
|               <el-col :span="16"> | ||||
|                 <el-input v-model="postForm.address" /> | ||||
|               </el-col> | ||||
|             </el-row> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="创建时间" prop="timestamp"> | ||||
|             <el-row :gutter="20"> | ||||
|               <el-col :span="8"> | ||||
|                 <el-date-picker :value="postForm.created_time" type="datetime" disabled /> | ||||
|               </el-col> | ||||
|             </el-row> | ||||
|           </el-form-item> | ||||
| 
 | ||||
|         </el-col> | ||||
|         <el-col :span="12"> | ||||
|           <el-form-item label="用户头像" label-width="160px"> | ||||
|             <el-row :gutter="12"> | ||||
|               <el-col :span="16"> | ||||
|                 <el-image :src="postForm.head_img_url" :preview-src-list="[postForm.head_img_url]" fit="contain" style="width: 100px; height: 100px" /> | ||||
|               </el-col> | ||||
|             </el-row> | ||||
|           </el-form-item> | ||||
| 
 | ||||
|           <el-form-item label="订阅状态" label-width="160px"> | ||||
|             <el-row :gutter="12"> | ||||
|               <el-col :span="16"> | ||||
|                 <el-select v-model="postForm.subscribe" class="filter-item"> | ||||
|                   <el-option v-for="item in wxbind_state_choices" :key="item.id" :label="item.name" :value="item.id" /> | ||||
|                 </el-select> | ||||
|               </el-col> | ||||
|             </el-row> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="性别" label-width="160px"> | ||||
|             <el-row :gutter="12"> | ||||
|               <el-col :span="16"> | ||||
|                 <el-select v-model="postForm.sex" class="filter-item"> | ||||
|                   <el-option v-for="item in wxbind_sex_choices" :key="item.id" :label="item.name" :value="item.id" /> | ||||
|                 </el-select> | ||||
|               </el-col> | ||||
|             </el-row> | ||||
|           </el-form-item> | ||||
| 
 | ||||
|         </el-col> | ||||
|       </el-row> | ||||
|     </el-form> | ||||
|     <el-col :span="9" style="float: right"> | ||||
|       <el-button v-if="!is_edit" type="primary" :disabled="postForm.id === postForm.used_id" @click="is_edit=true">修改</el-button> | ||||
|       <div v-else> | ||||
|         <el-button type="primary" @click="is_edit=false">取消</el-button> | ||||
|         <el-button type="primary" @click="updateData">保存修改</el-button> | ||||
|       </div> | ||||
|     </el-col> | ||||
|   </div> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
| import { getWxBindInfos, updateWxBindInfo } from '@/api/wxbind' | ||||
| const wxbind_state_choices = [ | ||||
|   { id: false, name: '未订阅' }, | ||||
|   { id: true, name: '已订阅' } | ||||
| ] | ||||
| 
 | ||||
| const wxbind_sex_choices = [ | ||||
|   { id: 0, name: '未知' }, | ||||
|   { id: 1, name: '男' }, | ||||
|   { id: 2, name: '女' } | ||||
| ] | ||||
| 
 | ||||
| const defaultForm = { | ||||
|   user_id: undefined, | ||||
|   address: undefined, | ||||
|   created_time: undefined, | ||||
|   head_img_url: undefined, | ||||
|   id: undefined, | ||||
|   nickname: undefined, | ||||
|   openid: undefined, | ||||
|   sex: undefined, | ||||
|   subscribe: undefined, | ||||
|   subscribe_time: undefined | ||||
| } | ||||
| 
 | ||||
| export default { | ||||
|   name: 'OrderDetail', | ||||
|   components: { }, filters: {}, | ||||
|   data() { | ||||
|     return { | ||||
|       postForm: Object.assign({}, defaultForm), | ||||
|       loading: false, | ||||
|       is_edit: false, | ||||
|       wxbind_state_choices, | ||||
|       wxbind_sex_choices | ||||
|     } | ||||
|   }, | ||||
|   computed: {}, | ||||
|   created() { | ||||
|     const id = this.$route.params && this.$route.params.id | ||||
|     this.fetchData(id) | ||||
|   }, | ||||
|   methods: { | ||||
|     fetchData(id) { | ||||
|       getWxBindInfos({ id: id }).then(response => { | ||||
|         if (response.data.length === 1) { | ||||
|           this.postForm = response.data[0] | ||||
|         } | ||||
|       }).catch(err => { | ||||
|         console.log(err) | ||||
|       }) | ||||
|     }, | ||||
|     updateData() { | ||||
|       updateWxBindInfo(this.postForm).then(response => { | ||||
|         this.$message.success('更新成功') | ||||
|         this.postForm = response.data | ||||
|       }).catch(err => { | ||||
|         console.log(err) | ||||
|       }) | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </script> | ||||
| 
 | ||||
| <style scoped> | ||||
| 
 | ||||
| </style> | ||||
| @ -0,0 +1,201 @@ | ||||
| <template> | ||||
|   <div class="app-container"> | ||||
|     <div class="filter-container"> | ||||
|       <el-input v-model="listQuery.user_id" placeholder="用户ID" style="width: 140px;" class="filter-item" clearable @keyup.enter.native="handleFilter" /> | ||||
|       <el-input v-model="listQuery.openid" placeholder="微信openid" style="width: 300px;" class="filter-item" clearable @keyup.enter.native="handleFilter" /> | ||||
|       <el-input v-model="listQuery.nickname" placeholder="微信昵称" style="width: 200px;" class="filter-item" clearable @keyup.enter.native="handleFilter" /> | ||||
|       <el-select v-model="listQuery.subscribe" placeholder="玩家是否订阅" clearable class="filter-item" style="width: 140px" @change="handleFilter"> | ||||
|         <el-option v-for="item in wxbind_state_choices" :key="item.id" :label="item.name" :value="item.id" /> | ||||
|       </el-select> | ||||
|       <el-select v-model="listQuery.sort" style="width: 140px" class="filter-item" @change="handleFilter"> | ||||
|         <el-option v-for="item in sortOptions" :key="item.key" :label="item.label" :value="item.key" /> | ||||
|       </el-select> | ||||
|       <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter"> | ||||
|         Search | ||||
|       </el-button> | ||||
|     </div> | ||||
|     <el-table | ||||
|       v-loading="listLoading" | ||||
|       :data="list" | ||||
|       element-loading-text="Loading" | ||||
|       border | ||||
|       fit | ||||
|       highlight-current-row | ||||
|       stripe | ||||
|     > | ||||
|       <el-table-column align="center" label="ID" width="90"> | ||||
|         <template slot-scope="scope"> | ||||
|           {{ scope.row.id }} | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column label="用户ID" width="100" align="center"> | ||||
|         <template slot-scope="scope"> | ||||
|           <router-link :to="{name: 'user_info_edit',params:{id:scope.row.user_id}}"> | ||||
|             <el-link type="primary"> {{ scope.row.user_id }}</el-link> | ||||
|           </router-link> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column label="头像" align="center"> | ||||
|         <template slot-scope="scope"> | ||||
|           <el-image :src="scope.row.head_img_url" :preview-src-list="[scope.row.head_img_url]" fit="contain" style="width: 80px; height: 80px" /> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column label="微信昵称" min-width="180px" align="center"> | ||||
|         <template slot-scope="scope"> | ||||
|           {{ scope.row.nickname }} | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column label="微信openid" min-width="280px" align="center"> | ||||
|         <template slot-scope="scope"> | ||||
|           {{ scope.row.openid }} | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column label="地址" min-width="200px" align="center"> | ||||
|         <template slot-scope="scope"> | ||||
|           {{ scope.row.address }} | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column label="性别" min-width="60px" align="center"> | ||||
|         <template slot-scope="scope"> | ||||
|           {{ scope.row |sexLableFilter }} | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column class-name="status-col" label="订阅状态" width="95" align="center"> | ||||
|         <template slot-scope="scope"> | ||||
|           <el-tag :type="scope.row.subscribe | statusFilter">{{ scope.row| statusLableFilter }}</el-tag> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column align="center" prop="created_time" label="创建时间" width="120"> | ||||
|         <template slot-scope="scope"> | ||||
|           <i class="el-icon-time" /> | ||||
|           <el-tooltip :content="scope.row.created_time"> | ||||
|             <span>{{ scope.row.created_time|formatTime }}</span> | ||||
|           </el-tooltip> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width"> | ||||
|         <template slot-scope="scope"> | ||||
|           <router-link :to="{name: 'wxbind_info_edit',params:{id:scope.row.id}}"> | ||||
|             <el-button type="primary" size="mini"> | ||||
|               查看编辑 | ||||
|             </el-button> | ||||
|           </router-link> | ||||
|           <el-button type="danger" size="mini" @click="remove_wxbind(scope.row.id)"> | ||||
|             删除 | ||||
|           </el-button> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|     </el-table> | ||||
|     <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="fetchData" /> | ||||
| 
 | ||||
|   </div> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
| import { getWxBindInfos, deleteWxBind } from '@/api/wxbind' | ||||
| import { baseFilter } from '@/utils' | ||||
| import Pagination from '@/components/Pagination' // secondary package based on el-pagination | ||||
| import waves from '@/directive/waves' // waves directive | ||||
| 
 | ||||
| const sortOptions = [ | ||||
|   { label: '创建时间 Ascending', key: 'created_time' }, | ||||
|   { label: '创建时间 Descending', key: '-created_time' } | ||||
| ] | ||||
| 
 | ||||
| const wxbind_state_choices = [ | ||||
|   { id: false, name: '未订阅' }, | ||||
|   { id: true, name: '已订阅' } | ||||
| ] | ||||
| 
 | ||||
| const wxbind_sex_choices = [ | ||||
|   { id: 0, name: '未知' }, | ||||
|   { id: 1, name: '男' }, | ||||
|   { id: 2, name: '女' } | ||||
| ] | ||||
| 
 | ||||
| export default { | ||||
|   name: 'WxBindInfo', | ||||
|   components: { Pagination }, | ||||
|   directives: { waves }, | ||||
|   filters: { | ||||
|     formatTime(time) { | ||||
|       if (time) { | ||||
|         return time.split('T')[0] | ||||
|       } | ||||
|     }, | ||||
|     wxbindStatusFilter(status) { | ||||
|       const statusMap = { | ||||
|         '1': 'success', | ||||
|         '0': 'gray', | ||||
|         '2': 'info' } | ||||
|       return statusMap[status] | ||||
|     }, | ||||
|     wxbindLableFilter(row) { | ||||
|       if (row.wxbind_type === 2) { | ||||
|         return '应用' + row.app_info.name + '域名' | ||||
|       } | ||||
|       return baseFilter(row.wxbind_type, row.wxbind_type_choices) | ||||
|     }, | ||||
|     statusLableFilter(row) { | ||||
|       return baseFilter(row.subscribe, wxbind_state_choices) | ||||
|     }, | ||||
|     sexLableFilter(row) { | ||||
|       return baseFilter(row.sex, wxbind_sex_choices) | ||||
|     }, | ||||
|     statusFilter(status) { | ||||
|       const statusMap = { | ||||
|         true: 'success', | ||||
|         false: 'danger' | ||||
|       } | ||||
|       return statusMap[status] | ||||
|     } | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       list: null, | ||||
|       listLoading: true, | ||||
|       total: 0, | ||||
|       listQuery: { | ||||
|         page: 1, | ||||
|         limit: 10, | ||||
|         user_id: undefined, | ||||
|         sort: '-created_time', | ||||
|         openid: undefined, | ||||
|         nickname: undefined, | ||||
|         subscribe: undefined | ||||
|       }, | ||||
|       sortOptions, | ||||
|       wxbind_state_choices | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|     this.fetchData() | ||||
|   }, mounted() { | ||||
|     if (this.$route.params.user_id) { | ||||
|       this.listQuery.user_id = this.$route.params.user_id | ||||
|     } | ||||
|     console.log(this.$router) | ||||
|   }, | ||||
|   methods: { | ||||
|     remove_wxbind(wxbind_id) { | ||||
|       deleteWxBind({ id: wxbind_id }).then(response => { | ||||
|         this.list = response.data | ||||
|         this.total = response.total | ||||
|         this.listLoading = false | ||||
|       }) | ||||
|     }, | ||||
|     handleFilter() { | ||||
|       this.listQuery.page = 1 | ||||
|       this.fetchData() | ||||
|     }, | ||||
|     fetchData() { | ||||
|       this.listLoading = true | ||||
|       getWxBindInfos(this.listQuery).then(response => { | ||||
|         this.list = response.data | ||||
|         this.total = response.total | ||||
|         this.listLoading = false | ||||
|       }) | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </script> | ||||
					Loading…
					
					
				
		Reference in new issue