Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
swx_weapp
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
2022-10-13 22:58:13 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d888731ff1b0ab70282b6044d06e0c50954ea2c3
d888731f
1 parent
312a586c
授权功能测试调整
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
19 deletions
src/pages/auth/index.vue
src/pages/createActivity/index.vue
src/pages/index/index.vue
src/utils/mixin.js
src/pages/auth/index.vue
View file @
d888731
<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-13 2
1:52:36
* @LastEditTime: 2022-10-13 2
2:47:04
* @FilePath: /swx/src/pages/auth/index.vue
* @Description: 文件描述
-->
...
...
@@ -31,12 +31,12 @@ export default {
var cookie = res.cookies[0];
if (cookie != null) {
wx.setStorageSync("sessionid", res.cookies[0]);//服务器返回的 Set-Cookie,保存到本地
//TAG 小程序绑定cookie
// 修改请求头
// request.defaults.headers.cookie = res.cookies[0];
Taro.navigateBack({
delta: 1 // 返回上一级页面。
});
//TAG 小程序绑定cookie
// 修改请求头
request.defaults.headers.cookie = wx.getStorageSync("sessionid");
}
} else {
console.warn(res.data.msg);
...
...
src/pages/createActivity/index.vue
View file @
d888731
<!--
* @Date: 2022-09-21 16:04:10
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-13 2
1:51:33
* @LastEditTime: 2022-10-13 2
2:46:15
* @FilePath: /swx/src/pages/createActivity/index.vue
* @Description: 创建活动页面
-->
...
...
@@ -281,6 +281,7 @@ import activityEditor from "@/components/activity-editor";
import { getCurrentPageUrl, getCurrentPageParam } from "@/utils/weapp";
import request from '../../utils/request';
import Taro from '@tarojs/taro'
import mixin from '../../utils/mixin';
const message = ref('');
const message1 = ref('');
...
...
@@ -317,11 +318,6 @@ const removeUploadImage = () => {
/**********************************/
onMounted(() => {
// if (!wx.getStorageSync("sessionid")) {
// Taro.navigateTo({
// url: '../auth/index'
// })
// }
if (getCurrentPageParam().type === 'edit') {
// 动态修改标题
wx.setNavigationBarTitle({
...
...
@@ -533,6 +529,7 @@ import "./index.less";
export default {
name: "createActivityPage",
mixins: [mixin.init],
// onLoad (options) {
//options.参数名就可以取到
// if (options.type === 'edit') {
...
...
src/pages/index/index.vue
View file @
d888731
<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-
08 10:10:20
* @LastEditTime: 2022-10-
13 22:30:46
* @FilePath: /swx/src/pages/index/index.vue
* @Description: 首页
-->
...
...
@@ -27,18 +27,20 @@
<script setup>
import Taro from '@tarojs/taro'
import { ref } from 'vue';
import { ref
, onMounted
} from 'vue';
import activityCard from '@/components/activity-card.vue'
import navbar from '@/components/navbar.vue'
import request from '../../utils/request';
// request.get('/srv/?a=activity_app_homepage')
// .then(res => {
// console.warn(res);
// })
// .catch(err => {
// console.error(err);
// })
onMounted(() => {
request.get('/srv/?a=activity_app_homepage')
.then(res => {
// console.warn(res);
})
.catch(err => {
console.error(err);
})
})
const activity_list = ref([{
title: '智慧没有烦恼',
...
...
src/utils/mixin.js
0 → 100644
View file @
d888731
/*
* @Date: 2022-10-13 22:36:08
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-13 22:43:46
* @FilePath: /swx/src/utils/mixin.js
* @Description: 文件描述
*/
import
request
from
'./request'
;
export
default
{
// 初始化设置
init
:
{
created
()
{
// 绑定cookie
if
(
wx
.
getStorageSync
(
"sessionid"
))
{
request
.
defaults
.
headers
.
cookie
=
wx
.
getStorageSync
(
"sessionid"
);
}
}
}
};
Please
register
or
login
to post a comment