提交 19363e6f 编写于 作者: F fancy

支持tokenName的修改

上级 9327eb4b
......@@ -23,10 +23,11 @@ Page({
if (id && id != '') {
var url = api.cmsWebUrl(id);
var who = wx.getStorageSync('who');
var tokenName = wx.getStorageSync('tokenName');
var token = ''
if (who && who.token) {
token = who.token;
url = url + '&x-token=' + token;
url = url + '&'+tokenName+'=' + token;
}
url = url + '#wechat_redirect';
console.log('信息页码 url', url);
......
......@@ -60,6 +60,7 @@ Page({
//下载文件
downloadFileAndOpen: function (url) {
var who = wx.getStorageSync('who');
var tokenName = wx.getStorageSync('tokenName');
var token = '';
if (who && who.token) {
token = who.token;
......@@ -67,7 +68,7 @@ Page({
wx.downloadFile({
url: url,
header: {
'x-token': token
tokenName: token
},
success(res) {
if (res.statusCode === 200) {
......
......@@ -59,6 +59,7 @@ Page({
const tempFilePath = obj.url;
console.log('裁剪完成,,', tempFilePath);
var who = wx.getStorageSync('who');
var tokenName = wx.getStorageSync('tokenName');
var token = '';
if (who && who.token) {
token = who.token;
......@@ -72,7 +73,7 @@ Page({
{
method: 'PUT',
header: {
'x-token': token
tokenName: token
}}).then(res => {
const data = res.data
console.log('上传头像完成', data);
......
......@@ -30,6 +30,7 @@ Page({
//获取头像文件
avatar: function() {
var who = wx.getStorageSync('who');
var tokenName = wx.getStorageSync('tokenName');
var token = '';
if (who && who.token) {
token = who.token;
......@@ -39,7 +40,7 @@ Page({
wx.downloadFile({
url: url,
header: {
'x-token': token
tokenName: token
},
success(res) {
if (res.statusCode === 200) {
......
......@@ -37,10 +37,11 @@ Page({
openDraft: function(draft, title = '') {
var url = api.workDraftUrl(draft);
var who = wx.getStorageSync('who');
var tokenName = wx.getStorageSync('tokenName');
var token = ''
if (who && who.token) {
token = who.token;
url = url + '&x-token=' + token;
url = url + '&'+tokenName+'=' + token;
}
url = url + '#wechat_redirect';
console.log('草稿页面 url', url);
......@@ -53,10 +54,11 @@ Page({
openWorkUrl: function(work, title = '') {
var url = api.workWebUrl(work);
var who = wx.getStorageSync('who');
var tokenName = wx.getStorageSync('tokenName');
var token = ''
if (who && who.token) {
token = who.token;
url = url + '&x-token=' + token;
url = url + '&'+tokenName+'=' + token;
}
url = url + '#wechat_redirect';
console.log('待办页面 url', url);
......@@ -69,10 +71,11 @@ Page({
openWorkCompletedUrl: function(workcompletedid, title = '') {
var url = api.workCompletedWebUrl(workcompletedid);
var who = wx.getStorageSync('who');
var tokenName = wx.getStorageSync('tokenName');
var token = ''
if (who && who.token) {
token = who.token;
url = url + '&x-token=' + token;
url = url + '&'+tokenName+'=' + token;
}
url = url + '#wechat_redirect';
console.log('待办页面 url', url);
......
......@@ -58,10 +58,13 @@ function request(method, url, param, isShowLoading) {
function setDistribute(distribute) {
wx.removeStorageSync('webServer');
wx.removeStorageSync('assembles');
wx.removeStorageSync('tokenName');
var webServer = distribute.webServer || {}
wx.setStorageSync('webServer', webServer);
var assembles = distribute.assembles || {}
wx.setStorageSync('assembles', assembles);
var tokenName = distribute.tokenName || 'x-token'
wx.setStorageSync('tokenName', tokenName);
}
// 获取模块的baseUrl
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册