| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- var _request = require('../../utils/request.js')
- Page({
- data: {
- qr: '',
- popup: false
- },
- onLoad: function (options) {
- this.getqcode()
- },
- getqcode: function () {
- var that = this
- var url = 'v1/customer_service/qrcode'
- var params = {}
- var success = function (res) {
- that.setData({
- qr: res.data
- })
- }
- _request.$get(url, params, success)
- },
- downLoad () {
- wx.showLoading({
- title: '加载中',
- })
- var that = this
- wx.downloadFile({
- url: that.data.qr,
- success: function(res) {
- if (res.statusCode === 200) {
- that.saveImage(res.tempFilePath)
- }
- }
- })
- },
- saveImage (val) {
- var that = this
- wx.saveImageToPhotosAlbum({
- filePath: val,
- success(res) {
- wx.showToast({
- title: '已保存相册',
- icon: 'success',
- duration: 2000
- })
- },
- fail (res) {
- wx.getSetting({
- success (res) {
- if (!res.authSetting['scope.writePhotosAlbum']) {
- that.setData({
- popup: true
- })
- }
- }
- })
- },
- complete () {
- wx.hideLoading()
- }
- })
- },
- setting () {
- this.setData({
- popup: false
- })
- },
- onShareAppMessage: function (val) {
- return _request.share({
- sc: 'xcx_group'
- })
- },
- tokf(){
- console.log('oninfo');
- var that = this
- var url = 'v1/user/info'
- var params = {}
- var success = function (res) {
- let info = res.data;
- if(info.wx_user.id){
- let uurl = encodeURIComponent(`https://tfohowapi.hiwavo.com/h5yingyuchat.html?&visitor_id=fohow-${info.wx_user.id}&visitor_name=${info.wx_user.nickname}&avator=${info.wx_user.head}&from=xcx`);
- console.log("uurl",uurl);
- wx.navigateTo({
- url: '/pages/web/web?id='+uurl
- })
- }else{
- wx.showToast({
- title: '请先登录'
- })
- }
- }
- _request.$get(url, params, success);
- },
- })
|