Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
data-table
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2023-02-24 16:49:30 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ecbd2f86c248bcefbc4b200354f269b41a2a134d
ecbd2f86
1 parent
1dd8fa44
fix
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
11 deletions
src/App.vue
src/components/TextField/index.vue
src/utils/tools.js
src/App.vue
View file @
ecbd2f8
...
...
@@ -2,7 +2,7 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-05-26 23:52:36
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-02-24 1
5:17:24
* @LastEditTime: 2023-02-24 1
6:09:01
* @FilePath: /data-table/src/App.vue
* @Description:
-->
...
...
@@ -24,9 +24,9 @@ import { Toast } from "vant";
// eslint-disable-next-line no-unused-vars
import vConsole from "@/utils/vconsole";
// 初始化WX环境
//
import wx from 'weixin-js-sdk'
//
import { wxJsAPI } from '@/api/wx/config'
//
import { apiList } from '@/api/wx/jsApiList.js'
import wx from 'weixin-js-sdk'
import { wxJsAPI } from '@/api/wx/config'
import { apiList } from '@/api/wx/jsApiList.js'
import { wxInfo, getUrlParams } from "@/utils/tools";
import { styleColor } from "@/constant.js";
import { getFormSettingAPI } from "@/api/form.js";
...
...
@@ -61,13 +61,41 @@ watch(
// web端判断
const is_pc = computed(() => wxInfo().isPC);
// const stringify = (params) => {
// const queryString = []
// Object.keys(params || {}).forEach(k => {
// queryString.push(k + '=' + params[k])
// })
// return '?' + queryString.join('&')
// }
onMounted(async () => {
const code = getUrlParams(location.href) ? getUrlParams(location.href).code : '';
// const wxJs = await wxJsAPI({ form_code: code });
// const raw_url = encodeURIComponent(location.origin + location.pathname + stringify($route.query)); // 未授权的地址
// const wxJs = await wxJsAPI({ form_code: code, url: raw_url });
// wxJs.data.jsApiList = apiList;
// wx.config(wxJs.data);
// wx.ready(() => {
// wx.showAllNonBaseMenuItem();
// wx.scanQRCode({
// needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
// scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
// success: function (res) {
// if (res.errMsg === 'scanQRCode:ok') {
// let code = res.resultStr;
// let code_arr = code.split(",");
// console.warn(code_arr);
// } else {
// console.warn('扫描失败');
// }
// },
// error: function (res) {
// if (res.errMsg.indexOf('function_not_exist') > 0) {
// alert('版本过低请升级')
// }
// alert(res.errMsg);
// },
// });
// });
// wx.error((err) => {
// console.warn(err);
...
...
src/components/TextField/index.vue
View file @
ecbd2f8
<!--
* @Date: 2022-08-29 14:31:20
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-02-24 1
5:14:35
* @LastEditTime: 2023-02-24 1
6:47:46
* @FilePath: /data-table/src/components/TextField/index.vue
* @Description: 单行文本输入框
-->
...
...
@@ -28,7 +28,7 @@ import { showSuccessToast, showFailToast } from 'vant';
import wx from 'weixin-js-sdk'
import { wxJsAPI } from '@/api/wx/config'
import { apiList } from '@/api/wx/jsApiList.js'
import { wxInfo, getUrlParams } from "@/utils/tools";
import { wxInfo, getUrlParams
, stringifyQuery
} from "@/utils/tools";
const props = defineProps({
item: Object,
...
...
@@ -43,7 +43,8 @@ const test = $route.query.test;
const clickRightIcon = async () => {
const code = getUrlParams(location.href) ? getUrlParams(location.href).code : '';
const wxJs = await wxJsAPI({ form_code: code });
const raw_url = encodeURIComponent(location.pathname + stringifyQuery($route.query)); // 未授权的地址
const wxJs = await wxJsAPI({ form_code: code, url: raw_url });
wxJs.data.jsApiList = apiList;
wx.config(wxJs.data);
wx.ready(() => {
...
...
src/utils/tools.js
View file @
ecbd2f8
/*
* @Date: 2022-04-18 15:59:42
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-02-
15 18:20:03
* @LastEditTime: 2023-02-
24 16:13:06
* @FilePath: /data-table/src/utils/tools.js
* @Description: 文件描述
*/
...
...
@@ -115,4 +115,23 @@ const getUrlParams = (url) => {
return
items
}
export
{
formatDate
,
wxInfo
,
hasEllipsis
,
parseQueryString
,
strExist
,
changeURLArg
,
getUrlParams
};
// 格式化URL参数为字符串
const
stringifyQuery
=
(
params
)
=>
{
const
queryString
=
[];
Object
.
keys
(
params
||
{}).
forEach
((
k
)
=>
{
queryString
.
push
(
k
+
'='
+
params
[
k
]);
});
return
'?'
+
queryString
.
join
(
'&'
);
};
export
{
formatDate
,
wxInfo
,
hasEllipsis
,
parseQueryString
,
strExist
,
changeURLArg
,
getUrlParams
,
stringifyQuery
,
};
...
...
Please
register
or
login
to post a comment