作者 徐浩

上传依赖

1 unpackage/ 1 unpackage/
2 -node_modules/  
3 -package.json/  
4 package-lock.json/ 2 package-lock.json/
5 -common/service.js  
6 /.hbuilderx 3 /.hbuilderx
7 /unpackage 4 /unpackage
  1 +import Vue from 'vue'
  2 +import store from '../store/index.js'
  3 +// 管理账号信息
  4 +const USERS_KEY = 'USERS_KEY';
  5 +const STATE_KEY = 'STATE_KEY';
  6 +const map_key = "7FEBZ-WLWK2-PMGUE-C4BFT-EKXB6-BFFNR"
  7 +const VER=process.env.NODE_ENV === 'development' ? 0.1 : 0 // 版本 0 静态
  8 +// const baseurl = "https://edu.baoshanjiaoyu.com/"
  9 +const baseurl = "https://edudev.baoshanjiaoyu.com/"
  10 +const imgurl = baseurl
  11 +var IPurl = baseurl + 'api/'
  12 +const limit=20
  13 +// if(VER==1){
  14 +// IPurl = imgurl + 'api/'
  15 +// }else{
  16 +// IPurl = imgurl + 'api1/'
  17 +// }
  18 +
  19 +// const IPurl=process.env.NODE_ENV === 'production' ? imgurl + 'api/' : 'http://192.168.0.100/api/'
  20 +
  21 +const share_title='中职教育'
  22 +const share_summary='中职教育'
  23 +const share_img='/static/logo1.png'
  24 +/**
  25 + * 请求头
  26 + */
  27 +var header= {
  28 + 'content-type': 'application/x-www-form-urlencoded',
  29 + // 'token':uni.getStorageSync('token')||'',
  30 + // 'userId':uni.getStorageSync('userId')||''
  31 + }
  32 +
  33 +
  34 +/**
  35 + * function: 根据需求处理请求参数:添加固定参数配置等
  36 + * @params 请求参数
  37 + */
  38 +function dealParams(params) {
  39 + console.log("请求参数:", params)
  40 + return params;
  41 +}
  42 +
  43 +
  44 +
  45 +const getUsers = function() {
  46 + let ret = '';
  47 + ret = uni.getStorageSync(USERS_KEY);
  48 + if (!ret) {
  49 + ret = '[]';
  50 + }
  51 + return JSON.parse(ret);
  52 +}
  53 +
  54 +const addUser = function(userInfo) {
  55 + let users = getUsers();
  56 + users.push({
  57 + account: userInfo.account,
  58 + password: userInfo.password
  59 + });
  60 + uni.setStorageSync(USERS_KEY, JSON.stringify(users));
  61 +}
  62 +
  63 +
  64 +const jump = function(e) {
  65 + // console.log(e.currentTarget.dataset.type)
  66 + var datas = e.currentTarget.dataset
  67 + console.log(datas.login == true)
  68 + console.log(store.state.hasLogin)
  69 + if (datas.login == true) {
  70 + if (!store.state.hasLogin) {
  71 + uni.navigateTo({
  72 + url: '/pages/login/login'
  73 + })
  74 + return
  75 + }
  76 + }
  77 + if (datas.type == 'sp') {
  78 + console.log(datas.spurl)
  79 + store.commit('spurl_fuc', datas.spurl)
  80 + uni.navigateTo({
  81 + url: datas.url
  82 + })
  83 + return
  84 + }
  85 + if (datas.type == 'web') {
  86 + console.log(datas.url)
  87 + store.commit('web_url', datas.url)
  88 + uni.navigateTo({
  89 + url: '/pages/web_html/web_html'
  90 + })
  91 + return
  92 + }
  93 + if (datas.type == 2) {
  94 + uni.switchTab({
  95 + url: datas.url
  96 + })
  97 + } else if (datas.type == 3) {
  98 + uni.redirectTo({
  99 + url: datas.url
  100 + })
  101 + } else {
  102 + uni.navigateTo({
  103 + url: datas.url
  104 + })
  105 + }
  106 +}
  107 +const pveimg = function(e) {
  108 + var current = e.currentTarget.dataset.src
  109 + var urls = e.currentTarget.dataset.array
  110 +
  111 + let urls1 = []
  112 + if (urls) {
  113 + urls1 = urls
  114 +
  115 + } else {
  116 + urls1[0] = current
  117 + }
  118 + // console.log(urls1)
  119 + uni.previewImage({
  120 + current: current, // 当前显示图片的http链接
  121 + urls: urls1 // 需要预览的图片http链接列表
  122 + })
  123 +
  124 +}
  125 +const call = function(e) {
  126 + console.log(e)
  127 + // return
  128 + if (e.currentTarget.dataset.tel) {
  129 + // wx.makePhoneCall({
  130 + // phoneNumber: e.currentTarget.dataset.tel+''
  131 + // })
  132 + uni.showModal({
  133 + title: '提示',
  134 + content: '是否拨打' + e.currentTarget.dataset.tel + '?',
  135 + success: function(res) {
  136 + if (res.confirm) {
  137 + ///shops/phone_buy
  138 + // var jkurl = '/shops/phone_buy'
  139 + // var datas={
  140 + // phone:e.currentTarget.dataset.tel
  141 + // }
  142 + // P_post(jkurl, datas).then(res => {
  143 + // console.log(res)
  144 + // if (res.code == 1) {
  145 + // var datas = res.data
  146 + // console.log(typeof datas)
  147 +
  148 + // if (typeof datas == 'string') {
  149 + // datas = JSON.parse(datas)
  150 + // }
  151 +
  152 + // } else {
  153 + // if (res.msg) {
  154 + // uni.showToast({
  155 + // icon: 'none',
  156 + // title: res.msg
  157 + // })
  158 + // } else {
  159 + // uni.showToast({
  160 + // icon: 'none',
  161 + // title: '操作失败'
  162 + // })
  163 + // }
  164 + // }
  165 + // }).catch(e => {
  166 + // console.log(e)
  167 + // uni.showToast({
  168 + // icon: 'none',
  169 + // title: '操作失败'
  170 + // })
  171 + // })
  172 + wx.makePhoneCall({
  173 + phoneNumber: e.currentTarget.dataset.tel + ''
  174 + })
  175 + console.log('用户点击确定');
  176 + } else if (res.cancel) {
  177 + console.log('用户点击取消');
  178 + }
  179 + }
  180 + });
  181 + }
  182 +}
  183 +const call1 = function(e) {
  184 + console.log(e)
  185 + var datas=e.currentTarget.dataset
  186 + var jkurl = '/list/show'
  187 + var datas={
  188 + pid:datas.id
  189 + }
  190 + P_post(jkurl, datas).then(res => {
  191 + console.log(res)
  192 + if (res.code == 1) {
  193 + var datas = res.data
  194 + console.log(typeof datas)
  195 +
  196 + if (typeof datas == 'string') {
  197 + datas = JSON.parse(datas)
  198 + }
  199 + if (datas) {
  200 +
  201 + uni.showModal({
  202 + title: '提示',
  203 + content: '是否拨打' + datas + '?',
  204 + success: function(res) {
  205 + if (res.confirm) {
  206 + ///shops/phone_buy
  207 +
  208 + wx.makePhoneCall({
  209 + phoneNumber: datas + ''
  210 + })
  211 + console.log('用户点击确定');
  212 + } else if (res.cancel) {
  213 + console.log('用户点击取消');
  214 + }
  215 + }
  216 + });
  217 + }else{
  218 + uni.showToast({
  219 + icon:'none',
  220 + title:'手机号不存在'
  221 + })
  222 + }
  223 + } else {
  224 + if(res.code==-3){
  225 + uni.showToast({
  226 + icon: 'none',
  227 + title: '请先购买会员'
  228 + })
  229 + return
  230 + }
  231 + if (res.msg) {
  232 + uni.showToast({
  233 + icon: 'none',
  234 + title: res.msg
  235 + })
  236 + } else {
  237 + uni.showToast({
  238 + icon: 'none',
  239 + title: '操作失败'
  240 + })
  241 + }
  242 + }
  243 + }).catch(e => {
  244 + console.log(e)
  245 + uni.showToast({
  246 + icon: 'none',
  247 + title: '操作失败'
  248 + })
  249 + })
  250 + // return
  251 +
  252 +}
  253 +// 微信登录
  254 +const wxlogin = function(num) {
  255 + var that = this
  256 + if (num == 1) {
  257 + uni.showLoading({
  258 + mask: true,
  259 + title: '正在登录'
  260 + })
  261 + }
  262 + return new Promise((resolve, reject) => {
  263 + if (num == 'token') {
  264 + var data = {
  265 + 'token':uni.getStorageSync('token'),
  266 +
  267 + type: 2
  268 + }
  269 +
  270 + uni.request({
  271 + url: IPurl + '/login',
  272 + data: data,
  273 + header: {
  274 + 'content-type': 'application/x-www-form-urlencoded',
  275 +
  276 + },
  277 + dataType: 'json',
  278 + method: 'POST',
  279 + success(res) {
  280 + uni.hideLoading()
  281 + console.log(res.data)
  282 + if (res.data.code == -1) {
  283 + store.commit('logout')
  284 + uni.navigateTo({
  285 + url: '/pages/login/login'
  286 + })
  287 + return
  288 + }
  289 + // if (res.data.code == -2) {
  290 + // if (num == 1) {
  291 + // uni.redirectTo({
  292 + // url: '/pages/login_tel/login_tel?nickname=' + uinfo.nickName + '&avatarurl=' + uinfo.avatarUrl
  293 + // })
  294 + // } else {
  295 + // uni.navigateTo({
  296 + // url: '/pages/login_tel/login_tel?nickname=' + uinfo.nickName + '&avatarurl=' + uinfo.avatarUrl
  297 + // })
  298 + // }
  299 + // return
  300 + // }
  301 + if (res.data.code == 1) {
  302 + console.log('登录成功')
  303 + uni.setStorageSync('identity', res.data.data.identity)
  304 + uni.setStorageSync('token', res.data.data.token)
  305 +
  306 +
  307 + store.commit('login', res.data.data)
  308 + } else {
  309 + uni.removeStorageSync('userInfo')
  310 + uni.removeStorageSync('token')
  311 + uni.showToast({
  312 + icon: 'none',
  313 + title: '登录失败',
  314 + })
  315 + }
  316 + resolve(res.data)
  317 + },
  318 + fail(err) {
  319 + uni.hideLoading()
  320 + uni.showToast({
  321 + icon: 'none',
  322 + title: '登录失败'
  323 + })
  324 + reject(err)
  325 + }
  326 + })
  327 + } else {
  328 + var userInfo = uni.getStorageSync('userInfo')
  329 + if (!userInfo) {
  330 +
  331 + } else {
  332 + uni.login({
  333 + success: function(res) {
  334 + // console.log(res)
  335 + // return
  336 + // 发送 res.code 到后台换取 openId, sessionKey, unionId
  337 + var uinfo = userInfo
  338 + let data = {
  339 + js_code: res.code,
  340 + nick: uinfo.nickName,
  341 + img: uinfo.avatarUrl
  342 + }
  343 + if (num == 'token') {
  344 + data = {
  345 + token: uni.getStorageSync('token')
  346 + }
  347 + }
  348 + let rcode = res.code
  349 + console.log(res.code)
  350 + uni.request({
  351 + url: IPurl + '/sign/wx_register',
  352 + data: data,
  353 + header: {
  354 + 'content-type': 'application/x-www-form-urlencoded'
  355 + },
  356 + dataType: 'json',
  357 + method: 'POST',
  358 + success(res) {
  359 + uni.hideLoading()
  360 + console.log(res.data)
  361 + if (res.data.code == -2) {
  362 + uni.showToast({
  363 + icon:'none',
  364 + title:'请绑定手机号'
  365 + })
  366 +
  367 + setTimeout(()=>{
  368 + if (num == 1) {
  369 + uni.redirectTo({
  370 + url: '/pages/login_tel/login_tel?nickname=' + uinfo.nickName + '&avatarurl=' + uinfo.avatarUrl
  371 + })
  372 + } else {
  373 + uni.navigateTo({
  374 + url: '/pages/login_tel/login_tel?nickname=' + uinfo.nickName + '&avatarurl=' + uinfo.avatarUrl
  375 + })
  376 + }
  377 + },1000)
  378 + return
  379 + }
  380 + if (res.data.code == 1) {
  381 + /*{
  382 + "code":1,"msg":"success",
  383 + "data":
  384 + {"img":"https:\/\/thirdwx.qlogo.cn\/mmopen\/vi_32\/Q0j4TwGTfTLQyUDQBFgtqQlBSNEr4WJJqhslupYjMr1ojdUAPC0iaibmj2CICmC7aV6M5MG8nKFliaibxNAxJGSYXA\/132",
  385 + "nick":"问心",
  386 + "token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjozLCJhdWQiOiJZXyIsImlhdCI6MTYyMzk4NTYzMSwibmJmIjoxNjIzOTg1NjMxLCJleHAiOjE2MjM5OTI4MzF9.BCuXb7D3Uyryt8DPf6pT_ptMWCYyX6aufx2MH218jZ4"}}
  387 + */
  388 + console.log('登录成功')
  389 + console.log(res.data)
  390 + uni.setStorageSync('token', res.data.data.token)
  391 +
  392 +
  393 + store.commit('login', res.data.data)
  394 +
  395 +
  396 + if (num == 1) {
  397 + uni.showToast({
  398 + icon: 'none',
  399 + title: '登录成功'
  400 + })
  401 + setTimeout(() => {
  402 + uni.navigateBack()
  403 + }, 1000)
  404 + }
  405 + } else {
  406 + uni.removeStorageSync('userInfo')
  407 + uni.removeStorageSync('token')
  408 + uni.showToast({
  409 + icon: 'none',
  410 + title: '登录失败',
  411 + })
  412 + }
  413 +
  414 + },
  415 + fail(err) {
  416 + uni.hideLoading()
  417 + uni.showToast({
  418 + icon: 'none',
  419 + title: '登录失败'
  420 + })
  421 + reject(err)
  422 + }
  423 + })
  424 + }
  425 + })
  426 + }
  427 + return
  428 +
  429 + }
  430 + })
  431 +}
  432 +// 手机号登录
  433 +const login_tel = function(num) {
  434 + var datas
  435 + var tel
  436 + var password
  437 + /*if(uni.getStorageSync('tel')){
  438 + tel= uni.getStorageSync('tel')
  439 + password= uni.getStorageSync('password')
  440 + datas = {
  441 + type:3,
  442 + phone: tel,
  443 + password: password
  444 + }
  445 + }else{
  446 + return
  447 + }*/
  448 + if(!uni.getStorageSync('token')){
  449 + return
  450 + }else{
  451 +
  452 + }
  453 + // var jkurl = '/login/login'
  454 + var jkurl = '/login'
  455 + var loginDatas=uni.getStorageSync('userinfo')
  456 + var cid=''
  457 + // #ifdef APP-PLUS
  458 + // 获取客户端标识信息
  459 + var info = plus.push.getClientInfo();
  460 + console.log(info)
  461 + cid=info.clientid
  462 + // #endif
  463 + datas={
  464 + type:5,
  465 + token:uni.getStorageSync('token')||'',
  466 + cid:cid
  467 + }
  468 + P_post(jkurl, datas).then(res => {
  469 + console.log(res)
  470 + if (res.code == 1) {
  471 + var datas = res.data
  472 + console.log(typeof datas)
  473 +
  474 + if (typeof datas == 'string') {
  475 + datas = JSON.parse(datas)
  476 + }
  477 + console.log('登录成功')
  478 + // uni.setStorageSync('token', datas.token)
  479 + // uni.setStorageSync('userId', datas.id)
  480 + // uni.setStorageSync('tel', tel)
  481 + // uni.setStorageSync('password', password)
  482 + uni.setStorageSync('token', datas.token)
  483 + store.commit('login', datas)
  484 + // store.commit('login', datas.nickname)
  485 + // setTimeout(() => {
  486 + // uni.navigateBack({
  487 + // delta: 1
  488 + // })
  489 + // }, 1000)
  490 +
  491 + } else {
  492 + if (res.msg) {
  493 + uni.showToast({
  494 + icon: 'none',
  495 + title: res.msg
  496 + })
  497 + } else {
  498 + uni.showToast({
  499 + icon: 'none',
  500 + title: '操作失败'
  501 + })
  502 + }
  503 + }
  504 + }).catch(e => {
  505 + console.log(e)
  506 + uni.showToast({
  507 + icon: 'none',
  508 + title: '操作失败'
  509 + })
  510 + })
  511 +}
  512 +const setUsermsg = function(data) {
  513 + var jkurl = '/user/amendInfo'
  514 +
  515 + post(jkurl, data,
  516 + function(res) {
  517 +
  518 + // if (res.data.code == 1) {
  519 + if (res.data.code == 1) {
  520 + var datas = res.data.data
  521 + // console.log(typeof datas)
  522 +
  523 + if (typeof datas == 'string') {
  524 + datas = JSON.parse(datas)
  525 + }
  526 + wxlogin()
  527 + uni.showToast({
  528 + title: '操作成功'
  529 + })
  530 +
  531 + } else {
  532 + if (res.data.msg) {
  533 + uni.showToast({
  534 + icon: 'none',
  535 + title: res.data.msg
  536 + })
  537 + } else {
  538 + uni.showToast({
  539 + icon: 'none',
  540 + title: '操作失败'
  541 + })
  542 + }
  543 + }
  544 + },
  545 + function(err) {
  546 + that.btnkg = 0
  547 +
  548 + uni.showToast({
  549 + icon: 'none',
  550 + title: '获取数据失败'
  551 + })
  552 +
  553 + }
  554 + )
  555 +}
  556 +
  557 +
  558 +const wx_upload = function(tximg,type) {
  559 + return new Promise((resolve, reject) => {
  560 + uni.showLoading({
  561 + mask: true,
  562 + title: '正在上传'
  563 + })
  564 + // #ifndef H5
  565 + console.log(tximg)
  566 + var jkurl='login/upload'
  567 +
  568 + uni.uploadFile({
  569 + url: IPurl + jkurl,
  570 + filePath: tximg,
  571 + name: 'file',
  572 + header: header,
  573 + formData: {
  574 + token: uni.getStorageSync('token')
  575 + },
  576 + // success: (uploadFileRes) => {
  577 + // console.log(uploadFileRes.data);
  578 + // var ndata = JSON.parse(uploadFileRes.data)
  579 + // resolve(uploadFileRes)
  580 + // },
  581 + complete: (res) => {
  582 + uni.hideLoading();
  583 + uni.stopPullDownRefresh(); //慎用hideLoading,会关闭wx.showToast弹窗
  584 + // console.log(`耗时${Date.now() - timeStart}`);
  585 + console.log(res)
  586 + if (res.statusCode == 200) { //请求成功
  587 + var ndata = JSON.parse(res.data)
  588 + if (ndata.code == -1) {
  589 + store.commit('logout')
  590 + uni.navigateTo({
  591 + url: '/pagesC_mxx/login/login'
  592 + })
  593 + return
  594 + } else if (ndata.code == 0) {
  595 + if (ndata.msg) {
  596 +
  597 + uni.showToast({
  598 + icon: 'none',
  599 + title: ndata.msg
  600 + })
  601 + } else {
  602 +
  603 + uni.showToast({
  604 + icon: 'none',
  605 + title: '操作失败'
  606 + })
  607 + }
  608 + }
  609 + resolve(ndata)
  610 + } else {
  611 + reject(res);
  612 + }
  613 + }
  614 + });
  615 + // #endif
  616 + // #ifdef H5
  617 + uni.request({
  618 + url: tximg,
  619 + method: 'GET',
  620 +
  621 + responseType: 'arraybuffer',
  622 + success: (res) => {
  623 + let base64 = wx.arrayBufferToBase64(res.data); //把arraybuffer转成base64
  624 + console.log('base64')
  625 + // console.log(base64)
  626 + base64 = 'data:image/jpeg;base64,' + base64; //不加上这串字符,在页面无法显示
  627 + // return base64
  628 + var datas={
  629 + base64_img:base64,
  630 + // type:1,
  631 + }
  632 + var jkurl='/login/uploadbase'
  633 + // if(type==1){
  634 + // jkurl='Sign/video'
  635 + // }
  636 + var jkurls=IPurl + jkurl
  637 + // var jkurl='https://yibeitong.com.aa.800123456.top/api/'+'/upload/base64Img'
  638 + console.log('h5 upload')
  639 + uni.request({
  640 + url: jkurls,
  641 + data: datas,
  642 + method: 'POST',
  643 + header: {
  644 + 'content-type': 'application/x-www-form-urlencoded'
  645 + },
  646 + complete: (res) => {
  647 + uni.hideLoading();
  648 + uni.stopPullDownRefresh(); //慎用hideLoading,会关闭wx.showToast弹窗
  649 + console.log(res)
  650 + if (res.statusCode == 200) { //请求成功
  651 + console.log(res)
  652 + if (res.data.code == 0) {
  653 + if (res.data.msg) {
  654 +
  655 + uni.showToast({
  656 + icon: 'none',
  657 + title: res.data.msg
  658 + })
  659 + } else {
  660 +
  661 + uni.showToast({
  662 + icon: 'none',
  663 + title: '操作失败'
  664 + })
  665 + }
  666 + }
  667 + resolve(res.data)
  668 + } else {
  669 + reject(res);
  670 + }
  671 + }
  672 + })
  673 + // 单个请求
  674 + // P_post(jkurl, datas).then(res => {
  675 + // resolve(ndata)
  676 + // }).catch(e => {
  677 + // reject(res);
  678 + // })
  679 + },
  680 + fail: (err) => {
  681 + console.log(err)
  682 + }
  683 + });
  684 +
  685 + // #endif
  686 + })
  687 +
  688 +}
  689 +
  690 +
  691 +
  692 +
  693 +/**
  694 + * @description 配置接口请求的公共方法
  695 + * @example
  696 + * example
  697 + * @param {String} url = '' 接口请求地址
  698 + * @param {String} param = {} 接口请求参数
  699 + * @param {String} header = {} 接口请求头
  700 + * @param {String} method = [get|post] 可选值域包括get和post,get是直接请求,post是提交数据
  701 + * @author: wenxin
  702 + * @createTime: 2021-4-6 15:09:19
  703 + */
  704 +const http = ({
  705 + url = '',
  706 + param = {},
  707 + method = '',
  708 + header = {
  709 + 'content-type': 'application/x-www-form-urlencoded',
  710 + // 'token':uni.getStorageSync('token')||''
  711 + }
  712 +
  713 +
  714 +} = {}) => {
  715 + // console.log(header)
  716 + let timeStart = Date.now();
  717 + return new Promise((resolve, reject) => {
  718 + // console.log('请求url:' + getUrl(url));
  719 +
  720 + // console.log("请求头:", header)
  721 + // console.log("param:", param)
  722 + param={
  723 + token:uni.getStorageSync('token')||'',
  724 +
  725 + ...param
  726 +
  727 + }
  728 +
  729 + uni.request({
  730 + url: getUrl(url),
  731 + data: param,
  732 + method: method,
  733 + header: header,
  734 + success: (res) => {
  735 + // console.log(res)
  736 + uni.hideLoading();
  737 + uni.stopPullDownRefresh(); //慎用hideLoading,会关闭wx.showToast弹窗
  738 + // if(res.data.code==-3){
  739 + // uni.showToast({
  740 + // icon: 'none',
  741 + // title: '请先购买会员'
  742 + // })
  743 + // setTimeout(()=>{
  744 + // uni.navigateTo({
  745 + // url:'/pages/my_vip/my_vip?type=2'
  746 + // })
  747 + // },1000)
  748 + // return
  749 + // }
  750 + if (res.data.code == -1) {
  751 + uni.showToast({
  752 + title:res.data.msg,
  753 + icon:'none'
  754 + })
  755 + setTimeout(function(){
  756 + store.commit('logout')
  757 + uni.navigateTo({
  758 + url: '/pages/login/login'
  759 + })
  760 + },1000)
  761 +
  762 + return
  763 + } else if (res.data.code == 0 && res.msg == '请先登录账号~') {
  764 + uni.navigateTo({
  765 + url: '/pages/login/login'
  766 + })
  767 + return
  768 + } else if (res.data.code == 0) {
  769 + if (res.data.msg) {
  770 +
  771 + uni.showToast({
  772 + icon: 'none',
  773 + title: res.data.msg
  774 + })
  775 + } else {
  776 +
  777 + uni.showToast({
  778 + icon: 'none',
  779 + title: '操作失败'
  780 + })
  781 + }
  782 + }
  783 + // if(res.data.code == 2){
  784 + // uni.showModal({
  785 + // title: '提示',
  786 + // content: res.data.msg,
  787 + // showCancel:false,
  788 + // confirmText:'关闭',
  789 + // success: function (res) {
  790 + // if (res.confirm) {
  791 + // console.log('用户点击确定');
  792 + // } else if (res.cancel) {
  793 + // console.log('用户点击取消');
  794 + // }
  795 + // }
  796 + // });
  797 + // }
  798 + resolve(res.data)
  799 + },
  800 + fail: (err) => {
  801 + uni.hideLoading()
  802 + uni.stopPullDownRefresh()
  803 + if(!reject){
  804 + uni.showToast({
  805 + icon: 'none',
  806 + title: '系统异常错误'
  807 + })
  808 + return
  809 + }
  810 + reject(err)
  811 + },
  812 + /*complete: (res) => {
  813 + uni.hideLoading();
  814 + uni.stopPullDownRefresh(); //慎用hideLoading,会关闭wx.showToast弹窗
  815 + console.log(`耗时${Date.now() - timeStart}`);
  816 + console.log(res)
  817 + if (res.statusCode == 200) { //请求成功
  818 + console.log(res)
  819 + if (res.data.code == -1) {
  820 + store.commit('logout')
  821 + // #ifdef MP-WEIXIN
  822 + uni.navigateTo({
  823 + url: '/pages/login/login'
  824 + })
  825 + // #endif
  826 + // #ifndef MP-WEIXIN
  827 + uni.navigateTo({
  828 + url: '/pages/login/login'
  829 + })
  830 + // #endif
  831 + return
  832 + } else if (res.data.code == 0 && res.msg == '请先登录账号~') {
  833 + // #ifdef MP-WEIXIN
  834 + uni.navigateTo({
  835 + url: '/pages/login/login'
  836 + })
  837 + // #endif
  838 + // #ifndef MP-WEIXIN
  839 + uni.navigateTo({
  840 + url: '/pages/login/login'
  841 + })
  842 + // #endif
  843 + return
  844 + } else if (res.data.code == 0) {
  845 + if (res.data.msg) {
  846 +
  847 + uni.showToast({
  848 + icon: 'none',
  849 + title: res.data.msg
  850 + })
  851 + } else {
  852 +
  853 + uni.showToast({
  854 + icon: 'none',
  855 + title: '操作失败'
  856 + })
  857 + }
  858 + }
  859 + resolve(res.data)
  860 + } else {
  861 + reject(res);
  862 + }
  863 + }*/
  864 + })
  865 + })
  866 +}
  867 +// 获取url
  868 +const getUrl = (url) => {
  869 + if (!url) {
  870 + return url
  871 + }
  872 + if (url.slice(0, 1) == "/") {
  873 + // console.log(true);
  874 + url = url.substr(1);
  875 + }
  876 + if (url.indexOf('://') == -1) {
  877 + url = IPurl + url;
  878 + }
  879 + return url;
  880 +}
  881 +//暴露出去调用的方法
  882 +
  883 +
  884 +/**
  885 + * @description get方法
  886 + * @example
  887 + * example
  888 + * @param {String} url = '' 接口请求地址
  889 + * @param {String} param = 请求参数
  890 + * @author: wenxin
  891 + * @createTime: 2021-4-6 15:07:33
  892 + */
  893 +const P_get = (url, param = {},header) => {
  894 + if (!param.load_mode) {
  895 + wx.showLoading({
  896 + title: '请求中,请耐心等待...',
  897 + });
  898 + }
  899 + return http({
  900 + url,
  901 + param,
  902 + method: 'GET',
  903 + header
  904 + })
  905 +}
  906 +/**
  907 + * @description post方法
  908 + * @example
  909 + * example
  910 + * @param {String} url = '' 接口请求地址
  911 + * @param {String} param = 请求参数
  912 + * @author: wenxin
  913 + * @createTime: 2021-4-6 15:07:33
  914 + */
  915 +const P_post = (url, param = {},header) => {
  916 + return http({
  917 + url,
  918 + param,
  919 + method: "POST",
  920 + header
  921 + })
  922 +}
  923 +
  924 +const P_put = (url, param = {}) => {
  925 + return http({
  926 + url,
  927 + param,
  928 + method: 'put'
  929 + })
  930 +}
  931 +
  932 +const P_delete = (url, param = {}) => {
  933 + return http({
  934 + url,
  935 + param,
  936 + method: 'put'
  937 + })
  938 +}
  939 +// // 单个请求
  940 +// service.P_get('/cate/list').then(res => {
  941 +// console.log(res)
  942 +// }).catch(e => {
  943 +// console.log(e)
  944 +// })
  945 +
  946 +// // 一个页面多个请求
  947 +// Promise.all([
  948 +// service.P_get('/cate/list'),
  949 +// service.P_get(`detail/${id}`)
  950 +// ]).then(result => {
  951 +// console.log(result)
  952 +// }).catch(e => {
  953 +// console.log(e)
  954 +// })
  955 +const getimg = function(img,type) {
  956 + // return img
  957 +
  958 +
  959 +
  960 + if (!img) return
  961 + if (!type) {
  962 + type = ','
  963 + }
  964 + if(type!='arr'){
  965 +
  966 + img = img.split(type)
  967 + }
  968 + // console.log(imgurl+img)
  969 + if (img[0].indexOf('://') == -1) {
  970 + img = imgurl + img[0]
  971 + }else{
  972 + img = img[0]
  973 + }
  974 + return img
  975 +}
  976 +const getimgarr = function(imgs, type) {
  977 + if (!imgs) return
  978 + if (!type) {
  979 + type = ','
  980 + }
  981 + if(type!='arr'){
  982 +
  983 + imgs = imgs.split(type)
  984 + }
  985 + // console.log(imgurl+img)
  986 + var newimgs = []
  987 + for (var i = 0; i < imgs.length; i++) {
  988 + var img = imgs[i]
  989 + if (img.indexOf('://') == -1) {
  990 + img = imgurl + img
  991 + }
  992 + newimgs.push(img)
  993 + }
  994 + // console.log(newimgs)
  995 + return newimgs
  996 +}
  997 +const gettime = function(mj, join_msg,timetype) {
  998 + if (!mj) {
  999 + return ''
  1000 + }
  1001 + if(!join_msg){
  1002 + join_msg='-'
  1003 + }
  1004 + var ntime = new Date(mj * 1000)
  1005 + // console.log(ntime)
  1006 + var n_year = ntime.getFullYear();
  1007 + var n_month = ntime.getMonth() + 1;
  1008 + var n_date = ntime.getDate();
  1009 + var n_hour = ntime.getHours();
  1010 + var n_minute = ntime.getMinutes();
  1011 + n_month=n_month<10? '0'+n_month:n_month
  1012 + n_date = n_date < 10 ? '0' + n_date : n_date
  1013 + n_hour = n_hour < 10 ? '0' + n_hour : n_hour
  1014 + n_minute = n_minute < 10 ? '0' + n_minute : n_minute
  1015 + if(timetype=='ymd'){
  1016 + return n_year+join_msg+n_month+join_msg+n_date
  1017 + }
  1018 + if(timetype=='hm'){
  1019 + return n_hour+':'+n_minute
  1020 + }
  1021 + return n_year+join_msg+n_month+join_msg+n_date+' '+n_hour+':'+n_minute
  1022 +
  1023 + var time = new Date();
  1024 + var year = time.getFullYear();
  1025 + var month = time.getMonth() + 1;
  1026 + var date = time.getDate();
  1027 + var hour = time.getHours();
  1028 + var minute = time.getMinutes();
  1029 + // n_month=n_month<10? '0'+n_month:n_month
  1030 + n_date = n_date < 10 ? '0' + n_date : n_date
  1031 + n_hour = n_hour < 10 ? '0' + n_hour : n_hour
  1032 + n_minute = n_minute < 10 ? '0' + n_minute : n_minute
  1033 + if (n_year == year) {
  1034 +
  1035 + return {
  1036 + type: 1,
  1037 + year: n_year,
  1038 + month: n_month,
  1039 + date: n_date,
  1040 + hour: n_hour,
  1041 + minute: n_minute,
  1042 + time: '今天 ' + n_hour + ':' + n_minute
  1043 + }
  1044 + } else {
  1045 +
  1046 + return {
  1047 + type: 2,
  1048 + year: n_year,
  1049 + month: n_month,
  1050 + date: n_date,
  1051 + hour: n_hour,
  1052 + minute: n_minute,
  1053 + time: n_year + '-' + n_month + '-' + n_date
  1054 + }
  1055 + }
  1056 +}
  1057 +
  1058 +
  1059 +const get_fwb = function(str) {
  1060 + if (!str) {
  1061 + return
  1062 + }
  1063 + str = str // .replace(/<p([\s\w"=\/\.:;]+)((?:(style="[^"]+")))/ig, '<p')
  1064 + .replace(/<br\/>/ig, '<view style="width:100%;height:15upx;"></view>')
  1065 + .replace(/<br \/>/ig, '<view style="width:100%;height:15upx;"></view>')
  1066 + .replace(/<p([\s\w"-=\/\.:;]+)((?:(class="[^"]+")))/ig, '<p $1')
  1067 + .replace(/<p([\s\w"-=\/\.:;]+)/ig, '<p$1 class="xcx_fwb_p"')
  1068 + // .replace(/<div([\s\w"=\/\.:;]+)((?:(style="[^"]+")))/ig, '<div')
  1069 + .replace(/<div([\s\w"-=\/\.:;]+)((?:(class="[^"]+")))/ig, '<div $1')
  1070 + .replace(/<div([\s\w"-=\/\.:;]+)/ig, '<div$1 class="xcx_fwb_div"')
  1071 +
  1072 + // .replace(/<img([\s\w"-=\/\.:;]+)((?:(height="[^"]+")))/ig, '<img $1')
  1073 + // .replace(/<img([\s\w"-=\/\.:;]+)((?:(width="[^"]+")))/ig, '<img $1')
  1074 + // .replace(/<img([\s\w"-=\/\.:;]+)((?:(style="[^"]+")))/ig, '<img $1')
  1075 + .replace(/<img([\s\w"-=\/\.:;]+)((?:(alt="[^"]+")))/ig, '<img $1')
  1076 + .replace(/<img([\s\w"-=\/\.:;]+)((?:(class="[^"]+")))/ig, '<img $1')
  1077 + .replace(/<img([\s\w"-=\/\.:;]+)/ig, '<img class="xcx_fwb_img" $1 ')
  1078 + return str
  1079 +}
  1080 +
  1081 +
  1082 +
  1083 +//pay
  1084 +const wxpay=function (datas,type){
  1085 + if(!datas) return
  1086 + uni.showLoading({
  1087 + mask:true,
  1088 + title:'正在拉起支付'
  1089 + })
  1090 + if (typeof datas == 'string') {
  1091 + datas = JSON.parse(datas)
  1092 + }
  1093 + return new Promise((resolve,reject)=>{
  1094 + uni.hideLoading()
  1095 + uni.requestPayment({
  1096 + provider: 'wxpay',
  1097 + timeStamp: datas.timeStamp||String(Date.now()),
  1098 + nonceStr: datas.nonceStr,
  1099 + package: datas.package,
  1100 + signType: datas.signType,
  1101 + paySign: datas.paySign,
  1102 + success: function (res) {
  1103 + console.log('success:' + JSON.stringify(res));
  1104 + resolve(res)
  1105 +
  1106 + },
  1107 + fail: function (err) {
  1108 + if(!reject){
  1109 + uni.showToast({
  1110 + icon: 'none',
  1111 + title: '微信支付失败'
  1112 + })
  1113 + }else{
  1114 +
  1115 + reject(err);
  1116 + }
  1117 + console.log('fail:' + JSON.stringify(err));
  1118 + }
  1119 + });
  1120 + })
  1121 +
  1122 +}
  1123 +
  1124 +const emojiList1 = [
  1125 + [{
  1126 + "url": "100.gif",
  1127 + alt: "[微笑]"
  1128 + }, {
  1129 + "url": "101.gif",
  1130 + alt: "[伤心]"
  1131 + }, {
  1132 + "url": "102.gif",
  1133 + alt: "[美女]"
  1134 + }, {
  1135 + "url": "103.gif",
  1136 + alt: "[发呆]"
  1137 + }, {
  1138 + "url": "104.gif",
  1139 + alt: "[墨镜]"
  1140 + }, {
  1141 + "url": "105.gif",
  1142 + alt: "[哭]"
  1143 + }, {
  1144 + "url": "106.gif",
  1145 + alt: "[羞]"
  1146 + }, {
  1147 + "url": "107.gif",
  1148 + alt: "[哑]"
  1149 + }, {
  1150 + "url": "108.gif",
  1151 + alt: "[睡]"
  1152 + }, {
  1153 + "url": "109.gif",
  1154 + alt: "[哭]"
  1155 + }, {
  1156 + "url": "110.gif",
  1157 + alt: "[囧]"
  1158 + }, {
  1159 + "url": "111.gif",
  1160 + alt: "[怒]"
  1161 + }, {
  1162 + "url": "112.gif",
  1163 + alt: "[调皮]"
  1164 + }, {
  1165 + "url": "113.gif",
  1166 + alt: "[笑]"
  1167 + }, {
  1168 + "url": "114.gif",
  1169 + alt: "[惊讶]"
  1170 + }, {
  1171 + "url": "115.gif",
  1172 + alt: "[难过]"
  1173 + }, {
  1174 + "url": "116.gif",
  1175 + alt: "[酷]"
  1176 + }, {
  1177 + "url": "117.gif",
  1178 + alt: "[汗]"
  1179 + }, {
  1180 + "url": "118.gif",
  1181 + alt: "[抓狂]"
  1182 + }, {
  1183 + "url": "119.gif",
  1184 + alt: "[吐]"
  1185 + }, {
  1186 + "url": "120.gif",
  1187 + alt: "[笑]"
  1188 + }, {
  1189 + "url": "121.gif",
  1190 + alt: "[快乐]"
  1191 + }, {
  1192 + "url": "122.gif",
  1193 + alt: "[奇]"
  1194 + }, {
  1195 + "url": "123.gif",
  1196 + alt: "[傲]"
  1197 + }],
  1198 + [{
  1199 + "url": "124.gif",
  1200 + alt: "[饿]"
  1201 + }, {
  1202 + "url": "125.gif",
  1203 + alt: "[累]"
  1204 + }, {
  1205 + "url": "126.gif",
  1206 + alt: "[吓]"
  1207 + }, {
  1208 + "url": "127.gif",
  1209 + alt: "[汗]"
  1210 + }, {
  1211 + "url": "128.gif",
  1212 + alt: "[高兴]"
  1213 + }, {
  1214 + "url": "129.gif",
  1215 + alt: "[闲]"
  1216 + }, {
  1217 + "url": "130.gif",
  1218 + alt: "[努力]"
  1219 + }, {
  1220 + "url": "131.gif",
  1221 + alt: "[骂]"
  1222 + }, {
  1223 + "url": "132.gif",
  1224 + alt: "[疑问]"
  1225 + }, {
  1226 + "url": "133.gif",
  1227 + alt: "[秘密]"
  1228 + }, {
  1229 + "url": "134.gif",
  1230 + alt: "[乱]"
  1231 + }, {
  1232 + "url": "135.gif",
  1233 + alt: "[疯]"
  1234 + }, {
  1235 + "url": "136.gif",
  1236 + alt: "[哀]"
  1237 + }, {
  1238 + "url": "137.gif",
  1239 + alt: "[鬼]"
  1240 + }, {
  1241 + "url": "138.gif",
  1242 + alt: "[打击]"
  1243 + }, {
  1244 + "url": "139.gif",
  1245 + alt: "[bye]"
  1246 + }, {
  1247 + "url": "140.gif",
  1248 + alt: "[汗]"
  1249 + }, {
  1250 + "url": "141.gif",
  1251 + alt: "[抠]"
  1252 + }, {
  1253 + "url": "142.gif",
  1254 + alt: "[鼓掌]"
  1255 + }, {
  1256 + "url": "143.gif",
  1257 + alt: "[糟糕]"
  1258 + }, {
  1259 + "url": "144.gif",
  1260 + alt: "[恶搞]"
  1261 + }, {
  1262 + "url": "145.gif",
  1263 + alt: "[什么]"
  1264 + }, {
  1265 + "url": "146.gif",
  1266 + alt: "[什么]"
  1267 + }, {
  1268 + "url": "147.gif",
  1269 + alt: "[累]"
  1270 + }],
  1271 + [{
  1272 + "url": "148.gif",
  1273 + alt: "[看]"
  1274 + }, {
  1275 + "url": "149.gif",
  1276 + alt: "[难过]"
  1277 + }, {
  1278 + "url": "150.gif",
  1279 + alt: "[难过]"
  1280 + }, {
  1281 + "url": "151.gif",
  1282 + alt: "[坏]"
  1283 + }, {
  1284 + "url": "152.gif",
  1285 + alt: "[亲]"
  1286 + }, {
  1287 + "url": "153.gif",
  1288 + alt: "[吓]"
  1289 + }, {
  1290 + "url": "154.gif",
  1291 + alt: "[可怜]"
  1292 + }, {
  1293 + "url": "155.gif",
  1294 + alt: "[刀]"
  1295 + }, {
  1296 + "url": "156.gif",
  1297 + alt: "[水果]"
  1298 + }, {
  1299 + "url": "157.gif",
  1300 + alt: "[酒]"
  1301 + }, {
  1302 + "url": "158.gif",
  1303 + alt: "[篮球]"
  1304 + }, {
  1305 + "url": "159.gif",
  1306 + alt: "[乒乓]"
  1307 + }, {
  1308 + "url": "160.gif",
  1309 + alt: "[咖啡]"
  1310 + }, {
  1311 + "url": "161.gif",
  1312 + alt: "[美食]"
  1313 + }, {
  1314 + "url": "162.gif",
  1315 + alt: "[动物]"
  1316 + }, {
  1317 + "url": "163.gif",
  1318 + alt: "[鲜花]"
  1319 + }, {
  1320 + "url": "164.gif",
  1321 + alt: "[枯]"
  1322 + }, {
  1323 + "url": "165.gif",
  1324 + alt: "[唇]"
  1325 + }, {
  1326 + "url": "166.gif",
  1327 + alt: "[爱]"
  1328 + }, {
  1329 + "url": "167.gif",
  1330 + alt: "[分手]"
  1331 + }, {
  1332 + "url": "168.gif",
  1333 + alt: "[生日]"
  1334 + }, {
  1335 + "url": "169.gif",
  1336 + alt: "[电]"
  1337 + }, {
  1338 + "url": "170.gif",
  1339 + alt: "[炸弹]"
  1340 + }, {
  1341 + "url": "171.gif",
  1342 + alt: "[刀子]"
  1343 + }],
  1344 + [{
  1345 + "url": "172.gif",
  1346 + alt: "[足球]"
  1347 + }, {
  1348 + "url": "173.gif",
  1349 + alt: "[瓢虫]"
  1350 + }, {
  1351 + "url": "174.gif",
  1352 + alt: "[翔]"
  1353 + }, {
  1354 + "url": "175.gif",
  1355 + alt: "[月亮]"
  1356 + }, {
  1357 + "url": "176.gif",
  1358 + alt: "[太阳]"
  1359 + }, {
  1360 + "url": "177.gif",
  1361 + alt: "[礼物]"
  1362 + }, {
  1363 + "url": "178.gif",
  1364 + alt: "[抱抱]"
  1365 + }, {
  1366 + "url": "179.gif",
  1367 + alt: "[拇指]"
  1368 + }, {
  1369 + "url": "180.gif",
  1370 + alt: "[贬低]"
  1371 + }, {
  1372 + "url": "181.gif",
  1373 + alt: "[握手]"
  1374 + }, {
  1375 + "url": "182.gif",
  1376 + alt: "[剪刀手]"
  1377 + }, {
  1378 + "url": "183.gif",
  1379 + alt: "[抱拳]"
  1380 + }, {
  1381 + "url": "184.gif",
  1382 + alt: "[勾引]"
  1383 + }, {
  1384 + "url": "185.gif",
  1385 + alt: "[拳头]"
  1386 + }, {
  1387 + "url": "186.gif",
  1388 + alt: "[小拇指]"
  1389 + }, {
  1390 + "url": "187.gif",
  1391 + alt: "[拇指八]"
  1392 + }, {
  1393 + "url": "188.gif",
  1394 + alt: "[食指]"
  1395 + }, {
  1396 + "url": "189.gif",
  1397 + alt: "[ok]"
  1398 + }, {
  1399 + "url": "190.gif",
  1400 + alt: "[情侣]"
  1401 + }, {
  1402 + "url": "191.gif",
  1403 + alt: "[爱心]"
  1404 + }, {
  1405 + "url": "192.gif",
  1406 + alt: "[蹦哒]"
  1407 + }, {
  1408 + "url": "193.gif",
  1409 + alt: "[颤抖]"
  1410 + }, {
  1411 + "url": "194.gif",
  1412 + alt: "[怄气]"
  1413 + }, {
  1414 + "url": "195.gif",
  1415 + alt: "[跳舞]"
  1416 + }],
  1417 + [{
  1418 + "url": "196.gif",
  1419 + alt: "[发呆]"
  1420 + }, {
  1421 + "url": "197.gif",
  1422 + alt: "[背着]"
  1423 + }, {
  1424 + "url": "198.gif",
  1425 + alt: "[伸手]"
  1426 + }, {
  1427 + "url": "199.gif",
  1428 + alt: "[耍帅]"
  1429 + }, {
  1430 + "url": "200.png",
  1431 + alt: "[微笑]"
  1432 + }, {
  1433 + "url": "201.png",
  1434 + alt: "[生病]"
  1435 + }, {
  1436 + "url": "202.png",
  1437 + alt: "[哭泣]"
  1438 + }, {
  1439 + "url": "203.png",
  1440 + alt: "[吐舌]"
  1441 + }, {
  1442 + "url": "204.png",
  1443 + alt: "[迷糊]"
  1444 + }, {
  1445 + "url": "205.png",
  1446 + alt: "[瞪眼]"
  1447 + }, {
  1448 + "url": "206.png",
  1449 + alt: "[恐怖]"
  1450 + }, {
  1451 + "url": "207.png",
  1452 + alt: "[忧愁]"
  1453 + }, {
  1454 + "url": "208.png",
  1455 + alt: "[眨眉]"
  1456 + }, {
  1457 + "url": "209.png",
  1458 + alt: "[闭眼]"
  1459 + }, {
  1460 + "url": "210.png",
  1461 + alt: "[鄙视]"
  1462 + }, {
  1463 + "url": "211.png",
  1464 + alt: "[阴暗]"
  1465 + }, {
  1466 + "url": "212.png",
  1467 + alt: "[小鬼]"
  1468 + }, {
  1469 + "url": "213.png",
  1470 + alt: "[礼物]"
  1471 + }, {
  1472 + "url": "214.png",
  1473 + alt: "[拜佛]"
  1474 + }, {
  1475 + "url": "215.png",
  1476 + alt: "[力量]"
  1477 + }, {
  1478 + "url": "216.png",
  1479 + alt: "[金钱]"
  1480 + }, {
  1481 + "url": "217.png",
  1482 + alt: "[蛋糕]"
  1483 + }, {
  1484 + "url": "218.png",
  1485 + alt: "[彩带]"
  1486 + }, {
  1487 + "url": "219.png",
  1488 + alt: "[礼物]"
  1489 + }, ]
  1490 +]
  1491 +const emojiList = [
  1492 + {
  1493 + "url": "100.gif",
  1494 + alt: "[微笑]"
  1495 + }, {
  1496 + "url": "101.gif",
  1497 + alt: "[伤心]"
  1498 + }, {
  1499 + "url": "102.gif",
  1500 + alt: "[美女]"
  1501 + }, {
  1502 + "url": "103.gif",
  1503 + alt: "[发呆]"
  1504 + }, {
  1505 + "url": "104.gif",
  1506 + alt: "[墨镜]"
  1507 + }, {
  1508 + "url": "105.gif",
  1509 + alt: "[哭]"
  1510 + }, {
  1511 + "url": "106.gif",
  1512 + alt: "[羞]"
  1513 + }, {
  1514 + "url": "107.gif",
  1515 + alt: "[哑]"
  1516 + }, {
  1517 + "url": "108.gif",
  1518 + alt: "[睡]"
  1519 + }, {
  1520 + "url": "109.gif",
  1521 + alt: "[哭]"
  1522 + }, {
  1523 + "url": "110.gif",
  1524 + alt: "[囧]"
  1525 + }, {
  1526 + "url": "111.gif",
  1527 + alt: "[怒]"
  1528 + }, {
  1529 + "url": "112.gif",
  1530 + alt: "[调皮]"
  1531 + }, {
  1532 + "url": "113.gif",
  1533 + alt: "[笑]"
  1534 + }, {
  1535 + "url": "114.gif",
  1536 + alt: "[惊讶]"
  1537 + }, {
  1538 + "url": "115.gif",
  1539 + alt: "[难过]"
  1540 + }, {
  1541 + "url": "116.gif",
  1542 + alt: "[酷]"
  1543 + }, {
  1544 + "url": "117.gif",
  1545 + alt: "[汗]"
  1546 + }, {
  1547 + "url": "118.gif",
  1548 + alt: "[抓狂]"
  1549 + }, {
  1550 + "url": "119.gif",
  1551 + alt: "[吐]"
  1552 + }, {
  1553 + "url": "120.gif",
  1554 + alt: "[笑]"
  1555 + }, {
  1556 + "url": "121.gif",
  1557 + alt: "[快乐]"
  1558 + }, {
  1559 + "url": "122.gif",
  1560 + alt: "[奇]"
  1561 + }, {
  1562 + "url": "123.gif",
  1563 + alt: "[傲]"
  1564 + },
  1565 + {
  1566 + "url": "124.gif",
  1567 + alt: "[饿]"
  1568 + }, {
  1569 + "url": "125.gif",
  1570 + alt: "[累]"
  1571 + }, {
  1572 + "url": "126.gif",
  1573 + alt: "[吓]"
  1574 + }, {
  1575 + "url": "127.gif",
  1576 + alt: "[汗]"
  1577 + }, {
  1578 + "url": "128.gif",
  1579 + alt: "[高兴]"
  1580 + }, {
  1581 + "url": "129.gif",
  1582 + alt: "[闲]"
  1583 + }, {
  1584 + "url": "130.gif",
  1585 + alt: "[努力]"
  1586 + }, {
  1587 + "url": "131.gif",
  1588 + alt: "[骂]"
  1589 + }, {
  1590 + "url": "132.gif",
  1591 + alt: "[疑问]"
  1592 + }, {
  1593 + "url": "133.gif",
  1594 + alt: "[秘密]"
  1595 + }, {
  1596 + "url": "134.gif",
  1597 + alt: "[乱]"
  1598 + }, {
  1599 + "url": "135.gif",
  1600 + alt: "[疯]"
  1601 + }, {
  1602 + "url": "136.gif",
  1603 + alt: "[哀]"
  1604 + }, {
  1605 + "url": "137.gif",
  1606 + alt: "[鬼]"
  1607 + }, {
  1608 + "url": "138.gif",
  1609 + alt: "[打击]"
  1610 + }, {
  1611 + "url": "139.gif",
  1612 + alt: "[bye]"
  1613 + }, {
  1614 + "url": "140.gif",
  1615 + alt: "[汗]"
  1616 + }, {
  1617 + "url": "141.gif",
  1618 + alt: "[抠]"
  1619 + }, {
  1620 + "url": "142.gif",
  1621 + alt: "[鼓掌]"
  1622 + }, {
  1623 + "url": "143.gif",
  1624 + alt: "[糟糕]"
  1625 + }, {
  1626 + "url": "144.gif",
  1627 + alt: "[恶搞]"
  1628 + }, {
  1629 + "url": "145.gif",
  1630 + alt: "[什么]"
  1631 + }, {
  1632 + "url": "146.gif",
  1633 + alt: "[什么]"
  1634 + }, {
  1635 + "url": "147.gif",
  1636 + alt: "[累]"
  1637 + },
  1638 + {
  1639 + "url": "148.gif",
  1640 + alt: "[看]"
  1641 + }, {
  1642 + "url": "149.gif",
  1643 + alt: "[难过]"
  1644 + }, {
  1645 + "url": "150.gif",
  1646 + alt: "[难过]"
  1647 + }, {
  1648 + "url": "151.gif",
  1649 + alt: "[坏]"
  1650 + }, {
  1651 + "url": "152.gif",
  1652 + alt: "[亲]"
  1653 + }, {
  1654 + "url": "153.gif",
  1655 + alt: "[吓]"
  1656 + }, {
  1657 + "url": "154.gif",
  1658 + alt: "[可怜]"
  1659 + }, {
  1660 + "url": "155.gif",
  1661 + alt: "[刀]"
  1662 + }, {
  1663 + "url": "156.gif",
  1664 + alt: "[水果]"
  1665 + }, {
  1666 + "url": "157.gif",
  1667 + alt: "[酒]"
  1668 + }, {
  1669 + "url": "158.gif",
  1670 + alt: "[篮球]"
  1671 + }, {
  1672 + "url": "159.gif",
  1673 + alt: "[乒乓]"
  1674 + }, {
  1675 + "url": "160.gif",
  1676 + alt: "[咖啡]"
  1677 + }, {
  1678 + "url": "161.gif",
  1679 + alt: "[美食]"
  1680 + }, {
  1681 + "url": "162.gif",
  1682 + alt: "[动物]"
  1683 + }, {
  1684 + "url": "163.gif",
  1685 + alt: "[鲜花]"
  1686 + }, {
  1687 + "url": "164.gif",
  1688 + alt: "[枯]"
  1689 + }, {
  1690 + "url": "165.gif",
  1691 + alt: "[唇]"
  1692 + }, {
  1693 + "url": "166.gif",
  1694 + alt: "[爱]"
  1695 + }, {
  1696 + "url": "167.gif",
  1697 + alt: "[分手]"
  1698 + }, {
  1699 + "url": "168.gif",
  1700 + alt: "[生日]"
  1701 + }, {
  1702 + "url": "169.gif",
  1703 + alt: "[电]"
  1704 + }, {
  1705 + "url": "170.gif",
  1706 + alt: "[炸弹]"
  1707 + }, {
  1708 + "url": "171.gif",
  1709 + alt: "[刀子]"
  1710 + },
  1711 + {
  1712 + "url": "172.gif",
  1713 + alt: "[足球]"
  1714 + }, {
  1715 + "url": "173.gif",
  1716 + alt: "[瓢虫]"
  1717 + }, {
  1718 + "url": "174.gif",
  1719 + alt: "[翔]"
  1720 + }, {
  1721 + "url": "175.gif",
  1722 + alt: "[月亮]"
  1723 + }, {
  1724 + "url": "176.gif",
  1725 + alt: "[太阳]"
  1726 + }, {
  1727 + "url": "177.gif",
  1728 + alt: "[礼物]"
  1729 + }, {
  1730 + "url": "178.gif",
  1731 + alt: "[抱抱]"
  1732 + }, {
  1733 + "url": "179.gif",
  1734 + alt: "[拇指]"
  1735 + }, {
  1736 + "url": "180.gif",
  1737 + alt: "[贬低]"
  1738 + }, {
  1739 + "url": "181.gif",
  1740 + alt: "[握手]"
  1741 + }, {
  1742 + "url": "182.gif",
  1743 + alt: "[剪刀手]"
  1744 + }, {
  1745 + "url": "183.gif",
  1746 + alt: "[抱拳]"
  1747 + }, {
  1748 + "url": "184.gif",
  1749 + alt: "[勾引]"
  1750 + }, {
  1751 + "url": "185.gif",
  1752 + alt: "[拳头]"
  1753 + }, {
  1754 + "url": "186.gif",
  1755 + alt: "[小拇指]"
  1756 + }, {
  1757 + "url": "187.gif",
  1758 + alt: "[拇指八]"
  1759 + }, {
  1760 + "url": "188.gif",
  1761 + alt: "[食指]"
  1762 + }, {
  1763 + "url": "189.gif",
  1764 + alt: "[ok]"
  1765 + }, {
  1766 + "url": "190.gif",
  1767 + alt: "[情侣]"
  1768 + }, {
  1769 + "url": "191.gif",
  1770 + alt: "[爱心]"
  1771 + }, {
  1772 + "url": "192.gif",
  1773 + alt: "[蹦哒]"
  1774 + }, {
  1775 + "url": "193.gif",
  1776 + alt: "[颤抖]"
  1777 + }, {
  1778 + "url": "194.gif",
  1779 + alt: "[怄气]"
  1780 + }, {
  1781 + "url": "195.gif",
  1782 + alt: "[跳舞]"
  1783 + },
  1784 + {
  1785 + "url": "196.gif",
  1786 + alt: "[发呆]"
  1787 + }, {
  1788 + "url": "197.gif",
  1789 + alt: "[背着]"
  1790 + }, {
  1791 + "url": "198.gif",
  1792 + alt: "[伸手]"
  1793 + }, {
  1794 + "url": "199.gif",
  1795 + alt: "[耍帅]"
  1796 + }, {
  1797 + "url": "200.png",
  1798 + alt: "[微笑]"
  1799 + }, {
  1800 + "url": "201.png",
  1801 + alt: "[生病]"
  1802 + }, {
  1803 + "url": "202.png",
  1804 + alt: "[哭泣]"
  1805 + }, {
  1806 + "url": "203.png",
  1807 + alt: "[吐舌]"
  1808 + }, {
  1809 + "url": "204.png",
  1810 + alt: "[迷糊]"
  1811 + }, {
  1812 + "url": "205.png",
  1813 + alt: "[瞪眼]"
  1814 + }, {
  1815 + "url": "206.png",
  1816 + alt: "[恐怖]"
  1817 + }, {
  1818 + "url": "207.png",
  1819 + alt: "[忧愁]"
  1820 + }, {
  1821 + "url": "208.png",
  1822 + alt: "[眨眉]"
  1823 + }, {
  1824 + "url": "209.png",
  1825 + alt: "[闭眼]"
  1826 + }, {
  1827 + "url": "210.png",
  1828 + alt: "[鄙视]"
  1829 + }, {
  1830 + "url": "211.png",
  1831 + alt: "[阴暗]"
  1832 + }, {
  1833 + "url": "212.png",
  1834 + alt: "[小鬼]"
  1835 + }, {
  1836 + "url": "213.png",
  1837 + alt: "[礼物]"
  1838 + }, {
  1839 + "url": "214.png",
  1840 + alt: "[拜佛]"
  1841 + }, {
  1842 + "url": "215.png",
  1843 + alt: "[力量]"
  1844 + }, {
  1845 + "url": "216.png",
  1846 + alt: "[金钱]"
  1847 + }, {
  1848 + "url": "217.png",
  1849 + alt: "[蛋糕]"
  1850 + }, {
  1851 + "url": "218.png",
  1852 + alt: "[彩带]"
  1853 + }, {
  1854 + "url": "219.png",
  1855 + alt: "[礼物]"
  1856 + },
  1857 +]
  1858 +
  1859 +/**@dateTimeFliter 转换格林日期时间格式为常用日期格式
  1860 + * @time[必填] Date 格林日期格式
  1861 + * @part[可选,默认:0] Number 选择返回日期时间部分 列:0:返回所有 1:只返回日期 2:只返回时间
  1862 + * @dateComplete[可选,默认:true] Boolean 日期位数不足是否添0补齐:true:补齐,false:不补齐
  1863 + * @timeComplete[可选,默认:true] Boolean 时间位数不足是否添0补齐:true:补齐,false:不补齐
  1864 + * @dateConnector[可选,默认:-] String 年月日连接符 例: - : /
  1865 + * @timeConnector[可选,默认::] String 时间连接符 例: - : /
  1866 + * @hour12[可选,默认:false] Boolean 是否返回12小时制时间 例: true:返回12小时制时间 false:返回24小时制时间
  1867 + * @return '2019-11-25 15:05:54' String 返回示例
  1868 + * **/
  1869 +const dateTimeFliter = function(time, part = 0, dateComplete = true, timeComplete = true, dateConnector = '-',
  1870 + timeConnector = ':', hour12 = false) {
  1871 + let year = time.getFullYear()
  1872 + let month = time.getMonth() + 1
  1873 + let day = time.getDate()
  1874 + let hour = time.getHours()
  1875 + let minute = time.getMinutes()
  1876 + let second = time.getSeconds()
  1877 + let dateStr = ''
  1878 + let timeStr = ''
  1879 + //转换日期
  1880 + if (dateComplete) { //添0补齐
  1881 + if (month < 10) {
  1882 + month = '0' + month
  1883 + }
  1884 + if (day < 10) {
  1885 + day = '0' + day
  1886 + }
  1887 + }
  1888 + dateStr = year + dateConnector + month + dateConnector + day
  1889 + //转换时间
  1890 + //修改小时制
  1891 + if (hour12) {
  1892 + if (hour > 12) {
  1893 + hour = hour - 12
  1894 + if (timeComplete) {
  1895 + if (hour < 10) {
  1896 + hour = '下午 ' + '0' + hour
  1897 + } else {
  1898 + hour = '下午 ' + hour
  1899 + }
  1900 + }
  1901 + } else {
  1902 + if (timeComplete) {
  1903 + if (hour < 10) {
  1904 + hour = '上午 ' + '0' + hour
  1905 + } else {
  1906 + hour = '上午 ' + hour
  1907 + }
  1908 + }
  1909 + }
  1910 + }
  1911 + //判断分钟与秒
  1912 + if (timeComplete) { //添0补齐
  1913 + if (minute < 10) {
  1914 + minute = '0' + minute
  1915 + }
  1916 + if (second < 10) {
  1917 + second = '0' + second
  1918 + }
  1919 + }
  1920 + // timeStr = hour + timeConnector + minute + timeConnector + second
  1921 + timeStr = hour + timeConnector + minute
  1922 + //合成输出值
  1923 + if (part == 0) {
  1924 + return dateStr + ' ' + timeStr
  1925 + } else if (part == 1) {
  1926 + return dateStr
  1927 + } else if (part == 2) {
  1928 + return timeStr
  1929 + }
  1930 + return '传参有误'
  1931 +}
  1932 +
  1933 +/**
  1934 + * @description 视频封面
  1935 + * @example
  1936 + * example
  1937 +
  1938 + * @param {String} img = '' 视频地址
  1939 + * @author: wenxin
  1940 + * @createTime: 2021-8-3 9:18:19 ?F10: AM?
  1941 + */
  1942 +const imgIP_video=function(img){
  1943 + if(!img){
  1944 + return img
  1945 + }
  1946 + var newimg =imgurl+img
  1947 + var arr = []
  1948 + arr = newimg.split(".");
  1949 + console.log(arr[arr.length-1])
  1950 + if(arr[arr.length-1]=='mp4'){
  1951 + arr[arr.length-1]='png'
  1952 + }
  1953 + newimg=arr.join('.')
  1954 + // console.log(newimg)
  1955 + return newimg
  1956 +}
  1957 +const see_tip=function(str,type){
  1958 + uni.showToast({
  1959 + icon:'none',
  1960 + title:str
  1961 + })
  1962 +}
  1963 +const back=function(str,type){
  1964 + uni.navigateBack({
  1965 + delta:1
  1966 + })
  1967 +}
  1968 +const set_num=function(str,type){
  1969 + if(type=='k'){
  1970 + if(str>999){
  1971 + str=str/1000
  1972 + str=str.toFixed(0)
  1973 + str=str+type
  1974 + return str
  1975 +
  1976 + }else{
  1977 + return str
  1978 + }
  1979 + }
  1980 +}
  1981 +const LNum=function(txt,num) {
  1982 +
  1983 + if(!num){
  1984 + num=11
  1985 + }
  1986 + var str = txt;
  1987 + if(!str){
  1988 + return
  1989 + }
  1990 + if(str.length>num){
  1991 +
  1992 + str = str.substr(0, num) + '...';
  1993 + }else{
  1994 + str = str.substr(0, num)
  1995 + }
  1996 + return str
  1997 +}
  1998 +export default {
  1999 + getUsers,
  2000 + addUser,
  2001 + IPurl,
  2002 + map_key,
  2003 + imgurl,
  2004 + jump,
  2005 + call,
  2006 + call1,
  2007 + wxlogin,
  2008 + login_tel,
  2009 + setUsermsg,
  2010 + P_get,
  2011 + P_post,
  2012 + P_put,
  2013 + P_delete,
  2014 + gettime,
  2015 + getimg,
  2016 + getimgarr,
  2017 + pveimg,
  2018 + get_fwb,
  2019 + wx_upload,
  2020 + wxpay,
  2021 + baseurl,
  2022 +
  2023 + emojiList,
  2024 + dateTimeFliter,
  2025 + imgIP_video,
  2026 + share_title,
  2027 + share_summary,
  2028 + share_img,
  2029 + see_tip,
  2030 + back,
  2031 + VER,
  2032 + set_num,
  2033 + LNum,
  2034 + limit
  2035 +}