123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- import {
- get,
- post
- } from '../../utils/http';
- Page({
-
- data: {
- current: 0,
- list: []
- },
-
- onLoad: function (options) {
- this.getMruserRole()
- },
-
- onReady: function () {
- },
-
- onShow: function () {
- },
-
- onHide: function () {
- },
-
- onUnload: function () {
- },
-
- onPullDownRefresh: function () {
- },
-
- onReachBottom: function () {
- },
-
- onShareAppMessage: function () {
- },
- onChangeRole(e) {
- let { list } = this.data;
- list.forEach((item,index) => {
- item.selected = 0
- })
- list[e.currentTarget.dataset.index].selected = 1
- this.setData({
- list,
- current: e.currentTarget.dataset.index
- })
- },
-
- getMruserRole() {
- let { current } = this.data;
- get('api/mruser/role',{},(res) => {
-
-
-
-
-
- console.log(res.data);
- this.setData({
- list: res.data
- })
- })
- },
-
- onSubmit() {
-
-
- let { current,list } = this.data;
- post('api/mruser/change_role',{
- role_id: list[current].id
- },(res) => {
- wx.showToast({
- title: res.msg,
- icon: 'none'
- })
- setTimeout(() => {
- wx.reLaunch({
- url: '/pages/home/home',
- })
- }, 1500);
- })
- }
- })
|