瀏覽代碼

修改首页

zs 1 年之前
父節點
當前提交
e691ae5cc2

+ 32 - 3
pages/home/index.vue

@@ -12,12 +12,22 @@
 			<uni-collapse>
 				<uni-collapse-item title="群组" thumb="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png">
 					<view class="content">
-						<text class="text">群组</text>
+						<view class="list" v-for="(item, index) in groupList" :key="index" @tap="toInfo(item)">
+							1111
+						</view>
+						<view class="is_bottom" v-if="is_bottom">
+							<text>{{config.bottom_title||'到底了!'}}</text>
+						</view>
 					</view>
 				</uni-collapse-item>
 				<uni-collapse-item title="好友" thumb="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png">
 					<view class="content">
-						<text class="text">群组</text>
+						<view class="list" v-for="(item, index) in friendList" :key="index" @tap="toInfo(item)">
+							1111
+						</view>
+						<view class="is_bottom" v-if="is_bottom">
+							<text>{{config.bottom_title||'到底了!'}}</text>
+						</view>
 					</view>
 				</uni-collapse-item>
 			</uni-collapse>
@@ -30,13 +40,19 @@
 		data() {
 			return {
 				user: {},
+				config: {},
 				// 广告
-				advertList: []
+				advertList: [],
+				// 群组
+				groupList: [],
+				// 好友
+				friendList: []
 			}
 		},
 		onShow: async function() {
 			const that = this;
 			await that.searchToken();
+			await that.searchConfig();
 			await that.search();
 		},
 		onPullDownRefresh: async function() {
@@ -59,6 +75,19 @@
 					});
 				}
 			},
+			searchConfig() {
+				const that = this;
+				try {
+					const res = uni.getStorageSync('config');
+					if (res) that.$set(that, `config`, res);
+				} catch (e) {
+					uni.showToast({
+						title: err.errmsg,
+						icon: 'error',
+						duration: 2000
+					});
+				}
+			},
 			// 查询
 			async search() {
 				const that = this;

+ 35 - 32
pages/index/index.vue

@@ -22,41 +22,44 @@
 			// 查询基本设置
 			async searchConfig() {
 				const that = this;
-				let res = await that.$api(`/config`, 'GET', {});
-				if (res.errcode == '0') {
-					that.$set(that, `logoUrl`, res.data.logo_url[0].url);
-					uni.setStorage({
-						key: 'config',
-						data: res.data,
-						success: function(res) {},
-						fail: function(err) {
-							console.log(err);
-						}
-					})
-				}
+				// let res = await that.$api(`/config`, 'GET', {});
+				// if (res.errcode == '0') {
+				// 	that.$set(that, `logoUrl`, res.data.logo_url[0].url);
+				// 	uni.setStorage({
+				// 		key: 'config',
+				// 		data: res.data,
+				// 		success: function(res) {},
+				// 		fail: function(err) {
+				// 			console.log(err);
+				// 		}
+				// 	})
+				// }
 			},
 			async searchOpenid() {
 				const that = this;
-				try {
-					const res = uni.getStorageSync('openid');
-					const aee = await that.$api(`/login/wxapp/${res}`, 'POST', {})
-					if (aee.errcode == '0') {
-						uni.reLaunch({
-							url: `/pages/home/index`
-						})
-					} else {
-						uni.showToast({
-							title: aee.errmsg,
-							icon: 'none'
-						})
-					}
-				} catch (e) {
-					uni.showToast({
-						title: err.errmsg,
-						icon: 'error',
-						duration: 2000
-					});
-				}
+				// try {
+				// 	const res = uni.getStorageSync('openid');
+				// 	const aee = await that.$api(`/login/wxapp/${res}`, 'POST', {})
+				// 	if (aee.errcode == '0') {
+				// 		uni.reLaunch({
+				// 			url: `/pages/home/index`
+				// 		})
+				// 	} else {
+				// 		uni.showToast({
+				// 			title: aee.errmsg,
+				// 			icon: 'none'
+				// 		})
+				// 	}
+				// } catch (e) {
+				// 	uni.showToast({
+				// 		title: err.errmsg,
+				// 		icon: 'error',
+				// 		duration: 2000
+				// 	});
+				// }
+				uni.reLaunch({
+					url: `/pages/home/index`
+				})
 			}
 		},
 	}

文件差異過大導致無法顯示
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/home/index.js.map


文件差異過大導致無法顯示
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/index/index.js.map


+ 33 - 2
unpackage/dist/dev/mp-weixin/pages/home/index.js

@@ -213,12 +213,27 @@ var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/r
 //
 //
 //
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
 var _default = {
   data: function data() {
     return {
       user: {},
+      config: {},
       // 广告
-      advertList: []
+      advertList: [],
+      // 群组
+      groupList: [],
+      // 好友
+      friendList: []
     };
   },
   onShow: function () {
@@ -233,8 +248,11 @@ var _default = {
               return that.searchToken();
             case 3:
               _context.next = 5;
-              return that.search();
+              return that.searchConfig();
             case 5:
+              _context.next = 7;
+              return that.search();
+            case 7:
             case "end":
               return _context.stop();
           }
@@ -285,6 +303,19 @@ var _default = {
         });
       }
     },
+    searchConfig: function searchConfig() {
+      var that = this;
+      try {
+        var res = uni.getStorageSync('config');
+        if (res) that.$set(that, "config", res);
+      } catch (e) {
+        uni.showToast({
+          title: err.errmsg,
+          icon: 'error',
+          duration: 2000
+        });
+      }
+    },
     // 查询
     search: function search() {
       var _this = this;

文件差異過大導致無法顯示
+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/home/index.wxml


+ 39 - 47
unpackage/dist/dev/mp-weixin/pages/index/index.js

@@ -217,28 +217,24 @@ var _default = {
     searchConfig: function searchConfig() {
       var _this = this;
       return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
-        var that, res;
+        var that;
         return _regenerator.default.wrap(function _callee2$(_context2) {
           while (1) {
             switch (_context2.prev = _context2.next) {
               case 0:
-                that = _this;
-                _context2.next = 3;
-                return that.$api("/config", 'GET', {});
-              case 3:
-                res = _context2.sent;
-                if (res.errcode == '0') {
-                  that.$set(that, "logoUrl", res.data.logo_url[0].url);
-                  uni.setStorage({
-                    key: 'config',
-                    data: res.data,
-                    success: function success(res) {},
-                    fail: function fail(err) {
-                      console.log(err);
-                    }
-                  });
-                }
-              case 5:
+                that = _this; // let res = await that.$api(`/config`, 'GET', {});
+                // if (res.errcode == '0') {
+                // 	that.$set(that, `logoUrl`, res.data.logo_url[0].url);
+                // 	uni.setStorage({
+                // 		key: 'config',
+                // 		data: res.data,
+                // 		success: function(res) {},
+                // 		fail: function(err) {
+                // 			console.log(err);
+                // 		}
+                // 	})
+                // }
+              case 1:
               case "end":
                 return _context2.stop();
             }
@@ -249,44 +245,40 @@ var _default = {
     searchOpenid: function searchOpenid() {
       var _this2 = this;
       return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
-        var that, res, aee;
+        var that;
         return _regenerator.default.wrap(function _callee3$(_context3) {
           while (1) {
             switch (_context3.prev = _context3.next) {
               case 0:
-                that = _this2;
-                _context3.prev = 1;
-                res = uni.getStorageSync('openid');
-                _context3.next = 5;
-                return that.$api("/login/wxapp/".concat(res), 'POST', {});
-              case 5:
-                aee = _context3.sent;
-                if (aee.errcode == '0') {
-                  uni.reLaunch({
-                    url: "/pages/home/index"
-                  });
-                } else {
-                  uni.showToast({
-                    title: aee.errmsg,
-                    icon: 'none'
-                  });
-                }
-                _context3.next = 12;
-                break;
-              case 9:
-                _context3.prev = 9;
-                _context3.t0 = _context3["catch"](1);
-                uni.showToast({
-                  title: err.errmsg,
-                  icon: 'error',
-                  duration: 2000
+                that = _this2; // try {
+                // 	const res = uni.getStorageSync('openid');
+                // 	const aee = await that.$api(`/login/wxapp/${res}`, 'POST', {})
+                // 	if (aee.errcode == '0') {
+                // 		uni.reLaunch({
+                // 			url: `/pages/home/index`
+                // 		})
+                // 	} else {
+                // 		uni.showToast({
+                // 			title: aee.errmsg,
+                // 			icon: 'none'
+                // 		})
+                // 	}
+                // } catch (e) {
+                // 	uni.showToast({
+                // 		title: err.errmsg,
+                // 		icon: 'error',
+                // 		duration: 2000
+                // 	});
+                // }
+                uni.reLaunch({
+                  url: "/pages/home/index"
                 });
-              case 12:
+              case 2:
               case "end":
                 return _context3.stop();
             }
           }
-        }, _callee3, null, [[1, 9]]);
+        }, _callee3);
       }))();
     }
   }