diff --git a/app.json b/app.json
index 3fdba94..fe4280a 100644
--- a/app.json
+++ b/app.json
@@ -25,7 +25,8 @@
"pages/copyright/refund/refund",
"pages/copyright/repair/repair",
"pages/copyright/applyRepair/applyRepair",
- "pages/copyright/applyRefund/applyRefund"
+ "pages/copyright/applyRefund/applyRefund",
+ "pages/shop/market"
],
"window": {
"navigationBarTextStyle": "black",
@@ -42,6 +43,12 @@
"iconPath": "/static/images/ic_home_normal.png",
"selectedIconPath": "/static/images/ic_home_select.png"
},
+ {
+ "pagePath": "pages/shop/market",
+ "text": "软著市场",
+ "iconPath": "/static/images/ic_home_normal.png",
+ "selectedIconPath": "/static/images/ic_home_select.png"
+ },
{
"pagePath": "pages/mine/mineIndex/mine",
"text": "我的",
diff --git a/net/api/invoiceApi.js b/net/api/invoiceApi.js
index 1609551..f3c55f0 100644
--- a/net/api/invoiceApi.js
+++ b/net/api/invoiceApi.js
@@ -2,6 +2,7 @@ import {
request
} from "../http";
const Cache = require('../../utils/storage');
+const projectName = "plug"
// 公共API
const apiPath = {
mineInvoiceOrderList: '/api/invoicerecharge/recharge-listpage/{userId}/{status}', //可以开具发票的订单
@@ -21,7 +22,7 @@ class InvoiceApi {
static doGetMineInvoiceOrderList(data, status) {
const userId = Cache.get('userId')
const path = apiPath.mineInvoiceOrderList.replace('{userId}', userId).replace('{status}', status)
- return request(path, "GET", data, null, 'plug')
+ return request(path, "GET", data, projectName)
}
static doGetDicListByPId(id) {
const path = apiPath.dicByPId.replace('{pId}', id)
@@ -31,45 +32,45 @@ class InvoiceApi {
static doGetMineInvoiceList(data) {
const userId = Cache.get('userId')
const path = apiPath.mineInvoiceList.replace('{userId}', userId)
- return request(path, "GET", data, null, 'plug')
+ return request(path, "GET", data, projectName)
}
//保存我的开票信息
static doSaveMineInvoiceInfo(data) {
const userId = Cache.get('userId')
const path = apiPath.saveInvoiceInfo.replace('{userId}', userId)
- return request(path, "POST", data, null, 'plug')
+ return request(path, "POST", data, projectName)
}
//编辑开票信息
static doUpdateMineInvoiceInfo(id, data) {
const path = apiPath.updateInvoiceInfo.replace('{invoiceId}', id)
- return request(path, "PUT", data, null, 'plug')
+ return request(path, "PUT", data, projectName)
}
//删除开票信息
static doDelMineInvoiceInfo(id) {
const path = apiPath.deleteInvoiceInfo.replace('{ids}', id)
- return request(path, "DELETE", null, null, 'plug')
+ return request(path, "DELETE", null, projectName)
}
//开票申请列表
static doGetInvoiceRecordList(data) {
const userId = Cache.get('userId')
const path = apiPath.mineInvoiceRecordList.replace('{userId}', userId)
- return request(path, "GET", data, null, 'plug')
+ return request(path, "GET", data, projectName)
}
//取消开票申请
static doCancelInvoiceRecord(id) {
const path = apiPath.cancelInvoiceRecord.replace('{invoiceRechargeId}', id)
- return request(path, "PUT", null, null, 'plug')
+ return request(path, "PUT", null, projectName)
}
//提交开票申请
static doSaveInvoiceRecord(data) {
const userId = Cache.get('userId')
const path = apiPath.saveInvoiceRecord.replace('{userId}', userId)
- return request(path, "POST", data, null, 'plug')
+ return request(path, "POST", data, projectName)
}
//修改开票申请
static doUpdateInvoiceRecord(id, data) {
const path = apiPath.updateInvoiceRecord.replace('{invoiceRechargeId}', id)
- return request(path, 'PUT', data, null, 'plug')
+ return request(path, 'PUT', data, projectName)
}
}
diff --git a/net/api/payApi.js b/net/api/payApi.js
index 33f8be0..747484a 100644
--- a/net/api/payApi.js
+++ b/net/api/payApi.js
@@ -29,7 +29,7 @@ class PayService {
}
//获取微信支付参数
static doGetWxPayParams(data) {
- return request(apiPath.wxPayParams, "POST", data, null, "operator")
+ return request(apiPath.wxPayParams, "POST", data, "operator")
}
}
diff --git a/net/api/projectApi.js b/net/api/projectApi.js
index 3a70fcf..b4d1d93 100644
--- a/net/api/projectApi.js
+++ b/net/api/projectApi.js
@@ -84,7 +84,7 @@ class ProjectService {
//获取使用规则数据
static doGetRuleDate(id) {
const path = apiPath.ruleData.replace('{id}', id)
- return request(path, "GET", null, null, "operator", false)
+ return request(path, "GET", null, "operator", false)
}
static doGetInvestDetail(data) {
return request(apiPath.investDetail, "GET", data)
diff --git a/net/api/shop.js b/net/api/shop.js
new file mode 100644
index 0000000..3c15d60
--- /dev/null
+++ b/net/api/shop.js
@@ -0,0 +1,57 @@
+import {
+ request
+} from "../http";
+// 公共API
+const proName = 'aiShop'
+const apiPath = {
+ indexList: "/api/goodsonline/listpage", //上架的软著商品列表 GET
+ saveGoods: "/api/goods/save", //新增软著商品 POST
+ goodsDetail: "/api/goods/get/{goodsId}", //商品详情 GET
+ delGoods: "/api/goods/remove/{ids}", //删除商品 DELETE
+ updateGoods: "/api/goods/update/{goodsId}", //修改商品 PUT
+ doCheck: "/api/goods/sub-check/{goodsId}", //提交审核 PUT
+ onGoods: "/api/goods/publish/{goodsId}", //上架商品 PUT
+ offGoods: "/api/goods/no-publish/{goodsId}", //下架商品 PUT
+}
+class Shop {
+ //获取上架的软著列表
+ static doGetIndexList(data) {
+ return request(apiPath.indexList, "GET", data, proName)
+ }
+ //新增软件商品
+ static doSaveGoods(data) {
+ return request(apiPath.saveGoods, "POST", data, proName)
+ }
+ //商品详情
+ static doGetGoodsDetail(id) {
+ const path = apiPath.goodsDetail.replace('{goodsId}', id)
+ return request(path, "GET", null, proName)
+ }
+ //删除商品
+ static doDelGoods(id) {
+ const path = apiPath.delGoods.replace('{goodsId}', id)
+ return request(path, "DELETE", null, proName)
+ }
+ //更新商品
+ static doUpdateGoods(id, data) {
+ const path = apiPath.updateGoods.replace('{goodsId}', id)
+ return request(path, "PUT", data, proName)
+ }
+ //提交审核
+ static doSubCheck(id) {
+ const path = apiPath.doCheck.replace('{goodsId}', id)
+ return request(path, "PUT", null, proName)
+ }
+ //上架商品
+ static doOnGoods(id) {
+ const path = apiPath.onGoods.replace('{goodsId}', id)
+ return request(path, "PUT", null, proName)
+ }
+ //下架商品
+ static doOffGoods(id) {
+ const path = apiPath.offGoods.replace('{goodsId}', id)
+ return request(path, "PUT", null, proName)
+ }
+}
+
+export default Shop;
\ No newline at end of file
diff --git a/net/api/userApi.js b/net/api/userApi.js
index bb735e1..fdca3ef 100644
--- a/net/api/userApi.js
+++ b/net/api/userApi.js
@@ -26,13 +26,13 @@ const apiPath = {
}
class UserService {
static doLogin(data) {
- return request(apiPath.loginUrl, "POST", data, null, 'operator', false)
+ return request(apiPath.loginUrl, "POST", data, 'operator', false)
}
static doRegister(data) {
- return request(apiPath.registerUrl, "POST", data, null, 'operator', false)
+ return request(apiPath.registerUrl, "POST", data, 'operator', false)
}
static doUnbindWx() {
- return request(apiPath.unbindWx, "GET", null, null, 'operator', true)
+ return request(apiPath.unbindWx, "GET", null, 'operator', true)
}
static doUpdateUserInfo(data) {
return request(apiPath.updateUserInfo, "PUT", data)
diff --git a/net/http.js b/net/http.js
index a7ed72b..ad4b275 100644
--- a/net/http.js
+++ b/net/http.js
@@ -5,10 +5,18 @@ import {
uploadImgUrl,
previewUrl,
copyrightUrl,
+ aiShopUrl,
imgAssets,
appUrl
} from '../net/mainUrl'
-
+// 项目与基础URL映射关系
+const PROJECT_URL_MAP = {
+ operator: operatorUrl,
+ copyright: copyrightUrl,
+ plug: operatorPlug,
+ aiShop: aiShopUrl,
+ // 添加新项目只需在此扩展
+};
/**
* 传入请求参数,返回Promise支持链试调用
* @param url 请求地址
@@ -16,56 +24,42 @@ import {
* @param data 请求体数据
* @param params 请求参数
*/
-function request(url, method = "GET", data = {}, params = {}, project = "copyright", needToken = true) {
- const header = {
- "content-type": "application/json"
- // 有其他content-type需求加点逻辑判断处理即可
- }
- //是否需要token
+function request(url, method = "GET", data = {}, project = "copyright", needToken = true) {
+ // 1. 参数预处理
+ const baseUrl = PROJECT_URL_MAP[project] || copyrightUrl;
+ const requestUrl = baseUrl + url;
+ // 2. 请求头配置
+ const headers = {
+ "Content-Type": "application/json"
+ };
+
if (needToken) {
- const token = Cache.get('token')
+ const token = Cache.get('token');
if (token) {
- header.Auth = `Bearer ${token}`;
+ headers.Auth = `Bearer ${token}`;
}
}
- //判断项目
- var baseUrl = operatorUrl
- if (project == 'operator') {
- baseUrl = operatorUrl
- } else if (project == 'copyright') {
- baseUrl = copyrightUrl
- } else if (project == 'plug') {
- baseUrl = operatorPlug
- }
+ // 3. 请求配置
+ const requestConfig = {
+ url: requestUrl.toString(),
+ method: method.toUpperCase(),
+ data,
+ header: headers,
+ timeout: 10000,
+ dataType: "json"
+ };
return new Promise(function (resolve, reject) {
wx.request({
- url: baseUrl + url,
- timeout: 8000,
- method,
- data,
- dataType: "json", // 微信官方文档中介绍会对数据进行一次JSON.parse
- header,
+ ...requestConfig,
success(res) {
- // wx.hideLoading();
- // HTTP状态码为200才视为成功
if (res.statusCode === 200) {
- // 真正的数据响应体中还有一层success字段判断业务状态,按实际情况处理
resolve(res.data)
- // if (res.data.success) {
- // resolve(res.data.result)
- // } else {
- // // 业务判断错误
- // reject(res)
- // }
} else {
console.log('错误success')
- // wx.request的特性,只要有响应就会走success回调,所以在这里判断状态,非200的均视为请求失败
reject(res.data)
}
},
fail(err) {
- // wx.hideLoading();
- // 断网、服务器挂了都会fail回调,直接reject即可
console.log('错误')
if (err.data) {
reject(err.data)
diff --git a/net/mainUrl.js b/net/mainUrl.js
index a8fe72e..82a6afd 100644
--- a/net/mainUrl.js
+++ b/net/mainUrl.js
@@ -1,7 +1,8 @@
// 定义api服务地址
-const operatorUrl = 'https://www.aimzhu.com/operator';
+const operatorUrl = 'https://www.aimzhu.com/operator'
const operatorPlug = 'https://www.aimzhu.com/operator-plugin'
-const copyrightUrl = 'https://www.aimzhu.com/copyright';
+const copyrightUrl = 'https://www.aimzhu.com/copyright'
+const aiShopUrl = 'https://www.aimzhu.com/aishop'
const uploadImgUrl = copyrightUrl + '/api/file/v2/upload-image'
const previewUrl = copyrightUrl + '/route/file/v2/download/true/'
const imgAssets = 'https://www.aimzhu.com/miniapp-assets'
@@ -13,6 +14,7 @@ export {
uploadImgUrl,
previewUrl,
copyrightUrl,
+ aiShopUrl,
imgAssets,
appUrl
}
\ No newline at end of file
diff --git a/pages/index/index.js b/pages/index/index.js
index 55b74c2..71680ee 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -7,6 +7,7 @@ import {
} from '../../net/http'
const Cache = require('../../utils/storage')
const Utils = require('../../utils/util')
+const data =require('../../utils/data')
const app = getApp()
const deviceInfo = wx.getDeviceInfo()
const screenInfo = wx.getWindowInfo();
@@ -87,23 +88,7 @@ Page({
showAd: false, //显示优惠卷广告
tempCoupons: [], //优惠卷
isNoShowToday: false, //今日不再显示
- tabList: [{
- "pagePath": "pages/index/index",
- "text": "首页",
- "iconPath": app.globalData.localAssets + "/ic_home_normal.png",
- "selectedIconPath": app.globalData.localAssets + "/ic_home_select.png",
- "selected": true,
- "hasMsg": false,
- },
- {
- "pagePath": "pages/mine/mineIndex/mine",
- "text": "我的",
- "iconPath": app.globalData.localAssets + "/ic_mine_normal.png",
- "selectedIconPath": app.globalData.localAssets + "/ic_mine_select.png",
- "selected": false,
- "hasMsg": false
- }
- ],
+ tabList: data.tabList,
},
onLoad(e) {
const _self = this
@@ -615,7 +600,7 @@ Page({
})
const requests = _self.data.tempCoupons.map(item => {
const coupons = {
- couponId: _self.data.tempCoupons.couponId
+ couponId: item.couponId
}
return UserApi.doSaveCoupons(coupons)
})
diff --git a/pages/mine/mineIndex/mine.js b/pages/mine/mineIndex/mine.js
index 6bd05b3..f283930 100644
--- a/pages/mine/mineIndex/mine.js
+++ b/pages/mine/mineIndex/mine.js
@@ -1,10 +1,8 @@
// pages/mine/mine.js
import UserApi from '../../../net/api/userApi'
import ProApi from '../../../net/api/projectApi'
-import {
- copyrightUrl
-} from '../../../net/http'
const Utils = require('../../../utils/util')
+const data = require('../../../utils/data')
const app = getApp()
const deviceInfo = wx.getDeviceInfo()
const screenInfo = wx.getWindowInfo();
@@ -33,47 +31,7 @@ Page({
allCount: 0,
materialCount: 0,
accountInfo: {},
- menuList: [{
- icon: "ic-user",
- title: "个人信息",
- path: "/pages/mine/mineAccount/mineInfo/mineInfo"
- }, {
- icon: 'ic-msg',
- title: '消息通知',
- path: '/pages/mine/mineAccount/mineMsgNotice/mineMsgNotice'
- }, {
- icon: 'ic-refund',
- title: '退款项目',
- path: '/pages/copyright/refund/refund'
- }, {
- icon: 'ic-repair',
- title: '补正项目',
- path: '/pages/copyright/repair/repair'
- }, {
- icon: 'ic-invoice-info',
- title: '发票抬头',
- path: '/pages/mine/mineAccount/invoiceInfo/invoiceInfo'
- }, {
- icon: "ic-pay-record",
- title: "资金流水",
- path: "/pages/mine/mineAccount/minePayRecord/minePayRecord"
- }, {
- icon: "ic-order",
- title: "我的订单",
- path: "/pages/mine/mineAccount/mineOrder/mineOrder"
- }, {
- icon: "ic-invoice",
- title: "发票管理",
- path: "/pages/mine/mineAccount/mineInvoiceManage/mineInvoiceManage"
- }, {
- icon: "ic-contact",
- title: "产权联系人",
- path: "/pages/mine/mineAccount/mineContact/mineContact"
- }, {
- icon: "ic-unbind",
- title: "微信解绑",
- path: ""
- }],
+ menuList: data.mineMenuList,
buttons: [{
text: '知道了'
}],
@@ -83,23 +41,7 @@ Page({
errorHint: '',
animationData: {}, //刷新动画
animation: null,
- tabList: [{
- "pagePath": "pages/index/index",
- "text": "首页",
- "iconPath": app.globalData.localAssets + "/ic_home_normal.png",
- "selectedIconPath": app.globalData.localAssets + "/ic_home_select.png",
- "selected": false,
- "hasMsg": false
- },
- {
- "pagePath": "pages/mine/mineIndex/mine",
- "text": "我的",
- "iconPath": app.globalData.localAssets + "/ic_mine_normal.png",
- "selectedIconPath": app.globalData.localAssets + "/ic_mine_select.png",
- "selected": true,
- "hasMsg": false
- }
- ],
+ tabList: data.tabList,
allPrice: 0, //全托管价格
materialPrice: 0, //写材料价格
urgent: 0, //加急价格
diff --git a/pages/shop/market.js b/pages/shop/market.js
new file mode 100644
index 0000000..8607d86
--- /dev/null
+++ b/pages/shop/market.js
@@ -0,0 +1,35 @@
+// pages/shop/market.js
+const data= require('../../utils/data')
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ tabList:data.tabList
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad(options) {
+
+ },
+
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow() {
+ console.log('页面显示')
+ const pages = getCurrentPages();
+ const currentPage = pages[pages.length - 1];
+ const tabList = this.data.tabList;
+ tabList.forEach(item => {
+ item.selected = item.pagePath === currentPage.route;
+ });
+ this.setData({
+ tabList
+ });
+ },
+})
\ No newline at end of file
diff --git a/pages/shop/market.json b/pages/shop/market.json
new file mode 100644
index 0000000..d091179
--- /dev/null
+++ b/pages/shop/market.json
@@ -0,0 +1,5 @@
+{
+ "usingComponents": {
+ "custom-tabbar": "/components/tabbar/custom-tabbar"
+ }
+}
\ No newline at end of file
diff --git a/pages/shop/market.wxml b/pages/shop/market.wxml
new file mode 100644
index 0000000..f094b8c
--- /dev/null
+++ b/pages/shop/market.wxml
@@ -0,0 +1,4 @@
+
+ 市场
+
+
\ No newline at end of file
diff --git a/pages/shop/market.wxss b/pages/shop/market.wxss
new file mode 100644
index 0000000..34ef34f
--- /dev/null
+++ b/pages/shop/market.wxss
@@ -0,0 +1 @@
+/* pages/shop/market.wxss */
\ No newline at end of file
diff --git a/utils/data.js b/utils/data.js
index fae0dd3..42a7f40 100644
--- a/utils/data.js
+++ b/utils/data.js
@@ -28,8 +28,76 @@ const stateList = [{
"title": "已取消",
"value": "CANCELED"
}]
+const tabList = [{
+ "pagePath": "pages/index/index",
+ "text": "首页",
+ "iconPath": "/static/images/ic_home_normal.png",
+ "selectedIconPath": "/static/images/ic_home_select.png",
+ "selected": false,
+ "hasMsg": false
+ },
+ {
+ "pagePath": "pages/shop/market",
+ "text": "软著市场",
+ "iconPath": "/static/images/ic_home_normal.png",
+ "selectedIconPath": "/static/images/ic_home_select.png",
+ "selected": false,
+ "hasMsg": false,
+ },
+ {
+ "pagePath": "pages/mine/mineIndex/mine",
+ "text": "我的",
+ "iconPath": "/static/images/ic_mine_normal.png",
+ "selectedIconPath": "/static/images/ic_mine_select.png",
+ "selected": false,
+ "hasMsg": false
+ }
+]
+const mineMenuList = [{
+ "icon": "ic-user",
+ "title": "个人信息",
+ "path": "/pages/mine/mineAccount/mineInfo/mineInfo"
+}, {
+ "icon": 'ic-msg',
+ "title": '消息通知',
+ "path": '/pages/mine/mineAccount/mineMsgNotice/mineMsgNotice'
+}, {
+ "icon": 'ic-refund',
+ "title": '退款项目',
+ "path": '/pages/copyright/refund/refund'
+}, {
+ "icon": 'ic-repair',
+ "title": '补正项目',
+ "path": '/pages/copyright/repair/repair'
+}, {
+ "icon": 'ic-invoice-info',
+ "title": '发票抬头',
+ "path": '/pages/mine/mineAccount/invoiceInfo/invoiceInfo'
+}, {
+ "icon": "ic-pay-record",
+ "title": "资金流水",
+ "path": "/pages/mine/mineAccount/minePayRecord/minePayRecord"
+}, {
+ "icon": "ic-order",
+ "title": "我的订单",
+ "path": "/pages/mine/mineAccount/mineOrder/mineOrder"
+}, {
+ "icon": "ic-invoice",
+ "title": "发票管理",
+ "path": "/pages/mine/mineAccount/mineInvoiceManage/mineInvoiceManage"
+}, {
+ "icon": "ic-contact",
+ "title": "产权联系人",
+ "path": "/pages/mine/mineAccount/mineContact/mineContact"
+}, {
+ "icon": "ic-unbind",
+ "title": "微信解绑",
+ "path": ""
+}]
module.exports = {
stateList,
kindList,
- typeList
+ typeList,
+ tabList,
+ mineMenuList
}
\ No newline at end of file